Mercurial > pidgin.yaz
annotate libpurple/plugins/joinpart.c @ 15617:03e40db222eb
"Oopsy daisy"
EW!
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 11 Feb 2007 04:01:36 +0000 |
parents | 3b6ce2116f74 |
children | 32c366eeeb99 |
rev | line source |
---|---|
15566
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
2 * gaim |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
3 * |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
4 * Gaim is the legal property of its developers, whose names are too numerous |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
6 * source distribution. |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
7 * |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
12 * |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
17 * |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
21 */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
22 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
23 #include "internal.h" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
24 #include "conversation.h" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
25 #include "debug.h" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
26 #include "plugin.h" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
27 #include "version.h" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
28 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
29 #define JOINPART_PLUGIN_ID "core-rlaager-joinpart" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
30 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
31 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
32 /* Preferences */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
33 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
34 /* The number of minutes before a person is considered |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
35 * to have stopped being part of active conversation. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
36 #define DELAY_PREF "/plugins/core/joinpart/delay" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
37 #define DELAY_DEFAULT 10 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
38 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
39 /* The number of people that must be in a room for this |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
40 * plugin to have any effect */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
41 #define THRESHOLD_PREF "/plugins/core/joinpart/threshold" |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
42 #define THRESHOLD_DEFAULT 20 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
43 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
44 struct joinpart_key |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
45 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
46 GaimConversation *conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
47 char *user; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
48 }; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
50 static guint joinpart_key_hash(const struct joinpart_key *key) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 g_return_val_if_fail(key != NULL, 0); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
53 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
54 return g_direct_hash(key->conv) + g_str_hash(key->user); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
55 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
57 static gboolean joinpart_key_equal(const struct joinpart_key *a, const struct joinpart_key *b) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
58 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 if (a == NULL) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
60 return (b == NULL); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 else if (b == NULL) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
62 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
64 return (a->conv == b->conv) && !strcmp(a->user, b->user); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
66 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
67 static void joinpart_key_destroy(struct joinpart_key *key) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
68 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
69 g_return_if_fail(key != NULL); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
70 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
71 g_free(key->user); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
72 g_free(key); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
73 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
74 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
75 static gboolean should_hide_notice(GaimConversation *conv, const char *name, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
76 GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
77 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
78 GaimConvChat *chat; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
79 int threshold; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
80 struct joinpart_key *key; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 time_t *last_said; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
82 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
83 g_return_val_if_fail(conv != NULL, FALSE); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
84 g_return_val_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT, FALSE); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
85 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
86 /* If the room is small, don't bother. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
87 chat = GAIM_CONV_CHAT(conv); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
88 threshold = gaim_prefs_get_int(THRESHOLD_PREF); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 if (g_list_length(gaim_conv_chat_get_users(chat)) < threshold) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
90 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
91 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
92 /* We always care about our buddies! */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
93 if (gaim_find_buddy(gaim_conversation_get_account(conv), name)) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
95 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
96 /* Only show the notice if the user has spoken recently. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
97 key = g_new(struct joinpart_key, 1); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 key->conv = conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
99 key->user = g_strdup(name); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
100 last_said = g_hash_table_lookup(users, key); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
101 if (last_said != NULL) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
102 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
103 int delay = gaim_prefs_get_int(DELAY_PREF); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
105 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
106 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
107 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
108 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
109 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
110 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
111 static gboolean chat_buddy_leaving_cb(GaimConversation *conv, const char *name, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 const char *reason, GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
113 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
114 return should_hide_notice(conv, name, users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
115 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
116 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 static gboolean chat_buddy_joining_cb(GaimConversation *conv, const char *name, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
118 GaimConvChatBuddyFlags flags, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
119 GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
120 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
121 return should_hide_notice(conv, name, users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
122 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
123 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
124 static void received_chat_msg_cb(GaimAccount *account, char *sender, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
125 char *message, GaimConversation *conv, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
126 GaimMessageFlags flags, GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
127 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
128 struct joinpart_key key; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
129 time_t *last_said; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
130 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
131 /* Most of the time, we'll already have tracked the user, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
132 * so we avoid memory allocation here. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
133 key.conv = conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
134 key.user = sender; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
135 last_said = g_hash_table_lookup(users, &key); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
136 if (last_said != NULL) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
137 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
138 /* They just said something, so update the time. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
139 time(last_said); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
140 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
141 else |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
142 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
143 struct joinpart_key *key2; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
144 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
145 key2 = g_new(struct joinpart_key, 1); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
146 key2->conv = conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
147 key2->user = g_strdup(sender); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
148 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
149 last_said = g_new(time_t, 1); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
150 time(last_said); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
151 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
152 g_hash_table_insert(users, key2, last_said); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
153 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
154 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
155 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
156 static gboolean check_expire_time(struct joinpart_key *key, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
157 time_t *last_said, time_t *limit) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
158 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
159 gaim_debug_info("joinpart", "Removing key for %s/%s\n", key->conv->name, key->user); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
160 return (*last_said < *limit); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
161 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
162 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
163 static gboolean clean_users_hash(GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
164 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
165 int delay = gaim_prefs_get_int(DELAY_PREF); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
166 time_t limit = time(NULL) - (60 * delay); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
167 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
168 g_hash_table_foreach_remove(users, (GHRFunc)check_expire_time, &limit); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
169 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
170 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
171 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
172 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
173 static gboolean plugin_load(GaimPlugin *plugin) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
174 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
175 void *conv_handle; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
176 GHashTable *users; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
177 guint id; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
178 gpointer *data; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
179 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
180 users = g_hash_table_new_full((GHashFunc)joinpart_key_hash, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
181 (GEqualFunc)joinpart_key_equal, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
182 (GDestroyNotify)joinpart_key_destroy, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
183 g_free); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
184 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
185 conv_handle = gaim_conversations_get_handle(); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
186 gaim_signal_connect(conv_handle, "chat-buddy-joining", plugin, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
187 GAIM_CALLBACK(chat_buddy_joining_cb), users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
188 gaim_signal_connect(conv_handle, "chat-buddy-leaving", plugin, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
189 GAIM_CALLBACK(chat_buddy_leaving_cb), users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
190 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
191 GAIM_CALLBACK(received_chat_msg_cb), users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
192 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
193 /* Cleanup every 5 minutes */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
194 id = gaim_timeout_add(1000 * 60 * 5, (GSourceFunc)clean_users_hash, users); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
195 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
196 data = g_new(gpointer, 2); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
197 data[0] = users; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
198 data[1] = GUINT_TO_POINTER(id); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
199 plugin->extra = data; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
200 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
201 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
202 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
203 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
204 static gboolean plugin_unload(GaimPlugin *plugin) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
205 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
206 gpointer *data = plugin->extra; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
207 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
208 /* Destroy the hash table. The core plugin code will |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
209 * disconnect the signals, and since Gaim is single-threaded, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
210 * we don't have to worry one will be called after this. */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
211 g_hash_table_destroy((GHashTable *)data[0]); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
212 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
213 g_source_remove(GPOINTER_TO_UINT(data[1])); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
214 g_free(data); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
215 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
216 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
217 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
218 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
219 static GaimPluginPrefFrame * |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
220 get_plugin_pref_frame(GaimPlugin *plugin) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
221 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
222 GaimPluginPrefFrame *frame; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
223 GaimPluginPref *ppref; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
224 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
225 g_return_val_if_fail(plugin != NULL, FALSE); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
226 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
227 frame = gaim_plugin_pref_frame_new(); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
228 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
229 ppref = gaim_plugin_pref_new_with_label(_("Join/Part Hiding Configuration")); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
230 gaim_plugin_pref_frame_add(frame, ppref); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
231 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
232 ppref = gaim_plugin_pref_new_with_name_and_label(THRESHOLD_PREF, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
233 _("Minimum Room Size")); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
234 gaim_plugin_pref_set_bounds(ppref, 0, 1000); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
235 gaim_plugin_pref_frame_add(frame, ppref); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
236 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
237 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
238 ppref = gaim_plugin_pref_new_with_name_and_label(DELAY_PREF, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
239 _("User Inactivity Timeout (in minutes)")); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
240 gaim_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
241 gaim_plugin_pref_frame_add(frame, ppref); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
242 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
243 return frame; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
244 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
245 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
246 static GaimPluginUiInfo prefs_info = { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
247 get_plugin_pref_frame, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
248 0, /* page_num (reserved) */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
249 NULL /* frame (reserved) */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
250 }; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
251 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
252 static GaimPluginInfo info = |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
253 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
254 GAIM_PLUGIN_MAGIC, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
255 GAIM_MAJOR_VERSION, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
256 GAIM_MINOR_VERSION, |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
257 GAIM_PLUGIN_STANDARD, /**< type */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
258 NULL, /**< ui_requirement */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
259 0, /**< flags */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
260 NULL, /**< dependencies */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
261 GAIM_PRIORITY_DEFAULT, /**< priority */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
262 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
263 JOINPART_PLUGIN_ID, /**< id */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
264 N_("Join/Part Hiding"), /**< name */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
265 VERSION, /**< version */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
266 /** summary */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
267 N_("Hides extraneous join/part messages."), |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
268 /** description */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
269 N_("This plugin hides join/part messages in large " |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
270 "rooms, except for those users actively taking " |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
271 "part in a conversation."), |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
272 "Richard Laager <rlaager@pidgin.im>", /**< author */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
273 GAIM_WEBSITE, /**< homepage */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
274 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
275 plugin_load, /**< load */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
276 plugin_unload, /**< unload */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
277 NULL, /**< destroy */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
278 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
279 NULL, /**< ui_info */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
280 NULL, /**< extra_info */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
281 &prefs_info, /**< prefs_info */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
282 NULL /**< actions */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
283 }; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
284 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
285 static void |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
286 init_plugin(GaimPlugin *plugin) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
287 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
288 gaim_prefs_add_none("/plugins/core/joinpart"); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
289 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
290 gaim_prefs_add_int(DELAY_PREF, DELAY_DEFAULT); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
291 gaim_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
292 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
293 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
294 GAIM_INIT_PLUGIN(joinpart, init_plugin, info) |