[PATCH 2/4] Use NULL instead of "offline" for the user status.
Felipe Contreras
felipe.contreras at gmail.com
Sun Jun 22 11:03:19 EDT 2008
Initially offline users had a NULL status, so the UI wasn't updated
accordingly. Making this consistent makes things easier.
---
libpurple/protocols/msn/notification.c | 2 +-
libpurple/protocols/msn/user.c | 12 +++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c
index 0fc7560..7387e5e 100644
--- a/libpurple/protocols/msn/notification.c
+++ b/libpurple/protocols/msn/notification.c
@@ -1017,7 +1017,7 @@ fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
/* Tell libpurple that the user has signed off */
user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]);
- user->status = "offline";
+ msn_user_set_state(user, NULL);
msn_user_update(user);
/* If we have an open MsnSlpLink with the user then close it */
diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c
index a73cec2..060ab97 100644
--- a/libpurple/protocols/msn/user.c
+++ b/libpurple/protocols/msn/user.c
@@ -95,8 +95,8 @@ msn_user_update(MsnUser *user)
account = user->userlist->session->account;
- if (user->status != NULL) {
- gboolean offline = (strcmp(user->status, "offline") == 0);
+ {
+ gboolean offline = (user->status == NULL);
if (!offline) {
purple_prpl_got_user_status(account, user->passport, user->status,
@@ -106,7 +106,7 @@ msn_user_update(MsnUser *user)
purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
purple_prpl_got_user_status(account, user->passport, "available", NULL);
} else {
- purple_prpl_got_user_status(account, user->passport, user->status, NULL);
+ purple_prpl_got_user_status(account, user->passport, "offline", NULL);
}
}
@@ -136,6 +136,12 @@ msn_user_set_state(MsnUser *user, const char *state)
{
const char *status;
+ if (state == NULL)
+ {
+ user->status = NULL;
+ return;
+ }
+
if (!g_ascii_strcasecmp(state, "BSY"))
status = "busy";
else if (!g_ascii_strcasecmp(state, "BRB"))
--
1.5.6
More information about the Devel
mailing list