comparison libpurple/protocols/oscar/oscar.c @ 32767:2ec94166be43

On the way to hiding the PurpleConnection struct. * Added purple_connection_get_flags() and purple_connection_set_flags() * Use purple_connection_ accessor functions.
author andrew.victor@mxit.com
date Tue, 18 Oct 2011 18:47:48 +0000
parents f75041cb3fec
children 4a34689eeb33
comparison
equal deleted inserted replaced
32766:ea2b621fd3ba 32767:2ec94166be43
653 const gchar *encryption_type; 653 const gchar *encryption_type;
654 GList *handlers; 654 GList *handlers;
655 GList *sorted_handlers; 655 GList *sorted_handlers;
656 GList *cur; 656 GList *cur;
657 GString *msg = g_string_new(""); 657 GString *msg = g_string_new("");
658 PurpleConnectionFlags flags;
658 659
659 gc = purple_account_get_connection(account); 660 gc = purple_account_get_connection(account);
660 od = oscar_data_new(); 661 od = oscar_data_new();
661 od->gc = gc; 662 od->gc = gc;
662 purple_connection_set_protocol_data(gc, od); 663 purple_connection_set_protocol_data(gc, od);
738 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); 739 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf);
739 g_free(buf); 740 g_free(buf);
740 return; 741 return;
741 } 742 }
742 743
743 gc->flags |= PURPLE_CONNECTION_HTML; 744 flags = PURPLE_CONNECTION_HTML;
744 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) { 745 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) {
745 od->icq = TRUE; 746 od->icq = TRUE;
746 } else { 747 } else {
747 gc->flags |= PURPLE_CONNECTION_AUTO_RESP; 748 flags |= PURPLE_CONNECTION_AUTO_RESP;
748 } 749 }
749 750
750 /* Set this flag based on the protocol_id rather than the username, 751 /* Set this flag based on the protocol_id rather than the username,
751 because that is what's tied to the get_moods prpl callback. */ 752 because that is what's tied to the get_moods prpl callback. */
752 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) 753 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq"))
753 gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS; 754 flags |= PURPLE_CONNECTION_SUPPORT_MOODS;
755
756 purple_connection_set_flags(gc, flags);
754 757
755 od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); 758 od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
756 759
757 encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION); 760 encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION);
758 if (!purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) { 761 if (!purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) {
998 1001
999 pos->offset = offset; 1002 pos->offset = offset;
1000 pos->len = len; 1003 pos->len = len;
1001 pos->modname = g_strdup(modname); 1004 pos->modname = g_strdup(modname);
1002 1005
1003 if (purple_proxy_connect(pos->gc, pos->gc->account, "pidgin.im", 80, 1006 if (purple_proxy_connect(pos->gc, purple_connection_get_account(pos->gc), "pidgin.im", 80,
1004 straight_to_hell, pos) == NULL) 1007 straight_to_hell, pos) == NULL)
1005 { 1008 {
1006 char buf[256]; 1009 char buf[256];
1007 g_free(pos->modname); 1010 g_free(pos->modname);
1008 g_free(pos); 1011 g_free(pos);
1545 info = va_arg(ap, aim_userinfo_t *); 1548 info = va_arg(ap, aim_userinfo_t *);
1546 va_end(ap); 1549 va_end(ap);
1547 1550
1548 purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL); 1551 purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL);
1549 purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); 1552 purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE);
1550 g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->bn)); 1553 g_hash_table_remove(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), info->bn));
1551 1554
1552 return 1; 1555 return 1;
1553 } 1556 }
1554 1557
1555 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { 1558 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
3174 peer_odc_send_typing(conn, state); 3177 peer_odc_send_typing(conn, state);
3175 } 3178 }
3176 else { 3179 else {
3177 /* Don't send if this turkey is in our deny list */ 3180 /* Don't send if this turkey is in our deny list */
3178 GSList *list; 3181 GSList *list;
3179 for (list=gc->account->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); 3182 for (list=purple_connection_get_account(gc)->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next);
3180 if (!list) { 3183 if (!list) {
3181 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name)); 3184 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), name));
3182 if (bi && bi->typingnot) { 3185 if (bi && bi->typingnot) {
3183 if (state == PURPLE_TYPING) 3186 if (state == PURPLE_TYPING)
3184 aim_im_sendmtn(od, 0x0001, name, 0x0002); 3187 aim_im_sendmtn(od, 0x0001, name, 0x0002);
3185 else if (state == PURPLE_TYPED) 3188 else if (state == PURPLE_TYPED)
3186 aim_im_sendmtn(od, 0x0001, name, 0x0001); 3189 aim_im_sendmtn(od, 0x0001, name, 0x0001);