comparison src/server.c @ 12981:880844bef520

[gaim-migrate @ 15334] Don't auto-reply when we're invisible, either committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 21 Jan 2006 22:33:12 +0000
parents b7fd4315ab79
children 44a8d46ee3c1
comparison
equal deleted inserted replaced
12980:b7fd4315ab79 12981:880844bef520
430 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, 430 void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
431 GaimMessageFlags flags, time_t mtime) 431 GaimMessageFlags flags, time_t mtime)
432 { 432 {
433 GaimAccount *account; 433 GaimAccount *account;
434 GaimConversation *cnv; 434 GaimConversation *cnv;
435 GaimPresence *presence;
436 GaimStatus *status;
437 char *message, *name; 435 char *message, *name;
438 char *angel, *buffy; 436 char *angel, *buffy;
439 int plugin_return; 437 int plugin_return;
440 438
441 g_return_if_fail(msg != NULL); 439 g_return_if_fail(msg != NULL);
445 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { 443 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) {
446 /* protocol does not support privacy, handle it ourselves */ 444 /* protocol does not support privacy, handle it ourselves */
447 if (!gaim_privacy_check(account, who)) 445 if (!gaim_privacy_check(account, who))
448 return; 446 return;
449 } 447 }
450
451 presence = gaim_account_get_presence(account);
452 448
453 /* 449 /*
454 * We should update the conversation window buttons and menu, 450 * We should update the conversation window buttons and menu,
455 * if it exists. 451 * if it exists.
456 */ 452 */
513 * - or we're not idle and the 'only auto respond if idle' pref 509 * - or we're not idle and the 'only auto respond if idle' pref
514 * is set 510 * is set
515 */ 511 */
516 if (gc->flags & GAIM_CONNECTION_AUTO_RESP) 512 if (gc->flags & GAIM_CONNECTION_AUTO_RESP)
517 { 513 {
514 GaimPresence *presence;
515 GaimStatus *status;
516 GaimStatusType *status_type;
517 GaimStatusPrimitive primitive;
518 const gchar *auto_reply_pref; 518 const gchar *auto_reply_pref;
519 const char *away_msg = NULL; 519 const char *away_msg = NULL;
520 520
521 auto_reply_pref = gaim_prefs_get_string("/core/away/auto_reply"); 521 auto_reply_pref = gaim_prefs_get_string("/core/away/auto_reply");
522 522
523 presence = gaim_account_get_presence(account);
523 status = gaim_presence_get_active_status(presence); 524 status = gaim_presence_get_active_status(presence);
524 if (gaim_status_is_available(status) || 525 status_type = gaim_status_get_type(status);
526 primitive = gaim_status_type_get_primitive(status_type);
527 if ((primitive == GAIM_STATUS_AVAILABLE) ||
528 (primitive == GAIM_STATUS_INVISIBLE) ||
529 (primitive == GAIM_STATUS_MOBILE) ||
525 !strcmp(auto_reply_pref, "never") || 530 !strcmp(auto_reply_pref, "never") ||
526 (!gaim_presence_is_idle(presence) && 531 (!gaim_presence_is_idle(presence) && !strcmp(auto_reply_pref, "awayidle")))
527 !strcmp(auto_reply_pref, "awayidle")))
528 { 532 {
529 g_free(name); 533 g_free(name);
530 return; 534 return;
531 } 535 }
532 536