Mercurial > pidgin.yaz
changeset 27703:f4556d6f58c4
merge of '0c2f544829df2f3a369504315f8b3a6cc325749a'
and 'f2bce03092740049135bf66058679e1091699175'
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sun, 19 Jul 2009 17:45:08 +0000 |
parents | 4fb5e292de75 (diff) c6105d18ba61 (current diff) |
children | aac28ab73e9e |
files | |
diffstat | 7 files changed, 92 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jul 19 17:27:55 2009 +0000 +++ b/ChangeLog Sun Jul 19 17:45:08 2009 +0000 @@ -30,17 +30,11 @@ useful when running libpurple inside of Valgrind or similar programs. Currently, it keeps plugins in memory, allowing Valgrind to perform symbol resolution of leak traces at shutdown. - * Add support for receiving handwritten (ink) messages on MSN. * Don't do IPv6 address lookups if the computer does not have an IPv6 address configured. - * Add support for receiving audio clips on MSN. * Fix a leak when the UI provides its own DNS resolving UI op. (Aman Gupta) * Don't fork a DNS resolver process to resolve IP addresses. (Aman Gupta) - * Show the invite message for buddies that requested authorization - from you on MSN. - * Support sending an invite message to buddies when requesting authorization - from them on MSN. * Better handling of corrupt certificates in the TLS Peers cache. * More efficient purple_find_buddies() and purple_find_group() functions. (Jan Kaluza and Aman Gupta) @@ -129,6 +123,15 @@ * Ability to set personal details for an account and for buddies in the buddylist. + MSN: + * Add support for receiving handwritten (ink) messages on MSN. + * Add support for receiving audio clips on MSN. + * Show the invite message for buddies that requested authorization + from you on MSN. + * Support sending an invite message to buddies when requesting authorization + from them on MSN. + * Timeout switchboard connections aggressively + Pidgin: * Added -f command line option to tell Pidgin to ignore NetworkManager and assume it has a valid network connection.
--- a/finch/gntmedia.c Sun Jul 19 17:27:55 2009 +0000 +++ b/finch/gntmedia.c Sun Jul 19 17:45:08 2009 +0000 @@ -25,7 +25,7 @@ */ #include "finch.h" - +#include <internal.h> #include "gntconv.h" #include "gntmedia.h"
--- a/libpurple/protocols/msn/servconn.c Sun Jul 19 17:27:55 2009 +0000 +++ b/libpurple/protocols/msn/servconn.c Sun Jul 19 17:45:08 2009 +0000 @@ -26,6 +26,7 @@ #include "error.h" static void read_cb(gpointer data, gint source, PurpleInputCondition cond); +static void servconn_timeout_renew(MsnServConn *servconn); /************************************************************************** * Main @@ -52,6 +53,8 @@ servconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); servconn->tx_handler = 0; + servconn->timeout_sec = 0; + servconn->timeout_handle = 0; servconn->fd = -1; @@ -82,6 +85,8 @@ purple_circ_buffer_destroy(servconn->tx_buf); if (servconn->tx_handler > 0) purple_input_remove(servconn->tx_handler); + if (servconn->timeout_handle > 0) + purple_input_remove(servconn->timeout_handle); msn_cmdproc_destroy(servconn->cmdproc); g_free(servconn); @@ -184,6 +189,7 @@ servconn->connect_cb(servconn); servconn->inpa = purple_input_add(servconn->fd, PURPLE_INPUT_READ, read_cb, data); + servconn_timeout_renew(servconn); } else { @@ -219,6 +225,7 @@ servconn->connected = TRUE; servconn->httpconn->virgin = TRUE; + servconn_timeout_renew(servconn); /* Someone wants to know we connected. */ servconn->connect_cb(servconn); @@ -267,6 +274,12 @@ servconn->inpa = 0; } + if (servconn->timeout_handle > 0) + { + purple_input_remove(servconn->timeout_handle); + servconn->timeout_handle = 0; + } + close(servconn->fd); servconn->rx_buf = NULL; @@ -279,6 +292,35 @@ servconn->disconnect_cb(servconn); } +static gboolean +servconn_idle_timeout_cb(MsnServConn *servconn) +{ + msn_servconn_disconnect(servconn); + return FALSE; +} + +static void +servconn_timeout_renew(MsnServConn *servconn) +{ + if (servconn->timeout_handle) { + purple_input_remove(servconn->timeout_handle); + servconn->timeout_handle = 0; + } + + if (servconn->connected && servconn->timeout_sec) { + servconn->timeout_handle = purple_timeout_add_seconds( + servconn->timeout_sec, servconn_idle_timeout_cb, servconn); + } +} + +void +msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds) +{ + servconn->timeout_sec = seconds; + if (servconn->connected) + servconn_timeout_renew(servconn); +} + static void servconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) { @@ -304,6 +346,7 @@ } purple_circ_buffer_mark_read(servconn->tx_buf, ret); + servconn_timeout_renew(servconn); } gssize @@ -358,6 +401,7 @@ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); } + servconn_timeout_renew(servconn); return ret; } @@ -392,6 +436,7 @@ servconn->rx_len += len; msn_servconn_process_data(servconn); + servconn_timeout_renew(servconn); } void msn_servconn_process_data(MsnServConn *servconn)
--- a/libpurple/protocols/msn/servconn.h Sun Jul 19 17:27:55 2009 +0000 +++ b/libpurple/protocols/msn/servconn.h Sun Jul 19 17:45:08 2009 +0000 @@ -88,6 +88,8 @@ PurpleCircBuffer *tx_buf; guint tx_handler; + guint timeout_sec; + guint timeout_handle; void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ @@ -178,4 +180,12 @@ */ void msn_servconn_process_data(MsnServConn *servconn); +/** + * Set a idle timeout fot this servconn + * + * @param servconn The servconn + * @param seconds The idle timeout in seconds + */ +void msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds); + #endif /* _MSN_SERVCONN_H_ */
--- a/libpurple/protocols/msn/switchboard.c Sun Jul 19 17:27:55 2009 +0000 +++ b/libpurple/protocols/msn/switchboard.c Sun Jul 19 17:45:08 2009 +0000 @@ -42,15 +42,15 @@ msn_switchboard_new(MsnSession *session) { MsnSwitchBoard *swboard; - MsnServConn *servconn; g_return_val_if_fail(session != NULL, NULL); swboard = g_new0(MsnSwitchBoard, 1); swboard->session = session; - swboard->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_SB); - swboard->cmdproc = servconn->cmdproc; + swboard->servconn = msn_servconn_new(session, MSN_SERVCONN_SB); + msn_servconn_set_idle_timeout(swboard->servconn, 60); + swboard->cmdproc = swboard->servconn->cmdproc; swboard->msg_queue = g_queue_new(); swboard->empty = TRUE;
--- a/libpurple/protocols/silc/silc.c Sun Jul 19 17:27:55 2009 +0000 +++ b/libpurple/protocols/silc/silc.c Sun Jul 19 17:45:08 2009 +0000 @@ -535,7 +535,7 @@ return; } purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to not load SILC key pair")); + _("Unable to load SILC key pair")); gc->proto_data = NULL; silc_free(sg); return;
--- a/libpurple/util.c Sun Jul 19 17:27:55 2009 +0000 +++ b/libpurple/util.c Sun Jul 19 17:45:08 2009 +0000 @@ -1409,7 +1409,8 @@ gboolean ignore; }; -#define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ +#define ALLOW_TAG_ALT(x, y) do { \ + if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ const char *o = c + strlen("<" x); \ const char *p = NULL, *q = NULL, *r = NULL; \ GString *innards = g_string_new(""); \ @@ -1460,26 +1461,27 @@ g_string_free(innards, TRUE); \ continue; \ } \ - if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \ - (*(c+strlen("<" x)) == '>' || \ - !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \ + if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \ + (*(c+strlen("<" x)) == '>' || \ + !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \ + if(xhtml) \ + xhtml = g_string_append(xhtml, "<" y); \ + c += strlen("<" x); \ + if(*c != '/') { \ + struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ + pt->src_tag = x; \ + pt->dest_tag = y; \ + tags = g_list_prepend(tags, pt); \ if(xhtml) \ - xhtml = g_string_append(xhtml, "<" y); \ - c += strlen("<" x); \ - if(*c != '/') { \ - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ - pt->src_tag = x; \ - pt->dest_tag = y; \ - tags = g_list_prepend(tags, pt); \ - if(xhtml) \ - xhtml = g_string_append_c(xhtml, '>'); \ - } else { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "/>");\ - } \ - c = strchr(c, '>') + 1; \ - continue; \ - } + xhtml = g_string_append_c(xhtml, '>'); \ + } else { \ + if(xhtml) \ + xhtml = g_string_append(xhtml, "/>");\ + } \ + c = strchr(c, '>') + 1; \ + continue; \ + } \ + } while (0); #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x) void purple_markup_html_to_xhtml(const char *html, char **xhtml_out, @@ -1572,9 +1574,8 @@ ALLOW_TAG("h5"); ALLOW_TAG("h6"); /* we only allow html to start the message */ - if(c == html) { + if(c == html) ALLOW_TAG("html"); - } ALLOW_TAG_ALT("i", "em"); ALLOW_TAG_ALT("italic", "em"); ALLOW_TAG("li");