Mercurial > pidgin
comparison src/prpl.c @ 10007:267a2b69e36e
[gaim-migrate @ 10924]
Better i18nability and more uniform code?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Sep 2004 04:30:37 +0000 |
parents | 9baedaca25c7 |
children | a38881ec9c0f |
comparison
equal
deleted
inserted
replaced
10006:9baedaca25c7 | 10007:267a2b69e36e |
---|---|
55 if (login_time == 0) | 55 if (login_time == 0) |
56 login_time = time(NULL); | 56 login_time = time(NULL); |
57 | 57 |
58 presence = gaim_account_get_presence(account); | 58 presence = gaim_account_get_presence(account); |
59 | 59 |
60 /* | 60 gaim_presence_set_login_time(presence, login_time); |
61 * TODO: Set a presence's sign-on time. We don't support this yet. | |
62 */ | |
63 gaim_debug_warning("prpl", | |
64 "Attempting to set an account's sign-on time, but we " | |
65 "don't support this yet! FIX IT!\n"); | |
66 } | 61 } |
67 | 62 |
68 static gboolean | 63 static gboolean |
69 set_value_from_arg(GaimStatus *status, const char *id, va_list *args) | 64 set_value_from_arg(GaimStatus *status, const char *id, va_list *args) |
70 { | 65 { |
195 gaim_prpl_got_account_warning_level(GaimAccount *account, const char *username, | 190 gaim_prpl_got_account_warning_level(GaimAccount *account, const char *username, |
196 unsigned int level) | 191 unsigned int level) |
197 { | 192 { |
198 GaimPresence *presence; | 193 GaimPresence *presence; |
199 unsigned int old_level; | 194 unsigned int old_level; |
200 char buf2[1024]; | 195 gchar *buf; |
201 | 196 |
202 g_return_if_fail(account != NULL); | 197 g_return_if_fail(account != NULL); |
203 | 198 |
204 presence = gaim_account_get_presence(account); | 199 presence = gaim_account_get_presence(account); |
205 | 200 |
210 gaim_presence_set_warning_level(presence, level); | 205 gaim_presence_set_warning_level(presence, level); |
211 | 206 |
212 if (old_level >= level) | 207 if (old_level >= level) |
213 return; | 208 return; |
214 | 209 |
215 g_snprintf(buf2, sizeof(buf2), | 210 if (username == NULL) |
216 _("%s has just been warned by %s.\n" | 211 buf = g_strdup_printf(_("%s has just been warned by an anonymous " |
217 "Your new warning level is %d%%"), | 212 "person.\nYour new warning level is %d%%"), |
218 gaim_account_get_username(account), | 213 gaim_account_get_username(account), |
219 (username == NULL ? _("an anonymous person") : username), | 214 level); |
220 level); | 215 else |
221 | 216 buf = g_strdup_printf(_("%s has just been warned by %s.\n" |
222 gaim_notify_info(NULL, NULL, buf2, NULL); | 217 "Your new warning level is %d%%"), |
218 gaim_account_get_username(account), | |
219 username, level); | |
220 | |
221 gaim_notify_info(NULL, NULL, buf, NULL); | |
222 | |
223 g_free(buf); | |
223 } | 224 } |
224 | 225 |
225 void | 226 void |
226 gaim_prpl_got_user_idle(GaimAccount *account, const char *name, | 227 gaim_prpl_got_user_idle(GaimAccount *account, const char *name, |
227 gboolean idle, time_t idle_time) | 228 gboolean idle, time_t idle_time) |
228 { | 229 { |
229 GaimBuddy *buddy; | 230 GaimBuddy *buddy; |
231 GaimPresence *presence; | |
230 | 232 |
231 g_return_if_fail(account != NULL); | 233 g_return_if_fail(account != NULL); |
232 g_return_if_fail(name != NULL); | 234 g_return_if_fail(name != NULL); |
233 g_return_if_fail(gaim_account_is_connected(account)); | 235 g_return_if_fail(gaim_account_is_connected(account)); |
234 | 236 |
235 if ((buddy = gaim_find_buddy(account, name)) == NULL) | 237 if ((buddy = gaim_find_buddy(account, name)) == NULL) |
236 return; | 238 return; |
237 | 239 |
238 gaim_presence_set_idle(gaim_buddy_get_presence(buddy), idle, idle_time); | 240 presence = gaim_buddy_get_presence(buddy); |
241 | |
242 gaim_presence_set_idle(presence, idle, idle_time); | |
239 } | 243 } |
240 | 244 |
241 void | 245 void |
242 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name, | 246 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name, |
243 time_t login_time) | 247 time_t login_time) |
302 void | 306 void |
303 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name, | 307 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name, |
304 unsigned int level) | 308 unsigned int level) |
305 { | 309 { |
306 GaimBuddy *buddy; | 310 GaimBuddy *buddy; |
311 GaimPresence *presence; | |
307 | 312 |
308 g_return_if_fail(account != NULL); | 313 g_return_if_fail(account != NULL); |
309 g_return_if_fail(name != NULL); | 314 g_return_if_fail(name != NULL); |
310 | 315 |
311 if ((buddy = gaim_find_buddy(account, name)) == NULL) | 316 if ((buddy = gaim_find_buddy(account, name)) == NULL) |
312 return; | 317 return; |
313 | 318 |
314 gaim_presence_set_warning_level(gaim_buddy_get_presence(buddy), level); | 319 presence = gaim_buddy_get_presence(buddy); |
320 | |
321 gaim_presence_set_warning_level(presence, level); | |
315 } | 322 } |
316 | 323 |
317 void | 324 void |
318 gaim_prpl_set_account_status(GaimAccount *account, GaimStatus *status) | 325 gaim_prpl_set_account_status(GaimAccount *account, GaimStatus *status) |
319 { | 326 { |
378 for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) { | 385 for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) { |
379 plugin = (GaimPlugin *)l->data; | 386 plugin = (GaimPlugin *)l->data; |
380 | 387 |
381 /* Just In Case (TM) */ | 388 /* Just In Case (TM) */ |
382 if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) { | 389 if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) { |
383 | |
384 if (!strcmp(plugin->info->id, id)) | 390 if (!strcmp(plugin->info->id, id)) |
385 return plugin; | 391 return plugin; |
386 } | 392 } |
387 } | 393 } |
388 | 394 |