Mercurial > pidgin.yaz
comparison src/protocols/oscar/auth.c @ 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 | 9467e4ee81be |
comparison
equal
deleted
inserted
replaced
2703:441b84ab7f4e | 2704:fee85ed7fc3f |
---|---|
368 * | 368 * |
369 */ | 369 */ |
370 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 370 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
371 { | 371 { |
372 aim_tlvlist_t *tlvlist; | 372 aim_tlvlist_t *tlvlist; |
373 aim_rxcallback_t userfunc; | |
374 struct aim_authresp_info info; | |
373 int ret = 0; | 375 int ret = 0; |
374 aim_rxcallback_t userfunc; | 376 |
375 char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL; | 377 memset(&info, 0, sizeof(info)); |
376 unsigned char *cookie = NULL; | |
377 int errorcode = 0, regstatus = 0; | |
378 int latestbuild = 0, latestbetabuild = 0; | |
379 char *latestrelease = NULL, *latestbeta = NULL; | |
380 char *latestreleaseurl = NULL, *latestbetaurl = NULL; | |
381 char *latestreleaseinfo = NULL, *latestbetainfo = NULL; | |
382 | 378 |
383 /* | 379 /* |
384 * Read block of TLVs. All further data is derived | 380 * Read block of TLVs. All further data is derived |
385 * from what is parsed here. | 381 * from what is parsed here. |
386 */ | 382 */ |
389 /* | 385 /* |
390 * No matter what, we should have a screen name. | 386 * No matter what, we should have a screen name. |
391 */ | 387 */ |
392 memset(sess->sn, 0, sizeof(sess->sn)); | 388 memset(sess->sn, 0, sizeof(sess->sn)); |
393 if (aim_gettlv(tlvlist, 0x0001, 1)) { | 389 if (aim_gettlv(tlvlist, 0x0001, 1)) { |
394 sn = aim_gettlv_str(tlvlist, 0x0001, 1); | 390 info.sn = aim_gettlv_str(tlvlist, 0x0001, 1); |
395 strncpy(sess->sn, sn, sizeof(sess->sn)); | 391 strncpy(sess->sn, info.sn, sizeof(sess->sn)); |
396 } | 392 } |
397 | 393 |
398 /* | 394 /* |
399 * Check for an error code. If so, we should also | 395 * Check for an error code. If so, we should also |
400 * have an error url. | 396 * have an error url. |
401 */ | 397 */ |
402 if (aim_gettlv(tlvlist, 0x0008, 1)) | 398 if (aim_gettlv(tlvlist, 0x0008, 1)) |
403 errorcode = aim_gettlv16(tlvlist, 0x0008, 1); | 399 info.errorcode = aim_gettlv16(tlvlist, 0x0008, 1); |
404 if (aim_gettlv(tlvlist, 0x0004, 1)) | 400 if (aim_gettlv(tlvlist, 0x0004, 1)) |
405 errurl = aim_gettlv_str(tlvlist, 0x0004, 1); | 401 info.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1); |
406 | 402 |
407 /* | 403 /* |
408 * BOS server address. | 404 * BOS server address. |
409 */ | 405 */ |
410 if (aim_gettlv(tlvlist, 0x0005, 1)) | 406 if (aim_gettlv(tlvlist, 0x0005, 1)) |
411 bosip = aim_gettlv_str(tlvlist, 0x0005, 1); | 407 info.bosip = aim_gettlv_str(tlvlist, 0x0005, 1); |
412 | 408 |
413 /* | 409 /* |
414 * Authorization cookie. | 410 * Authorization cookie. |
415 */ | 411 */ |
416 if (aim_gettlv(tlvlist, 0x0006, 1)) { | 412 if (aim_gettlv(tlvlist, 0x0006, 1)) { |
417 aim_tlv_t *tmptlv; | 413 aim_tlv_t *tmptlv; |
418 | 414 |
419 tmptlv = aim_gettlv(tlvlist, 0x0006, 1); | 415 tmptlv = aim_gettlv(tlvlist, 0x0006, 1); |
420 | 416 |
421 if ((cookie = malloc(tmptlv->length))) | 417 info.cookie = tmptlv->value; |
422 memcpy(cookie, tmptlv->value, tmptlv->length); | |
423 } | 418 } |
424 | 419 |
425 /* | 420 /* |
426 * The email address attached to this account | 421 * The email address attached to this account |
427 * Not available for ICQ logins. | 422 * Not available for ICQ logins. |
428 */ | 423 */ |
429 if (aim_gettlv(tlvlist, 0x0011, 1)) | 424 if (aim_gettlv(tlvlist, 0x0011, 1)) |
430 email = aim_gettlv_str(tlvlist, 0x0011, 1); | 425 info.email = aim_gettlv_str(tlvlist, 0x0011, 1); |
431 | 426 |
432 /* | 427 /* |
433 * The registration status. (Not real sure what it means.) | 428 * The registration status. (Not real sure what it means.) |
434 * Not available for ICQ logins. | 429 * Not available for ICQ logins. |
435 * | 430 * |
440 * This has to do with whether your email address is available | 435 * This has to do with whether your email address is available |
441 * to other users or not. AFAIK, this feature is no longer used. | 436 * to other users or not. AFAIK, this feature is no longer used. |
442 * | 437 * |
443 */ | 438 */ |
444 if (aim_gettlv(tlvlist, 0x0013, 1)) | 439 if (aim_gettlv(tlvlist, 0x0013, 1)) |
445 regstatus = aim_gettlv16(tlvlist, 0x0013, 1); | 440 info.regstatus = aim_gettlv16(tlvlist, 0x0013, 1); |
446 | 441 |
447 if (aim_gettlv(tlvlist, 0x0040, 1)) | 442 if (aim_gettlv(tlvlist, 0x0040, 1)) |
448 latestbetabuild = aim_gettlv32(tlvlist, 0x0040, 1); | 443 info.latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1); |
449 if (aim_gettlv(tlvlist, 0x0041, 1)) | 444 if (aim_gettlv(tlvlist, 0x0041, 1)) |
450 latestbetaurl = aim_gettlv_str(tlvlist, 0x0041, 1); | 445 info.latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1); |
451 if (aim_gettlv(tlvlist, 0x0042, 1)) | 446 if (aim_gettlv(tlvlist, 0x0042, 1)) |
452 latestbetainfo = aim_gettlv_str(tlvlist, 0x0042, 1); | 447 info.latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1); |
453 if (aim_gettlv(tlvlist, 0x0043, 1)) | 448 if (aim_gettlv(tlvlist, 0x0043, 1)) |
454 latestbeta = aim_gettlv_str(tlvlist, 0x0043, 1); | 449 info.latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1); |
455 if (aim_gettlv(tlvlist, 0x0048, 1)) | 450 if (aim_gettlv(tlvlist, 0x0048, 1)) |
456 ; /* no idea what this is */ | 451 ; /* no idea what this is */ |
457 | 452 |
458 if (aim_gettlv(tlvlist, 0x0044, 1)) | 453 if (aim_gettlv(tlvlist, 0x0044, 1)) |
459 latestbuild = aim_gettlv32(tlvlist, 0x0044, 1); | 454 info.latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1); |
460 if (aim_gettlv(tlvlist, 0x0045, 1)) | 455 if (aim_gettlv(tlvlist, 0x0045, 1)) |
461 latestreleaseurl = aim_gettlv_str(tlvlist, 0x0045, 1); | 456 info.latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1); |
462 if (aim_gettlv(tlvlist, 0x0046, 1)) | 457 if (aim_gettlv(tlvlist, 0x0046, 1)) |
463 latestreleaseinfo = aim_gettlv_str(tlvlist, 0x0046, 1); | 458 info.latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1); |
464 if (aim_gettlv(tlvlist, 0x0047, 1)) | 459 if (aim_gettlv(tlvlist, 0x0047, 1)) |
465 latestrelease = aim_gettlv_str(tlvlist, 0x0047, 1); | 460 info.latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1); |
466 if (aim_gettlv(tlvlist, 0x0049, 1)) | 461 if (aim_gettlv(tlvlist, 0x0049, 1)) |
467 ; /* no idea what this is */ | 462 ; /* no idea what this is */ |
468 | 463 |
469 | 464 |
470 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) { | 465 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) |
471 /* XXX return as a struct? */ | 466 ret = userfunc(sess, rx, &info); |
472 ret = userfunc(sess, rx, sn, errorcode, errurl, regstatus, email, bosip, cookie, latestrelease, latestbuild, latestreleaseurl, latestreleaseinfo, latestbeta, latestbetabuild, latestbetaurl, latestbetainfo); | 467 |
473 } | 468 free(info.sn); |
474 | 469 free(info.bosip); |
475 free(sn); | 470 free(info.errorurl); |
476 free(bosip); | 471 free(info.email); |
477 free(errurl); | 472 free(info.latestrelease.name); |
478 free(email); | 473 free(info.latestrelease.url); |
479 free(cookie); | 474 free(info.latestrelease.info); |
480 free(latestrelease); | 475 free(info.latestbeta.name); |
481 free(latestreleaseurl); | 476 free(info.latestbeta.url); |
482 free(latestbeta); | 477 free(info.latestbeta.info); |
483 free(latestbetaurl); | |
484 free(latestreleaseinfo); | |
485 free(latestbetainfo); | |
486 | 478 |
487 aim_freetlvchain(&tlvlist); | 479 aim_freetlvchain(&tlvlist); |
488 | 480 |
489 return ret; | 481 return ret; |
490 } | 482 } |