Mercurial > pidgin.yaz
changeset 28215:766f7905314a
merged with im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 10 Aug 2009 20:36:54 +0900 |
parents | 141e76df86a6 (current diff) 2075b5cb608e (diff) |
children | 6fca316de1e2 |
files | libpurple/protocols/msn/msg.c libpurple/util.c pidgin/gtkimhtml.c |
diffstat | 12 files changed, 217 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.win32 Sat Aug 08 17:35:08 2009 +0900 +++ b/ChangeLog.win32 Mon Aug 10 20:36:54 2009 +0900 @@ -1,4 +1,5 @@ version 2.6.0 (??/??/2009): + * Added XMPP URI support. version 2.5.8 (06/27/2009): * No changes
--- a/doc/funniest_home_convos.txt Sat Aug 08 17:35:08 2009 +0900 +++ b/doc/funniest_home_convos.txt Mon Aug 10 20:36:54 2009 +0900 @@ -572,3 +572,42 @@ 15:46 <khc> well, there was a Grand Smiley Theme Database 15:47 <SimGuy> the GSTD sounds like a bad acronym 15:47 <khc> I realized after typing that + +-- + +(01:51:38 AM) user entered the room. +(01:52:46 AM) user: .addKeyActionListener(new KeyActionListener() onKeyPress() {if (event.geyKeyPresss().equals(Key.UP_ARROW) { inputbox.text = history.pop() }}}}}}}); +(01:52:51 AM) user: THERE, FOR **** SAKE +(01:52:53 AM) user: its 2009 +(01:53:06 AM) user: oh wait. ctrl up works +(01:53:07 AM) user: lol +(01:53:11 AM) user: yey me +(01:53:16 AM) user left the room. +(01:55:31 AM) darkrain42: Wow. +(01:58:15 AM) QuLogic: I think he failed to realize we'd have to re-write pidgin in java to do that +(01:59:44 AM) khc: history.pop() is clearly wrong too + +-- + +Some time later: +(02:41:55 AM) user entered the room. +(02:42:24 AM) user: didn't I read some idiot post, about 2 years ago, before pidgin was renamed / forked, over one dev refusing to make minimize on close? +(02:43:12 AM) QuLogic: I see you've learned to at least ask a question before jumping to random conclusions +(02:44:01 AM) user: QuLogic: :-)))))))))))))))))))))) +(02:44:12 AM) user: hey, I submitted a code patch! +(02:44:36 AM) user: now, anyway, what happened? why did I get the buddy list (empty) stealing focus, and why did it exit on close? +(02:44:40 AM) QuLogic: it's not really a patch if it's in the wrong language +(02:44:42 AM) user: I've had this argument before, in 2006 +(02:44:55 AM) user: QuLogic: simple, rewrite the rest ;-) +(02:44:58 AM) khc: pidgin never steals focus +(02:45:10 AM) khc: if it exit on close, it's because you didn't turn on the systray icon +(02:47:17 AM) user: khc - and that isn't default... why? anyway. I recall something on the matter, and I think this was the project (pre-fork?) or is this the unforked, renamed? I forget. +(02:47:42 AM) user: Whoever it was arguing about it (and font sizes I believe) was an idiot... not one of you I suppose, just making idle chit chat. +(02:47:43 AM) user: thanks +(02:47:48 AM) darkrain42: It is on by default. Some distros change that. +(02:48:00 AM) darkrain42: And I don't even know what you're arguing about at this point. +(02:48:11 AM) user: ... /leave - That command doesn't work on this protocol... /leave #pidgin ...That comm..... :-((( +(02:48:18 AM) user: darkrain42: now arguing, just remembering something +(02:48:27 AM) user left the room. +(02:49:04 AM) darkrain42: Wow. (again) +
--- a/libpurple/protocols/jabber/libxmpp.c Sat Aug 08 17:35:08 2009 +0900 +++ b/libpurple/protocols/jabber/libxmpp.c Mon Aug 10 20:36:54 2009 +0900 @@ -28,6 +28,7 @@ #include "internal.h" #include "accountopt.h" +#include "core.h" #include "debug.h" #include "version.h" @@ -47,6 +48,8 @@ #include "data.h" #include "ibb.h" +static PurplePlugin *my_protocol = NULL; + static PurplePluginProtocolInfo prpl_info = { OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | @@ -266,6 +269,70 @@ NULL }; +static PurpleAccount *find_acct(const char *prpl, const char *acct_id) +{ + PurpleAccount *acct = NULL; + + /* If we have a specific acct, use it */ + if (acct_id) { + acct = purple_accounts_find(acct_id, prpl); + if (acct && !purple_account_is_connected(acct)) + acct = NULL; + } else { /* Otherwise find an active account for the protocol */ + GList *l = purple_accounts_get_all(); + while (l) { + if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) + && purple_account_is_connected(l->data)) { + acct = l->data; + break; + } + l = l->next; + } + } + + return acct; +} + +static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) +{ + char *acct_id = g_hash_table_lookup(params, "account"); + PurpleAccount *acct; + + if (g_ascii_strcasecmp(proto, "xmpp")) + return FALSE; + + acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); + + if (!acct) + return FALSE; + + /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ + if (g_hash_table_lookup_extended(params, "message", NULL, NULL)) { + char *body = g_hash_table_lookup(params, "body"); + if (user && *user) { + PurpleConversation *conv = + purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, user); + purple_conversation_present(conv); + if (body && *body) + purple_conv_send_confirm(conv, body); + } + } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { + char *name = g_hash_table_lookup(params, "name"); + if (user && *user) + purple_blist_request_add_buddy(acct, user, NULL, name); + } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { + PurpleConnection *gc = purple_account_get_connection(acct); + if (user && *user) { + GHashTable *params = jabber_chat_info_defaults(gc, user); + jabber_chat_join(gc, params); + } + return TRUE; + } + + return FALSE; +} + + static void init_plugin(PurplePlugin *plugin) { @@ -331,6 +398,7 @@ prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + my_protocol = plugin; jabber_init_plugin(plugin); purple_prefs_remove("/plugins/prpl/jabber"); @@ -366,6 +434,9 @@ jabber_ibb_init(); jabber_si_init(); + + purple_signal_connect(purple_get_core(), "uri-handler", plugin, + PURPLE_CALLBACK(xmpp_uri_handler), NULL); }
--- a/libpurple/protocols/jabber/presence.c Sat Aug 08 17:35:08 2009 +0900 +++ b/libpurple/protocols/jabber/presence.c Mon Aug 10 20:36:54 2009 +0900 @@ -698,6 +698,7 @@ const char *real_jid = NULL; const char *affiliation = NULL; const char *role = NULL; + gboolean is_our_resource = FALSE; /* Is the presence about us? */ /* * XEP-0045 mandates the presence to include a resource (which is @@ -718,10 +719,15 @@ xmlnode *status_node; xmlnode *item_node; - status_node = xmlnode_get_child(x, "status"); - if (status_node) { + for (status_node = xmlnode_get_child(x, "status"); status_node; + status_node = xmlnode_get_next_twin(status_node)) { const char *code = xmlnode_get_attrib(status_node, "code"); - if (purple_strequal(code, "201")) { + if (!code) + continue; + + if (g_str_equal(code, "110")) { + is_our_resource = TRUE; + } else if (g_str_equal(code, "201")) { if ((chat = jabber_chat_find(js, jid->node, jid->domain))) { chat->config_dialog_type = PURPLE_REQUEST_ACTION; chat->config_dialog_handle = @@ -737,7 +743,7 @@ _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); } - } else if (purple_strequal(code, "210")) { + } else if (g_str_equal(code, "210")) { /* server rewrote room-nick */ if((chat = jabber_chat_find(js, jid->node, jid->domain))) { g_free(chat->handle); @@ -814,7 +820,6 @@ "http://jabber.org/protocol/muc#user"); if (chat->muc && x) { const char *nick; - const char *code = NULL; const char *item_jid = NULL; const char *to; xmlnode *stat; @@ -824,13 +829,16 @@ if (item) item_jid = xmlnode_get_attrib(item, "jid"); - stat = xmlnode_get_child(x, "status"); + for (stat = xmlnode_get_child(x, "status"); stat; + stat = xmlnode_get_next_twin(stat)) { + const char *code = xmlnode_get_attrib(stat, "code"); - if (stat) - code = xmlnode_get_attrib(stat, "code"); + if (!code) + continue; - if (code) { - if(!strcmp(code, "301")) { + if (g_str_equal(code, "110")) { + is_our_resource = TRUE; + } else if(!strcmp(code, "301")) { /* XXX: we got banned */ } else if(!strcmp(code, "303") && item && (nick = xmlnode_get_attrib(item, "nick"))) { @@ -839,10 +847,11 @@ g_free(chat->handle); chat->handle = g_strdup(nick); } + + /* TODO: This should probably be moved out of the loop */ purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick); jabber_chat_remove_handle(chat, jid->resource); - /* TODO: Enable this when this is in a for-loop... - break; */ + continue; } else if(!strcmp(code, "307")) { /* Someone was kicked from the room */ xmlnode *reason = NULL, *actor = NULL;
--- a/libpurple/protocols/msn/msg.c Sat Aug 08 17:35:08 2009 +0900 +++ b/libpurple/protocols/msn/msg.c Mon Aug 10 20:36:54 2009 +0900 @@ -1113,6 +1113,7 @@ { GHashTable *body; const gchar *guid; + gboolean accepted = FALSE; g_return_if_fail(cmdproc != NULL); g_return_if_fail(msg != NULL); @@ -1140,6 +1141,9 @@ } else purple_debug_warning("msn", "Invite msg missing " "Application-GUID.\n"); + + accepted = TRUE; + } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { purple_debug_info("msn", "Computer call\n"); @@ -1165,9 +1169,35 @@ g_free(buf); } } - } else - purple_debug_warning("msn", - "Unhandled invite msg with GUID %s.\n", guid); + } else { + const gchar *application = g_hash_table_lookup(body, "Application-Name"); + purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", + guid, application ? application : "(null)"); + } + + if (!accepted) { + const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie"); + if (cookie) { + MsnSwitchBoard *swboard = cmdproc->data; + char *text; + MsnMessage *cancel; + + cancel = msn_message_new(MSN_MSG_TEXT); + msn_message_set_content_type(cancel, "text/x-msmsgsinvite"); + msn_message_set_charset(cancel, "UTF-8"); + msn_message_set_flag(cancel, 'U'); + + text = g_strdup_printf("Invitation-Command: CANCEL\r\n" + "Invitation-Cookie: %s\r\n" + "Cancel-Code: REJECT_NOT_INSTALLED\r\n", + cookie); + msn_message_set_bin_data(cancel, text, strlen(text)); + g_free(text); + + msn_switchboard_send_msg(swboard, cancel, TRUE); + msn_message_destroy(cancel); + } + } g_hash_table_destroy(body); }
--- a/libpurple/protocols/msn/slp.c Sat Aug 08 17:35:08 2009 +0900 +++ b/libpurple/protocols/msn/slp.c Mon Aug 10 20:36:54 2009 +0900 @@ -244,6 +244,8 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, const char *euf_guid, const char *context) { + gboolean accepted = FALSE; + if (!strcmp(euf_guid, MSN_OBJ_GUID)) { /* Emoticon or UserDisplay */ @@ -314,7 +316,10 @@ msn_slpmsg_set_image(slpmsg, img); msn_slplink_queue_slpmsg(slplink, slpmsg); purple_imgstore_unref(img); + + accepted = TRUE; } + else if (!strcmp(euf_guid, MSN_FT_GUID)) { /* File Transfer */ @@ -360,6 +365,9 @@ purple_xfer_request(xfer); } + + accepted = TRUE; + } else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) { purple_debug_info("msn", "Cam request.\n"); if (slpcall && slpcall->slplink && @@ -382,6 +390,7 @@ g_free(buf); } } + } else if (!strcmp(euf_guid, MSN_CAM_GUID)) { purple_debug_info("msn", "Cam invite.\n"); if (slpcall && slpcall->slplink && @@ -404,8 +413,16 @@ g_free(buf); } } + } else purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid); + + if (!accepted) { + char *content = g_strdup_printf("SessionID: %lu\r\n\r\n", + slpcall->session_id); + send_decline(slpcall, branch, "application/x-msnmsgr-sessionreqbody", content); + g_free(content); + } } void
--- a/libpurple/util.c Sat Aug 08 17:35:08 2009 +0900 +++ b/libpurple/util.c Mon Aug 10 20:36:54 2009 +0900 @@ -3562,6 +3562,7 @@ void purple_got_protocol_handler_uri(const char *uri) { char proto[11]; + char delimiter; const char *tmp, *param_string; char *cmd; GHashTable *params = NULL; @@ -3577,7 +3578,13 @@ proto[len] = '\0'; tmp++; - purple_debug_info("util", "Processing message '%s' for protocol '%s'.\n", tmp, proto); + + if (g_str_equal(proto, "xmpp")) + delimiter = ';'; + else + delimiter = '&'; + + purple_debug_info("util", "Processing message '%s' for protocol '%s' using delimiter '%c'.\n", tmp, proto, delimiter); if ((param_string = strchr(tmp, '?'))) { const char *keyend = NULL, *pairstart; @@ -3590,7 +3597,7 @@ pairstart = tmp = param_string; while (*tmp || *pairstart) { - if (*tmp == '&' || !(*tmp)) { + if (*tmp == delimiter || !(*tmp)) { /* If there is no explicit value */ if (keyend == NULL) keyend = tmp;
--- a/pidgin/gtkimhtml.c Sat Aug 08 17:35:08 2009 +0900 +++ b/pidgin/gtkimhtml.c Mon Aug 10 20:36:54 2009 +0900 @@ -2967,7 +2967,7 @@ font->size = oldfont->size; else font->size = 3; - if ((imhtml->format_functions & (GTK_IMHTML_GROW|GTK_IMHTML_SHRINK))) + if ((imhtml->format_functions & (GTK_IMHTML_GROW|GTK_IMHTML_SHRINK)) && (font->size != 3 || (oldfont && oldfont->size == 3))) gtk_imhtml_font_set_size(imhtml, font->size); g_free(size); fonts = g_slist_prepend (fonts, font);
--- a/pidgin/gtkmedia.c Sat Aug 08 17:35:08 2009 +0900 +++ b/pidgin/gtkmedia.c Mon Aug 10 20:36:54 2009 +0900 @@ -500,7 +500,7 @@ gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; - purple_request_accept_cancel(gtkmedia, "Media invitation", + purple_request_accept_cancel(gtkmedia, _("Incoming Call"), message, NULL, PURPLE_DEFAULT_ACTION_NONE, (void*)account, gtkmedia->priv->screenname, NULL, gtkmedia->priv->media,
--- a/pidgin/gtkwhiteboard.c Sat Aug 08 17:35:08 2009 +0900 +++ b/pidgin/gtkwhiteboard.c Mon Aug 10 20:36:54 2009 +0900 @@ -273,6 +273,7 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) { PidginWhiteboard *gtkwb; + GtkWidget *colour_dialog; g_return_if_fail(wb != NULL); gtkwb = wb->ui_data; @@ -287,6 +288,12 @@ gtkwb->pixmap = NULL; } + colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); + if (colour_dialog) { + gtk_widget_destroy(colour_dialog); + g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); + } + if(gtkwb->window) { gtk_widget_destroy(gtkwb->window); @@ -804,7 +811,7 @@ { gtk_widget_destroy(dialog); - purple_debug_info("gtkwhiteboard", "File not Saved... Canceled\n"); + purple_debug_info("gtkwhiteboard", "File not Saved... Cancelled\n"); } } @@ -848,9 +855,11 @@ purple_whiteboard_send_brush(wb, old_size, new_color); } -static void color_selection_dialog_destroy(GtkWidget *w, GtkWidget *destroy) +static void color_selection_dialog_destroy(GtkWidget *w, PidginWhiteboard *gtkwb) { - gtk_widget_destroy(destroy); + GtkWidget *dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); + gtk_widget_destroy(dialog); + g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); } static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) @@ -859,6 +868,7 @@ GtkColorSelectionDialog *dialog; dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); + g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", G_CALLBACK(change_color_cb), gtkwb); @@ -867,7 +877,7 @@ gtk_widget_destroy(dialog->help_button); g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", - G_CALLBACK(color_selection_dialog_destroy), dialog); + G_CALLBACK(color_selection_dialog_destroy), gtkwb); gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE);
--- a/pidgin/win32/nsis/pidgin-installer.nsi Sat Aug 08 17:35:08 2009 +0900 +++ b/pidgin/win32/nsis/pidgin-installer.nsi Mon Aug 10 20:36:54 2009 +0900 @@ -567,6 +567,7 @@ !insertmacro URI_SECTION "msnim" !insertmacro URI_SECTION "myim" !insertmacro URI_SECTION "ymsgr" + !insertmacro URI_SECTION "xmpp" SectionGroupEnd ;-------------------------------- @@ -708,6 +709,8 @@ Call un.UnregisterURIHandler Push "ymsgr" Call un.UnregisterURIHandler + Push "xmpp" + Call un.UnregisterURIHandler Delete "$INSTDIR\ca-certs\America_Online_Root_Certification_Authority_1.pem" Delete "$INSTDIR\ca-certs\AOL_Member_CA.pem"
--- a/po/nn.po Sat Aug 08 17:35:08 2009 +0900 +++ b/po/nn.po Mon Aug 10 20:36:54 2009 +0900 @@ -2,8 +2,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-08-02 23:34-0700\n" -"PO-Revision-Date: 2009-08-01 13:29+0100\n" +"POT-Creation-Date: 2009-08-09 19:06-0700\n" +"PO-Revision-Date: 2009-08-09 02:41+0100\n" "Last-Translator: Yngve Spjeld Landro <nynorsk@landro.net>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -12132,6 +12132,9 @@ msgid "%s wishes to start a video session with you." msgstr "%s ønskjer å starta ei biletøkt med deg." +msgid "_Pause" +msgstr "_Pause" + #, c-format msgid "%s has %d new message." msgid_plural "%s has %d new messages." @@ -12673,7 +12676,7 @@ "(%s for filnamn)" msgid "M_ute sounds" -msgstr "&Demp lydar" +msgstr "_Demp lydar" msgid "Sounds when conversation has _focus" msgstr "Lydar medan samtalevindauget har _fokus" @@ -12688,7 +12691,7 @@ msgstr "Spel" msgid "_Browse..." -msgstr "Bla &gjennom…" +msgstr "Bla _gjennom…" msgid "_Reset" msgstr "_Nullstill" @@ -13068,9 +13071,6 @@ msgid "_Open Mail" msgstr "_Opna e-post" -msgid "_Pause" -msgstr "_Pause" - msgid "_Edit" msgstr "_Endra"