| 492 aim_session_t *sess = aim_conn_getsess(conn); |
492 aim_session_t *sess = aim_conn_getsess(conn); |
| 493 GaimConnection *gc = sess ? sess->aux_data : NULL; |
493 GaimConnection *gc = sess ? sess->aux_data : NULL; |
| 494 OscarData *od; |
494 OscarData *od; |
| 495 |
495 |
| 496 if (!gc) { |
496 if (!gc) { |
| 497 /* gc is null. we return, else we seg SIGSEG on next line. */ |
|
| 498 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
497 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
| 499 "oscar callback for closed connection (1).\n"); |
498 "oscar callback for closed connection (1).\n"); |
| 500 return; |
499 return; |
| 501 } |
500 } |
| 502 |
501 |
| 599 } |
598 } |
| 600 } |
599 } |
| 601 } |
600 } |
| 602 |
601 |
| 603 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
602 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
| 604 char *s = g_strdup_vprintf(format, va); |
|
| 605 char buf[256]; |
|
| 606 char *t; |
|
| 607 GaimConnection *gc = sess->aux_data; |
603 GaimConnection *gc = sess->aux_data; |
| 608 |
604 gchar *s = g_strdup_vprintf(format, va); |
| 609 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); |
605 gchar *buf; |
| 610 t = g_strconcat(buf, s, NULL); |
606 |
| 611 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
607 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); |
| 612 if (t[strlen(t)-1] != '\n') |
608 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); |
| |
609 if (buf[strlen(buf)-1] != '\n') |
| 613 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
610 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
| 614 g_free(t); |
611 g_free(buf); |
| 615 g_free(s); |
612 g_free(s); |
| 616 } |
613 } |
| 617 |
614 |
| 618 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
615 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
| 619 { |
616 { |
| 661 gc->flags |= GAIM_CONNECTION_AUTO_RESP; |
658 gc->flags |= GAIM_CONNECTION_AUTO_RESP; |
| 662 } |
659 } |
| 663 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
660 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
| 664 |
661 |
| 665 sess = g_new0(aim_session_t, 1); |
662 sess = g_new0(aim_session_t, 1); |
| 666 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); |
663 aim_session_init(sess, TRUE, 0); |
| 667 aim_setdebuggingcb(sess, oscar_debug); |
664 aim_setdebuggingcb(sess, oscar_debug); |
| 668 /* |
665 /* |
| 669 * We need an immediate queue because we don't use a while-loop |
666 * We need an immediate queue because we don't use a while-loop |
| 670 * to see if things need to be sent. |
667 * to see if things need to be sent. |
| 671 */ |
668 */ |
| 3678 aim_ssi_reqrights(sess); |
3676 aim_ssi_reqrights(sess); |
| 3679 aim_ssi_reqdata(sess); |
3677 aim_ssi_reqdata(sess); |
| 3680 #endif |
3678 #endif |
| 3681 |
3679 |
| 3682 aim_locate_reqrights(sess); |
3680 aim_locate_reqrights(sess); |
| 3683 aim_bos_reqbuddyrights(sess, fr->conn); |
3681 aim_buddylist_reqrights(sess, fr->conn); |
| 3684 aim_im_reqparams(sess); |
3682 aim_im_reqparams(sess); |
| 3685 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */ |
3683 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */ |
| 3686 |
3684 |
| 3687 #ifdef NOSSI |
3685 #ifdef NOSSI |
| 3688 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3686 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
| 4612 #ifdef NOSSI |
4610 #ifdef NOSSI |
| 4613 char buf[MSG_LEN]; |
4611 char buf[MSG_LEN]; |
| 4614 int n=0; |
4612 int n=0; |
| 4615 while (buddies) { |
4613 while (buddies) { |
| 4616 if (n > MSG_LEN - 18) { |
4614 if (n > MSG_LEN - 18) { |
| 4617 aim_bos_setbuddylist(od->sess, od->conn, buf); |
4615 aim_buddylist_set(od->sess, od->conn, buf); |
| 4618 n = 0; |
4616 n = 0; |
| 4619 } |
4617 } |
| 4620 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4618 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
| 4621 buddies = buddies->next; |
4619 buddies = buddies->next; |
| 4622 } |
4620 } |
| 4623 aim_bos_setbuddylist(od->sess, od->conn, buf); |
4621 aim_buddylist_set(od->sess, od->conn, buf); |
| 4624 #else |
4622 #else |
| 4625 if (od->sess->ssi.received_data) { |
4623 if (od->sess->ssi.received_data) { |
| 4626 while (buddies) { |
4624 while (buddies) { |
| 4627 GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4625 GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
| 4628 GaimGroup *group = gaim_find_buddys_group(buddy); |
4626 GaimGroup *group = gaim_find_buddys_group(buddy); |