Mercurial > pidgin
changeset 9967:2f153f8cdf81
[gaim-migrate @ 10877]
(21:12:31) KingAnt: What's up with MSN status stuff?
(21:12:33) KingAnt: I want to compile
(21:12:35) LSchiere: hey mark :-)
(21:12:39) LSchiere: lack of patches
(21:12:48) nosnilmot:
http://nosnilmot.com/patches/gaim-1.0.0cvs-msn-status.patch
(21:12:54) KingAnt: Ha ha
(21:12:57) LSchiere: there we go :-D
(21:12:58) nosnilmot: might be good enough, might not
(21:13:06) KingAnt: I need to ask these kinds of questions more often
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 08 Sep 2004 01:16:14 +0000 |
parents | b15c177895b9 |
children | 67468d443cd1 |
files | src/protocols/msn/msn.c src/protocols/msn/notification.c |
diffstat | 2 files changed, 93 insertions(+), 89 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/msn.c Wed Sep 08 01:10:26 2004 +0000 +++ b/src/protocols/msn/msn.c Wed Sep 08 01:16:14 2004 +0000 @@ -392,17 +392,19 @@ 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 @@ 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 @@ } 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; + + gc = gaim_account_get_connection(account); + + if (gc == NULL) + return; session = gc->proto_data; - if (gc->away != NULL) - { - g_free(gc->away); - gc->away = NULL; - } - - if (msg != NULL) - { - gc->away = g_strdup(""); - status = MSN_AWAY; - } - else if (state) - { - gc->away = g_strdup(""); + state = gaim_status_get_id(status); - 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; + 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 @@ session = gc->proto_data; - if (gc->away != NULL) - return; - msn_change_status(session, (idle ? MSN_IDLE : MSN_ONLINE)); } @@ -1170,7 +1168,9 @@ 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, _("<b>Alias:</b> %s<br>"), aliastext); @@ -1183,8 +1183,9 @@ 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, _("<b>%s:</b> %s<br>"), _("Idle"), idletime); g_free(idletime); @@ -1685,7 +1686,7 @@ 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 */
--- a/src/protocols/msn/notification.c Wed Sep 08 01:10:26 2004 +0000 +++ b/src/protocols/msn/notification.c Wed Sep 08 01:16:14 2004 +0000 @@ -453,7 +453,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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