Mercurial > pidgin.yaz
changeset 2704:fee85ed7fc3f
[gaim-migrate @ 2717]
I had to recompile zephyr AGAIN!!
committer: Tailor Script <tailor@pidgin.im>
author | Adam Fritzler <mid@auk.cx> |
---|---|
date | Sat, 10 Nov 2001 02:07:37 +0000 |
parents | 441b84ab7f4e |
children | 5f431eefb0f2 |
files | src/protocols/oscar/aim.h src/protocols/oscar/auth.c src/protocols/oscar/oscar.c |
diffstat | 3 files changed, 70 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h Sat Nov 10 01:48:17 2001 +0000 +++ b/src/protocols/oscar/aim.h Sat Nov 10 02:07:37 2001 +0000 @@ -499,7 +499,25 @@ typedef int (*aim_rxcallback_t)(aim_session_t *, aim_frame_t *, ...); -/* aim_login.c */ +struct aim_clientrelease { + char *name; + fu32_t build; + char *url; + char *info; +}; + +struct aim_authresp_info { + char *sn; + fu16_t errorcode; + char *errorurl; + fu16_t regstatus; + char *email; + char *bosip; + fu8_t *cookie; + struct aim_clientrelease latestrelease; + struct aim_clientrelease latestbeta; +}; + faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn);
--- a/src/protocols/oscar/auth.c Sat Nov 10 01:48:17 2001 +0000 +++ b/src/protocols/oscar/auth.c Sat Nov 10 02:07:37 2001 +0000 @@ -370,15 +370,11 @@ static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_tlvlist_t *tlvlist; + aim_rxcallback_t userfunc; + struct aim_authresp_info info; int ret = 0; - aim_rxcallback_t userfunc; - char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL; - unsigned char *cookie = NULL; - int errorcode = 0, regstatus = 0; - int latestbuild = 0, latestbetabuild = 0; - char *latestrelease = NULL, *latestbeta = NULL; - char *latestreleaseurl = NULL, *latestbetaurl = NULL; - char *latestreleaseinfo = NULL, *latestbetainfo = NULL; + + memset(&info, 0, sizeof(info)); /* * Read block of TLVs. All further data is derived @@ -391,8 +387,8 @@ */ memset(sess->sn, 0, sizeof(sess->sn)); if (aim_gettlv(tlvlist, 0x0001, 1)) { - sn = aim_gettlv_str(tlvlist, 0x0001, 1); - strncpy(sess->sn, sn, sizeof(sess->sn)); + info.sn = aim_gettlv_str(tlvlist, 0x0001, 1); + strncpy(sess->sn, info.sn, sizeof(sess->sn)); } /* @@ -400,15 +396,15 @@ * have an error url. */ if (aim_gettlv(tlvlist, 0x0008, 1)) - errorcode = aim_gettlv16(tlvlist, 0x0008, 1); + info.errorcode = aim_gettlv16(tlvlist, 0x0008, 1); if (aim_gettlv(tlvlist, 0x0004, 1)) - errurl = aim_gettlv_str(tlvlist, 0x0004, 1); + info.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1); /* * BOS server address. */ if (aim_gettlv(tlvlist, 0x0005, 1)) - bosip = aim_gettlv_str(tlvlist, 0x0005, 1); + info.bosip = aim_gettlv_str(tlvlist, 0x0005, 1); /* * Authorization cookie. @@ -418,8 +414,7 @@ tmptlv = aim_gettlv(tlvlist, 0x0006, 1); - if ((cookie = malloc(tmptlv->length))) - memcpy(cookie, tmptlv->value, tmptlv->length); + info.cookie = tmptlv->value; } /* @@ -427,7 +422,7 @@ * Not available for ICQ logins. */ if (aim_gettlv(tlvlist, 0x0011, 1)) - email = aim_gettlv_str(tlvlist, 0x0011, 1); + info.email = aim_gettlv_str(tlvlist, 0x0011, 1); /* * The registration status. (Not real sure what it means.) @@ -442,47 +437,44 @@ * */ if (aim_gettlv(tlvlist, 0x0013, 1)) - regstatus = aim_gettlv16(tlvlist, 0x0013, 1); + info.regstatus = aim_gettlv16(tlvlist, 0x0013, 1); if (aim_gettlv(tlvlist, 0x0040, 1)) - latestbetabuild = aim_gettlv32(tlvlist, 0x0040, 1); + info.latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1); if (aim_gettlv(tlvlist, 0x0041, 1)) - latestbetaurl = aim_gettlv_str(tlvlist, 0x0041, 1); + info.latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1); if (aim_gettlv(tlvlist, 0x0042, 1)) - latestbetainfo = aim_gettlv_str(tlvlist, 0x0042, 1); + info.latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1); if (aim_gettlv(tlvlist, 0x0043, 1)) - latestbeta = aim_gettlv_str(tlvlist, 0x0043, 1); + info.latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1); if (aim_gettlv(tlvlist, 0x0048, 1)) ; /* no idea what this is */ if (aim_gettlv(tlvlist, 0x0044, 1)) - latestbuild = aim_gettlv32(tlvlist, 0x0044, 1); + info.latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1); if (aim_gettlv(tlvlist, 0x0045, 1)) - latestreleaseurl = aim_gettlv_str(tlvlist, 0x0045, 1); + info.latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1); if (aim_gettlv(tlvlist, 0x0046, 1)) - latestreleaseinfo = aim_gettlv_str(tlvlist, 0x0046, 1); + info.latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1); if (aim_gettlv(tlvlist, 0x0047, 1)) - latestrelease = aim_gettlv_str(tlvlist, 0x0047, 1); + info.latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1); if (aim_gettlv(tlvlist, 0x0049, 1)) ; /* no idea what this is */ - if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) { - /* XXX return as a struct? */ - ret = userfunc(sess, rx, sn, errorcode, errurl, regstatus, email, bosip, cookie, latestrelease, latestbuild, latestreleaseurl, latestreleaseinfo, latestbeta, latestbetabuild, latestbetaurl, latestbetainfo); - } + if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) + ret = userfunc(sess, rx, &info); - free(sn); - free(bosip); - free(errurl); - free(email); - free(cookie); - free(latestrelease); - free(latestreleaseurl); - free(latestbeta); - free(latestbetaurl); - free(latestreleaseinfo); - free(latestbetainfo); + free(info.sn); + free(info.bosip); + free(info.errorurl); + free(info.email); + free(info.latestrelease.name); + free(info.latestrelease.url); + free(info.latestrelease.info); + free(info.latestbeta.name); + free(info.latestbeta.url); + free(info.latestbeta.info); aim_freetlvchain(&tlvlist);
--- a/src/protocols/oscar/oscar.c Sat Nov 10 01:48:17 2001 +0000 +++ b/src/protocols/oscar/oscar.c Sat Nov 10 02:07:37 2001 +0000 @@ -555,16 +555,10 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; - aim_conn_t *bosconn = NULL; - char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL; - fu8_t *cookie = NULL; - int errorcode = 0, regstatus = 0; - int latestbuild = 0, latestbetabuild = 0; - char *latestrelease = NULL, *latestbeta = NULL; - char *latestreleaseurl = NULL, *latestbetaurl = NULL; - char *latestreleaseinfo = NULL, *latestbetainfo = NULL; + struct aim_authresp_info *info; int i; char *host; int port; struct aim_user *user; + aim_conn_t *bosconn; struct gaim_connection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; @@ -573,30 +567,13 @@ atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, va_start(ap, fr); - sn = va_arg(ap, char *); - errorcode = va_arg(ap, int); - errurl = va_arg(ap, char *); - regstatus = va_arg(ap, int); - email = va_arg(ap, char *); - bosip = va_arg(ap, char *); - cookie = va_arg(ap, unsigned char *); - - latestrelease = va_arg(ap, char *); - latestbuild = va_arg(ap, int); - latestreleaseurl = va_arg(ap, char *); - latestreleaseinfo = va_arg(ap, char *); - - latestbeta = va_arg(ap, char *); - latestbetabuild = va_arg(ap, int); - latestbetaurl = va_arg(ap, char *); - latestbetainfo = va_arg(ap, char *); - + info = va_arg(ap, struct aim_authresp_info *); va_end(ap); - debug_printf("inside auth_resp (Screen name: %s)\n", sn); - - if (errorcode || !bosip || !cookie) { - switch (errorcode) { + debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); + + if (info->errorcode || !info->bosip || !info->cookie) { + switch (info->errorcode) { case 0x05: /* Incorrect nick/password */ hide_login_progress(gc, _("Incorrect nickname or password.")); @@ -620,26 +597,20 @@ hide_login_progress(gc, _("Authentication Failed")); break; } - debug_printf("Login Error Code 0x%04x\n", errorcode); - debug_printf("Error URL: %s\n", errurl); + debug_printf("Login Error Code 0x%04x\n", info->errorcode); + debug_printf("Error URL: %s\n", info->errorurl); od->killme = TRUE; return 1; } - debug_printf("Reg status: %2d\n", regstatus); - if (email) { - debug_printf("Email: %s\n", email); + debug_printf("Reg status: %d\n", info->regstatus); + if (info->email) { + debug_printf("Email: %s\n", info->email); } else { debug_printf("Email is NULL\n"); } - debug_printf("BOSIP: %s\n", bosip); - if (latestbeta) - debug_printf("Latest WinAIM beta version %s, build %d, at %s (%s)\n", - latestbeta, latestbetabuild, latestbetaurl, latestbetainfo); - if (latestrelease) - debug_printf("Latest WinAIM released version %s, build %d, at %s (%s)\n", - latestrelease, latestbuild, latestreleaseurl, latestreleaseinfo); + debug_printf("BOSIP: %s\n", info->bosip); debug_printf("Closing auth connection...\n"); aim_conn_kill(sess, &fr->conn); @@ -676,13 +647,13 @@ aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); ((struct oscar_data *)gc->proto_data)->conn = bosconn; - for (i = 0; i < (int)strlen(bosip); i++) { - if (bosip[i] == ':') { - port = atoi(&(bosip[i+1])); + for (i = 0; i < (int)strlen(info->bosip); i++) { + if (info->bosip[i] == ':') { + port = atoi(&(info->bosip[i+1])); break; } } - host = g_strndup(bosip, i); + host = g_strndup(info->bosip, i); bosconn->status |= AIM_CONN_STATUS_INPROGRESS; bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); g_free(host); @@ -691,8 +662,9 @@ od->killme = TRUE; return 0; } - aim_sendcookie(sess, bosconn, cookie); + aim_sendcookie(sess, bosconn, info->cookie); gaim_input_remove(gc->inpa); + return 1; }