Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 25443:5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
xmpp branches.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Mar 2009 06:37:05 +0000 |
parents | 13574de83636 |
children | ae2b4394fbe2 13541e130064 7e020fbe2cdb 439f07ce4c8a 7ace7bf0bfad c4fd9222dda1 ff4212a5268f d8e6a2d592a4 |
comparison
equal
deleted
inserted
replaced
25442:13574de83636 | 25443:5f9a24d1c25e |
---|---|
182 | 182 |
183 static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) | 183 static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) |
184 { | 184 { |
185 if(xmlnode_get_child(packet, "starttls")) { | 185 if(xmlnode_get_child(packet, "starttls")) { |
186 if(jabber_process_starttls(js, packet)) | 186 if(jabber_process_starttls(js, packet)) |
187 | 187 |
188 return; | 188 return; |
189 } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { | 189 } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { |
190 purple_connection_error_reason (js->gc, | 190 purple_connection_error_reason (js->gc, |
191 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | 191 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
192 _("You require encryption, but it is not available on this server.")); | 192 _("You require encryption, but it is not available on this server.")); |
465 { | 465 { |
466 JabberStream *js = gc->proto_data; | 466 JabberStream *js = gc->proto_data; |
467 | 467 |
468 if (js->keepalive_timeout == -1) { | 468 if (js->keepalive_timeout == -1) { |
469 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); | 469 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
470 | 470 |
471 xmlnode *ping = xmlnode_new_child(iq->node, "ping"); | 471 xmlnode *ping = xmlnode_new_child(iq->node, "ping"); |
472 xmlnode_set_namespace(ping, "urn:xmpp:ping"); | 472 xmlnode_set_namespace(ping, "urn:xmpp:ping"); |
473 | 473 |
474 js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc); | 474 js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc); |
475 jabber_iq_set_callback(iq, jabber_pong_cb, NULL); | 475 jabber_iq_set_callback(iq, jabber_pong_cb, NULL); |
476 jabber_iq_send(iq); | 476 jabber_iq_send(iq); |
477 } | 477 } |
478 } | 478 } |
576 | 576 |
577 if(js->state == JABBER_STREAM_CONNECTING) | 577 if(js->state == JABBER_STREAM_CONNECTING) |
578 jabber_send_raw(js, "<?xml version='1.0' ?>", -1); | 578 jabber_send_raw(js, "<?xml version='1.0' ?>", -1); |
579 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); | 579 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); |
580 purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); | 580 purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); |
581 | 581 |
582 /* Tell the app that we're doing encryption */ | 582 /* Tell the app that we're doing encryption */ |
583 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); | 583 jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); |
584 } | 584 } |
585 | 585 |
586 | 586 |
734 purple_connection_error_reason (gc, | 734 purple_connection_error_reason (gc, |
735 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | 735 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
736 _("Invalid XMPP ID")); | 736 _("Invalid XMPP ID")); |
737 return; | 737 return; |
738 } | 738 } |
739 | 739 |
740 if (!js->user->domain || *(js->user->domain) == '\0') { | 740 if (!js->user->domain || *(js->user->domain) == '\0') { |
741 purple_connection_error_reason (gc, | 741 purple_connection_error_reason (gc, |
742 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | 742 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
743 _("Invalid XMPP ID. Domain must be set.")); | 743 _("Invalid XMPP ID. Domain must be set.")); |
744 return; | 744 return; |
745 } | 745 } |
746 | 746 |
747 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) | 747 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
748 my_jb->subscription |= JABBER_SUB_BOTH; | 748 my_jb->subscription |= JABBER_SUB_BOTH; |
749 | 749 |
750 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); | 750 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); |
751 | 751 |
851 purple_notify_info(NULL, _("Unregistration Successful"), | 851 purple_notify_info(NULL, _("Unregistration Successful"), |
852 _("Unregistration Successful"), buf); | 852 _("Unregistration Successful"), buf); |
853 g_free(buf); | 853 g_free(buf); |
854 } else { | 854 } else { |
855 char *msg = jabber_parse_error(js, packet, NULL); | 855 char *msg = jabber_parse_error(js, packet, NULL); |
856 | 856 |
857 if(!msg) | 857 if(!msg) |
858 msg = g_strdup(_("Unknown Error")); | 858 msg = g_strdup(_("Unknown Error")); |
859 | 859 |
860 purple_notify_error(NULL, _("Unregistration Failed"), | 860 purple_notify_error(NULL, _("Unregistration Failed"), |
861 _("Unregistration Failed"), msg); | 861 _("Unregistration Failed"), msg); |
862 g_free(msg); | 862 g_free(msg); |
863 } | 863 } |
864 g_free(to); | 864 g_free(to); |
897 iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); | 897 iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); |
898 query = xmlnode_get_child(iq->node, "query"); | 898 query = xmlnode_get_child(iq->node, "query"); |
899 if (cbdata->who) | 899 if (cbdata->who) |
900 xmlnode_set_attrib(iq->node,"to",cbdata->who); | 900 xmlnode_set_attrib(iq->node,"to",cbdata->who); |
901 xmlnode_new_child(query, "remove"); | 901 xmlnode_new_child(query, "remove"); |
902 | 902 |
903 jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); | 903 jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); |
904 | 904 |
905 jabber_iq_send(iq); | 905 jabber_iq_send(iq); |
906 g_free(cbdata); | 906 g_free(cbdata); |
907 return; | 907 return; |
908 } | 908 } |
909 } else { | 909 } else { |
1029 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | 1029 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
1030 jabber_connection_schedule_close(js); | 1030 jabber_connection_schedule_close(js); |
1031 return; | 1031 return; |
1032 } | 1032 } |
1033 } | 1033 } |
1034 | 1034 |
1035 if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { | 1035 if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
1036 jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); | 1036 jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); |
1037 return; | 1037 return; |
1038 | 1038 |
1039 } else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) { | 1039 } else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) { |
1180 jabber_iq_send(iq); | 1180 jabber_iq_send(iq); |
1181 } | 1181 } |
1182 | 1182 |
1183 void jabber_register_gateway(JabberStream *js, const char *gateway) { | 1183 void jabber_register_gateway(JabberStream *js, const char *gateway) { |
1184 JabberIq *iq; | 1184 JabberIq *iq; |
1185 | 1185 |
1186 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); | 1186 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); |
1187 xmlnode_set_attrib(iq->node, "to", gateway); | 1187 xmlnode_set_attrib(iq->node, "to", gateway); |
1188 jabber_iq_send(iq); | 1188 jabber_iq_send(iq); |
1189 } | 1189 } |
1190 | 1190 |
1255 static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) { | 1255 static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) { |
1256 PurpleAccount *account = purple_connection_get_account(js->gc); | 1256 PurpleAccount *account = purple_connection_get_account(js->gc); |
1257 const char *type = xmlnode_get_attrib(packet,"type"); | 1257 const char *type = xmlnode_get_attrib(packet,"type"); |
1258 if(!strcmp(type,"error")) { | 1258 if(!strcmp(type,"error")) { |
1259 char *msg = jabber_parse_error(js, packet, NULL); | 1259 char *msg = jabber_parse_error(js, packet, NULL); |
1260 | 1260 |
1261 purple_notify_error(js->gc, _("Error unregistering account"), | 1261 purple_notify_error(js->gc, _("Error unregistering account"), |
1262 _("Error unregistering account"), msg); | 1262 _("Error unregistering account"), msg); |
1263 g_free(msg); | 1263 g_free(msg); |
1264 if(js->unregistration_cb) | 1264 if(js->unregistration_cb) |
1265 js->unregistration_cb(account, FALSE, js->unregistration_user_data); | 1265 js->unregistration_cb(account, FALSE, js->unregistration_user_data); |
1289 } | 1289 } |
1290 | 1290 |
1291 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { | 1291 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { |
1292 PurpleConnection *gc = purple_account_get_connection(account); | 1292 PurpleConnection *gc = purple_account_get_connection(account); |
1293 JabberStream *js; | 1293 JabberStream *js; |
1294 | 1294 |
1295 if(gc->state != PURPLE_CONNECTED) { | 1295 if(gc->state != PURPLE_CONNECTED) { |
1296 if(gc->state != PURPLE_CONNECTING) | 1296 if(gc->state != PURPLE_CONNECTING) |
1297 jabber_login(account); | 1297 jabber_login(account); |
1298 js = gc->proto_data; | 1298 js = gc->proto_data; |
1299 js->unregistration = TRUE; | 1299 js->unregistration = TRUE; |
1300 js->unregistration_cb = cb; | 1300 js->unregistration_cb = cb; |
1301 js->unregistration_user_data = user_data; | 1301 js->unregistration_user_data = user_data; |
1302 return; | 1302 return; |
1303 } | 1303 } |
1304 | 1304 |
1305 js = gc->proto_data; | 1305 js = gc->proto_data; |
1306 | 1306 |
1307 if (js->unregistration) { | 1307 if (js->unregistration) { |
1308 purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); | 1308 purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); |
1309 return; | 1309 return; |
1600 | 1600 |
1601 feat = g_new0(JabberFeature,1); | 1601 feat = g_new0(JabberFeature,1); |
1602 feat->shortname = g_strdup(shortname); | 1602 feat->shortname = g_strdup(shortname); |
1603 feat->namespace = g_strdup(namespace); | 1603 feat->namespace = g_strdup(namespace); |
1604 feat->is_enabled = cb; | 1604 feat->is_enabled = cb; |
1605 | 1605 |
1606 /* try to remove just in case it already exists in the list */ | 1606 /* try to remove just in case it already exists in the list */ |
1607 jabber_remove_feature(shortname); | 1607 jabber_remove_feature(shortname); |
1608 | 1608 |
1609 jabber_features = g_list_append(jabber_features, feat); | 1609 jabber_features = g_list_append(jabber_features, feat); |
1610 } | 1610 } |
1611 | 1611 |
1612 void jabber_remove_feature(const char *shortname) { | 1612 void jabber_remove_feature(const char *shortname) { |
1613 GList *feature; | 1613 GList *feature; |
1614 for(feature = jabber_features; feature; feature = feature->next) { | 1614 for(feature = jabber_features; feature; feature = feature->next) { |
1615 JabberFeature *feat = (JabberFeature*)feature->data; | 1615 JabberFeature *feat = (JabberFeature*)feature->data; |
1616 if(!strcmp(feat->shortname, shortname)) { | 1616 if(!strcmp(feat->shortname, shortname)) { |
1617 g_free(feat->shortname); | 1617 g_free(feat->shortname); |
1618 g_free(feat->namespace); | 1618 g_free(feat->namespace); |
1619 | 1619 |
1620 g_free(feature->data); | 1620 g_free(feature->data); |
1621 jabber_features = g_list_delete_link(jabber_features, feature); | 1621 jabber_features = g_list_delete_link(jabber_features, feature); |
1622 break; | 1622 break; |
1623 } | 1623 } |
1624 } | 1624 } |
1851 "priority", _("Priority"), priority_value, | 1851 "priority", _("Priority"), priority_value, |
1852 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1852 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1853 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1853 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1854 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1854 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1855 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1855 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1856 "buzz", _("Allow Buzz"), buzz_enabled, | 1856 "buzz", _("Allow Buzz"), buzz_enabled, |
1857 NULL); | 1857 NULL); |
1858 types = g_list_append(types, type); | 1858 types = g_list_append(types, type); |
1859 | 1859 |
1860 priority_value = purple_value_new(PURPLE_TYPE_INT); | 1860 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1861 purple_value_set_int(priority_value, 0); | 1861 purple_value_set_int(priority_value, 0); |
1867 "priority", _("Priority"), priority_value, | 1867 "priority", _("Priority"), priority_value, |
1868 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1868 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1869 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1869 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1870 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1870 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1871 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1871 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1872 "buzz", _("Allow Buzz"), buzz_enabled, | 1872 "buzz", _("Allow Buzz"), buzz_enabled, |
1873 NULL); | 1873 NULL); |
1874 types = g_list_append(types, type); | 1874 types = g_list_append(types, type); |
1875 | 1875 |
1876 priority_value = purple_value_new(PURPLE_TYPE_INT); | 1876 priority_value = purple_value_new(PURPLE_TYPE_INT); |
1877 purple_value_set_int(priority_value, 0); | 1877 purple_value_set_int(priority_value, 0); |
2026 | 2026 |
2027 purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO"); | 2027 purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO"); |
2028 | 2028 |
2029 if(js->pep) | 2029 if(js->pep) |
2030 jabber_pep_init_actions(&m); | 2030 jabber_pep_init_actions(&m); |
2031 | 2031 |
2032 if(js->commands) | 2032 if(js->commands) |
2033 jabber_adhoc_init_server_commands(js, &m); | 2033 jabber_adhoc_init_server_commands(js, &m); |
2034 | 2034 |
2035 return m; | 2035 return m; |
2036 } | 2036 } |
2078 { | 2078 { |
2079 JabberStream *js = gc->proto_data; | 2079 JabberStream *js = gc->proto_data; |
2080 JabberID *jid; | 2080 JabberID *jid; |
2081 JabberBuddy *jb; | 2081 JabberBuddy *jb; |
2082 JabberBuddyResource *jbr; | 2082 JabberBuddyResource *jbr; |
2083 | 2083 |
2084 if(!(jid = jabber_id_new(who))) | 2084 if(!(jid = jabber_id_new(who))) |
2085 return; | 2085 return; |
2086 | 2086 |
2087 if((jb = jabber_buddy_find(js, who, TRUE)) && | 2087 if((jb = jabber_buddy_find(js, who, TRUE)) && |
2088 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { | 2088 (jbr = jabber_buddy_find_resource(jb, jid->resource))) { |
2339 JabberChat *chat = jabber_chat_find_by_conv(conv); | 2339 JabberChat *chat = jabber_chat_find_by_conv(conv); |
2340 | 2340 |
2341 if (!chat || !args || !args[0] || !args[1]) | 2341 if (!chat || !args || !args[0] || !args[1]) |
2342 return PURPLE_CMD_RET_FAILED; | 2342 return PURPLE_CMD_RET_FAILED; |
2343 | 2343 |
2344 if (strcmp(args[1], "owner") != 0 && | 2344 if (strcmp(args[1], "owner") != 0 && |
2345 strcmp(args[1], "admin") != 0 && | 2345 strcmp(args[1], "admin") != 0 && |
2346 strcmp(args[1], "member") != 0 && | 2346 strcmp(args[1], "member") != 0 && |
2347 strcmp(args[1], "outcast") != 0 && | 2347 strcmp(args[1], "outcast") != 0 && |
2348 strcmp(args[1], "none") != 0) { | 2348 strcmp(args[1], "none") != 0) { |
2349 *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); | 2349 *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[1]); |
2469 static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) { | 2469 static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) { |
2470 | 2470 |
2471 JabberBuddy *jb; | 2471 JabberBuddy *jb; |
2472 JabberBuddyResource *jbr; | 2472 JabberBuddyResource *jbr; |
2473 PurpleConnection *gc = js->gc; | 2473 PurpleConnection *gc = js->gc; |
2474 PurpleBuddy *buddy = | 2474 PurpleBuddy *buddy = |
2475 purple_find_buddy(purple_connection_get_account(gc), username); | 2475 purple_find_buddy(purple_connection_get_account(gc), username); |
2476 const gchar *alias = | 2476 const gchar *alias = |
2477 buddy ? purple_buddy_get_contact_alias(buddy) : username; | 2477 buddy ? purple_buddy_get_contact_alias(buddy) : username; |
2478 | 2478 |
2479 if(!username) | 2479 if(!username) |
2480 return FALSE; | 2480 return FALSE; |
2481 | 2481 |
2482 jb = jabber_buddy_find(js, username, FALSE); | 2482 jb = jabber_buddy_find(js, username, FALSE); |
2483 if(!jb) { | 2483 if(!jb) { |
2484 *error = g_strdup_printf(_("Unable to buzz, because there is nothing " | 2484 *error = g_strdup_printf(_("Unable to buzz, because there is nothing " |
2485 "known about %s."), alias); | 2485 "known about %s."), alias); |
2486 return FALSE; | 2486 return FALSE; |
2487 } | 2487 } |
2488 | 2488 |
2489 jbr = jabber_buddy_find_resource(jb, NULL); | 2489 jbr = jabber_buddy_find_resource(jb, NULL); |
2490 if (!jbr) { | 2490 if (!jbr) { |
2491 *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."), | 2491 *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."), |
2492 alias); | 2492 alias); |
2493 return FALSE; | 2493 return FALSE; |
2494 } | 2494 } |
2495 | 2495 |
2496 if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) { | 2496 if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) { |
2497 xmlnode *buzz, *msg = xmlnode_new("message"); | 2497 xmlnode *buzz, *msg = xmlnode_new("message"); |
2498 gchar *to; | 2498 gchar *to; |
2499 | 2499 |
2500 to = g_strdup_printf("%s/%s", username, jbr->name); | 2500 to = g_strdup_printf("%s/%s", username, jbr->name); |
2501 xmlnode_set_attrib(msg, "to", to); | 2501 xmlnode_set_attrib(msg, "to", to); |
2502 g_free(to); | 2502 g_free(to); |
2503 | 2503 |
2504 /* avoid offline storage */ | 2504 /* avoid offline storage */ |
2521 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, | 2521 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, |
2522 const char *cmd, char **args, char **error, void *data) | 2522 const char *cmd, char **args, char **error, void *data) |
2523 { | 2523 { |
2524 JabberStream *js = conv->account->gc->proto_data; | 2524 JabberStream *js = conv->account->gc->proto_data; |
2525 const gchar *who; | 2525 const gchar *who; |
2526 | 2526 |
2527 if (!args || !args[0]) { | 2527 if (!args || !args[0]) { |
2528 /* use the buddy from conversation, if it's a one-to-one conversation */ | 2528 /* use the buddy from conversation, if it's a one-to-one conversation */ |
2529 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | 2529 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
2530 who = purple_conversation_get_name(conv); | 2530 who = purple_conversation_get_name(conv); |
2531 } else { | 2531 } else { |
2532 return PURPLE_CMD_RET_FAILED; | 2532 return PURPLE_CMD_RET_FAILED; |
2533 } | 2533 } |
2534 } else { | 2534 } else { |
2535 who = args[0]; | 2535 who = args[0]; |
2536 } | 2536 } |
2537 | 2537 |
2538 if (_jabber_send_buzz(js, who, error)) { | 2538 if (_jabber_send_buzz(js, who, error)) { |
2539 const gchar *alias; | 2539 const gchar *alias; |
2540 gchar *str; | 2540 gchar *str; |
2541 PurpleBuddy *buddy = | 2541 PurpleBuddy *buddy = |
2542 purple_find_buddy(purple_connection_get_account(conv->account->gc), | 2542 purple_find_buddy(purple_connection_get_account(conv->account->gc), |
2543 who); | 2543 who); |
2544 | 2544 |
2545 if (buddy != NULL) | 2545 if (buddy != NULL) |
2546 alias = purple_buddy_get_contact_alias(buddy); | 2546 alias = purple_buddy_get_contact_alias(buddy); |
2547 else | 2547 else |
2548 alias = who; | 2548 alias = who; |
2549 | 2549 |
2550 str = g_strdup_printf(_("Buzzing %s..."), alias); | 2550 str = g_strdup_printf(_("Buzzing %s..."), alias); |
2551 purple_conversation_write(conv, NULL, str, | 2551 purple_conversation_write(conv, NULL, str, |
2552 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); | 2552 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); |
2553 g_free(str); | 2553 g_free(str); |
2554 | 2554 |
2555 return PURPLE_CMD_RET_OK; | 2555 return PURPLE_CMD_RET_OK; |
2556 } else { | 2556 } else { |
2557 return PURPLE_CMD_RET_FAILED; | 2557 return PURPLE_CMD_RET_FAILED; |
2558 } | 2558 } |
2559 } | 2559 } |
2667 PURPLE_CMD_FLAG_PRPL_ONLY, | 2667 PURPLE_CMD_FLAG_PRPL_ONLY, |
2668 "prpl-jabber", jabber_cmd_ping, | 2668 "prpl-jabber", jabber_cmd_ping, |
2669 _("ping <jid>: Ping a user/component/server."), | 2669 _("ping <jid>: Ping a user/component/server."), |
2670 NULL); | 2670 NULL); |
2671 purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL, | 2671 purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL, |
2672 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | | 2672 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | |
2673 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | 2673 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, |
2674 "prpl-jabber", jabber_cmd_buzz, | 2674 "prpl-jabber", jabber_cmd_buzz, |
2675 _("buzz: Buzz a user to get their attention"), NULL); | 2675 _("buzz: Buzz a user to get their attention"), NULL); |
2676 } | 2676 } |
2677 | 2677 |