changeset 4767:f6d83e81d45a

[gaim-migrate @ 5085] This brings back: - Sounds - "SeanEgn logged in." messages - Plugin and perl events - Raise Buddy list on events - I think that's all. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 08:10:17 +0000
parents 03aa36cb4e38
children a1ea914506c9
files src/buddy.c src/server.c
diffstat 2 files changed, 49 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Fri Mar 14 07:04:46 2003 +0000
+++ b/src/buddy.c	Fri Mar 14 08:10:17 2003 +0000
@@ -1120,12 +1120,15 @@
 
 					expand = TRUE;
 				}
-
+				
 				oldersibling = node->prev;
 				while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter))
 					oldersibling = oldersibling->prev;
 
 				gtk_tree_store_insert_after(gtkblist->treemodel, &iter, &groupiter, oldersibling ? &oldersiblingiter : NULL);
+				
+				if (blist_options & OPT_BLIST_POPUP)
+					gtk_window_present(GTK_WINDOW(gtkblist->window));
 
 				if (expand) {       /* expand was set to true if this is the first element added to a group.  In such case
 						     * we expand the group node */
@@ -1204,6 +1207,8 @@
 
 	} else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry) {
 		gaim_gtk_blist_remove(list, node);
+		if (blist_options & OPT_BLIST_POPUP)
+			gtk_window_present(GTK_WINDOW(gtkblist->window));
 	}
 }
 
--- a/src/server.c	Fri Mar 14 07:04:46 2003 +0000
+++ b/src/server.c	Fri Mar 14 08:10:17 2003 +0000
@@ -35,6 +35,7 @@
 #include "prpl.h"
 #include "multi.h"
 #include "gaim.h"
+#include "sound.h"
 
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/tb_search.xpm"
@@ -899,22 +900,58 @@
 
 	gaim_blist_update_buddy_status(b, type);
 	
-	gaim_blist_update_buddy_presence(b, loggedin);
 
 	if (loggedin) {
-		if (!b->present) {
-			//b->present = 1;
+		if (!b->present == 1) {
+			struct gaim_conversation *c = gaim_find_conversation(b->name);
+			if (c) {
+				char *tmp = g_strdup_printf(_("%s logged in."), gaim_get_buddy_alias(b));
+				gaim_conversation_write(c, NULL, tmp, -1,
+							WFLAG_SYSTEM, time(NULL));
+				g_free(tmp);
+			} else if (awayqueue && find_queue_total_by_name(b->name)) {
+				struct queued_message *qm = g_new0(struct queued_message, 1);
+				g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
+				qm->message = g_strdup_printf(_("%s logged in."),
+							      gaim_get_buddy_alias(b));
+				qm->account = gc->account;
+				qm->tm = time(NULL);
+				qm->flags = WFLAG_SYSTEM;
+				qm->len = -1;
+				message_queue = g_slist_append(message_queue, qm);
+			}
+			gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE);
 			do_pounce(gc, b->name, OPT_POUNCE_SIGNON);
 			plugin_event(event_buddy_signon, gc, b->name);
 			system_log(log_signon, gc, b, OPT_LOG_BUDDY_SIGNON);
 		}
 	} else {
-		if (b->present) {
+		if (b->present == 1) {
+			struct gaim_conversation *c = gaim_find_conversation(b->name);
+			if (c) {
+				char *tmp = g_strdup_printf(_("%s logged out."), gaim_get_buddy_alias(b));
+				gaim_conversation_write(c, NULL, tmp, -1,
+							WFLAG_SYSTEM, time(NULL));
+				g_free(tmp);
+			} else if (awayqueue && find_queue_total_by_name(b->name)) {
+				struct queued_message *qm = g_new0(struct queued_message, 1);
+				g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
+				qm->message = g_strdup_printf(_("%s logged out."),
+							      gaim_get_buddy_alias(b));
+				qm->account = gc->account;
+				qm->tm = time(NULL);
+				qm->flags = WFLAG_SYSTEM;
+				qm->len = -1;
+				message_queue = g_slist_append(message_queue, qm);
+			}
+			gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE);
 			plugin_event(event_buddy_signoff, gc, b->name);
 			system_log(log_signoff, gc, b, OPT_LOG_BUDDY_SIGNON);
 		}
-		b->present = 0;
-	}
+	}	
+	
+	gaim_blist_update_buddy_presence(b, loggedin);
+
 }