Mercurial > pidgin.yaz
changeset 17228:5033139b3ead
merge of 'b8b81ea3c89a56d3526f1ca7373b947083c44a3f'
and 'd483d375dbe8fca98d12114188e00790374a4092'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 22 May 2007 07:09:32 +0000 |
parents | 61c5d8737f01 (diff) 9a649a04fd74 (current diff) |
children | b1db61e778d6 b25c4fe3a8ce |
files | libpurple/protocols/jabber/auth.c |
diffstat | 15 files changed, 313 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Tue May 22 07:08:57 2007 +0000 +++ b/COPYRIGHT Tue May 22 07:09:32 2007 +0000 @@ -87,6 +87,7 @@ Palmer Cox Jeramey Crawford Michael Culbertson +Steven Danna Martijn Dekker Vinicius Depizzol Philip Derrin
--- a/ChangeLog Tue May 22 07:08:57 2007 +0000 +++ b/ChangeLog Tue May 22 07:09:32 2007 +0000 @@ -32,6 +32,17 @@ conversation tabs (Ma Xuan) * Fix IRC connection bug with dircproxy (xjoe) * Ctrl+[shift]+tab focuses the next most active tab (William Thompson) + * Fix Open Hotmail Inbox for MSN to work more reliably + * Add a Google Talk item to the protocol list, to help users who think + we don't support Google Talk. The item acts just like "XMPP". + * Remember if the X server supports XScreenSaver, to avoid waking it + every 5 seconds. (Arjan van de Ven with Intel Corporation) + * Change our idle checking to poll only as necessary and raise the + unidle timeout from 5 seconds to 60 when using XScreenSaver. This + and the XScreenSaver change will reduce Pidgin's effect on power + consumption when running with NO_HZ. (Arjan van de Ven with Intel + Corporation) + * Conversation -> Save As will now use aliases. Finch: * Userlist in chat windows, which can be turned on or off using
--- a/finch/libgnt/Makefile.am Tue May 22 07:08:57 2007 +0000 +++ b/finch/libgnt/Makefile.am Tue May 22 07:09:32 2007 +0000 @@ -66,10 +66,10 @@ gntmarshal.c: $(srcdir)/genmarshal gntmarshal.h echo "#include \"gntmarshal.h\"" > $@ - cat $(srcdir)/genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --body >> $@ + glib-genmarshal --prefix=gnt_closure_marshal --body $(srcdir)/genmarshal >> $@ gntmarshal.h: $(srcdir)/genmarshal - cat $(srcdir)/genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --header > $@ + glib-genmarshal --prefix=gnt_closure_marshal --header $(srcdir)/genmarshal > $@ libgnt_laincludedir=$(includedir)/gnt libgnt_lainclude_HEADERS = \
--- a/libpurple/idle.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/idle.c Tue May 22 07:09:32 2007 +0000 @@ -197,8 +197,8 @@ } else if (!no_away && time_idle < away_seconds) { + no_away = 1; purple_savedstatus_set_idleaway(FALSE); - no_away = 1; if (time_until_next_idle_event == 0 || (away_seconds - time_idle) < time_until_next_idle_event) time_until_next_idle_event = away_seconds - time_idle; }
--- a/libpurple/plugins/perl/common/SavedStatuses.xs Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/plugins/perl/common/SavedStatuses.xs Tue May 22 07:09:32 2007 +0000 @@ -1,41 +1,129 @@ #include "module.h" +/* I can't get this to work, both with and without the const on the return + * type I get errors from gcc. One way about ignoring types in a cast, and the + * other about assigning to read-only variables. +const Purple::StatusType +purple_savedstatus_substatus_get_type(substatus) + const Purple::SavedStatus::Sub substatus +*/ + MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatus PREFIX = purple_savedstatus_ PROTOTYPES: ENABLE -gboolean -purple_savedstatus_delete(title) - const char *title - -Purple::SavedStatus -purple_savedstatus_find(title) - const char *title - -const char * -purple_savedstatus_get_message(saved_status) - Purple::SavedStatus saved_status - -const char * -purple_savedstatus_get_title(saved_status) - Purple::SavedStatus saved_status - -Purple::StatusPrimitive -purple_savedstatus_get_type(saved_status) - Purple::SavedStatus saved_status - Purple::SavedStatus purple_savedstatus_new(title, type) const char *title Purple::StatusPrimitive type void +purple_savedstatus_set_title(status, title) + Purple::SavedStatus status + const char *title + +void +purple_savedstatus_set_type(status, type) + Purple::SavedStatus status + Purple::StatusPrimitive type + +void purple_savedstatus_set_message(status, message) Purple::SavedStatus status const char *message +void +purple_savedstatus_set_substatus(status, account, type, message) + Purple::SavedStatus status + Purple::Account account + Purple::StatusType type + const char *message + +void +purple_savedstatus_unset_substatus(status, account) + Purple::SavedStatus status + Purple::Account account + +gboolean +purple_savedstatus_delete(title) + const char *title + Purple::SavedStatus purple_savedstatus_get_current() +Purple::SavedStatus +purple_savedstatus_get_default() + +Purple::SavedStatus +purple_savedstatus_get_idleaway() + +gboolean +purple_savedstatus_is_idleaway() + +void +purple_savedstatus_set_idleaway(idleaway) + gboolean idleaway + +Purple::SavedStatus +purple_savedstatus_get_startup() + +Purple::SavedStatus +purple_savedstatus_find(title) + const char *title + +Purple::SavedStatus +purple_savedstatus_find_by_creation_time(creation_time) + time_t creation_time + +Purple::SavedStatus +purple_savedstatus_find_transient_by_type_and_message(type, message) + Purple::StatusPrimitive type + const char *message + +gboolean +purple_savedstatus_is_transient(saved_status) + const Purple::SavedStatus saved_status + +const char * +purple_savedstatus_get_title(saved_status) + const Purple::SavedStatus saved_status + +Purple::StatusPrimitive +purple_savedstatus_get_type(saved_status) + const Purple::SavedStatus saved_status + +const char * +purple_savedstatus_get_message(saved_status) + const Purple::SavedStatus saved_status + +time_t +purple_savedstatus_get_creation_time(saved_status) + const Purple::SavedStatus saved_status + +gboolean +purple_savedstatus_has_substatuses(saved_status) + const Purple::SavedStatus saved_status + +Purple::SavedStatus::Sub +purple_savedstatus_get_substatus(saved_status, account) + Purple::SavedStatus saved_status + Purple::Account account + +void +purple_savedstatus_activate(saved_status) + Purple::SavedStatus saved_status + +void +purple_savedstatus_activate_for_account(saved_status, account) + const Purple::SavedStatus saved_status + Purple::Account account + +MODULE = Purple::SavedStatus::Sub PACKAGE = Purple::SavedStatus::Sub PREFIX = purple_savedstatus_substatus_ +PROTOTYPES: ENABLE + +const char * +purple_savedstatus_substatus_get_message(substatus) + const Purple::SavedStatus::Sub substatus + MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatuses PREFIX = purple_savedstatuses_ PROTOTYPES: ENABLE @@ -48,6 +136,16 @@ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); } +void +purple_savedstatuses_get_popular(how_many) + unsigned int how_many +PREINIT: + const GList *l; +PPCODE: + for (l = purple_savedstatuses_get_popular(how_many); l != NULL; l = l->next) { + XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); + } + Purple::Handle purple_savedstatuses_get_handle()
--- a/libpurple/plugins/perl/common/module.h Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/plugins/perl/common/module.h Tue May 22 07:09:32 2007 +0000 @@ -236,7 +236,7 @@ /* savedstatuses.h */ typedef PurpleSavedStatus * Purple__SavedStatus; -typedef PurpleSavedStatusSub * Purple__SavedStatusSub; +typedef PurpleSavedStatusSub * Purple__SavedStatus__Sub; /* sound.h */ typedef PurpleSoundEventID Purple__SoundEventID;
--- a/libpurple/plugins/perl/common/typemap Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/plugins/perl/common/typemap Tue May 22 07:09:32 2007 +0000 @@ -137,7 +137,9 @@ Purple::RoomlistRoomType T_IV Purple::SavedStatus T_PurpleObj -Purple::SavedStatusSub T_PurpleObj +const Purple::SavedStatus T_PurpleObj +Purple::SavedStatus::Sub T_PurpleObj +const Purple::SavedStatus::Sub T_PurpleObj Purple::SoundEventID T_IV Purple::Sound::UiOps T_PurpleObj
--- a/libpurple/protocols/jabber/auth.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/protocols/jabber/auth.c Tue May 22 07:09:32 2007 +0000 @@ -612,28 +612,62 @@ jabber_iq_send(iq); } +/* Parts of this algorithm are inspired by stuff in libgsasl */ static GHashTable* parse_challenge(const char *challenge) { + const char *token_start, *val_start, *val_end, *cur; GHashTable *ret = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - char **pairs; - int i; - pairs = g_strsplit(challenge, ",", -1); + cur = challenge; + while(*cur != '\0') { + /* Find the end of the token */ + gboolean in_quotes = FALSE; + char *name, *value = NULL; + token_start = cur; + while(*cur != '\0' && (in_quotes || (!in_quotes && *cur != ','))) { + if (*cur == '"') + in_quotes = !in_quotes; + cur++; + } + + /* Find start of value. */ + val_start = strchr(token_start, '='); + if (val_start == NULL || val_start > cur) + val_start = cur; + + if (token_start != val_start) { + name = g_strndup(token_start, val_start - token_start); - for(i=0; pairs[i]; i++) { - char **keyval = g_strsplit(pairs[i], "=", 2); - if(keyval[0] && keyval[1]) { - if(keyval[1][0] == '"' && keyval[1][strlen(keyval[1])-1] == '"') - g_hash_table_replace(ret, g_strdup(keyval[0]), g_strndup(keyval[1]+1, strlen(keyval[1])-2)); - else - g_hash_table_replace(ret, g_strdup(keyval[0]), g_strdup(keyval[1])); + if (val_start != cur) { + val_start++; + while (val_start != cur && (*val_start == ' ' || *val_start == '\t' + || *val_start == '\r' || *val_start == '\n' + || *val_start == '"')) + val_start++; + + val_end = cur; + while (val_end != val_start && (*val_end == ' ' || *val_end == ',' || *val_end == '\t' + || *val_end == '\r' || *val_start == '\n' + || *val_end == '"')) + val_end--; + + if (val_start != val_end) + value = g_strndup(val_start, val_end - val_start + 1); + } + + g_hash_table_replace(ret, name, value); } - g_strfreev(keyval); + + /* Find the start of the next token, if there is one */ + if (*cur != '\0') { + cur++; + while (*cur == ' ' || *cur == ',' || *cur == '\t' + || *cur == '\r' || *cur == '\n') + cur++; + } } - g_strfreev(pairs); - return ret; } @@ -738,14 +772,14 @@ } else { /* assemble a response, and send it */ /* see RFC 2831 */ - GString *response = g_string_new(""); - char *a2; - char *auth_resp; - char *buf; - char *cnonce; char *realm; char *nonce; + /* Make sure the auth string contains everything that should be there. + This isn't everything in RFC2831, but it is what we need. */ + + nonce = g_hash_table_lookup(parts, "nonce"); + /* we're actually supposed to prompt the user for a realm if * the server doesn't send one, but that really complicates things, * so i'm not gonna worry about it until is poses a problem to @@ -754,48 +788,55 @@ if(!realm) realm = js->user->domain; - cnonce = g_strdup_printf("%x%u%x", g_random_int(), (int)time(NULL), - g_random_int()); - nonce = g_hash_table_lookup(parts, "nonce"); - + if (nonce == NULL || realm == NULL) + purple_connection_error(js->gc, _("Invalid challenge from server")); + else { + GString *response = g_string_new(""); + char *a2; + char *auth_resp; + char *buf; + char *cnonce; - a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm); - auth_resp = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); + cnonce = g_strdup_printf("%x%u%x", g_random_int(), (int)time(NULL), + g_random_int()); - a2 = g_strdup_printf(":xmpp/%s", realm); - js->expected_rspauth = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); + a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm); + auth_resp = generate_response_value(js->user, + purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); + g_free(a2); + a2 = g_strdup_printf(":xmpp/%s", realm); + js->expected_rspauth = generate_response_value(js->user, + purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); + g_free(a2); - g_string_append_printf(response, "username=\"%s\"", js->user->node); - g_string_append_printf(response, ",realm=\"%s\"", realm); - g_string_append_printf(response, ",nonce=\"%s\"", nonce); - g_string_append_printf(response, ",cnonce=\"%s\"", cnonce); - g_string_append_printf(response, ",nc=00000001"); - g_string_append_printf(response, ",qop=auth"); - g_string_append_printf(response, ",digest-uri=\"xmpp/%s\"", realm); - g_string_append_printf(response, ",response=%s", auth_resp); - g_string_append_printf(response, ",charset=utf-8"); + g_string_append_printf(response, "username=\"%s\"", js->user->node); + g_string_append_printf(response, ",realm=\"%s\"", realm); + g_string_append_printf(response, ",nonce=\"%s\"", nonce); + g_string_append_printf(response, ",cnonce=\"%s\"", cnonce); + g_string_append_printf(response, ",nc=00000001"); + g_string_append_printf(response, ",qop=auth"); + g_string_append_printf(response, ",digest-uri=\"xmpp/%s\"", realm); + g_string_append_printf(response, ",response=%s", auth_resp); + g_string_append_printf(response, ",charset=utf-8"); - g_free(auth_resp); - g_free(cnonce); + g_free(auth_resp); + g_free(cnonce); - enc_out = purple_base64_encode((guchar *)response->str, response->len); + enc_out = purple_base64_encode((guchar *)response->str, response->len); - purple_debug(PURPLE_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str); + purple_debug(PURPLE_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str); - buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out); + buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out); - jabber_send_raw(js, buf, -1); + jabber_send_raw(js, buf, -1); - g_free(buf); + g_free(buf); - g_free(enc_out); + g_free(enc_out); - g_string_free(response, TRUE); + g_string_free(response, TRUE); + } } g_free(enc_in);
--- a/libpurple/protocols/msn/msn.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Tue May 22 07:09:32 2007 +0000 @@ -619,7 +619,8 @@ account = purple_connection_get_account(gc); user = msn_normalize(account, purple_account_get_username(account)); - if (strstr(user, "@hotmail.") != NULL) + if ((strstr(user, "@hotmail.") != NULL) || + (strstr(user, "@msn.com") != NULL)) { m = g_list_append(m, NULL); act = purple_plugin_action_new(_("Open Hotmail Inbox"),
--- a/libpurple/protocols/msn/notification.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/protocols/msn/notification.c Tue May 22 07:09:32 2007 +0000 @@ -592,6 +592,10 @@ qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { static int count = 0; + MsnSession *session = cmdproc->session; + + if (session->passport_info.file == NULL) + return; if (count++ < 26) return;
--- a/libpurple/protocols/msn/session.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/protocols/msn/session.c Tue May 22 07:09:32 2007 +0000 @@ -404,4 +404,9 @@ /* Sync users */ msn_session_sync_users(session); + /* It seems that some accounts that haven't accessed hotmail for a while + * and @msn.com accounts don't automatically get the initial email + * notification so we always request it on login + */ + msn_cmdproc_send(session->notification->cmdproc, "URL", "%s", "INBOX"); }
--- a/libpurple/purple-remote Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/purple-remote Tue May 22 07:09:32 2007 +0000 @@ -94,6 +94,8 @@ def execute(uri): match = re.match(urlregexp, uri) protocol = match.group(2) + if protocol == "xmpp" + protocol = "jabber" if protocol == "aim" or protocol == "icq": protocol = "oscar" if protocol is not None:
--- a/libpurple/util.c Tue May 22 07:08:57 2007 +0000 +++ b/libpurple/util.c Tue May 22 07:09:32 2007 +0000 @@ -1874,6 +1874,11 @@ while (1) { if (badchar(*t) || badentity(t)) { + if ((!g_ascii_strncasecmp(c, "http://", 7) && (t - c == 7)) || + (!g_ascii_strncasecmp(c, "https://", 8) && (t - c == 8))) { + break; + } + if (*(t) == ',' && (*(t + 1) != ' ')) { t++; continue; @@ -1933,6 +1938,12 @@ t = c; while (1) { if (badchar(*t) || badentity(t)) { + + if ((!g_ascii_strncasecmp(c, "ftp://", 6) && (t - c == 6)) || + (!g_ascii_strncasecmp(c, "sftp://", 7) && (t - c == 7))) { + break; + } + if (*(t - 1) == '.') t--; if ((*(t - 1) == ')' && (inside_paren > 0))) { @@ -1984,8 +1995,21 @@ t = c; while (1) { if (badchar(*t) || badentity(t)) { + char *d; + if (t - c == 7) { + break; + } if (*(t - 1) == '.') t--; + if ((d = strstr(c + 7, "?")) != NULL && d < t) + url_buf = g_strndup(c + 7, d - c - 7); + else + url_buf = g_strndup(c + 7, t - c - 7); + if (!purple_email_is_valid(url_buf)) { + g_free(url_buf); + break; + } + g_free(url_buf); url_buf = g_strndup(c, t - c); tmpurlbuf = purple_unescape_html(url_buf); g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>", @@ -2000,6 +2024,39 @@ t++; } + } else if ((*c=='x') && (!g_ascii_strncasecmp(c, "xmpp:", 5)) && + (c == text || badchar(c[-1]) || badentity(c-1))) { + t = c; + while (1) { + if (badchar(*t) || badentity(t)) { + + if (t - c == 5) { + break; + } + + if (*(t) == ',' && (*(t + 1) != ' ')) { + t++; + continue; + } + + if (*(t - 1) == '.') + t--; + if ((*(t - 1) == ')' && (inside_paren > 0))) { + t--; + } + + url_buf = g_strndup(c, t - c); + tmpurlbuf = purple_unescape_html(url_buf); + g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>", + tmpurlbuf, url_buf); + g_free(url_buf); + g_free(tmpurlbuf); + c = t; + break; + } + t++; + + } } else if (c != text && (*c == '@')) { int flag; GString *gurl_buf = NULL; @@ -4155,7 +4212,7 @@ gunichar c = g_utf8_get_char(iter); /* If the character is an ASCII character and is alphanumeric, * or one of the specified values, no need to escape */ - if (c < 128 && (isalnum(c) || c == '@' || c == '-' || + if (c < 128 && (g_ascii_isalnum(c) || c == '@' || c == '-' || c == '_' || c == '.' || c == '#')) { buf[j++] = c; } else {
--- a/pidgin/gtkconv.c Tue May 22 07:08:57 2007 +0000 +++ b/pidgin/gtkconv.c Tue May 22 07:09:32 2007 +0000 @@ -1012,12 +1012,24 @@ { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); + PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + const char *name; gchar *buf; - - buf = g_strdup_printf("%s.html", purple_normalize(conv->account, conv->name)); - + gchar *c; + + if (buddy != NULL) + name = purple_buddy_get_contact_alias(buddy); + else + name = purple_normalize(conv->account, conv->name); + + buf = g_strdup_printf("%s.html", name); + for (c = buf ; *c ; c++) + { + if (*c == '/' || *c == '\\') + *c = ' '; + } purple_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"), - purple_escape_filename(buf), + buf, TRUE, G_CALLBACK(savelog_writefile_cb), NULL, NULL, NULL, conv, conv);
--- a/pidgin/plugins/pidginrc.c Tue May 22 07:08:57 2007 +0000 +++ b/pidgin/plugins/pidginrc.c Tue May 22 07:09:32 2007 +0000 @@ -45,15 +45,12 @@ static GtkWidget *color_widgets[G_N_ELEMENTS(color_prefs)]; static const char *widget_size_prefs[] = { - "/plugins/gtk/purplerc/size/GtkTreeView::expander_size", "/plugins/gtk/purplerc/size/GtkTreeView::horizontal_separator" }; static const char *widget_size_prefs_set[] = { - "/plugins/gtk/purplerc/set/size/GtkTreeView::expander_size", "/plugins/gtk/purplerc/set/size/GtkTreeView::horizontal_separator" }; static const char *widget_size_names[] = { - N_("GtkTreeView Expander Size"), N_("GtkTreeView Horizontal Separation") }; static GtkWidget *widget_size_widgets[G_N_ELEMENTS(widget_size_prefs)];