changeset 12924:e841e23a334c

[gaim-migrate @ 15277] patch #1408512 Psychic popups: disable when away committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Wed, 18 Jan 2006 03:04:25 +0000
parents f50a99d5ba9b
children fd734d1fb2f4
files COPYRIGHT plugins/psychic.c
diffstat 2 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Jan 18 02:58:15 2006 +0000
+++ b/COPYRIGHT	Wed Jan 18 03:04:25 2006 +0000
@@ -172,6 +172,7 @@
 Arkadiusz Miskiewicz
 Andrew Molloy
 Sergio Moretto
+Richard Nelson
 Matthew A. Nicholson
 Szilard Novaki
 Novell
--- a/plugins/psychic.c	Wed Jan 18 02:58:15 2006 +0000
+++ b/plugins/psychic.c	Wed Jan 18 03:04:25 2006 +0000
@@ -2,10 +2,12 @@
 
 #include "internal.h"
 
+#include "account.h"
 #include "blist.h"
 #include "conversation.h"
 #include "debug.h"
 #include "signals.h"
+#include "status.h"
 #include "version.h"
 
 #include "plugin.h"
@@ -27,17 +29,23 @@
 #define PREFS_BASE    "/plugins/core/psychic"
 #define PREF_BUDDIES  PREFS_BASE "/buddies_only"
 #define PREF_NOTICE   PREFS_BASE "/show_notice"
+#define PREF_STATUS   PREFS_BASE "/activate_online"
 
 
 static void
 buddy_typing_cb(GaimAccount *acct, const char *name, void *data) {
   GaimConversation *gconv;
 
-  if(gaim_prefs_get_bool(PREF_BUDDIES)) {
-    if(! gaim_find_buddy(acct, name)) {
-      DEBUG_INFO("not in blist, doing nothing\n");
-      return;
-    }
+  if(gaim_prefs_get_bool(PREF_STATUS) &&
+     gaim_status_is_available(gaim_account_get_active_status(acct))) {
+    DEBUG_INFO("not available, doing nothing\n");
+    return;
+  }
+
+  if(gaim_prefs_get_bool(PREF_BUDDIES) &&
+     ! gaim_find_buddy(acct, name)) {
+    DEBUG_INFO("not in blist, doing nothing\n");
+    return;
   }
 
   gconv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, acct);
@@ -65,7 +73,12 @@
   frame = gaim_plugin_pref_frame_new();
   
   pref = gaim_plugin_pref_new_with_name(PREF_BUDDIES);
-  gaim_plugin_pref_set_label(pref, _("Only enable for users on the buddy list"));
+  gaim_plugin_pref_set_label(pref, _("Only enable for users on"
+				     " the buddy list"));
+  gaim_plugin_pref_frame_add(frame, pref);
+
+  pref = gaim_plugin_pref_new_with_name(PREF_STATUS);
+  gaim_plugin_pref_set_label(pref, _("Disable when away"));
   gaim_plugin_pref_frame_add(frame, pref);
 
   pref = gaim_plugin_pref_new_with_name(PREF_NOTICE);
@@ -131,6 +144,7 @@
   gaim_prefs_add_none(PREFS_BASE);
   gaim_prefs_add_bool(PREF_BUDDIES, FALSE);
   gaim_prefs_add_bool(PREF_NOTICE, TRUE);
+  gaim_prefs_add_bool(PREF_STATUS, TRUE);
 }