changeset 20470:7d6f247f08d9

propagate from branch 'im.pidgin.pidgin' (head be582d1ac8a250870b9c691a8cb1ab4c170650bc) to branch 'im.pidgin.cpw.khc.msnp14' (head 02e228232108b82dfaf51b2bd5daabeab692c0b0)
author Carlos Silva <typ0@pidgin.im>
date Mon, 16 Jul 2007 23:06:21 +0000
parents 9e5bb492fc18 (current diff) 2f99cf09d912 (diff)
children 530a92d50c5e
files libpurple/protocols/msn/msn-utils.c libpurple/protocols/msn/msn-utils.h libpurple/protocols/msn/notification.c
diffstat 9 files changed, 115 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/doc/C-HOWTO.dox	Sat Jul 14 18:36:34 2007 +0000
+++ b/doc/C-HOWTO.dox	Mon Jul 16 23:06:21 2007 +0000
@@ -63,6 +63,10 @@
 	NULL,
 	NULL,
 	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 	NULL
 };
 
@@ -86,10 +90,10 @@
   Our last include is version.h which defines @c PURPLE_MAJOR_VERSION, and
   @c PURPLE_MINOR_VERSION.  There is not much you need to know about these,
   except that they are required and will stop your plugin from crashing Pidgin
-  when something has changed that you plugin does not know about yet.
+  when something has changed that your plugin does not know about yet.
 
-  plugin_load is not required.  It is called when the plugin is loaded so that
-  you can initialize any variables and so on.  But in this plugin we'll just
+  @c plugin_load is not required.  It is called when the plugin is loaded so
+  that you can initialize any variables and so on.  In this plugin we'll just
   use it to display a message.
 
   Next we have the @c PurplePluginInfo structure.  Every plugin MUST have one of
@@ -225,8 +229,7 @@
                                    code in:
                                      libpurple/plugins/pluginpref_example.c
                                  */
-	NULL                    /* Finally, the last member of the structure
-                                   is a function pointer where you can define
+	NULL,                   /* This is a function pointer where you can define
                                    "plugin actions".  The UI controls how
                                    they're displayed.  It should be of the
                                    type:
@@ -237,6 +240,22 @@
                                     It must return a GList of
                                     PurplePluginActions.
                                  */
+	NULL,                   /* This is a pointer reserved for future use.
+	                               We set it to NULL to indicate we don't
+								   need it.
+								 */
+	NULL,                   /* This is a pointer reserved for future use.
+	                               We set it to NULL to indicate we don't
+								   need it.
+								 */
+	NULL,                   /* This is a pointer reserved for future use.
+	                               We set it to NULL to indicate we don't
+								   need it.
+								 */
+	NULL                    /* This is a pointer reserved for future use.
+	                               We set it to NULL to indicate we don't
+								   need it.
+								 */
 };
   @endcode
 
--- a/finch/libgnt/gntbox.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/finch/libgnt/gntbox.c	Mon Jul 16 23:06:21 2007 +0000
@@ -222,6 +222,7 @@
 				h = maxh;
 		}
 
+		gnt_widget_confirm_size(wid, w, h);
 		gnt_widget_set_size(wid, w, h);
 	}
 
--- a/finch/libgnt/gntstyle.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Mon Jul 16 23:06:21 2007 +0000
@@ -49,7 +49,7 @@
 {
 #if GLIB_CHECK_VERSION(2,6,0)
 	const char *prg = g_get_prgname();
-	if ((group == NULL || *group != '\0') && prg &&
+	if ((group == NULL || *group == '\0') && prg &&
 			g_key_file_has_group(gkfile, prg))
 		group = prg;
 	if (!group)
--- a/finch/libgnt/gnttextview.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/finch/libgnt/gnttextview.c	Mon Jul 16 23:06:21 2007 +0000
@@ -796,54 +796,107 @@
 	view->flags |= flag;
 }
 
+/* Pager and editor setups */
+struct
+{
+	GntTextView *tv;
+	char *file;
+} pageditor;
+
+
+static void
+cleanup_pageditor()
+{
+	unlink(pageditor.file);
+	g_free(pageditor.file);
+
+	pageditor.file = NULL;
+	pageditor.tv = NULL;
+}
+
+static void
+editor_end_cb(int status, gpointer data)
+{
+	if (status == 0) {
+		char *text = NULL;
+		if (g_file_get_contents(pageditor.file, &text, NULL, NULL)) {
+			gnt_text_view_clear(pageditor.tv);
+			gnt_text_view_append_text_with_flags(pageditor.tv, text, GNT_TEXT_FLAG_NORMAL);
+			gnt_text_view_scroll(GNT_TEXT_VIEW(pageditor.tv), 0);
+			g_free(text);
+		}
+	}
+	cleanup_pageditor();
+}
+
 static void
 pager_end_cb(int status, gpointer data)
 {
-	unlink(data);
-	g_free(data);
+	cleanup_pageditor();
 }
 
 static gboolean
-check_for_pager_cb(GntWidget *widget, const char *key, GntTextView *view)
+check_for_ext_cb(GntWidget *widget, const char *key, GntTextView *view)
 {
-	static const char *combin = NULL;
+	static const char *pager = NULL;
+	static const char *editor = NULL;
 	char *argv[] = {NULL, NULL, NULL};
 	static char path[1024];
 	static int len = -1;
 	FILE *file;
 	gboolean ret;
+	gboolean pg;
 
-	if (combin == NULL) {
-		combin = gnt_key_translate(gnt_style_get_from_name("pager", "key"));
-		if (combin == NULL)
-			combin = "\033" "v";
+	if (pager == NULL) {
+		pager = gnt_key_translate(gnt_style_get_from_name("pager", "key"));
+		if (pager == NULL)
+			pager = "\033" "v";
+		editor = gnt_key_translate(gnt_style_get_from_name("editor", "key"));
+		if (editor == NULL)
+			editor = "\033" "e";
 		len = g_snprintf(path, sizeof(path), "%s" G_DIR_SEPARATOR_S "gnt", g_get_tmp_dir());
 	} else {
 		g_snprintf(path + len, sizeof(path) - len, "XXXXXX");
 	}
 
-	if (strcmp(key, combin)) {
+	if (strcmp(key, pager) == 0) {
+		if (g_object_get_data(G_OBJECT(widget), "pager-for") != view)
+			return FALSE;
+		pg = TRUE;
+	} else if (strcmp(key, editor) == 0) {
+		if (g_object_get_data(G_OBJECT(widget), "editor-for") != view)
+			return FALSE;
+		pg = FALSE;
+	} else {
 		return FALSE;
 	}
 
 	file = fdopen(g_mkstemp(path), "wb");
 	if (!file)
 		return FALSE;
-
 	fprintf(file, "%s", view->string->str);
 	fclose(file);
-	argv[0] = gnt_style_get_from_name("pager", "path");
-	argv[0] = argv[0] ? argv[0] : getenv("PAGER");
-	argv[0] = argv[0] ? argv[0] : "less";
-	argv[1] = g_strdup(path);
-	ret = gnt_giveup_console(NULL, argv, NULL, NULL, NULL, NULL, pager_end_cb, argv[1]);
-	if (!ret)
-		g_free(argv[1]);
+
+	pageditor.tv = view;
+	pageditor.file = g_strdup(path);
+
+	argv[0] = gnt_style_get_from_name(pg ? "pager" : "editor", "path");
+	argv[0] = argv[0] ? argv[0] : getenv(pg ? "PAGER" : "EDITOR");
+	argv[0] = argv[0] ? argv[0] : (pg ? "less" : "vim");
+	argv[1] = path;
+	ret = gnt_giveup_console(NULL, argv, NULL, NULL, NULL, NULL, pg ? pager_end_cb : editor_end_cb, NULL);
 	return ret;
 }
 
 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager)
 {
-	g_signal_connect(pager, "key_pressed", G_CALLBACK(check_for_pager_cb), view);
+	g_signal_connect(pager, "key_pressed", G_CALLBACK(check_for_ext_cb), view);
+	g_object_set_data(G_OBJECT(pager), "pager-for", view);
 }
 
+void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *wid)
+{
+	g_signal_connect(wid, "key_pressed", G_CALLBACK(check_for_ext_cb), view);
+	g_object_set_data(G_OBJECT(wid), "editor-for", view);
+}
+
--- a/finch/libgnt/gnttextview.h	Sat Jul 14 18:36:34 2007 +0000
+++ b/finch/libgnt/gnttextview.h	Mon Jul 16 23:06:21 2007 +0000
@@ -191,6 +191,13 @@
 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager);
 
 /**
+ * 
+ * @param view
+ * @param widget
+ */
+void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *pager);
+
+/**
  * Set a GntTextViewFlag for the textview widget.
  *
  * @param view  The textview widget
--- a/finch/libgnt/gnttree.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/finch/libgnt/gnttree.c	Mon Jul 16 23:06:21 2007 +0000
@@ -410,7 +410,7 @@
 	int start, i;
 	GntWidget *widget = GNT_WIDGET(tree);
 	GntTreeRow *row;
-	int pos, up, down;
+	int pos, up, down = 0;
 	int rows, scrcol;
 
 	if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED))
@@ -547,7 +547,7 @@
 	rows--;
 	if (rows > 0)
 	{
-		int total;
+		int total = 0;
 		int showing, position;
 
 		get_next_n_opt(tree->root, g_list_length(tree->list), &total);
--- a/libpurple/protocols/msn/notification.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Mon Jul 16 23:06:21 2007 +0000
@@ -1045,7 +1045,7 @@
 	user = msn_userlist_find_user(session->userlist, passport);
 
 	old_friendly = msn_user_get_friendly_name(user);
-	if (!old_friendly || (old_friendly && strcmp(old_friendly, friendly)))
+	if (!old_friendly || (old_friendly && (!friendly || strcmp(old_friendly, friendly))))
 	{
 		serv_got_alias(gc, passport, friendly);
 		msn_user_set_friendly_name(user, friendly);
--- a/libpurple/protocols/oscar/family_locate.c	Sat Jul 14 18:36:34 2007 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Mon Jul 16 23:06:21 2007 +0000
@@ -1264,10 +1264,13 @@
 	 * this buddy's info explicitly, then notify them that we have info
 	 * for this buddy.
 	 */
-	was_explicit = aim_locate_gotuserinfo(od, conn, userinfo2->sn);
-	if (was_explicit == TRUE)
-		if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
-			ret = userfunc(od, conn, frame, userinfo2);
+	if (userinfo2 != NULL)
+	{
+		was_explicit = aim_locate_gotuserinfo(od, conn, userinfo2->sn);
+		if (was_explicit == TRUE)
+			if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
+				ret = userfunc(od, conn, frame, userinfo2);
+	}
 
 	return ret;
 }
--- a/pidgin/pixmaps/emotes/default/22/default.theme.in	Sat Jul 14 18:36:34 2007 +0000
+++ b/pidgin/pixmaps/emotes/default/22/default.theme.in	Mon Jul 16 23:06:21 2007 +0000
@@ -29,7 +29,7 @@
 smile.png           :-)     :)
 wink.png            ;-)     ;)
 sad.png             :-(     :(
-tongue.png          :-P     :P
+tongue.png          :-P     :P      :-p
 shock.png           =-O
 kiss.png            :-*
 shout.png           >:o