Tue, 09 Jul 2013 15:48:17 +0530
Renamed buddy list functions to more appropriate/simler names.
* Replaced purple_blist_update_node_icon() with purple_blist_node_update()
* Replaced purple_blist_update_buddy_status() with purple_buddy_update_status()
* Replaced purple_blist_rename_buddy() with purple_buddy_set_name()
* Replaced purple_blist_alias_contact() with purple_contact_set_alias()
* Replaced purple_blist_alias_chat() with purple_chat_set_alias()
* Replaced purple_blist_alias_buddy() with purple_buddy_set_local_alias()
* Replaced purple_blist_server_alias_buddy() with purple_buddy_set_server_alias()
* Replaced purple_blist_rename_group() with purple_group_set_name()
* Replaced purple_blist_merge_contact() with purple_contact_merge()
* Replaced purple_find_buddy_in_group() with purple_blist_find_buddy_in_group()
* Replaced purple_find_buddy() with purple_blist_find_buddy()
* Replaced purple_find_buddies() with purple_blist_find_buddies()
* Replaced purple_find_group() with purple_blist_find_group()
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
1 | /** |
| 15884 | 2 | * purple |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
6 | * source distribution. |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
7 | * |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
12 | * |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
17 | * |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
22 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
23 | #include "internal.h" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
24 | #include "conversation.h" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
25 | #include "debug.h" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
26 | #include "plugin.h" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
27 | #include "version.h" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
28 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
29 | #define JOINPART_PLUGIN_ID "core-rlaager-joinpart" |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
30 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
31 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
32 | /* Preferences */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
33 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
34 | /* The number of minutes before a person is considered |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
35 | * to have stopped being part of active conversation. */ |
| 16481 | 36 | #define DELAY_PREF "/plugins/core/joinpart/delay" |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
37 | #define DELAY_DEFAULT 10 |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
38 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
39 | /* The number of people that must be in a room for this |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
40 | * plugin to have any effect */ |
| 16481 | 41 | #define THRESHOLD_PREF "/plugins/core/joinpart/threshold" |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
42 | #define THRESHOLD_DEFAULT 20 |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
43 | |
|
24135
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
44 | /* Hide buddies */ |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
45 | #define HIDE_BUDDIES_PREF "/plugins/core/joinpart/hide_buddies" |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
46 | #define HIDE_BUDDIES_DEFAULT FALSE |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
47 | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
48 | struct joinpart_key |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
49 | { |
| 15884 | 50 | PurpleConversation *conv; |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
51 | char *user; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
52 | }; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
53 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
54 | static guint joinpart_key_hash(const struct joinpart_key *key) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
55 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
56 | g_return_val_if_fail(key != NULL, 0); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
57 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
58 | return g_direct_hash(key->conv) + g_str_hash(key->user); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
59 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
60 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
61 | static gboolean joinpart_key_equal(const struct joinpart_key *a, const struct joinpart_key *b) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
62 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
63 | if (a == NULL) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
64 | return (b == NULL); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
65 | else if (b == NULL) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
66 | return FALSE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
67 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
68 | return (a->conv == b->conv) && !strcmp(a->user, b->user); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
69 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
70 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
71 | static void joinpart_key_destroy(struct joinpart_key *key) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
72 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
73 | g_return_if_fail(key != NULL); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
74 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
75 | g_free(key->user); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
76 | g_free(key); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
77 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
78 | |
| 15884 | 79 | static gboolean should_hide_notice(PurpleConversation *conv, const char *name, |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
80 | GHashTable *users) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
81 | { |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
28060
diff
changeset
|
82 | PurpleChatConversation *chat; |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
83 | int threshold; |
| 22606 | 84 | struct joinpart_key key; |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
85 | time_t *last_said; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
86 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
87 | g_return_val_if_fail(conv != NULL, FALSE); |
|
34626
b8b3186aff95
Refactored some libpurple plugins for GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
88 | g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(conv), FALSE); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
89 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
90 | /* If the room is small, don't bother. */ |
|
34628
014583658b51
Refactored libpurple/plugins to use the GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34626
diff
changeset
|
91 | chat = PURPLE_CHAT_CONVERSATION(conv); |
| 15884 | 92 | threshold = purple_prefs_get_int(THRESHOLD_PREF); |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
28060
diff
changeset
|
93 | if (g_list_length(purple_chat_conversation_get_users(chat)) < threshold) |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
94 | return FALSE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
95 | |
|
24135
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
96 | if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) && |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
97 | purple_blist_find_buddy(purple_conversation_get_account(conv), name)) |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
98 | return FALSE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
99 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
100 | /* Only show the notice if the user has spoken recently. */ |
| 22606 | 101 | key.conv = conv; |
| 102 | key.user = (gchar *)name; | |
| 103 | last_said = g_hash_table_lookup(users, &key); | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
104 | if (last_said != NULL) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
105 | { |
| 15884 | 106 | int delay = purple_prefs_get_int(DELAY_PREF); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
107 | if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
108 | return FALSE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
109 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
110 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
111 | return TRUE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
112 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
113 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
114 | static gboolean chat_user_leaving_cb(PurpleConversation *conv, const char *name, |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
115 | const char *reason, GHashTable *users) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
116 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
117 | return should_hide_notice(conv, name, users); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
118 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
119 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
120 | static gboolean chat_user_joining_cb(PurpleConversation *conv, const char *name, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
121 | PurpleChatUserFlags flags, |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
122 | GHashTable *users) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
123 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
124 | return should_hide_notice(conv, name, users); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
125 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
126 | |
| 15884 | 127 | static void received_chat_msg_cb(PurpleAccount *account, char *sender, |
| 128 | char *message, PurpleConversation *conv, | |
| 129 | PurpleMessageFlags flags, GHashTable *users) | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
130 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
131 | struct joinpart_key key; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
132 | time_t *last_said; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
133 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
134 | /* Most of the time, we'll already have tracked the user, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
135 | * so we avoid memory allocation here. */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
136 | key.conv = conv; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
137 | key.user = sender; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
138 | last_said = g_hash_table_lookup(users, &key); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
139 | if (last_said != NULL) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
140 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
141 | /* They just said something, so update the time. */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
142 | time(last_said); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
143 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
144 | else |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
145 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
146 | struct joinpart_key *key2; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
147 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
148 | key2 = g_new(struct joinpart_key, 1); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
149 | key2->conv = conv; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
150 | key2->user = g_strdup(sender); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
151 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
152 | last_said = g_new(time_t, 1); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
153 | time(last_said); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
154 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
155 | g_hash_table_insert(users, key2, last_said); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
156 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
157 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
158 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
159 | static gboolean check_expire_time(struct joinpart_key *key, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
160 | time_t *last_said, time_t *limit) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
161 | { |
|
17173
0ab8487ff12a
We can't be sure that the conv still exists, so don't dereference it.
Daniel Atallah <datallah@pidgin.im>
parents:
16745
diff
changeset
|
162 | purple_debug_info("joinpart", "Removing key for %s\n", key->user); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
163 | return (*last_said < *limit); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
164 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
165 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
166 | static gboolean clean_users_hash(GHashTable *users) |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
167 | { |
| 15884 | 168 | int delay = purple_prefs_get_int(DELAY_PREF); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
169 | time_t limit = time(NULL) - (60 * delay); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
170 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
171 | g_hash_table_foreach_remove(users, (GHRFunc)check_expire_time, &limit); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
172 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
173 | return TRUE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
174 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
175 | |
| 15884 | 176 | static gboolean plugin_load(PurplePlugin *plugin) |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
177 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
178 | void *conv_handle; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
179 | GHashTable *users; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
180 | guint id; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
181 | gpointer *data; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
182 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
183 | users = g_hash_table_new_full((GHashFunc)joinpart_key_hash, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
184 | (GEqualFunc)joinpart_key_equal, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
185 | (GDestroyNotify)joinpart_key_destroy, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
186 | g_free); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
187 | |
| 15884 | 188 | conv_handle = purple_conversations_get_handle(); |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
189 | purple_signal_connect(conv_handle, "chat-user-joining", plugin, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
190 | PURPLE_CALLBACK(chat_user_joining_cb), users); |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
191 | purple_signal_connect(conv_handle, "chat-user-leaving", plugin, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34628
diff
changeset
|
192 | PURPLE_CALLBACK(chat_user_leaving_cb), users); |
| 15884 | 193 | purple_signal_connect(conv_handle, "received-chat-msg", plugin, |
| 194 | PURPLE_CALLBACK(received_chat_msg_cb), users); | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
195 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
196 | /* Cleanup every 5 minutes */ |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24135
diff
changeset
|
197 | id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
198 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
199 | data = g_new(gpointer, 2); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
200 | data[0] = users; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
201 | data[1] = GUINT_TO_POINTER(id); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
202 | plugin->extra = data; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
203 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
204 | return TRUE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
205 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
206 | |
| 15884 | 207 | static gboolean plugin_unload(PurplePlugin *plugin) |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
208 | { |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
209 | gpointer *data = plugin->extra; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
210 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
211 | /* Destroy the hash table. The core plugin code will |
| 15884 | 212 | * disconnect the signals, and since Purple is single-threaded, |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
213 | * we don't have to worry one will be called after this. */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
214 | g_hash_table_destroy((GHashTable *)data[0]); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
215 | |
|
17570
4cca2fc0ec83
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@pidgin.im>
parents:
17173
diff
changeset
|
216 | purple_timeout_remove(GPOINTER_TO_UINT(data[1])); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
217 | g_free(data); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
218 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
219 | return TRUE; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
220 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
221 | |
| 15884 | 222 | static PurplePluginPrefFrame * |
| 223 | get_plugin_pref_frame(PurplePlugin *plugin) | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
224 | { |
| 15884 | 225 | PurplePluginPrefFrame *frame; |
| 226 | PurplePluginPref *ppref; | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
227 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
228 | g_return_val_if_fail(plugin != NULL, FALSE); |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
229 | |
| 15884 | 230 | frame = purple_plugin_pref_frame_new(); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
231 | |
| 28060 | 232 | ppref = purple_plugin_pref_new_with_label(_("Hide Joins/Parts")); |
| 15884 | 233 | purple_plugin_pref_frame_add(frame, ppref); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
234 | |
| 15884 | 235 | ppref = purple_plugin_pref_new_with_name_and_label(THRESHOLD_PREF, |
|
28059
176739c0bbc3
Clarify the preference strings for the Join/Part hiding plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
25716
diff
changeset
|
236 | /* Translators: Followed by an input request a number of people */ |
|
176739c0bbc3
Clarify the preference strings for the Join/Part hiding plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
25716
diff
changeset
|
237 | _("For rooms with more than this many people")); |
| 15884 | 238 | purple_plugin_pref_set_bounds(ppref, 0, 1000); |
| 239 | purple_plugin_pref_frame_add(frame, ppref); | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
240 | |
| 15884 | 241 | ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF, |
|
28059
176739c0bbc3
Clarify the preference strings for the Join/Part hiding plugin.
Paul Aurich <darkrain42@pidgin.im>
parents:
25716
diff
changeset
|
242 | _("If user has not spoken in this many minutes")); |
| 15884 | 243 | purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */ |
| 244 | purple_plugin_pref_frame_add(frame, ppref); | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
245 | |
|
24135
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
246 | ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF, |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
247 | _("Apply hiding rules to buddies")); |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
248 | purple_plugin_pref_frame_add(frame, ppref); |
|
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
249 | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
250 | return frame; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
251 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
252 | |
| 15884 | 253 | static PurplePluginUiInfo prefs_info = { |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
254 | get_plugin_pref_frame, |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
255 | 0, /* page_num (reserved) */ |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
256 | NULL, /* frame (reserved) */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
257 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
258 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
259 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
260 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
261 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
262 | NULL |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
263 | }; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
264 | |
| 15884 | 265 | static PurplePluginInfo info = |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
266 | { |
| 15884 | 267 | PURPLE_PLUGIN_MAGIC, |
| 268 | PURPLE_MAJOR_VERSION, | |
| 269 | PURPLE_MINOR_VERSION, | |
| 270 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
271 | NULL, /**< ui_requirement */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
272 | 0, /**< flags */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
273 | NULL, /**< dependencies */ |
| 15884 | 274 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
275 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
276 | JOINPART_PLUGIN_ID, /**< id */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
277 | N_("Join/Part Hiding"), /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
278 | DISPLAY_VERSION, /**< version */ |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
279 | /** summary */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
280 | N_("Hides extraneous join/part messages."), |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
281 | /** description */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
282 | N_("This plugin hides join/part messages in large " |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
283 | "rooms, except for those users actively taking " |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
284 | "part in a conversation."), |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
285 | "Richard Laager <rlaager@pidgin.im>", /**< author */ |
| 15884 | 286 | PURPLE_WEBSITE, /**< homepage */ |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
287 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
288 | plugin_load, /**< load */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
289 | plugin_unload, /**< unload */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
290 | NULL, /**< destroy */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
291 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
292 | NULL, /**< ui_info */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
293 | NULL, /**< extra_info */ |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
294 | &prefs_info, /**< prefs_info */ |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
295 | NULL, /**< actions */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
296 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
297 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
298 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
299 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
300 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
301 | NULL |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
302 | }; |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
303 | |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
304 | static void |
| 15884 | 305 | init_plugin(PurplePlugin *plugin) |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
306 | { |
| 16481 | 307 | purple_prefs_add_none("/plugins/core/joinpart"); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
308 | |
| 15884 | 309 | purple_prefs_add_int(DELAY_PREF, DELAY_DEFAULT); |
| 310 | purple_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT); | |
|
24135
3998dcd1e2fb
In the Join/Part plugin, add the ability to apply the rules to
Richard Laager <rlaager@pidgin.im>
parents:
22606
diff
changeset
|
311 | purple_prefs_add_bool(HIDE_BUDDIES_PREF, HIDE_BUDDIES_DEFAULT); |
|
15627
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
312 | } |
|
4be4b97cf1b7
I had this brilliant idea to deal with join/part notices "intelligently".
Richard Laager <rlaager@pidgin.im>
parents:
diff
changeset
|
313 | |
| 15884 | 314 | PURPLE_INIT_PLUGIN(joinpart, init_plugin, info) |