changeset 8076:504d98d14c25

[gaim-migrate @ 8775] CTRL+(1 through 8) and SHIFT+CTRL+(1 through 8) no longer insert smileys twice CTRL+(1 through 8) and SHIFT+CTRL+(1 through 8) inserts WYSIWYG smileys instead of text Removed some functions in from gtkconv.c that I don't think we need that I think Chip said were left over from a simpler way of life This may break some key commands or something in the text entry window of convos. Lemme know if it does Love me tender committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 11 Jan 2004 21:36:17 +0000
parents 41e973dbca03
children abee07bc573f
files src/conversation.c src/gtkconv.c src/protocols/oscar/ft.c src/protocols/oscar/oscar.c
diffstat 4 files changed, 58 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Sun Jan 11 20:47:13 2004 +0000
+++ b/src/conversation.c	Sun Jan 11 21:36:17 2004 +0000
@@ -185,7 +185,7 @@
 	GaimConversationType type;
 	GaimConnection *gc;
 	GaimConversationUiOps *ops;
-	char *buffy = NULL;
+	char *displayed = NULL, *sent = NULL;
 	int plugin_return;
 	int err = 0;
 	GList *first;
@@ -212,38 +212,60 @@
 	if ((gc->flags & GAIM_CONNECTION_HTML) &&
 		gaim_prefs_get_bool("/core/conversations/send_urls_as_links")) {
 
-		buffy = gaim_markup_linkify(message);
+		displayed = gaim_markup_linkify(message);
 	}
 	else
-		buffy = g_strdup(message);
+		displayed = g_strdup(message);
 
 	plugin_return =
 		GPOINTER_TO_INT(gaim_signal_emit_return_1(
 			gaim_conversations_get_handle(),
-			(type == GAIM_CONV_IM
-			 ? "displaying-im-msg" : "displaying-chat-msg"),
-			gaim_conversation_get_account(conv), conv, &buffy));
-
-	if (buffy == NULL)
+			(type == GAIM_CONV_IM ? "writing-im-msg" : "writing-chat-msg"),
+			gaim_conversation_get_account(conv), conv, &displayed));
+
+	if (displayed == NULL)
 		return;
 
 	if (plugin_return) {
-		g_free(buffy);
+		g_free(displayed);
+		return;
+	}
+
+	gaim_signal_emit(gaim_conversations_get_handle(),
+		(type == GAIM_CONV_IM ? "wrote-im-msg" : "wrote-chat-msg"),
+		gaim_conversation_get_account(conv), conv, displayed);
+
+	sent = g_strdup(displayed);
+
+	plugin_return =
+		GPOINTER_TO_INT(gaim_signal_emit_return_1(
+			gaim_conversations_get_handle(), (type == GAIM_CONV_IM ?
+			"displaying-im-msg" : "displaying-chat-msg"),
+			gaim_conversation_get_account(conv), conv, &displayed));
+
+	if (displayed == NULL) {
+		g_free(sent);
+		return;
+	}
+
+	if (plugin_return) {
+		g_free(displayed);
+		g_free(sent);
 		return;
 	}
 
 	gaim_signal_emit(gaim_conversations_get_handle(),
 		(type == GAIM_CONV_IM ? "displayed-im-msg" : "displayed-chat-msg"),
-		gaim_conversation_get_account(conv), conv, buffy);
+		gaim_conversation_get_account(conv), conv, displayed);
 
 	if (type == GAIM_CONV_IM) {
 		GaimConvIm *im = GAIM_CONV_IM(conv);
 
 		gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg",
 						 gaim_conversation_get_account(conv),
-						 gaim_conversation_get_name(conv), &buffy);
-
-		if (buffy != NULL && buffy[0] != '\0') {
+						 gaim_conversation_get_name(conv), &sent);
+
+		if (sent != NULL && sent[0] != '\0') {
 			GaimConvImFlags imflags = 0;
 			GaimMessageFlags msgflags = GAIM_MESSAGE_SEND;
 
@@ -253,10 +275,10 @@
 			}
 
 			err = serv_send_im(gc, gaim_conversation_get_name(conv),
-							    buffy, imflags);
+							    sent, imflags);
 
 			if (err > 0)
-				gaim_conv_im_write(im, NULL, buffy, msgflags, time(NULL));
+				gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL));
 
 			if (im->images != NULL) {
 				GSList *tempy;
@@ -276,19 +298,19 @@
 
 			gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
 							 gaim_conversation_get_account(conv),
-							 gaim_conversation_get_name(conv), buffy);
+							 gaim_conversation_get_name(conv), sent);
 		}
 	}
 	else {
 		gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg",
-						 gaim_conversation_get_account(conv), &buffy,
+						 gaim_conversation_get_account(conv), &sent,
 						 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
 
-		if (buffy != NULL && buffy[0] != '\0') {
-			err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), buffy);
+		if (sent != NULL && sent[0] != '\0') {
+			err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent);
 
 			gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg",
-							 gaim_conversation_get_account(conv), buffy,
+							 gaim_conversation_get_account(conv), sent,
 							 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
 		}
 	}
@@ -319,6 +341,9 @@
 			}
 		}
 	}
+
+	g_free(displayed);
+	g_free(sent);
 }
 
 static void
--- a/src/gtkconv.c	Sun Jan 11 20:47:13 2004 +0000
+++ b/src/gtkconv.c	Sun Jan 11 21:36:17 2004 +0000
@@ -123,7 +123,6 @@
 static GtkWidget *invite_dialog = NULL;
 
 /* Prototypes. <-- because Paco-Paco hates this comment. */
-static void check_everything(GtkTextBuffer *buffer);
 static void set_toggle(GtkWidget *tb, gboolean active);
 static void move_next_tab(GaimConversation *conv);
 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv);
@@ -345,14 +344,6 @@
 	gtk_widget_grab_focus(gtkconv->entry);
 }
 
-static gboolean
-entry_key_pressed_cb_1(GtkTextBuffer *buffer)
-{
-	check_everything(buffer);
-
-	return FALSE;
-}
-
 static void default_formatize(GaimConversation *conv) {
 	GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv);
 	GaimConnection *gc = gaim_conversation_get_gc(conv);
@@ -1258,7 +1249,7 @@
 }
 
 static gboolean
-entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data)
+entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
 {
 	GaimConvWindow *win;
 	GaimConversation *conv;
@@ -1457,8 +1448,7 @@
 			}
 
 			if (*buf) {
-				gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer,
-												 buf, -1);
+				gtk_imhtml_insert_smiley(GTK_IMHTML(gtkconv->entry), conv->account->protocol_id, buf);
 				g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event");
 			}
 		}
@@ -2362,22 +2352,6 @@
 }
 
 static void
-check_everything(GtkTextBuffer *buffer)
-{
-	GaimConversation *conv;
-	GaimGtkConversation *gtkconv;
-
-	conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer),
-														 "user_data");
-
-	g_return_if_fail(conv != NULL);
-
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-	/* CONV TODO */
-}
-
-static void
 set_toggle(GtkWidget *tb, gboolean active)
 {
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active);
@@ -3594,7 +3568,7 @@
 	/* Setup the scrolled window to put gtkimhtml in. */
 	gtkconv->sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw),
-								   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+								   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw),
 										GTK_SHADOW_IN);
 	gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE);
@@ -3634,7 +3608,7 @@
 	/* Setup the list of users. */
 	sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-								   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+								   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
 	gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0);
 	gtk_widget_show(sw);
@@ -3740,13 +3714,8 @@
 				25));
 	g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv);
 
-	g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event",
-							 G_CALLBACK(entry_key_pressed_cb_1),
-							 gtkconv->entry_buffer);
 	g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
-					 G_CALLBACK(entry_key_pressed_cb_2), conv);
-	g_signal_connect(G_OBJECT(sw), "key_press_event",
-					 G_CALLBACK(entry_key_pressed_cb_2), conv);
+					 G_CALLBACK(entry_key_pressed_cb), conv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
 						   G_CALLBACK(entry_stop_rclick_cb), NULL);
 
@@ -3791,7 +3760,7 @@
 	/* Setup the gtkimhtml widget. */
 	gtkconv->sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw),
-								   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+								   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw),
 										GTK_SHADOW_IN);
 	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0);
@@ -3844,13 +3813,8 @@
 				25));
 	g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv);
 
-	g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event",
-							 G_CALLBACK(entry_key_pressed_cb_1),
-							 gtkconv->entry_buffer);
 	g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
-					 G_CALLBACK(entry_key_pressed_cb_2), conv);
-	g_signal_connect(G_OBJECT(sw), "key_press_event",
-					 G_CALLBACK(entry_key_pressed_cb_2), conv);
+					 G_CALLBACK(entry_key_pressed_cb), conv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
 						   G_CALLBACK(entry_stop_rclick_cb), NULL);
 
--- a/src/protocols/oscar/ft.c	Sun Jan 11 20:47:13 2004 +0000
+++ b/src/protocols/oscar/ft.c	Sun Jan 11 21:36:17 2004 +0000
@@ -664,6 +664,7 @@
 			ret = userfunc(sess, &fr, snptr, 0);
 	}
 
+	/* Is the second half of this really needed?  I'm skeptical. */
 	if ((payloadlength != 0) && (payloadlength != UINT_MAX)) {
 		char *msg;
 		int recvd = 0;
--- a/src/protocols/oscar/oscar.c	Sun Jan 11 20:47:13 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Jan 11 21:36:17 2004 +0000
@@ -278,9 +278,10 @@
 /* for icons */
 static gboolean gaim_icon_timerfunc(gpointer data);
 
-/* prpl actions - remove this at some point */
+/* remove these at some point? */
 /* Because I don't like forward declarations?  I think that was why... */
 static void oscar_set_info(GaimConnection *gc, const char *text);
+static void oscar_set_away(GaimConnection *gc, const char *state, const char *message);
 
 static void oscar_free_name_data(struct name_data *data) {
 	g_free(data->name);
@@ -3811,6 +3812,9 @@
 		aim_locate_setcaps(od->sess, caps_aim);
 	oscar_set_info(gc, gc->account->user_info);
 
+	if (gc->away_state != NULL)
+		oscar_set_away(gc, gc->away_state, gc->away);
+
 	return 1;
 }