Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 20685:02df6998b466
propagate from branch 'im.pidgin.rlaager.merging.2_2_1_conflicts' (head 4ad1081695d083df424898e6e7091f731b401265)
to branch 'im.pidgin.pidgin' (head d33243e8f5347776c81f81a0e4ba3a76ae5505a5)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 28 Sep 2007 16:34:43 +0000 |
parents | 8c32a904ed1f be2538a92099 |
children | 58455f507a9b |
comparison
equal
deleted
inserted
replaced
20258:509ca8ebe515 | 20685:02df6998b466 |
---|---|
812 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); | 812 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); |
813 if(account && cbdata->js->registration) { | 813 if(account && cbdata->js->registration) { |
814 if(account->registration_cb) | 814 if(account->registration_cb) |
815 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); | 815 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
816 jabber_connection_schedule_close(cbdata->js); | 816 jabber_connection_schedule_close(cbdata->js); |
817 } | 817 } |
818 g_free(cbdata->who); | 818 g_free(cbdata->who); |
819 g_free(cbdata); | 819 g_free(cbdata); |
820 } | 820 } |
821 | 821 |
822 static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) | 822 static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
881 if((url = xmlnode_get_child(x, "url"))) { | 881 if((url = xmlnode_get_child(x, "url"))) { |
882 char *href; | 882 char *href; |
883 if((href = xmlnode_get_data(url))) { | 883 if((href = xmlnode_get_data(url))) { |
884 purple_notify_uri(NULL, href); | 884 purple_notify_uri(NULL, href); |
885 g_free(href); | 885 g_free(href); |
886 if(js->registration) { | 886 if(js->registration) { |
887 js->gc->wants_to_die = TRUE; | 887 js->gc->wants_to_die = TRUE; |
888 if(account->registration_cb) /* succeeded, but we have no login info */ | 888 if(account->registration_cb) /* succeeded, but we have no login info */ |
889 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); | 889 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
890 jabber_connection_schedule_close(js); | 890 jabber_connection_schedule_close(js); |
891 } | 891 } |
892 return; | 892 return; |
893 } | 893 } |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
986 if(registered) { | 986 if(registered) { |
987 field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE); | 987 field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE); |
988 purple_request_field_group_add_field(group, field); | 988 purple_request_field_group_add_field(group, field); |
989 } | 989 } |
990 | 990 |
991 if((y = xmlnode_get_child(query, "instructions"))) | 991 if((y = xmlnode_get_child(query, "instructions"))) |
992 instructions = xmlnode_get_data(y); | 992 instructions = xmlnode_get_data(y); |
993 else if(registered) | 993 else if(registered) |
994 instructions = g_strdup(_("Please fill out the information below " | 994 instructions = g_strdup(_("Please fill out the information below " |
995 "to change your account registration.")); | 995 "to change your account registration.")); |
996 else | 996 else |
997 instructions = g_strdup(_("Please fill out the information below " | 997 instructions = g_strdup(_("Please fill out the information below " |
998 "to register your new account.")); | 998 "to register your new account.")); |
999 | 999 |
1000 cbdata = g_new0(JabberRegisterCBData, 1); | 1000 cbdata = g_new0(JabberRegisterCBData, 1); |
1001 cbdata->js = js; | 1001 cbdata->js = js; |
1002 cbdata->who = g_strdup(from); | 1002 cbdata->who = g_strdup(from); |
1003 | 1003 |
1018 purple_connection_get_account(js->gc), NULL, NULL, | 1018 purple_connection_get_account(js->gc), NULL, NULL, |
1019 cbdata); | 1019 cbdata); |
1020 g_free(title); | 1020 g_free(title); |
1021 } | 1021 } |
1022 | 1022 |
1023 g_free(instructions); | 1023 g_free(instructions); |
1024 } | 1024 } |
1025 | 1025 |
1026 void jabber_register_start(JabberStream *js) | 1026 void jabber_register_start(JabberStream *js) |
1027 { | 1027 { |
1028 JabberIq *iq; | 1028 JabberIq *iq; |
1029 | 1029 |
1530 NULL, TRUE, TRUE, FALSE, | 1530 NULL, TRUE, TRUE, FALSE, |
1531 "priority", _("Priority"), priority_value, | 1531 "priority", _("Priority"), priority_value, |
1532 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1532 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1533 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1533 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1534 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1534 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1535 "tune_artist", _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), | 1535 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
1536 "tune_title", _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), | 1536 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
1537 "tune_album", _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), | 1537 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
1538 "tune_genre", _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), | 1538 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
1539 "tune_comment", _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), | 1539 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
1540 "tune_track", _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), | 1540 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
1541 "tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), | 1541 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
1542 "tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), | 1542 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
1543 "tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), | 1543 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
1544 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1544 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1545 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), | 1545 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
1546 NULL); | 1546 NULL); |
1547 types = g_list_append(types, type); | 1547 types = g_list_append(types, type); |
1548 | 1548 |
1553 _("Chatty"), TRUE, TRUE, FALSE, | 1553 _("Chatty"), TRUE, TRUE, FALSE, |
1554 "priority", _("Priority"), priority_value, | 1554 "priority", _("Priority"), priority_value, |
1555 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1555 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1556 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1556 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1557 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1557 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1558 "tune_artist", _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), | 1558 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
1559 "tune_title", _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), | 1559 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
1560 "tune_album", _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), | 1560 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
1561 "tune_genre", _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), | 1561 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
1562 "tune_comment", _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), | 1562 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
1563 "tune_track", _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), | 1563 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
1564 "tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), | 1564 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
1565 "tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), | 1565 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
1566 "tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), | 1566 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
1567 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1567 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1568 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), | 1568 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
1569 NULL); | 1569 NULL); |
1570 types = g_list_append(types, type); | 1570 types = g_list_append(types, type); |
1571 | 1571 |
1576 NULL, TRUE, TRUE, FALSE, | 1576 NULL, TRUE, TRUE, FALSE, |
1577 "priority", _("Priority"), priority_value, | 1577 "priority", _("Priority"), priority_value, |
1578 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1578 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1579 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1579 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1580 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1580 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1581 "tune_artist", _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), | 1581 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
1582 "tune_title", _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), | 1582 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
1583 "tune_album", _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), | 1583 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
1584 "tune_genre", _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), | 1584 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
1585 "tune_comment", _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), | 1585 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
1586 "tune_track", _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), | 1586 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
1587 "tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), | 1587 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
1588 "tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), | 1588 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
1589 "tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), | 1589 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
1590 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1590 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1591 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), | 1591 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
1592 NULL); | 1592 NULL); |
1593 types = g_list_append(types, type); | 1593 types = g_list_append(types, type); |
1594 | 1594 |
1599 NULL, TRUE, TRUE, FALSE, | 1599 NULL, TRUE, TRUE, FALSE, |
1600 "priority", _("Priority"), priority_value, | 1600 "priority", _("Priority"), priority_value, |
1601 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1601 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1602 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1602 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1603 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1603 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1604 "tune_artist", _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), | 1604 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
1605 "tune_title", _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), | 1605 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
1606 "tune_album", _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), | 1606 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
1607 "tune_genre", _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), | 1607 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
1608 "tune_comment", _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), | 1608 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
1609 "tune_track", _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), | 1609 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
1610 "tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), | 1610 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
1611 "tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), | 1611 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
1612 "tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), | 1612 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
1613 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1613 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1614 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), | 1614 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
1615 NULL); | 1615 NULL); |
1616 types = g_list_append(types, type); | 1616 types = g_list_append(types, type); |
1617 | 1617 |
1622 _("Do Not Disturb"), TRUE, TRUE, FALSE, | 1622 _("Do Not Disturb"), TRUE, TRUE, FALSE, |
1623 "priority", _("Priority"), priority_value, | 1623 "priority", _("Priority"), priority_value, |
1624 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | 1624 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), |
1625 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), | 1625 "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), |
1626 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), | 1626 "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), |
1627 "tune_artist", _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), | 1627 PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), |
1628 "tune_title", _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), | 1628 PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), |
1629 "tune_album", _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), | 1629 PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), |
1630 "tune_genre", _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), | 1630 PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), |
1631 "tune_comment", _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), | 1631 PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), |
1632 "tune_track", _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), | 1632 PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), |
1633 "tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), | 1633 PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), |
1634 "tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), | 1634 PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), |
1635 "tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), | 1635 PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), |
1636 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), | 1636 "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), |
1637 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), | 1637 "buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN), |
1638 NULL); | 1638 NULL); |
1639 types = g_list_append(types, type); | 1639 types = g_list_append(types, type); |
1640 | 1640 |
2237 } | 2237 } |
2238 } | 2238 } |
2239 *error = g_strdup_printf(_("Unable to buzz, because the user %s does not support it."), args[0]); | 2239 *error = g_strdup_printf(_("Unable to buzz, because the user %s does not support it."), args[0]); |
2240 return PURPLE_CMD_RET_FAILED; | 2240 return PURPLE_CMD_RET_FAILED; |
2241 } | 2241 } |
2242 | |
2243 GList *jabber_attention_types(PurpleAccount *account) | |
2244 { | |
2245 static GList *types = NULL; | |
2246 PurpleAttentionType *attn; | |
2247 | |
2248 if (!types) { | |
2249 attn = g_new0(PurpleAttentionType, 1); | |
2250 attn->name = _("Buzz"); | |
2251 attn->incoming_description = _("%s has buzzed you!"); | |
2252 attn->outgoing_description = _("Buzzing %s..."); | |
2253 types = g_list_append(types, attn); | |
2254 } | |
2255 | |
2256 return types; | |
2257 } | |
2258 | |
2259 gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) | |
2260 { | |
2261 PurpleConversation *conv; | |
2262 char *error; | |
2263 char *args[1]; | |
2264 PurpleCmdRet ret; | |
2265 | |
2266 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, username, gc->account); | |
2267 | |
2268 args[0] = (char *)username; | |
2269 | |
2270 ret = jabber_cmd_buzz(conv, "buzz", args, &error, NULL); | |
2271 | |
2272 if (ret == PURPLE_CMD_RET_FAILED) { | |
2273 purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)"); | |
2274 return FALSE; | |
2275 } else { | |
2276 return TRUE; | |
2277 } | |
2278 } | |
2279 | |
2242 | 2280 |
2243 gboolean jabber_offline_message(const PurpleBuddy *buddy) | 2281 gboolean jabber_offline_message(const PurpleBuddy *buddy) |
2244 { | 2282 { |
2245 return TRUE; | 2283 return TRUE; |
2246 } | 2284 } |