Mercurial > pidgin
changeset 17368:b31f53796f3b
merge of '3d155cfe6d5da449233ba5c19a6f5fea1a33467d'
and '85d3a31151de8461340501f24062fb9e2545dd99'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 29 May 2007 05:40:45 +0000 |
parents | 837b697723c0 (diff) 7ada026a53b9 (current diff) |
children | f80f7e1047be 8b322c8afeb6 |
files | |
diffstat | 8 files changed, 115 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/disco.c Tue May 29 05:40:22 2007 +0000 +++ b/libpurple/protocols/jabber/disco.c Tue May 29 05:40:45 2007 +0000 @@ -224,17 +224,17 @@ /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */ jabber_roster_request(js); } - + /* Send initial presence; this will trigger receipt of presence for contacts on the roster */ gpresence = purple_account_get_presence(js->gc->account); status = purple_presence_get_active_status(gpresence); - jabber_presence_send(js->gc->account, status); + jabber_presence_send(js->gc->account, status); } static void jabber_disco_server_info_result_cb(JabberStream *js, xmlnode *packet, gpointer data) { - xmlnode *query, *child; + xmlnode *query, *child; const char *from = xmlnode_get_attrib(packet, "from"); const char *type = xmlnode_get_attrib(packet, "type"); @@ -257,7 +257,7 @@ return; } - for (child = xmlnode_get_child(query, "identity"); child; + for (child = xmlnode_get_child(query, "identity"); child; child = xmlnode_get_next_twin(child)) { const char *category, *type, *name; category = xmlnode_get_attrib(child, "category"); @@ -266,7 +266,7 @@ type = xmlnode_get_attrib(child, "type"); if (!type || strcmp(type, "im")) continue; - + name = xmlnode_get_attrib(child, "name"); if (!name) continue; @@ -279,7 +279,7 @@ } } - for (child = xmlnode_get_child(query, "feature"); child; + for (child = xmlnode_get_child(query, "feature"); child; child = xmlnode_get_next_twin(child)) { const char *var; var = xmlnode_get_attrib(child, "var"); @@ -324,11 +324,16 @@ for(child = xmlnode_get_child(query, "item"); child; child = xmlnode_get_next_twin(child)) { JabberIq *iq; - const char *jid; + const char *jid, *node; if(!(jid = xmlnode_get_attrib(child, "jid"))) continue; + /* we don't actually care about the specific nodes, + * so we won't query them */ + if((node = xmlnode_get_attrib(child, "node"))) + continue; + iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); xmlnode_set_attrib(iq->node, "to", jid); jabber_iq_send(iq);
--- a/libpurple/protocols/jabber/presence.c Tue May 29 05:40:22 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Tue May 29 05:40:45 2007 +0000 @@ -106,11 +106,12 @@ return; disconnected = purple_account_is_disconnected(account); - primitive = purple_status_type_get_primitive(purple_status_get_type(status)); if(disconnected) return; + primitive = purple_status_type_get_primitive(purple_status_get_type(status)); + gc = purple_account_get_connection(account); js = gc->proto_data;
--- a/libpurple/protocols/jabber/si.c Tue May 29 05:40:22 2007 +0000 +++ b/libpurple/protocols/jabber/si.c Tue May 29 05:40:45 2007 +0000 @@ -26,6 +26,7 @@ #include "cipher.h" #include "debug.h" #include "ft.h" +#include "request.h" #include "network.h" #include "notify.h" @@ -769,6 +770,36 @@ } } +static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fields) +{ + purple_xfer_cancel_local(xfer); +} + +static void do_transfer_send(PurpleXfer *xfer, const char *resource) +{ + JabberSIXfer *jsx = xfer->data; + char **who_v = g_strsplit(xfer->who, "/", 2); + char *who; + + who = g_strdup_printf("%s/%s", who_v[0], resource); + g_strfreev(who_v); + g_free(xfer->who); + xfer->who = who; + jabber_disco_info_do(jsx->js, who, + jabber_si_xfer_send_disco_cb, xfer); +} + +static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) +{ + PurpleRequestField *field = purple_request_fields_get_field(fields, "resource"); + int selected_id = purple_request_field_choice_get_value(field); + GList *labels = purple_request_field_choice_get_labels(field); + + const char *selected_label = g_list_nth_data(labels, selected_id); + + do_transfer_send(xfer, selected_label); +} + static void jabber_si_xfer_init(PurpleXfer *xfer) { JabberSIXfer *jsx = xfer->data; @@ -776,26 +807,65 @@ if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { JabberBuddy *jb; JabberBuddyResource *jbr = NULL; + char *resource; + + if(NULL != (resource = jabber_get_resource(xfer->who))) { + /* they've specified a resource, no need to ask or + * default or anything, just do it */ + + do_transfer_send(xfer, resource); + g_free(resource); + } jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); - /* XXX */ - if(!jb) - return; + + if(!jb || !jb->resources) { + /* no resources online, we're trying to send to someone + * whose presence we're not subscribed to, or + * someone who is offline. Let's inform the user */ + char *msg; - /* XXX: for now, send to the first resource available */ - if(jb->resources != NULL) { - char **who_v = g_strsplit(xfer->who, "/", 2); - char *who; + if(!jb) { + msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); + } else if(jb->subscription & JABBER_SUB_TO) { + msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); + } else { + msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); + } + + purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); + g_free(msg); + } else if(g_list_length(jb->resources) == 1) { + /* only 1 resource online (probably our most common case) + * so no need to ask who to send to */ + jbr = jb->resources->data; + + do_transfer_send(xfer, jbr->name); - jbr = jabber_buddy_find_resource(jb, NULL); - who = g_strdup_printf("%s/%s", who_v[0], jbr->name); - g_strfreev(who_v); - g_free(xfer->who); - xfer->who = who; - jabber_disco_info_do(jsx->js, who, - jabber_si_xfer_send_disco_cb, xfer); } else { - return; /* XXX: ick */ + /* we've got multiple resources, we need to pick one to send to */ + GList *l; + char *msg = g_strdup_printf(_("Please select which resource of %s you would like to send a file to"), xfer->who); + PurpleRequestFields *fields = purple_request_fields_new(); + PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); + PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); + + for(l = jb->resources; l; l = l->next) + { + jbr = l->data; + + purple_request_field_choice_add(field, jbr->name); + } + + purple_request_field_group_add_field(group, field); + + purple_request_fields_add_group(fields, group); + + purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, + _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), + jsx->js->gc->account, xfer->who, NULL, xfer); + + g_free(msg); } } else { xmlnode *si, *feature, *x, *field, *value;
--- a/pidgin/gtkaccount.c Tue May 29 05:40:22 2007 +0000 +++ b/pidgin/gtkaccount.c Tue May 29 05:40:45 2007 +0000 @@ -433,6 +433,7 @@ /* Screen name */ dialog->screenname_entry = gtk_entry_new(); + g_object_set(G_OBJECT(dialog->screenname_entry), "truncate-multiline", TRUE, NULL); add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry);
--- a/pidgin/gtkblist.c Tue May 29 05:40:22 2007 +0000 +++ b/pidgin/gtkblist.c Tue May 29 05:40:45 2007 +0000 @@ -488,11 +488,6 @@ pidgin_syslog_show(); } -static void gtk_blist_show_onlinehelp_cb() -{ - purple_notify_uri(NULL, PURPLE_WEBSITE "documentation.php"); -} - static void do_join_chat(PidginJoinChatData *data) { @@ -2845,6 +2840,7 @@ { N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD }, { N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD }, { "/Buddies/sep3", NULL, NULL, 0, "<Separator>", NULL }, + { N_("/Buddies/_About Pidgin"), NULL, pidgin_dialogs_about, 0, "<Item>", NULL }, { N_("/Buddies/_Quit"), "<CTL>Q", purple_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT }, /* Accounts menu */ @@ -2861,14 +2857,9 @@ { N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<Item>", NULL }, { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL }, { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<Item>", NULL }, + { N_("/Tools/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL }, { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL }, { N_("/Tools/Mute _Sounds"), "<CTL>S", pidgin_blist_mute_sounds_cb, 0, "<CheckItem>", NULL }, - - /* Help */ - { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL }, - { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP }, - { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL }, - { N_("/Help/_About"), NULL, pidgin_dialogs_about, 0, "<Item>", NULL }, }; /********************************************************* @@ -3413,8 +3404,16 @@ "<span color='%s' size='smaller'>%s</span>", dim_grey(), esc, dim_grey(), statustext != NULL ? statustext : ""); - } - + } else if (!PURPLE_BUDDY_IS_ONLINE(b)) { + if (!selected && !statustext) /* We handle selected text later */ + text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc); + else if (!selected && !text) + text = g_strdup_printf("<span color='%s'>%s</span>\n" + "<span color='%s' size='smaller'>%s</span>", + dim_grey(), esc, dim_grey(), + statustext != NULL ? statustext : ""); + + } /* Not idle and not selected */ else if (!selected && !text) {
--- a/pidgin/gtkprefs.c Tue May 29 05:40:22 2007 +0000 +++ b/pidgin/gtkprefs.c Tue May 29 05:40:45 2007 +0000 @@ -1693,6 +1693,7 @@ vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); sw = gtk_scrolled_window_new(NULL,NULL); + gtk_widget_set_size_request(sw, -1, 100); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
--- a/pidgin/pidginstock.c Tue May 29 05:40:22 2007 +0000 +++ b/pidgin/pidginstock.c Tue May 29 05:40:45 2007 +0000 @@ -109,7 +109,7 @@ { PIDGIN_STOCK_STATUS_XA, "status", "extended-away.png", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, PIDGIN_STOCK_STATUS_XA_I }, { PIDGIN_STOCK_STATUS_LOGIN, "status", "log-in.png", TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, NULL }, { PIDGIN_STOCK_STATUS_LOGOUT, "status", "log-out.png", TRUE, TRUE, TRUE, TRUE, FALSE, FALSE , NULL }, - { PIDGIN_STOCK_STATUS_OFFLINE, "status", "offline.png", TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, NULL }, + { PIDGIN_STOCK_STATUS_OFFLINE, "status", "offline.png", TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, PIDGIN_STOCK_STATUS_OFFLINE_I }, { PIDGIN_STOCK_STATUS_PERSON, "status", "person.png", TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, NULL }, { PIDGIN_STOCK_STATUS_MESSAGE, "status", "message-pending.png",TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
--- a/pidgin/pidginstock.h Tue May 29 05:40:22 2007 +0000 +++ b/pidgin/pidginstock.h Tue May 29 05:40:45 2007 +0000 @@ -70,6 +70,7 @@ #define PIDGIN_STOCK_STATUS_LOGIN "pidgin-status-login" #define PIDGIN_STOCK_STATUS_LOGOUT "pidgin-status-logout" #define PIDGIN_STOCK_STATUS_OFFLINE "pidgin-status-offline" +#define PIDGIN_STOCK_STATUS_OFFLINE_I "pidgin-status-offline" #define PIDGIN_STOCK_STATUS_PERSON "pidgin-status-person" #define PIDGIN_STOCK_STATUS_MESSAGE "pidgin-status-message"