Mercurial > pidgin
annotate libpurple/plugins/joinpart.c @ 23957:b664b3924a52
correctly say we support offline messages for all buddies, this was never
changed apparently
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sat, 23 Aug 2008 23:21:07 +0000 |
parents | 13ca254ea7db |
children | 7f552614ec8a |
rev | line source |
---|---|
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
15822 | 2 * purple |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15565
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 |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18063
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15565
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. */ |
16430 | 36 #define DELAY_PREF "/plugins/core/joinpart/delay" |
15565
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 */ |
16430 | 41 #define THRESHOLD_PREF "/plugins/core/joinpart/threshold" |
15565
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 |
23943
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
44 /* Hide buddies */ |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
45 #define HIDE_BUDDIES_PREF "/plugins/core/joinpart/hide_buddies" |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
46 #define HIDE_BUDDIES_DEFAULT FALSE |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
47 |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
48 struct joinpart_key |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 { |
15822 | 50 PurpleConversation *conv; |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 char *user; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 }; |
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 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
|
55 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 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
|
57 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
58 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
|
59 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
60 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 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
|
62 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 if (a == NULL) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
64 return (b == NULL); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 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
|
66 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
67 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
68 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
|
69 } |
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 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
|
72 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
73 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
|
74 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
75 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
|
76 g_free(key); |
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 |
15822 | 79 static gboolean should_hide_notice(PurpleConversation *conv, const char *name, |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
80 GHashTable *users) |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 { |
15822 | 82 PurpleConvChat *chat; |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
83 int threshold; |
22469 | 84 struct joinpart_key key; |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
85 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
|
86 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
87 g_return_val_if_fail(conv != NULL, FALSE); |
15822 | 88 g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
90 /* If the room is small, don't bother. */ |
15822 | 91 chat = PURPLE_CONV_CHAT(conv); |
92 threshold = purple_prefs_get_int(THRESHOLD_PREF); | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
93 if (g_list_length(purple_conv_chat_get_users(chat)) < threshold) |
15565
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 |
23943
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
96 if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) && |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
97 purple_find_buddy(purple_conversation_get_account(conv), name)) |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 return FALSE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
99 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
100 /* Only show the notice if the user has spoken recently. */ |
22469 | 101 key.conv = conv; |
102 key.user = (gchar *)name; | |
103 last_said = g_hash_table_lookup(users, &key); | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 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
|
105 { |
15822 | 106 int delay = purple_prefs_get_int(DELAY_PREF); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
107 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
|
108 return FALSE; |
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 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
113 |
15822 | 114 static gboolean chat_buddy_leaving_cb(PurpleConversation *conv, const char *name, |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
115 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
|
116 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 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
|
118 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
119 |
15822 | 120 static gboolean chat_buddy_joining_cb(PurpleConversation *conv, const char *name, |
121 PurpleConvChatBuddyFlags flags, | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
122 GHashTable *users) |
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 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
|
125 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
126 |
15822 | 127 static void received_chat_msg_cb(PurpleAccount *account, char *sender, |
128 char *message, PurpleConversation *conv, | |
129 PurpleMessageFlags flags, GHashTable *users) | |
15565
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 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
|
132 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
|
133 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
134 /* 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
|
135 * 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
|
136 key.conv = conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
137 key.user = sender; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
138 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
|
139 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
|
140 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
141 /* 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
|
142 time(last_said); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
143 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
144 else |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
145 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
146 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
|
147 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
148 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
|
149 key2->conv = conv; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
150 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
|
151 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
152 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
|
153 time(last_said); |
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 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
|
156 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
157 } |
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 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
|
160 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
|
161 { |
17100
de2946d55a2d
We can't be sure that the conv still exists, so don't dereference it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16666
diff
changeset
|
162 purple_debug_info("joinpart", "Removing key for %s\n", key->user); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
163 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
|
164 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
165 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
166 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
|
167 { |
15822 | 168 int delay = purple_prefs_get_int(DELAY_PREF); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
169 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
|
170 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
171 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
|
172 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
173 return TRUE; |
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 |
15822 | 176 static gboolean plugin_load(PurplePlugin *plugin) |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
177 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
178 void *conv_handle; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
179 GHashTable *users; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
180 guint id; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
181 gpointer *data; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
182 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
183 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
|
184 (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
|
185 (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
|
186 g_free); |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
187 |
15822 | 188 conv_handle = purple_conversations_get_handle(); |
189 purple_signal_connect(conv_handle, "chat-buddy-joining", plugin, | |
190 PURPLE_CALLBACK(chat_buddy_joining_cb), users); | |
191 purple_signal_connect(conv_handle, "chat-buddy-leaving", plugin, | |
192 PURPLE_CALLBACK(chat_buddy_leaving_cb), users); | |
193 purple_signal_connect(conv_handle, "received-chat-msg", plugin, | |
194 PURPLE_CALLBACK(received_chat_msg_cb), users); | |
15565
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 /* Cleanup every 5 minutes */ |
15822 | 197 id = purple_timeout_add(1000 * 60 * 5, (GSourceFunc)clean_users_hash, users); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
198 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
199 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
|
200 data[0] = users; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
201 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
|
202 plugin->extra = data; |
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 return TRUE; |
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 |
15822 | 207 static gboolean plugin_unload(PurplePlugin *plugin) |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
208 { |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
209 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
|
210 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
211 /* Destroy the hash table. The core plugin code will |
15822 | 212 * disconnect the signals, and since Purple is single-threaded, |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
213 * 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
|
214 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
|
215 |
17478
0f4a562b38d1
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@wiktel.com>
parents:
17100
diff
changeset
|
216 purple_timeout_remove(GPOINTER_TO_UINT(data[1])); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
217 g_free(data); |
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 return TRUE; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
220 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
221 |
15822 | 222 static PurplePluginPrefFrame * |
223 get_plugin_pref_frame(PurplePlugin *plugin) | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
224 { |
15822 | 225 PurplePluginPrefFrame *frame; |
226 PurplePluginPref *ppref; | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
227 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
228 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
|
229 |
15822 | 230 frame = purple_plugin_pref_frame_new(); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
231 |
15822 | 232 ppref = purple_plugin_pref_new_with_label(_("Join/Part Hiding Configuration")); |
233 purple_plugin_pref_frame_add(frame, ppref); | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
234 |
15822 | 235 ppref = purple_plugin_pref_new_with_name_and_label(THRESHOLD_PREF, |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
236 _("Minimum Room Size")); |
15822 | 237 purple_plugin_pref_set_bounds(ppref, 0, 1000); |
238 purple_plugin_pref_frame_add(frame, ppref); | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
239 |
15822 | 240 ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF, |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
241 _("User Inactivity Timeout (in minutes)")); |
15822 | 242 purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */ |
243 purple_plugin_pref_frame_add(frame, ppref); | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
244 |
23943
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
245 ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF, |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
246 _("Apply hiding rules to buddies")); |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
247 purple_plugin_pref_frame_add(frame, ppref); |
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
248 |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
249 return frame; |
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 |
15822 | 252 static PurplePluginUiInfo prefs_info = { |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
253 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
|
254 0, /* page_num (reserved) */ |
16666
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
255 NULL, /* frame (reserved) */ |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
256 |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
257 /* padding */ |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
258 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
259 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
260 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
261 NULL |
15565
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 |
15822 | 264 static PurplePluginInfo info = |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
265 { |
15822 | 266 PURPLE_PLUGIN_MAGIC, |
267 PURPLE_MAJOR_VERSION, | |
268 PURPLE_MINOR_VERSION, | |
269 PURPLE_PLUGIN_STANDARD, /**< type */ | |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
270 NULL, /**< ui_requirement */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
271 0, /**< flags */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
272 NULL, /**< dependencies */ |
15822 | 273 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
15565
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 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
|
276 N_("Join/Part Hiding"), /**< name */ |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
19681
diff
changeset
|
277 DISPLAY_VERSION, /**< version */ |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
278 /** summary */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
279 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
|
280 /** description */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
281 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
|
282 "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
|
283 "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
|
284 "Richard Laager <rlaager@pidgin.im>", /**< author */ |
15822 | 285 PURPLE_WEBSITE, /**< homepage */ |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
286 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
287 plugin_load, /**< load */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
288 plugin_unload, /**< unload */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
289 NULL, /**< destroy */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
290 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
291 NULL, /**< ui_info */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
292 NULL, /**< extra_info */ |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
293 &prefs_info, /**< prefs_info */ |
16666
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
294 NULL, /**< actions */ |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
295 |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
296 /* padding */ |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
297 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
298 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
299 NULL, |
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16430
diff
changeset
|
300 NULL |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
301 }; |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
302 |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
303 static void |
15822 | 304 init_plugin(PurplePlugin *plugin) |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
305 { |
16430 | 306 purple_prefs_add_none("/plugins/core/joinpart"); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
307 |
15822 | 308 purple_prefs_add_int(DELAY_PREF, DELAY_DEFAULT); |
309 purple_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT); | |
23943
13ca254ea7db
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@wiktel.com>
parents:
22469
diff
changeset
|
310 purple_prefs_add_bool(HIDE_BUDDIES_PREF, HIDE_BUDDIES_DEFAULT); |
15565
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
311 } |
3b6ce2116f74
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
312 |
15822 | 313 PURPLE_INIT_PLUGIN(joinpart, init_plugin, info) |