Mercurial > pidgin.yaz
changeset 10762:019229bf8b7e
[gaim-migrate @ 12366]
A start on converting Novell to use the new status API. I don't know
when I'll get a chance to work on this again, so I'm committing this
now. If anyone wants to take a stab at it, feel free. Might want
to IM me if you start working on it (markdoliner on AIM and MSN,
lbdash on Yahoo!)
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 31 Mar 2005 03:42:38 +0000 |
parents | 7c6b69eb82f2 |
children | ec8b632c0e2a |
files | src/protocols/novell/novell.c |
diffstat | 1 files changed, 72 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/novell/novell.c Tue Mar 29 15:12:14 2005 +0000 +++ b/src/protocols/novell/novell.c Thu Mar 31 03:42:38 2005 +0000 @@ -30,6 +30,7 @@ #include "request.h" #include "network.h" #include "privacy.h" +#include "status.h" #include "version.h" #define DEFAULT_PORT 8300 @@ -2917,22 +2918,79 @@ return NULL; } -#if 0 + +/* + * TODO: Someone that uses this protocol needs to verify + * that these are correct and work. + * + * Before the status rewrite, Novell had the following + * user-setable statuses: Available, Away, Busy, Appear + * Offline and GAIM_AWAY_CUSTOM. Are all of those taken + * care of with the statuses below? + */ static GList * -novell_away_states(GaimConnection * gc) +novell_status_types(GaimAccount *account) { - GList *m = NULL; - - m = g_list_append(m, _("Available")); - m = g_list_append(m, _("Away")); - m = g_list_append(m, _("Busy")); - m = g_list_append(m, _("Appear Offline")); - m = g_list_append(m, GAIM_AWAY_CUSTOM); - - return m; + GList *status_types = NULL; + GaimStatusType *type; + + g_return_val_if_fail(account != NULL, NULL); + + type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, "offline", _("Offline"), FALSE, TRUE, FALSE); + status_types = g_list_append(status_types, type); + + /* TODO: Do we need both an "online" and an "available" state? */ + type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, "online", _("Online"), FALSE, TRUE, FALSE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, "available", _("Available"), TRUE, TRUE, TRUE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_AWAY, "away", _("Away"), TRUE, TRUE, TRUE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_AWAY, "busy", _("Busy"), TRUE, TRUE, TRUE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, "appearoffline", _("Appear Offline"), TRUE, TRUE, TRUE); + status_types = g_list_append(status_types, type); + + return status_types; } static void +novell_set_status(GaimAccount *account, GaimStatus *status) +{ + gboolean connected; + GaimStatusType *type; + int primitive; + + connected = gaim_account_is_connected(account); + type = gaim_status_get_type(status); + primitive = gaim_status_type_get_primitive(type); + + /* + * We don't have any independent statuses, so we don't need to + * do anything when a status is deactivated (because another + * status is about to be activated). + */ + if (!gaim_status_is_active(status)) + return; + + if (primitive != GAIM_STATUS_OFFLINE && !connected) { + gaim_account_connect(account); + } else if (primitive == GAIM_STATUS_OFFLINE && connected) { + gaim_account_disconnect(account); + } else { + if (!connected) + return; + + /* TODO: Need to do the same stuff that novell_set_away does here */ + } +} + +#if 0 +static void novell_set_away(GaimConnection * gc, const char *state, const char *msg) { NMUser *user; @@ -3003,6 +3061,7 @@ g_free(text); } #endif + static void novell_add_permit(GaimConnection *gc, const char *who) { @@ -3410,7 +3469,7 @@ novell_list_emblems, /* list_emblems */ novell_status_text, /* status_text */ novell_tooltip_text, /* tooltip_text */ - /*novell_away_states*/NULL, /* away_states */ + novell_status_types, /* status_types */ novell_blist_node_menu, /* blist_node_menu */ NULL, /* chat_info */ NULL, /* chat_info_defaults */ @@ -3420,7 +3479,7 @@ NULL, /* set_info */ novell_send_typing, /* send_typing */ novell_get_info, /* get_info */ - /*novell_set_away*/ NULL, /* set_away */ + novell_set_status, /* set_status */ novell_set_idle, /* set_idle */ NULL, /* change_passwd */ novell_add_buddy, /* add_buddy */