Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 0f94ec89f0bc ec6371d4cae8 |
children |
comparison
equal
deleted
inserted
replaced
32692:0f94ec89f0bc | 32827:4a34689eeb33 |
---|---|
438 /* | 438 /* |
439 * The server may have closed the socket (on a stream error), so if | 439 * The server may have closed the socket (on a stream error), so if |
440 * we're disconnecting, don't generate (possibly another) error that | 440 * we're disconnecting, don't generate (possibly another) error that |
441 * (for some UIs) would mask the first. | 441 * (for some UIs) would mask the first. |
442 */ | 442 */ |
443 if (!account->disconnecting) { | 443 if (!purple_account_is_disconnecting(account)) { |
444 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), | 444 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
445 g_strerror(errno)); | 445 g_strerror(errno)); |
446 purple_connection_error(js->gc, | 446 purple_connection_error(js->gc, |
447 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); | 447 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
448 g_free(tmp); | 448 g_free(tmp); |
653 purple_ssl_close(gsc); | 653 purple_ssl_close(gsc); |
654 g_return_if_reached(); | 654 g_return_if_reached(); |
655 } | 655 } |
656 | 656 |
657 while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { | 657 while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { |
658 gc->last_received = time(NULL); | 658 purple_connection_update_last_received(gc); |
659 buf[len] = '\0'; | 659 buf[len] = '\0'; |
660 purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); | 660 purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); |
661 jabber_parser_process(js, buf, len); | 661 jabber_parser_process(js, buf, len); |
662 if(js->reinit) | 662 if(js->reinit) |
663 jabber_stream_init(js); | 663 jabber_stream_init(js); |
687 static char buf[4096]; | 687 static char buf[4096]; |
688 | 688 |
689 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); | 689 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
690 | 690 |
691 if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { | 691 if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { |
692 gc->last_received = time(NULL); | 692 purple_connection_update_last_received(gc); |
693 #ifdef HAVE_CYRUS_SASL | 693 #ifdef HAVE_CYRUS_SASL |
694 if (js->sasl_maxbuf > 0) { | 694 if (js->sasl_maxbuf > 0) { |
695 const char *out; | 695 const char *out; |
696 unsigned int olen; | 696 unsigned int olen; |
697 int rc; | 697 int rc; |
829 | 829 |
830 if(js->state == JABBER_STREAM_CONNECTING) | 830 if(js->state == JABBER_STREAM_CONNECTING) |
831 jabber_send_raw(js, "<?xml version='1.0' ?>", -1); | 831 jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
832 | 832 |
833 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); | 833 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
834 gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); | 834 js->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); |
835 } | 835 } |
836 | 836 |
837 static void | 837 static void |
838 jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, | 838 jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
839 gpointer data) | 839 gpointer data) |
850 purple_connection_ssl_error (gc, error); | 850 purple_connection_ssl_error (gc, error); |
851 } | 851 } |
852 | 852 |
853 static void tls_init(JabberStream *js) | 853 static void tls_init(JabberStream *js) |
854 { | 854 { |
855 purple_input_remove(js->gc->inpa); | 855 purple_input_remove(js->inpa); |
856 js->gc->inpa = 0; | 856 js->inpa = 0; |
857 js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, | 857 js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd, |
858 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); | 858 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); |
859 /* The fd is no longer our concern */ | 859 /* The fd is no longer our concern */ |
860 js->fd = -1; | 860 js->fd = -1; |
861 } | 861 } |
862 | 862 |
1086 { | 1086 { |
1087 PurpleConnection *gc = purple_account_get_connection(account); | 1087 PurpleConnection *gc = purple_account_get_connection(account); |
1088 JabberStream *js; | 1088 JabberStream *js; |
1089 PurpleStoredImage *image; | 1089 PurpleStoredImage *image; |
1090 | 1090 |
1091 gc->flags |= PURPLE_CONNECTION_HTML | | 1091 purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY); |
1092 PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; | |
1093 js = jabber_stream_new(account); | 1092 js = jabber_stream_new(account); |
1094 if (js == NULL) | 1093 if (js == NULL) |
1095 return; | 1094 return; |
1096 | 1095 |
1097 /* TODO: Remove this at some point. Added 2010-02-14 (v2.6.6) */ | 1096 /* TODO: Remove this at some point. Added 2010-02-14 (v2.6.6) */ |
1145 | 1144 |
1146 if (type == JABBER_IQ_RESULT) { | 1145 if (type == JABBER_IQ_RESULT) { |
1147 if(js->registration) { | 1146 if(js->registration) { |
1148 buf = g_strdup_printf(_("Registration of %s@%s successful"), | 1147 buf = g_strdup_printf(_("Registration of %s@%s successful"), |
1149 js->user->node, js->user->domain); | 1148 js->user->node, js->user->domain); |
1150 if(account->registration_cb) | 1149 purple_account_register_completed(account, TRUE); |
1151 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); | |
1152 } else { | 1150 } else { |
1153 g_return_if_fail(to != NULL); | 1151 g_return_if_fail(to != NULL); |
1154 buf = g_strdup_printf(_("Registration to %s successful"), | 1152 buf = g_strdup_printf(_("Registration to %s successful"), |
1155 to); | 1153 to); |
1156 } | 1154 } |
1164 msg = g_strdup(_("Unknown Error")); | 1162 msg = g_strdup(_("Unknown Error")); |
1165 | 1163 |
1166 purple_notify_error(NULL, _("Registration Failed"), | 1164 purple_notify_error(NULL, _("Registration Failed"), |
1167 _("Registration Failed"), msg); | 1165 _("Registration Failed"), msg); |
1168 g_free(msg); | 1166 g_free(msg); |
1169 if(account->registration_cb) | 1167 purple_account_register_completed(account, FALSE); |
1170 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1171 } | 1168 } |
1172 g_free(to); | 1169 g_free(to); |
1173 if(js->registration) | 1170 if(js->registration) |
1174 jabber_connection_schedule_close(js); | 1171 jabber_connection_schedule_close(js); |
1175 } | 1172 } |
1265 if(cbdata->js->registration && !strcmp(id, "username")) { | 1262 if(cbdata->js->registration && !strcmp(id, "username")) { |
1266 g_free(cbdata->js->user->node); | 1263 g_free(cbdata->js->user->node); |
1267 cbdata->js->user->node = g_strdup(value); | 1264 cbdata->js->user->node = g_strdup(value); |
1268 } | 1265 } |
1269 if(cbdata->js->registration && !strcmp(id, "password")) | 1266 if(cbdata->js->registration && !strcmp(id, "password")) |
1270 purple_account_set_password(cbdata->js->gc->account, value); | 1267 purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value); |
1271 } | 1268 } |
1272 } | 1269 } |
1273 } | 1270 } |
1274 | 1271 |
1275 if(cbdata->js->registration) { | 1272 if(cbdata->js->registration) { |
1276 username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, | 1273 username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, |
1277 cbdata->js->user->resource ? "/" : "", | 1274 cbdata->js->user->resource ? "/" : "", |
1278 cbdata->js->user->resource ? cbdata->js->user->resource : ""); | 1275 cbdata->js->user->resource ? cbdata->js->user->resource : ""); |
1279 purple_account_set_username(cbdata->js->gc->account, username); | 1276 purple_account_set_username(purple_connection_get_account(cbdata->js->gc), username); |
1280 g_free(username); | 1277 g_free(username); |
1281 } | 1278 } |
1282 | 1279 |
1283 jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); | 1280 jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); |
1284 | 1281 |
1289 static void | 1286 static void |
1290 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) | 1287 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
1291 { | 1288 { |
1292 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); | 1289 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); |
1293 if(account && cbdata->js->registration) { | 1290 if(account && cbdata->js->registration) { |
1294 if(account->registration_cb) | 1291 purple_account_register_completed(account, FALSE); |
1295 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1296 jabber_connection_schedule_close(cbdata->js); | 1292 jabber_connection_schedule_close(cbdata->js); |
1297 } | 1293 } |
1298 g_free(cbdata->who); | 1294 g_free(cbdata->who); |
1299 g_free(cbdata); | 1295 g_free(cbdata); |
1300 } | 1296 } |
1359 registered = TRUE; | 1355 registered = TRUE; |
1360 | 1356 |
1361 if(js->registration) { | 1357 if(js->registration) { |
1362 purple_notify_error(NULL, _("Already Registered"), | 1358 purple_notify_error(NULL, _("Already Registered"), |
1363 _("Already Registered"), NULL); | 1359 _("Already Registered"), NULL); |
1364 if(account->registration_cb) | 1360 purple_account_register_completed(account, FALSE); |
1365 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | |
1366 jabber_connection_schedule_close(js); | 1361 jabber_connection_schedule_close(js); |
1367 return; | 1362 return; |
1368 } | 1363 } |
1369 } | 1364 } |
1370 | 1365 |
1381 purple_notify_uri(NULL, href); | 1376 purple_notify_uri(NULL, href); |
1382 g_free(href); | 1377 g_free(href); |
1383 | 1378 |
1384 if(js->registration) { | 1379 if(js->registration) { |
1385 js->gc->wants_to_die = TRUE; | 1380 js->gc->wants_to_die = TRUE; |
1386 if(account->registration_cb) /* succeeded, but we have no login info */ | 1381 /* succeeded, but we have no login info */ |
1387 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); | 1382 purple_account_register_completed(account, TRUE); |
1388 jabber_connection_schedule_close(js); | 1383 jabber_connection_schedule_close(js); |
1389 } | 1384 } |
1390 return; | 1385 return; |
1391 } | 1386 } |
1392 } | 1387 } |
1423 } | 1418 } |
1424 | 1419 |
1425 if((node = xmlnode_get_child(query, "name"))) { | 1420 if((node = xmlnode_get_child(query, "name"))) { |
1426 if(js->registration) | 1421 if(js->registration) |
1427 field = purple_request_field_string_new("name", _("Name"), | 1422 field = purple_request_field_string_new("name", _("Name"), |
1428 purple_account_get_alias(js->gc->account), FALSE); | 1423 purple_account_get_alias(purple_connection_get_account(js->gc)), FALSE); |
1429 else { | 1424 else { |
1430 char *data = xmlnode_get_data(node); | 1425 char *data = xmlnode_get_data(node); |
1431 field = purple_request_field_string_new("name", _("Name"), data, FALSE); | 1426 field = purple_request_field_string_new("name", _("Name"), data, FALSE); |
1432 g_free(data); | 1427 g_free(data); |
1433 } | 1428 } |
1557 | 1552 |
1558 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { | 1553 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { |
1559 PurpleConnection *gc = purple_account_get_connection(account); | 1554 PurpleConnection *gc = purple_account_get_connection(account); |
1560 JabberStream *js; | 1555 JabberStream *js; |
1561 | 1556 |
1562 if(gc->state != PURPLE_CONNECTED) { | 1557 if (purple_connection_get_state(gc) != PURPLE_CONNECTED) { |
1563 if(gc->state != PURPLE_CONNECTING) | 1558 if (purple_connection_get_state(gc) != PURPLE_CONNECTING) |
1564 jabber_login(account); | 1559 jabber_login(account); |
1565 js = purple_connection_get_protocol_data(gc); | 1560 js = purple_connection_get_protocol_data(gc); |
1566 js->unregistration = TRUE; | 1561 js->unregistration = TRUE; |
1567 js->unregistration_cb = cb; | 1562 js->unregistration_cb = cb; |
1568 js->unregistration_user_data = user_data; | 1563 js->unregistration_user_data = user_data; |
1604 purple_srv_txt_query_destroy(js->srv_query_data); | 1599 purple_srv_txt_query_destroy(js->srv_query_data); |
1605 | 1600 |
1606 if(js->gsc) { | 1601 if(js->gsc) { |
1607 purple_ssl_close(js->gsc); | 1602 purple_ssl_close(js->gsc); |
1608 } else if (js->fd > 0) { | 1603 } else if (js->fd > 0) { |
1609 if(js->gc->inpa) | 1604 if(js->inpa) { |
1610 purple_input_remove(js->gc->inpa); | 1605 purple_input_remove(js->inpa); |
1606 js->inpa = 0; | |
1607 } | |
1611 close(js->fd); | 1608 close(js->fd); |
1612 } | 1609 } |
1613 | 1610 |
1614 if (js->bosh) | 1611 if (js->bosh) |
1615 jabber_bosh_connection_destroy(js->bosh); | 1612 jabber_bosh_connection_destroy(js->bosh); |
1872 | 1869 |
1873 if (type == JABBER_IQ_ERROR || blocklist == NULL) | 1870 if (type == JABBER_IQ_ERROR || blocklist == NULL) |
1874 return; | 1871 return; |
1875 | 1872 |
1876 /* This is the only privacy method supported by XEP-0191 */ | 1873 /* This is the only privacy method supported by XEP-0191 */ |
1877 if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) | 1874 purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); |
1878 account->perm_deny = PURPLE_PRIVACY_DENY_USERS; | |
1879 | 1875 |
1880 /* | 1876 /* |
1881 * TODO: When account->deny is something more than a hash table, this can | 1877 * TODO: When account->deny is something more than a hash table, this can |
1882 * be re-written to find the set intersection and difference. | 1878 * be re-written to find the set intersection and difference. |
1883 */ | 1879 */ |
2489 { | 2485 { |
2490 if (type == JABBER_IQ_RESULT) { | 2486 if (type == JABBER_IQ_RESULT) { |
2491 purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), | 2487 purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), |
2492 _("Your password has been changed.")); | 2488 _("Your password has been changed.")); |
2493 | 2489 |
2494 purple_account_set_password(js->gc->account, (char *)data); | 2490 purple_account_set_password(purple_connection_get_account(js->gc), (char *)data); |
2495 } else { | 2491 } else { |
2496 char *msg = jabber_parse_error(js, packet, NULL); | 2492 char *msg = jabber_parse_error(js, packet, NULL); |
2497 | 2493 |
2498 purple_notify_error(js->gc, _("Error changing password"), | 2494 purple_notify_error(js->gc, _("Error changing password"), |
2499 _("Error changing password"), msg); | 2495 _("Error changing password"), msg); |
2744 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); | 2740 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); |
2745 text = _("Authorization mechanism too weak"); | 2741 text = _("Authorization mechanism too weak"); |
2746 } else if(xmlnode_get_child(packet, "not-authorized")) { | 2742 } else if(xmlnode_get_child(packet, "not-authorized")) { |
2747 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); | 2743 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
2748 /* Clear the pasword if it isn't being saved */ | 2744 /* Clear the pasword if it isn't being saved */ |
2749 if (!purple_account_get_remember_password(js->gc->account)) | 2745 if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) |
2750 purple_account_set_password(js->gc->account, NULL); | 2746 purple_account_set_password(purple_connection_get_account(js->gc), NULL); |
2751 text = _("Not Authorized"); | 2747 text = _("Not Authorized"); |
2752 } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { | 2748 } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { |
2753 text = _("Temporary Authentication Failure"); | 2749 text = _("Temporary Authentication Failure"); |
2754 } else { | 2750 } else { |
2755 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); | 2751 SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); |
3002 const char *cmd, char **args, char **error, void *data) | 2998 const char *cmd, char **args, char **error, void *data) |
3003 { | 2999 { |
3004 if(!args || !args[0]) | 3000 if(!args || !args[0]) |
3005 return PURPLE_CMD_RET_FAILED; | 3001 return PURPLE_CMD_RET_FAILED; |
3006 | 3002 |
3007 jabber_chat_invite(purple_conversation_get_gc(conv), | 3003 jabber_chat_invite(purple_conversation_get_connection(conv), |
3008 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", | 3004 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", |
3009 args[0]); | 3005 args[0]); |
3010 | 3006 |
3011 return PURPLE_CMD_RET_OK; | 3007 return PURPLE_CMD_RET_OK; |
3012 } | 3008 } |
3049 g_hash_table_insert(components, "handle", (gpointer)handle); | 3045 g_hash_table_insert(components, "handle", (gpointer)handle); |
3050 | 3046 |
3051 if (args[1]) | 3047 if (args[1]) |
3052 g_hash_table_insert(components, "password", args[1]); | 3048 g_hash_table_insert(components, "password", args[1]); |
3053 | 3049 |
3054 jabber_chat_join(purple_conversation_get_gc(conv), components); | 3050 jabber_chat_join(purple_conversation_get_connection(conv), components); |
3055 | 3051 |
3056 g_hash_table_destroy(components); | 3052 g_hash_table_destroy(components); |
3057 jabber_id_free(jid); | 3053 jabber_id_free(jid); |
3058 return PURPLE_CMD_RET_OK; | 3054 return PURPLE_CMD_RET_OK; |
3059 } | 3055 } |
3083 if (!chat) | 3079 if (!chat) |
3084 return PURPLE_CMD_RET_FAILED; | 3080 return PURPLE_CMD_RET_FAILED; |
3085 | 3081 |
3086 who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); | 3082 who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); |
3087 | 3083 |
3088 jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); | 3084 jabber_message_send_im(purple_conversation_get_connection(conv), who, args[1], 0); |
3089 | 3085 |
3090 g_free(who); | 3086 g_free(who); |
3091 return PURPLE_CMD_RET_OK; | 3087 return PURPLE_CMD_RET_OK; |
3092 } | 3088 } |
3093 | 3089 |
3164 } | 3160 } |
3165 | 3161 |
3166 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, | 3162 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
3167 const char *cmd, char **args, char **error, void *data) | 3163 const char *cmd, char **args, char **error, void *data) |
3168 { | 3164 { |
3169 JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); | 3165 PurpleAccount *account = purple_conversation_get_account(conv); |
3166 JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); | |
3170 const gchar *who; | 3167 const gchar *who; |
3171 gchar *description; | 3168 gchar *description; |
3172 PurpleBuddy *buddy; | 3169 PurpleBuddy *buddy; |
3173 const char *alias; | 3170 const char *alias; |
3174 PurpleAttentionType *attn = | 3171 PurpleAttentionType *attn = |
3175 purple_get_attention_type_from_code(conv->account, 0); | 3172 purple_get_attention_type_from_code(account, 0); |
3176 | 3173 |
3177 if (!args || !args[0]) { | 3174 if (!args || !args[0]) { |
3178 /* use the buddy from conversation, if it's a one-to-one conversation */ | 3175 /* use the buddy from conversation, if it's a one-to-one conversation */ |
3179 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | 3176 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
3180 who = purple_conversation_get_name(conv); | 3177 who = purple_conversation_get_name(conv); |
3183 } | 3180 } |
3184 } else { | 3181 } else { |
3185 who = args[0]; | 3182 who = args[0]; |
3186 } | 3183 } |
3187 | 3184 |
3188 buddy = purple_find_buddy(conv->account, who); | 3185 buddy = purple_find_buddy(account, who); |
3189 if (buddy != NULL) | 3186 if (buddy != NULL) |
3190 alias = purple_buddy_get_contact_alias(buddy); | 3187 alias = purple_buddy_get_contact_alias(buddy); |
3191 else | 3188 else |
3192 alias = who; | 3189 alias = who; |
3193 | 3190 |
3575 | 3572 |
3576 static PurpleCmdRet | 3573 static PurpleCmdRet |
3577 jabber_cmd_mood(PurpleConversation *conv, | 3574 jabber_cmd_mood(PurpleConversation *conv, |
3578 const char *cmd, char **args, char **error, void *data) | 3575 const char *cmd, char **args, char **error, void *data) |
3579 { | 3576 { |
3580 JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); | 3577 PurpleAccount *account = purple_conversation_get_account(conv); |
3578 JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); | |
3581 | 3579 |
3582 if (js->pep) { | 3580 if (js->pep) { |
3583 /* if no argument was given, unset mood */ | 3581 /* if no argument was given, unset mood */ |
3584 if (!args || !args[0]) { | 3582 if (!args || !args[0]) { |
3585 jabber_mood_set(js, NULL, NULL); | 3583 jabber_mood_set(js, NULL, NULL); |