changeset 9951:42cdec4f639b

[gaim-migrate @ 10847] <faceprint> datallah: i can just commit that without thinking, right? <audiokat2> faceprint: you can't break HEAD any worse right now :) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 04 Sep 2004 16:51:49 +0000
parents ba085944efee
children 8fdf9706c45d
files src/protocols/irc/irc.c src/protocols/irc/msgs.c src/protocols/msn/msn.c
diffstat 3 files changed, 72 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Sat Sep 04 05:36:32 2004 +0000
+++ b/src/protocols/irc/irc.c	Sat Sep 04 16:51:49 2004 +0000
@@ -41,7 +41,7 @@
 
 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b);
 static void irc_blist_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne);
-static GList *irc_away_states(GaimConnection *gc);
+static GList *irc_status_types(GaimAccount *account);
 static GList *irc_actions(GaimPlugin *plugin, gpointer context);
 /* static GList *irc_chat_info(GaimConnection *gc); */
 static void irc_login(GaimAccount *account);
@@ -606,27 +606,27 @@
 	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
-	NO_BUDDY_ICONS,			/* icon_spec */
-	irc_blist_icon,			/* list_icon */
-	irc_blist_emblems,		/* list_emblems */
+	NO_BUDDY_ICONS,		/* icon_spec */
+	irc_blist_icon,		/* list_icon */
+	irc_blist_emblems,	/* list_emblems */
 	NULL,					/* status_text */
 	NULL,					/* tooltip_text */
-	irc_away_states,		/* away_states */
+	irc_status_types,	/* away_states */
 	NULL,					/* blist_node_menu */
-	irc_chat_join_info,		/* chat_info */
+	irc_chat_join_info,	/* chat_info */
 	irc_chat_info_defaults,	/* chat_info_defaults */
-	irc_login,				/* login */
-	irc_close,				/* close */
-	irc_im_send,			/* send_im */
+	irc_login,		/* login */
+	irc_close,		/* close */
+	irc_im_send,		/* send_im */
 	NULL,					/* set_info */
 	NULL,					/* send_typing */
-	irc_get_info,			/* get_info */
-	irc_set_away,			/* set_away */
+	irc_get_info,		/* get_info */
+	irc_set_status,		/* set_status */
 	NULL,					/* set_idle */
 	NULL,					/* change_passwd */
-	irc_add_buddy,			/* add_buddy */
+	irc_add_buddy,		/* add_buddy */
 	NULL,					/* add_buddies */
-	irc_remove_buddy,		/* remove_buddy */
+	irc_remove_buddy,	/* remove_buddy */
 	NULL,					/* remove_buddies */
 	NULL,					/* add_permit */
 	NULL,					/* add_deny */
@@ -634,13 +634,13 @@
 	NULL,					/* rem_deny */
 	NULL,					/* set_permit_deny */
 	NULL,					/* warn */
-	irc_chat_join,			/* join_chat */
+	irc_chat_join,		/* join_chat */
 	NULL,					/* reject_chat */
-	irc_get_chat_name,		/* get_chat_name */
-	irc_chat_invite,		/* chat_invite */
-	irc_chat_leave,			/* chat_leave */
+	irc_get_chat_name,	/* get_chat_name */
+	irc_chat_invite,	/* chat_invite */
+	irc_chat_leave,		/* chat_leave */
 	NULL,					/* chat_whisper */
-	irc_chat_send,			/* chat_send */
+	irc_chat_send,		/* chat_send */
 	NULL,					/* keepalive */
 	NULL,					/* register_user */
 	NULL,					/* get_cb_info */
@@ -654,7 +654,7 @@
 	NULL,					/* set_buddy_icon */
 	NULL,					/* remove_group */
 	NULL,					/* get_cb_real_name */
-	irc_chat_set_topic,		/* set_chat_topic */
+	irc_chat_set_topic,	/* set_chat_topic */
 	NULL,					/* find_blist_chat */
 	irc_roomlist_get_list,	/* roomlist_get_list */
 	irc_roomlist_cancel,	/* roomlist_cancel */
--- a/src/protocols/irc/msgs.c	Sat Sep 04 05:36:32 2004 +0000
+++ b/src/protocols/irc/msgs.c	Sat Sep 04 16:51:49 2004 +0000
@@ -550,17 +550,20 @@
 {
 	GaimConnection *gc = gaim_account_get_connection(irc->account);
 	GaimBuddy *buddy = gaim_find_buddy(irc->account, name);
+	GaimPresence *presence;
 
 	if (!gc || !buddy)
 		return;
 
+	presence = gaim_buddy_get_presence(buddy);
+
 	if (ib->online && !ib->flag) {
-		serv_got_update(gc, buddy->name, FALSE, 0, 0, 0, 0);
+		gaim_presence_switch_status(presence, "online");
 		ib->online = FALSE;
 	}
 
 	if (!ib->online && ib->flag) {
-		serv_got_update(gc, buddy->name, TRUE, 0, 0, 0, 0);
+		gaim_presence_switch_status(presence, "offline");
 		ib->online = TRUE;
 	}
 }
--- a/src/protocols/msn/msn.c	Sat Sep 04 05:36:32 2004 +0000
+++ b/src/protocols/msn/msn.c	Sat Sep 04 16:51:49 2004 +0000
@@ -419,42 +419,69 @@
 }
 
 static char *
-msn_status_text(GaimBuddy *b)
+msn_status_text(GaimBuddy *buddy)
 {
-	if (b->uc & UC_UNAVAILABLE)
-		return g_strdup(msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
+	GaimPresence *presence = gaim_buddy_get_presence(buddy);
+	GaimStatus *status = gaim_presence_get_active_status(presence);
+
+	if (!gaim_status_is_available(status))
+		return g_strdup(gaim_status_get_name(status));
 
 	return NULL;
 }
 
 static char *
-msn_tooltip_text(GaimBuddy *b)
+msn_tooltip_text(GaimBuddy *buddy)
 {
+	GaimPresence *presence = gaim_buddy_get_presence(buddy);
+	GaimStatus *status = gaim_presence_get_active_status(presence);
 	char *text = NULL;
 
-	if (GAIM_BUDDY_IS_ONLINE(b))
+	if (gaim_presence_is_online(presence))
 	{
 		text = g_strdup_printf(_("\n<b>%s:</b> %s"), _("Status"),
-							   msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
+				gaim_status_get_name(status));
 	}
 
 	return text;
 }
 
 static GList *
-msn_away_states(GaimConnection *gc)
+msn_status_types(GaimAccount *account)
 {
-	GList *m = NULL;
+	GaimStatusType *offline;
+	GaimStatusType *online;
+	GaimStatusType *unavail;
+	GList *types = NULL;
+
+	offline = gaim_status_type_new(GAIM_STATUS_OFFLINE,
+			"offline", _("Offline"), FALSE);
+	types = g_list_append(types, offline);
+
+	online = gaim_status_type_new(GAIM_STATUS_ONLINE,
+			"online", _("Online"), FALSE);
+	types = g_list_append(types, online);
 
-	m = g_list_append(m, _("Available"));
-	m = g_list_append(m, _("Away From Computer"));
-	m = g_list_append(m, _("Be Right Back"));
-	m = g_list_append(m, _("Busy"));
-	m = g_list_append(m, _("On The Phone"));
-	m = g_list_append(m, _("Out To Lunch"));
-	m = g_list_append(m, _("Hidden"));
+	gaim_status_type_new(online, GAIM_STATUS_AVAILABLE, "available",
+			_("Available"), FALSE, FALSE, FALSE);
+	unavail = gaim_status_type_new(online, GAIM_STATUS_UNAVAILABLE,
+			"unavailable", _("Unavailable"),
+			FALSE, FALSE, FALSE);
 
-	return m;
+	gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "away",
+			_("Away"), FALSE, TRUE, FALSE);
+	gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "brb",
+			_("Be Right Back"), FALSE, TRUE, FALSE);
+	gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "busy",
+			_("Busy"), FALSE, TRUE, FALSE);
+	gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "phone",
+			_("On The Phone"), FALSE, TRUE, FALSE);
+	gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "lunch",
+			_("Out To Lunch"), FALSE, TRUE, FALSE);
+	gaim_status_type_new(unavail, GAIM_STATUS_HIDDEN, "hidden",
+			_("Hidden"), FALSE, TRUE, FALSE);
+
+	return types;
 }
 
 static GList *
@@ -1648,12 +1675,12 @@
 	msn_list_emblems,		/* list_emblems */
 	msn_status_text,		/* status_text */
 	msn_tooltip_text,		/* tooltip_text */
-	msn_away_states,		/* away_states */
-	msn_blist_node_menu,	/* blist_node_menu */
+	msn_status_types,		/* away_states */
+	msn_blist_node_menu,		/* blist_node_menu */
 	NULL,					/* chat_info */
 	NULL,					/* chat_info_defaults */
-	msn_login,				/* login */
-	msn_close,				/* close */
+	msn_login,			/* login */
+	msn_close,			/* close */
 	msn_send_im,			/* send_im */
 	NULL,					/* set_info */
 	msn_send_typing,		/* send_typing */
@@ -1669,7 +1696,7 @@
 	msn_add_deny,			/* add_deny */
 	msn_rem_permit,			/* rem_permit */
 	msn_rem_deny,			/* rem_deny */
-	msn_set_permit_deny,	/* set_permit_deny */
+	msn_set_permit_deny,		/* set_permit_deny */
 	NULL,					/* warn */
 	NULL,					/* join_chat */
 	NULL,					/* reject chat invite */