8b9 @verb #8484:"lj-login" any none none rxdo #9988 @program #8484:"lj-login" any none none if (caller_perms() != player) raise(E_PERM, "No. Go away.") endif if (argstr) uname = $su:trim(argstr) pword = this:hash($command_utils:read(tostr(uname, "'s LiveJournal password"))) else if (logininfo = listassoc(player, this.current_login)) {player, fl, uname, pword, @stuff} = logininfo else return player:tell({"You have not logged in before. Please type:", "", "lj-login (LiveJournal username)"}) endif endif if (idx = listiassoc(player, this.current_user)) if (!`this.current_user[idx][2] in stuff[2] ! ANY') this.current_user = listdelete(this.current_user, idx) endif endif moodlen = `stuff[3][$][1] ! ANY => 0' clientver = this.clientversion try result = this:send_request({{"mode", "login"}, {"user", uname}, {"hpassword", pword}, {"clientversion", clientver}, {"getpickws", "1"}, {"getmoods", moodlen}}) except e (ANY) return player:tell({"LiveJournal returned the following error:", e[2]}) endtry maxpic = toint(`listassoc("pickw_count", result)[2] ! ANY => 0') pics = {} if (maxpic) for pic in [1..maxpic] pics = {@pics, listassoc(tostr("pickw_", pic), result)[2]} endfor endif if (`msg = listassoc("message", result)[2] ! ANY') this:important_message(msg) endif maxjournal = toint(`listassoc("access_count", result)[2] ! ANY => 0') journals = {} if (maxjournal) for journal in [1..maxjournal] journals = {@journals, listassoc(tostr("access_", journal), result)[2]} endfor endif maxmoods = toint(`listassoc("mood_count", result)[2] ! ANY => 0') moods = `stuff[3] ! ANY => {}' for md in [1..maxmoods] moods = {@moods, {listassoc(tostr("mood_", md, "_id"), result)[2], listassoc(tostr("mood_", md, "_name"), result)[2]}} endfor logininfo = {1, uname, pword, pics, journals, moods} if (i = listiassoc(player, this.current_login)) this.current_login[i][2..$] = logininfo else this.current_login = {@this.current_login, {player, @logininfo}} endif player:tell("Welcome, ", `listassoc("name", result)[2] ! ANY => uname', "! You have successfully logged in.") "Last modified by Dax (#789) on Tue May 3 14:09:37 2005 MDT." . 0