comparison 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
comparison
equal deleted inserted replaced
9943:f8e395a054e2 9944:e4a27c9aec4c
143 { 143 {
144 if (b->present == GAIM_BUDDY_OFFLINE) 144 if (b->present == GAIM_BUDDY_OFFLINE)
145 *se = "offline"; 145 *se = "offline";
146 } 146 }
147 147
148 static GList *irc_away_states(GaimConnection *gc) 148 static GList *irc_status_types(GaimAccount *account)
149 { 149 {
150 return g_list_append(NULL, (gpointer)GAIM_AWAY_CUSTOM); 150 GaimStatusType *type;
151 GList *types = NULL;
152
153 type = gaim_status_type_new(GAIM_STATUS_OFFLINE, "offline",
154 _("Offline"), FALSE);
155 types = g_list_append(types, type);
156
157 type = gaim_status_type_new(GAIM_STATUS_ONLINE, "online",
158 _("Online"), FALSE);
159 types = g_list_append(types, type);
160
161 type = gaim_status_type_new(GAIM_STATUS_AVAILABLE, "available",
162 _("Available"), TRUE);
163 types = g_list_append(types, type);
164
165 type = gaim_status_type_new_with_attrs(
166 GAIM_STATUS_AWAY, "away", _("Away"), TRUE, TRUE, FALSE,
167 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING));
168
169 types = g_list_append(types, type);
170
171 return types;
151 } 172 }
152 173
153 static GList *irc_actions(GaimPlugin *plugin, gpointer context) 174 static GList *irc_actions(GaimPlugin *plugin, gpointer context)
154 { 175 {
155 GList *list = NULL; 176 GList *list = NULL;
342 const char *args[1]; 363 const char *args[1];
343 args[0] = who; 364 args[0] = who;
344 irc_cmd_whois(irc, "whois", NULL, args); 365 irc_cmd_whois(irc, "whois", NULL, args);
345 } 366 }
346 367
347 static void irc_set_away(GaimConnection *gc, const char *state, const char *msg) 368 static void irc_set_status(GaimAccount *account, GaimStatus *status)
348 { 369 {
370 GaimConnection *gc = gaim_account_get_connection(account);
349 struct irc_conn *irc = gc->proto_data; 371 struct irc_conn *irc = gc->proto_data;
350 const char *args[1]; 372 const char *args[1];
351 373 const char *status_id = gaim_status_get_id(status);
352 if (gc->away) { 374
353 g_free(gc->away); 375 if (!strcmp(status_id, "away"))
354 gc->away = NULL; 376 args[0] = gaim_status_get_attr_string(status, "message");
355 } 377 else if (!strcmp(status_id, "available"))
356 378 args[0] = NULL;
357 if (msg) 379
358 gc->away = g_strdup(msg);
359
360 args[0] = msg;
361 irc_cmd_away(irc, "away", NULL, args); 380 irc_cmd_away(irc, "away", NULL, args);
362 } 381 }
363 382
364 static void irc_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) 383 static void irc_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
365 { 384 {