Index: src/protocols/msn/msn.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msn.c,v
retrieving revision 1.323
diff -u -p -r1.323 msn.c
--- src/protocols/msn/msn.c 5 Sep 2004 06:29:50 -0000 1.323
+++ src/protocols/msn/msn.c 5 Sep 2004 16:17:20 -0000
@@ -392,17 +392,19 @@ msn_list_emblems(GaimBuddy *b, const cha
const char **nw, const char **ne)
{
MsnUser *user;
+ GaimPresence *presence;
const char *emblems[4] = { NULL, NULL, NULL, NULL };
- int away_type = MSN_AWAY_TYPE(b->uc);
int i = 0;
user = b->proto_data;
+ presence = gaim_buddy_get_presence(b);
- if (b->present == GAIM_BUDDY_OFFLINE)
+ if (!gaim_presence_is_online(presence))
emblems[i++] = "offline";
- else if (away_type == MSN_BUSY || away_type == MSN_PHONE)
+ else if (gaim_presence_is_status_active(presence, "busy") ||
+ gaim_presence_is_status_active(presence, "phone"))
emblems[i++] = "occupied";
- else if (away_type != 0)
+ else if (gaim_presence_is_status_active(presence, "away"))
emblems[i++] = "away";
if (user == NULL)
@@ -449,37 +451,49 @@ msn_tooltip_text(GaimBuddy *buddy)
static GList *
msn_status_types(GaimAccount *account)
{
- GaimStatusType *offline;
- GaimStatusType *online;
- GaimStatusType *unavail;
+ GaimStatusType *status;
GList *types = NULL;
- offline = gaim_status_type_new(GAIM_STATUS_OFFLINE,
+ status = gaim_status_type_new(GAIM_STATUS_OFFLINE,
"offline", _("Offline"), FALSE);
- types = g_list_append(types, offline);
+ types = g_list_append(types, status);
- online = gaim_status_type_new(GAIM_STATUS_ONLINE,
+ status = gaim_status_type_new(GAIM_STATUS_ONLINE,
"online", _("Online"), FALSE);
- types = g_list_append(types, online);
+ types = g_list_append(types, status);
- gaim_status_type_new(online, GAIM_STATUS_AVAILABLE, "available",
- _("Available"), FALSE, FALSE, FALSE);
- unavail = gaim_status_type_new(online, GAIM_STATUS_UNAVAILABLE,
+ status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
+ "available", _("Available"), FALSE, FALSE, FALSE);
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE,
"unavailable", _("Unavailable"),
FALSE, FALSE, FALSE);
+ types = g_list_append(types, status);
- gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "away",
+ status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "away",
_("Away"), FALSE, TRUE, FALSE);
- gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "brb",
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "brb",
_("Be Right Back"), FALSE, TRUE, FALSE);
- gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "busy",
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "busy",
_("Busy"), FALSE, TRUE, FALSE);
- gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "phone",
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "phone",
_("On The Phone"), FALSE, TRUE, FALSE);
- gaim_status_type_new(unavail, GAIM_STATUS_AWAY, "lunch",
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "lunch",
_("Out To Lunch"), FALSE, TRUE, FALSE);
- gaim_status_type_new(unavail, GAIM_STATUS_HIDDEN, "hidden",
+ types = g_list_append(types, status);
+
+ status = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, "hidden",
_("Hidden"), FALSE, TRUE, FALSE);
+ types = g_list_append(types, status);
return types;
}
@@ -740,53 +754,40 @@ msn_send_typing(GaimConnection *gc, cons
}
static void
-msn_set_away(GaimConnection *gc, const char *state, const char *msg)
+msn_set_status(GaimAccount *account, GaimStatus *status)
{
+ GaimConnection *gc;
MsnSession *session;
- int status;
+ const char *state;
+ int msnstatus;
- session = gc->proto_data;
+ gc = gaim_account_get_connection(account);
- if (gc->away != NULL)
- {
- g_free(gc->away);
- gc->away = NULL;
- }
+ if (gc == NULL)
+ return;
- if (msg != NULL)
- {
- gc->away = g_strdup("");
- status = MSN_AWAY;
- }
- else if (state)
- {
- gc->away = g_strdup("");
+ session = gc->proto_data;
- if (!strcmp(state, _("Away From Computer")))
- status = MSN_AWAY;
- else if (!strcmp(state, _("Be Right Back")))
- status = MSN_BRB;
- else if (!strcmp(state, _("Busy")))
- status = MSN_BUSY;
- else if (!strcmp(state, _("On The Phone")))
- status = MSN_PHONE;
- else if (!strcmp(state, _("Out To Lunch")))
- status = MSN_LUNCH;
- else if (!strcmp(state, _("Hidden")))
- status = MSN_HIDDEN;
- else
- {
- g_free(gc->away);
- gc->away = NULL;
- status = MSN_ONLINE;
- }
- }
- else if (gc->is_idle)
- status = MSN_IDLE;
+ state = gaim_status_get_id(status);
+
+ if (!strcmp(state, "away"))
+ msnstatus = MSN_AWAY;
+ else if (!strcmp(state, "brb"))
+ msnstatus = MSN_BRB;
+ else if (!strcmp(state, "busy"))
+ msnstatus = MSN_BUSY;
+ else if (!strcmp(state, "phone"))
+ msnstatus = MSN_PHONE;
+ else if (!strcmp(state, "lunch"))
+ msnstatus = MSN_LUNCH;
+ else if (!strcmp(state, "hidden"))
+ msnstatus = MSN_HIDDEN;
+ else if (0) /* how do we detect idle with new status? */
+ msnstatus = MSN_IDLE;
else
- status = MSN_ONLINE;
+ msnstatus = MSN_ONLINE;
- msn_change_status(session, status);
+ msn_change_status(session, msnstatus);
}
static void
@@ -796,9 +797,6 @@ msn_set_idle(GaimConnection *gc, int idl
session = gc->proto_data;
- if (gc->away != NULL)
- return;
-
msn_change_status(session, (idle ? MSN_IDLE : MSN_ONLINE));
}
@@ -1170,7 +1168,9 @@ msn_tooltip_info_text(MsnGetInfoData *in
info_data->name);
if (b) {
+ GaimPresence *presence;
char *statustext = msn_tooltip_text(b);
+ presence = gaim_buddy_get_presence(b);
if(b->alias && b->alias[0]) {
char *aliastext = g_markup_escape_text(b->alias, -1);
g_string_append_printf(s, _("Alias: %s
"), aliastext);
@@ -1183,8 +1183,9 @@ msn_tooltip_info_text(MsnGetInfoData *in
nicktext);
g_free(nicktext);
}
- if (b->idle > 0) {
- char *idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
+ if (gaim_presence_is_idle(presence)) {
+ char *idletime = gaim_str_seconds_to_string(time(NULL) -
+ gaim_presence_get_idle_time(presence));
g_string_append_printf(s, _("%s: %s
"), _("Idle"),
idletime);
g_free(idletime);
@@ -1685,7 +1686,7 @@ static GaimPluginProtocolInfo prpl_info
NULL, /* set_info */
msn_send_typing, /* send_typing */
msn_get_info, /* get_info */
- msn_set_away, /* set_away */
+ msn_set_status, /* set_away */
msn_set_idle, /* set_idle */
NULL, /* change_passwd */
msn_add_buddy, /* add_buddy */
Index: src/protocols/msn/notification.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/protocols/msn/notification.c,v
retrieving revision 1.114
diff -u -p -r1.114 notification.c
--- src/protocols/msn/notification.c 1 Sep 2004 01:07:39 -0000 1.114
+++ src/protocols/msn/notification.c 5 Sep 2004 16:17:20 -0000
@@ -453,7 +453,7 @@ fln_cmd(MsnCmdProc *cmdproc, MsnCommand
gc = cmdproc->session->account->gc;
- serv_got_update(gc, cmd->params[0], FALSE, 0, 0, 0, 0);
+ serv_got_update(gc, cmd->params[0], FALSE, 0);
}
static void
@@ -463,10 +463,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand
GaimConnection *gc;
MsnUser *user;
MsnObject *msnobj;
- int status = 0;
- int idle = 0;
- const char *state, *passport, *friendly;
- GaimBuddy *b;
+ const char *status, *state, *passport, *friendly;
session = cmdproc->session;
gc = session->account->gc;
@@ -488,26 +485,30 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand
msn_user_set_object(user, msnobj);
}
+/* what does this do?????
if ((b = gaim_find_buddy(gc->account, passport)) != NULL)
- status |= ((((b->uc) >> 1) & 0xF0) << 1);
+ status |= ((((b->uc) >> 1) & 0xF0) << 1); */
if (!g_ascii_strcasecmp(state, "BSY"))
- status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
+ status = "busy";
else if (!g_ascii_strcasecmp(state, "IDL"))
{
- status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
- idle = -1;
+ /* do something about idle time? */
+ status = "idle";
}
else if (!g_ascii_strcasecmp(state, "BRB"))
- status |= UC_UNAVAILABLE | (MSN_BRB << 1);
+ status = "brb";
else if (!g_ascii_strcasecmp(state, "AWY"))
- status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
+ status = "away";
else if (!g_ascii_strcasecmp(state, "PHN"))
- status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
+ status = "phone";
else if (!g_ascii_strcasecmp(state, "LUN"))
- status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
+ status = "lunch";
+ else
+ status = "available";
- serv_got_update(gc, passport, TRUE, 0, 0, idle, status);
+ /* serv_got_update(gc, passport, TRUE, 0, 0, idle, status); */
+ gaim_prpl_got_user_status(gc->account, passport, status, NULL);
}
static void
@@ -535,8 +536,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand
const char *state;
const char *passport;
const char *friendly;
- int status = 0;
- int idle = 0;
+ const char *status;
session = cmdproc->session;
gc = session->account->gc;
@@ -567,22 +567,25 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand
}
if (!g_ascii_strcasecmp(state, "BSY"))
- status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
+ status = "busy";
else if (!g_ascii_strcasecmp(state, "IDL"))
{
- status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
- idle = -1;
+ /* do something about idle time? */
+ status = "idle";
}
else if (!g_ascii_strcasecmp(state, "BRB"))
- status |= UC_UNAVAILABLE | (MSN_BRB << 1);
+ status = "brb";
else if (!g_ascii_strcasecmp(state, "AWY"))
- status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
+ status = "away";
else if (!g_ascii_strcasecmp(state, "PHN"))
- status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
+ status = "phone";
else if (!g_ascii_strcasecmp(state, "LUN"))
- status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
+ status = "lunch";
+ else
+ status = "available";
- serv_got_update(gc, passport, TRUE, 0, 0, idle, status);
+ /* serv_got_update(gc, passport, TRUE, 0, 0, idle, status); */
+ gaim_prpl_got_user_status(gc->account, passport, status, NULL);
}
static void