diff src/conversation.c @ 9627:8a540b8a5f70

[gaim-migrate @ 10471] A bug fix for away message tooltips and some more removing-gaim_notify_errors. Here's the thought: for errors associated with a buddy, check to see if there's already a window open for him, if so, print the error to the window and present the window to the user. If not, you can go ahead and gaim_notify_error. So, things like checking profiles in the buddy list might potentially print errors to conversations. I think this is good, but we'll try it out a bit. If it's really good, we won't even gaim_notify_error and instead create a new convo window just for the error. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 01 Aug 2004 00:31:45 +0000
parents c001be3c330e
children 81b31af2752d
line wrap: on
line diff
--- a/src/conversation.c	Sat Jul 31 23:30:01 2004 +0000
+++ b/src/conversation.c	Sun Aug 01 00:31:45 2004 +0000
@@ -1666,6 +1666,29 @@
 		gaim_conversation_write(c, who, message, flags, mtime);
 }
 
+gboolean gaim_conv_present_error(const char *who, GaimAccount *account, const char *what)
+{
+	GaimConversation *conv;
+	GaimConvWindow *window;
+
+	g_return_val_if_fail(who != NULL, FALSE);
+	g_return_val_if_fail(account !=NULL, FALSE);
+	g_return_val_if_fail(what != NULL, FALSE);
+
+	conv = gaim_find_conversation_with_account(who, account);
+	if (conv != NULL)
+		gaim_conversation_write(conv, NULL, what, GAIM_MESSAGE_ERROR, time(NULL));
+	else
+		return FALSE;
+	window = gaim_conversation_get_window(conv);
+	if (!gaim_conv_window_has_focus(window)) /* don't change the active conversation if the user is using this window */
+		gaim_conv_window_switch_conversation(window, gaim_conversation_get_index(conv));
+
+	gaim_conv_window_raise(window);
+
+	return TRUE;
+}
+
 void
 gaim_conv_im_send(GaimConvIm *im, const char *message)
 {