/cpw/tomkiewicz/gg11: 09856bbf0a67: Merge from trunk
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Wed Nov 21 12:26:13 EST 2012
Changeset: 09856bbf0a67a99c588a82a67772db6da1d0a0a1
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2012-11-21 18:26 +0100
Branch: default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/09856bbf0a67
Description:
Merge from trunk
diffstat:
COPYRIGHT | 2 +
ChangeLog | 3 +
ChangeLog.API | 4 +
libpurple/notify.c | 3 +
libpurple/protocols/mxit/formcmds.c | 2 +-
libpurple/util.c | 21 ++++
libpurple/util.h | 9 +
pidgin/gtkblist.c | 6 +-
pidgin/gtkdebug.c | 98 ++++++++++++--------
pidgin/gtkdocklet.c | 58 +++++++++---
pidgin/gtkdocklet.h | 7 +
pidgin/gtknotify.c | 28 +++++-
pidgin/gtknotify.h | 14 +++
pidgin/gtkprefs.c | 7 +
pidgin/gtkwebview.c | 42 ++++++--
pidgin/pixmaps/emotes/default/24/default.theme.in | 100 ----------------------
pidgin/pixmaps/emotes/small/16/Makefile.am | 2 +
pidgin/pixmaps/emotes/small/16/small.theme.in | 38 --------
pidgin/win32/gtkdocklet-win32.c | 16 ++-
19 files changed, 245 insertions(+), 215 deletions(-)
diffs (truncated from 889 to 300 lines):
diff --git a/COPYRIGHT b/COPYRIGHT
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -255,6 +255,7 @@ Instant Messaging Freedom, Inc.
Vitaliy Ischenko
Intel Corporation
Andrew Ivanov
+Momchil Ivanov
Scott Jackson
Hans Petter Jansson
David Jedelsky
@@ -416,6 +417,7 @@ Eric Polino <aluink at gmail.com>
Ari Pollak
Stephen Pope
Cristi Posoiu
+Alexei Potashnik
Nathan Poznick
Jory A. Pratt
David Preece
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@ version 3.0.0 (??/??/????):
either 2 or 3 will attempt to build with specifically 2.x or 3.x
support. The default is 'auto', which will first look for 3.x
development headers and then 2.x development headers.
+ * Add email notification in the docklet area. (Alexei) (#3571)
+ * Add a pref to select the type messages in conversation that triggers
+ the docklet notification. (Momchil) (#12598)
Finch:
* Support the conversation-extended signal for extending the
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -3,6 +3,7 @@ Pidgin and Finch: The Pimpin' Penguin IM
version 3.0.0 (??/??/????):
libpurple:
Added:
+ * displaying-emails-clear signal (notification signal)
* pidgin_create_webview
* purple_account_is_disconnecting
* purple_account_get_ui_data
@@ -23,6 +24,8 @@ version 3.0.0 (??/??/????):
* purple_conversation_message_get_alias
* purple_conversation_message_get_conv
* purple_contact_get_contact_size
+ * purple_notify_emails_pending
+ * purple_notify_emails_present
* purple_notify_searchresult_column_get_title
* purple_notify_searchresult_column_is_visible
* purple_notify_searchresult_column_set_visible
@@ -72,6 +75,7 @@ version 3.0.0 (??/??/????):
* Various WebKit-related functions in gtkwebview.h
* xmlnode_get_default_namespace
* xmlnode_strip_prefixes
+ * PidginDockletFlag
Changed:
* purple_account_add_buddy now takes an invite message as the last
diff --git a/libpurple/notify.c b/libpurple/notify.c
--- a/libpurple/notify.c
+++ b/libpurple/notify.c
@@ -818,6 +818,9 @@ purple_notify_init(void)
purple_value_new(PURPLE_TYPE_POINTER),
purple_value_new(PURPLE_TYPE_UINT));
+ purple_signal_register(handle, "displaying-emails-clear",
+ purple_marshal_VOID, NULL, 0);
+
purple_signal_register(handle, "displaying-userinfo",
purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
purple_value_new(PURPLE_TYPE_SUBTYPE,
diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c
--- a/libpurple/protocols/mxit/formcmds.c
+++ b/libpurple/protocols/mxit/formcmds.c
@@ -373,7 +373,7 @@ static void command_image(struct RXMsgDa
reply = g_hash_table_lookup(hash, "replymsg");
if (reply) {
g_string_append_printf(msg, "\n");
- mxit_add_html_link(mx, reply, FALSE, _( "click here" ));
+ mxit_add_html_link(mx, purple_url_decode(reply), FALSE, _( "click here" ));
}
}
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -4692,6 +4692,27 @@ purple_escape_filename(const char *str)
return buf;
}
+gchar * purple_escape_js(const gchar *str)
+{
+ gchar *tmp, *esc;
+
+ esc = tmp = purple_utf8_try_convert(str);
+
+ esc = purple_strreplace(esc, "\\", "\\\\");
+ g_free(tmp); tmp = esc;
+
+ esc = purple_strreplace(esc, "'", "\\'");
+ g_free(tmp); tmp = esc;
+
+ esc = purple_strreplace(esc, "\n", "\\n");
+ g_free(tmp); tmp = esc;
+
+ esc = purple_strreplace(esc, "\r", "");
+ g_free(tmp); tmp = esc;
+
+ return esc;
+}
+
void purple_restore_default_signal_handlers(void)
{
#ifndef _WIN32
diff --git a/libpurple/util.h b/libpurple/util.h
--- a/libpurple/util.h
+++ b/libpurple/util.h
@@ -1390,6 +1390,15 @@ const char *purple_unescape_filename(con
const char *purple_escape_filename(const char *str);
/**
+ * Escapes javascript-unfriendly substrings from a string.
+ *
+ * @param str The string to escape.
+ *
+ * @return The javascript-safe string (must be g_free'd after use).
+ */
+gchar * purple_escape_js(const gchar *str);
+
+/**
* Restore default signal handlers for signals which might reasonably have
* handlers. This should be called by a fork()'d child process, since child processes
* inherit the handlers of the parent.
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -5145,6 +5145,10 @@ headline_response_cb(GtkInfoBar *infobar
gtkblist->headline_destroy(gtkblist->headline_data);
reset_headline(gtkblist);
}
+ } else {
+ if (gtkblist->headline_destroy)
+ gtkblist->headline_destroy(gtkblist->headline_data);
+ reset_headline(gtkblist);
}
return FALSE;
@@ -5155,7 +5159,7 @@ headline_realize_cb(GtkWidget *widget, g
{
GdkCursor *hand_cursor = gdk_cursor_new(GDK_HAND2);
gdk_window_set_cursor(gtk_widget_get_window(widget), hand_cursor);
- gdk_cursor_unref(hand_cursor);
+ g_object_unref(hand_cursor);
}
static gboolean
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -76,7 +76,22 @@ typedef struct
/* Regex */ \
"div.hide{display:none;}" \
"span.regex{background-color:#ffafaf;font-weight:bold;}" \
- "</style></head><body class=l%d></body></html>"
+ "</style><script>" \
+ "function append(level, time, cat, msg) {" \
+ "var div = document.createElement('div');" \
+ "div.className = 'l' + level;" \
+ "div.appendChild(document.createTextNode('(' + time + ') '));" \
+ "if (cat) {" \
+ "var cat_n = document.createElement('b');" \
+ "cat_n.appendChild(document.createTextNode(cat + ':'));" \
+ "div.appendChild(cat_n);" \
+ "div.appendChild(document.createTextNode(' '));" \
+ "}" \
+ "div.appendChild(document.createTextNode(msg));" \
+ "document.body.appendChild(div);" \
+ "alert('appended');" \
+ "}" \
+ "</script></head><body class=l%d></body></html>"
static DebugWindow *debug_win = NULL;
static guint debug_enabled_timer = 0;
@@ -639,25 +654,39 @@ toolbar_context(GtkWidget *toolbar, GdkE
}
static void
-regex_html_appended_cb(GtkWebView *webview, WebKitDOMRange *range, DebugWindow *win)
+debug_window_appended(DebugWindow *win)
{
- if (!win || !win->window)
+ WebKitDOMDocument *dom;
+ WebKitDOMHTMLElement *body;
+ WebKitDOMNode *div;
+
+ if (!gtk_toggle_tool_button_get_active(
+ GTK_TOGGLE_TOOL_BUTTON(win->filter)))
return;
- if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
- WebKitDOMDocument *dom;
- WebKitDOMHTMLElement *body;
- WebKitDOMNode *div;
+ dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text));
+ body = webkit_dom_document_get_body(dom);
+ div = webkit_dom_node_get_last_child(WEBKIT_DOM_NODE(body));
- dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text));
- body = webkit_dom_document_get_body(dom);
- div = webkit_dom_node_get_last_child(WEBKIT_DOM_NODE(body));
+ if (webkit_dom_element_webkit_matches_selector(
+ WEBKIT_DOM_ELEMENT(div), "body>div:not(#pause)", NULL))
+ regex_match(win, dom, div);
+}
- if (webkit_dom_element_webkit_matches_selector(WEBKIT_DOM_ELEMENT(div),
- "body>div:not(#pause)",
- NULL))
- regex_match(win, dom, div);
+static gboolean debug_window_alert_cb(WebKitWebView *webview,
+ WebKitWebFrame *frame, gchar *message, gpointer _win)
+{
+ DebugWindow *win = _win;
+
+ if (!win || !win->window)
+ return FALSE;
+
+ if (g_strcmp0(message, "appended") == 0) {
+ debug_window_appended(win);
+ return TRUE;
}
+
+ return FALSE;
}
static DebugWindow *
@@ -831,8 +860,8 @@ debug_window_new(void)
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
gtk_widget_show(frame);
- g_signal_connect(G_OBJECT(win->text), "html-appended",
- G_CALLBACK(regex_html_appended_cb), win);
+ g_signal_connect(G_OBJECT(win->text), "script-alert",
+ G_CALLBACK(debug_window_alert_cb), win);
clear_cb(NULL, win);
@@ -958,6 +987,7 @@ pidgin_debug_init(void)
REGISTER_G_LOG_HANDLER("GModule");
REGISTER_G_LOG_HANDLER("GLib-GObject");
REGISTER_G_LOG_HANDLER("GThread");
+ REGISTER_G_LOG_HANDLER("Json");
#ifdef USE_GSTREAMER
REGISTER_G_LOG_HANDLER("GStreamer");
#endif
@@ -999,41 +1029,29 @@ pidgin_debug_window_hide(void)
static void
pidgin_debug_print(PurpleDebugLevel level, const char *category,
- const char *arg_s)
+ const char *arg_s)
{
- gchar *ts_s;
- gchar *esc_s, *cat_s, *tmp, *s;
+ gchar *esc_s;
const char *mdate;
time_t mtime;
+ gchar *js;
- if (debug_win == NULL ||
- !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"))
- {
+ if (debug_win == NULL)
return;
- }
+ if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"))
+ return;
mtime = time(NULL);
mdate = purple_utf8_strftime("%H:%M:%S", localtime(&mtime));
- ts_s = g_strdup_printf("(%s) ", mdate);
- if (category == NULL)
- cat_s = g_strdup("");
- else
- cat_s = g_strdup_printf("<b>%s:</b> ", category);
- tmp = purple_utf8_try_convert(arg_s);
- esc_s = g_markup_escape_text(tmp, -1);
+ esc_s = purple_escape_js(arg_s);
- s = g_strdup_printf("<div class=\"l%d\">%s%s%s</div>",
- level, ts_s, cat_s, esc_s);
+ js = g_strdup_printf("append(%d, '%s', '%s', '%s');",
+ level, mdate, category ? category : "", esc_s);
+ g_free(esc_s);
- g_free(ts_s);
- g_free(cat_s);
More information about the Commits
mailing list