Mercurial > pidgin
diff src/protocols/irc/irc.c @ 9944:e4a27c9aec4c
[gaim-migrate @ 10838]
with much rejoicing, and massive thanks to the efforts of Christian, and
all who have helped him, I present to you the incomplete status
rewrite!
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Fri, 03 Sep 2004 21:35:52 +0000 |
| parents | f8e395a054e2 |
| children | 42cdec4f639b |
line wrap: on
line diff
--- a/src/protocols/irc/irc.c Fri Sep 03 21:21:25 2004 +0000 +++ b/src/protocols/irc/irc.c Fri Sep 03 21:35:52 2004 +0000 @@ -145,9 +145,30 @@ *se = "offline"; } -static GList *irc_away_states(GaimConnection *gc) +static GList *irc_status_types(GaimAccount *account) { - return g_list_append(NULL, (gpointer)GAIM_AWAY_CUSTOM); + GaimStatusType *type; + GList *types = NULL; + + type = gaim_status_type_new(GAIM_STATUS_OFFLINE, "offline", + _("Offline"), FALSE); + types = g_list_append(types, type); + + type = gaim_status_type_new(GAIM_STATUS_ONLINE, "online", + _("Online"), FALSE); + types = g_list_append(types, type); + + type = gaim_status_type_new(GAIM_STATUS_AVAILABLE, "available", + _("Available"), TRUE); + types = g_list_append(types, type); + + type = gaim_status_type_new_with_attrs( + GAIM_STATUS_AWAY, "away", _("Away"), TRUE, TRUE, FALSE, + "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); + + types = g_list_append(types, type); + + return types; } static GList *irc_actions(GaimPlugin *plugin, gpointer context) @@ -344,20 +365,18 @@ irc_cmd_whois(irc, "whois", NULL, args); } -static void irc_set_away(GaimConnection *gc, const char *state, const char *msg) +static void irc_set_status(GaimAccount *account, GaimStatus *status) { + GaimConnection *gc = gaim_account_get_connection(account); struct irc_conn *irc = gc->proto_data; const char *args[1]; + const char *status_id = gaim_status_get_id(status); - if (gc->away) { - g_free(gc->away); - gc->away = NULL; - } + if (!strcmp(status_id, "away")) + args[0] = gaim_status_get_attr_string(status, "message"); + else if (!strcmp(status_id, "available")) + args[0] = NULL; - if (msg) - gc->away = g_strdup(msg); - - args[0] = msg; irc_cmd_away(irc, "away", NULL, args); }
