/soc/2013/ankitkv/gobjectification: b683d24ef1d7: Merge default ...
Ankit Vani
a at nevitus.org
Sun Jan 12 05:51:29 EST 2014
Changeset: b683d24ef1d7ffb18cffa16258b608fb65658df9
Author: Ankit Vani <a at nevitus.org>
Date: 2014-01-12 16:18 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b683d24ef1d7
Description:
Merge default branch
diffstat:
libpurple/conversation.c | 12 ++---
libpurple/server.c | 2 +-
pidgin/gtkconv.c | 95 +++++++++++++++++++++++++++++------------------
3 files changed, 65 insertions(+), 44 deletions(-)
diffs (170 lines):
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -146,18 +146,16 @@ common_send(PurpleConversation *conv, co
purple_conversation_get_name(conv), sent);
}
}
- else {
- PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(conv);
+ else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
+ int id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv));
purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg",
- account, &sent,
- purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv)));
+ account, &sent, id);
if (sent != NULL && sent[0] != '\0') {
- err = serv_chat_send(gc, purple_chat_conversation_get_id(chat), sent, msgflags);
+ err = serv_chat_send(gc, id, sent, msgflags);
purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg",
- account, sent,
- purple_chat_conversation_get_id(chat));
+ account, sent, id);
}
}
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -438,7 +438,7 @@ void serv_chat_invite(PurpleConnection *
g_free(buffy);
}
-/* Ya know, nothing uses this except purple_chat_conversation_dispose(),
+/* Ya know, nothing uses this except purple_chat_conversation_finalize(),
* I think I'll just merge it into that later...
* Then again, something might want to use this, from outside protocol-land
* to leave a chat without destroying the conversation.
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -207,7 +207,6 @@ static gboolean tab_complete(PurpleConve
static void pidgin_conv_updated(PurpleConversation *conv, PurpleConversationUpdateType type);
static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state);
static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state);
-static void update_typing_state(PidginConversation *gtkconv, gboolean deleting);
static void update_typing_icon(PidginConversation *gtkconv);
static void update_typing_message(PidginConversation *gtkconv, const char *message);
gboolean pidgin_conv_has_focus(PurpleConversation *conv);
@@ -1947,6 +1946,58 @@ gtkconv_cycle_focus(PidginConversation *
return !!next;
}
+static void
+update_typing_inserting(PidginConversation *gtkconv)
+{
+ gchar *text;
+
+ g_return_if_fail(gtkconv != NULL);
+
+ text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry));
+
+ got_typing_keypress(gtkconv, text[0] == '\0' || !strcmp(text, "\n"));
+
+ g_free(text);
+}
+
+static gboolean
+update_typing_deleting_cb(PidginConversation *gtkconv)
+{
+ PurpleIMConversation *im = PURPLE_IM_CONVERSATION(gtkconv->active_conv);
+ gchar *text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry));
+
+ if (!*text || !strcmp(text, "\n")) {
+ /* We deleted all the text, so turn off typing. */
+ purple_im_conversation_stop_send_typed_timeout(im);
+
+ serv_send_typing(purple_conversation_get_connection(gtkconv->active_conv),
+ purple_conversation_get_name(gtkconv->active_conv),
+ PURPLE_IM_NOT_TYPING);
+ }
+ else {
+ /* We're deleting, but not all of it, so it counts as typing. */
+ got_typing_keypress(gtkconv, FALSE);
+ }
+ g_free(text);
+
+ return FALSE;
+}
+
+static void
+update_typing_deleting(PidginConversation *gtkconv)
+{
+ gchar *text;
+
+ g_return_val_if_fail(gtkconv != NULL, FALSE);
+
+ text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry));
+
+ if (*text && strcmp(text, "\n"))
+ purple_timeout_add(0, (GSourceFunc)update_typing_deleting_cb, gtkconv);
+
+ g_free(text);
+}
+
static gboolean
conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
{
@@ -2202,17 +2253,18 @@ entry_key_press_cb(GtkWidget *entry, Gdk
}
}
- if (PURPLE_IS_IM_CONVERSATION(conv)) {
- gboolean deleting = FALSE;
+ if (PURPLE_IS_IM_CONVERSATION(conv) &&
+ purple_prefs_get_bool("/purple/conversations/im/send_typing")) {
switch (event->keyval) {
case GDK_KEY_BackSpace:
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
- deleting = TRUE;
- }
-
- update_typing_state(gtkconv, deleting);
+ update_typing_deleting(gtkconv);
+ break;
+ default:
+ update_typing_inserting(gtkconv);
+ }
}
return FALSE;
@@ -2426,35 +2478,6 @@ menu_conv_sel_send_cb(GObject *m, gpoint
pidgin_conv_switch_active_conversation(PURPLE_CONVERSATION(im));
}
-static void
-update_typing_state(PidginConversation *gtkconv, gboolean deleting)
-{
- PurpleIMConversation *im;
- gchar *text;
-
- g_return_if_fail(gtkconv != NULL);
-
- if (!purple_prefs_get_bool("/purple/conversations/im/send_typing"))
- return;
-
- im = PURPLE_IM_CONVERSATION(gtkconv->active_conv);
-
- text = gtk_webview_get_body_text(GTK_WEBVIEW(gtkconv->entry));
-
- if (!*text) {
-
- /* We deleted all the text, so turn off typing. */
- purple_im_conversation_stop_send_typed_timeout(im);
-
- serv_send_typing(purple_conversation_get_connection(gtkconv->active_conv),
- purple_conversation_get_name(gtkconv->active_conv),
- PURPLE_IM_NOT_TYPING);
- }
- else {
- got_typing_keypress(gtkconv, !deleting && text[1] == '\0');
- }
-}
-
/**************************************************************************
* A bunch of buddy icon functions
**************************************************************************/
More information about the Commits
mailing list