Created
February 18, 2010 14:25
-
-
Save cpjolicoeur/307688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(imhouser). | |
-export([new/1]). | |
-export([xmppauth/1]). | |
-export([xmpp_request_id/1]). | |
new({Pid, DynData}) -> | |
%%printer(DynData), | |
random:seed(erlang:now()), | |
L1 = [1, 4, 6, 7, 13, 389, 390, 391, 392, 393, 394, 429, 431, 435, 596, 817], | |
lists:nth(random:uniform(16), L1). | |
%% | |
%% The following is only used for debugging so I can guarantee my UID (817) is used | |
%% | |
%%L1 = [817], | |
%%lists:nth(random:uniform(1), L1). | |
xmppauth({Pid, DynData}) -> | |
%% | |
%% need to get the {imho_session_param, "abc123"} tuple from the DynData list | |
%% * if imho_session_param missing just return empty string for now | |
%% | |
%% encoded value is UID@domain.tld<0>UID<0>password | |
%% * UID => user_id | |
%% * password => imho_session_param | |
%% | |
%%printer(DynData), | |
D = "@openfire-dev.imoentertainment.com", | |
%%D = "@openfire-preview.imhomedia.com", | |
U = integer_to_list( proplists:get_value(imho_uid, DynData, "") ), | |
P = proplists:get_value(imho_session_param, DynData, ""), | |
base64:encode_to_string( string:join( [lists:concat([U, D]), U, P], [0] ) ). | |
xmpp_request_id({Pid, DynData}) -> | |
S = "cRequest_", | |
N1 = random:uniform(9), | |
N2 = random:uniform(9), | |
lists:concat([N1, S, N2]). | |
%% used for debugging contents of lists | |
printer(E) -> | |
io:format("E: ~p~n", [E]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment