Tue, 07 May 2013 05:04:46 -0400
Rewrite debug window filter in JS.
Note, this does cause a couple regressions, but they are probably not
that big a deal. First, the JS regular expression syntax is slightly
different. Second, the JS regex API lacks a way to reliably determine
the location of matched groups, so we can't highlight just the groups
and must highlight the entire expression.
I suspect that none of our users ever had to use any fancy regex in the
debug window, and that most of our developers didn't even know it could
be done. So I doubt these regressions will cause much pain.
| 9609 | 1 | /* |
| 2 | * Signals test plugin. | |
| 3 | * | |
| 4 | * Copyright (C) 2003 Christian Hammond. | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU General Public License as | |
| 8 | * published by the Free Software Foundation; either version 2 of the | |
| 9 | * License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, but | |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * 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:
16788
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16788
diff
changeset
|
19 | * 02111-1301, USA. |
| 9609 | 20 | */ |
| 21 | #define GTK_SIGNAL_TEST_PLUGIN_ID "gtk-signals-test" | |
| 22 | ||
|
28981
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
20288
diff
changeset
|
23 | #include "internal.h" |
|
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
20288
diff
changeset
|
24 | |
| 9609 | 25 | #include <gtk/gtk.h> |
| 26 | ||
| 27 | #include "debug.h" | |
| 9954 | 28 | #include "version.h" |
| 9609 | 29 | |
| 30 | #include "gtkaccount.h" | |
| 31 | #include "gtkblist.h" | |
| 32 | #include "gtkconv.h" | |
| 33 | #include "gtkplugin.h" | |
| 34 | ||
| 35 | /************************************************************************** | |
| 36 | * Account subsystem signal callbacks | |
| 37 | **************************************************************************/ | |
| 38 | static void | |
| 15884 | 39 | account_modified_cb(PurpleAccount *account, void *data) { |
| 40 | purple_debug_info("gtk-signal-test", "account modified cb\n"); | |
| 9609 | 41 | } |
| 42 | ||
| 43 | /************************************************************************** | |
| 44 | * Buddy List subsystem signal callbacks | |
| 45 | **************************************************************************/ | |
| 46 | static void | |
| 15884 | 47 | blist_created_cb(PurpleBuddyList *blist, void *data) { |
| 48 | purple_debug_info("gtk-signal-test", "buddy list created\n"); | |
| 9609 | 49 | } |
| 50 | ||
| 51 | static void | |
| 15884 | 52 | blist_drawing_tooltip_cb(PurpleBlistNode *node, GString *str, gboolean full, void *data) { |
| 53 | purple_debug_info("gtk-signal-test", "drawing tooltip cb\n"); | |
| 9609 | 54 | } |
| 55 | ||
| 56 | /************************************************************************** | |
| 57 | * Conversation subsystem signal callbacks | |
| 58 | **************************************************************************/ | |
| 59 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
60 | conversation_dragging_cb(PidginWindow *source, PidginWindow *destination) { |
| 15884 | 61 | purple_debug_info("gtk-signal-test", "conversation dragging cb\n"); |
| 9609 | 62 | } |
| 63 | ||
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
64 | static gboolean |
| 15884 | 65 | displaying_im_msg_cb(PurpleAccount *account, const char *who, char **buffer, |
| 66 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
67 | { |
| 15884 | 68 | purple_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n", |
| 69 | purple_conversation_get_name(conv), *buffer); | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
70 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
71 | return FALSE; |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
72 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
73 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
74 | static void |
| 15884 | 75 | displayed_im_msg_cb(PurpleAccount *account, const char *who, const char *buffer, |
| 76 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
77 | { |
| 15884 | 78 | purple_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n", |
| 79 | purple_conversation_get_name(conv), buffer); | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
80 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
81 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
82 | static gboolean |
| 15884 | 83 | displaying_chat_msg_cb(PurpleAccount *account, const char *who, char **buffer, |
| 84 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
85 | { |
| 15884 | 86 | purple_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n", |
| 87 | purple_conversation_get_name(conv), *buffer); | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
88 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
89 | return FALSE; |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
90 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
91 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
92 | static void |
| 15884 | 93 | displayed_chat_msg_cb(PurpleAccount *account, const char *who, const char *buffer, |
| 94 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
95 | { |
| 15884 | 96 | purple_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n", |
| 97 | purple_conversation_get_name(conv), buffer); | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
98 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
99 | |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
100 | static void |
| 15884 | 101 | conversation_switched_cb(PurpleConversation *conv, void *data) |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
102 | { |
| 15884 | 103 | purple_debug_misc("gtk-signals test", "conversation-switched (%s)\n", |
| 104 | purple_conversation_get_name(conv)); | |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
105 | } |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
106 | |
| 9609 | 107 | /************************************************************************** |
| 108 | * Plugin stuff | |
| 109 | **************************************************************************/ | |
| 110 | static gboolean | |
| 15884 | 111 | plugin_load(PurplePlugin *plugin) |
| 9609 | 112 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
113 | void *accounts_handle = pidgin_account_get_handle(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
114 | void *blist_handle = pidgin_blist_get_handle(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
115 | void *conv_handle = pidgin_conversations_get_handle(); |
| 9609 | 116 | |
| 117 | /* Accounts subsystem signals */ | |
| 15884 | 118 | purple_signal_connect(accounts_handle, "account-modified", |
| 119 | plugin, PURPLE_CALLBACK(account_modified_cb), NULL); | |
| 9609 | 120 | |
| 121 | /* Buddy List subsystem signals */ | |
| 15884 | 122 | purple_signal_connect(blist_handle, "gtkblist-created", |
| 123 | plugin, PURPLE_CALLBACK(blist_created_cb), NULL); | |
| 124 | purple_signal_connect(blist_handle, "drawing-tooltip", | |
| 125 | plugin, PURPLE_CALLBACK(blist_drawing_tooltip_cb), NULL); | |
| 9609 | 126 | |
| 127 | /* Conversations subsystem signals */ | |
| 15884 | 128 | purple_signal_connect(conv_handle, "conversation-dragging", |
| 129 | plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL); | |
| 130 | purple_signal_connect(conv_handle, "displaying-im-msg", | |
| 131 | plugin, PURPLE_CALLBACK(displaying_im_msg_cb), NULL); | |
| 132 | purple_signal_connect(conv_handle, "displayed-im-msg", | |
| 133 | plugin, PURPLE_CALLBACK(displayed_im_msg_cb), NULL); | |
| 134 | purple_signal_connect(conv_handle, "displaying-chat-msg", | |
| 135 | plugin, PURPLE_CALLBACK(displaying_chat_msg_cb), NULL); | |
| 136 | purple_signal_connect(conv_handle, "displayed-chat-msg", | |
| 137 | plugin, PURPLE_CALLBACK(displayed_chat_msg_cb), NULL); | |
| 138 | purple_signal_connect(conv_handle, "conversation-switched", | |
| 139 | plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL); | |
| 9609 | 140 | |
| 141 | return TRUE; | |
| 142 | } | |
| 143 | ||
| 11033 | 144 | static gboolean |
| 15884 | 145 | plugin_unload(PurplePlugin *plugin) { |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
146 | return TRUE; |
| 11033 | 147 | } |
| 148 | ||
| 15884 | 149 | static PurplePluginInfo info = |
| 9609 | 150 | { |
| 15884 | 151 | PURPLE_PLUGIN_MAGIC, |
| 152 | PURPLE_MAJOR_VERSION, | |
| 153 | PURPLE_MINOR_VERSION, | |
| 154 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
155 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
| 9609 | 156 | 0, /**< flags */ |
| 157 | NULL, /**< dependencies */ | |
| 15884 | 158 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 9609 | 159 | |
| 160 | GTK_SIGNAL_TEST_PLUGIN_ID, /**< id */ | |
| 161 | N_("GTK Signals Test"), /**< name */ | |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
162 | DISPLAY_VERSION, /**< version */ |
| 9609 | 163 | /** summary */ |
| 164 | N_("Test to see that all ui signals are working properly."), | |
| 165 | /** description */ | |
| 166 | N_("Test to see that all ui signals are working properly."), | |
| 167 | "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
| 15884 | 168 | PURPLE_WEBSITE, /**< homepage */ |
| 9609 | 169 | |
| 170 | plugin_load, /**< load */ | |
| 11033 | 171 | plugin_unload, /**< unload */ |
| 9609 | 172 | NULL, /**< destroy */ |
| 173 | ||
| 174 | NULL, /**< ui_info */ | |
| 175 | NULL, /**< extra_info */ | |
| 176 | NULL, | |
|
16788
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
177 | NULL, |
|
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
178 | |
|
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
179 | /* padding */ |
|
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
180 | NULL, |
|
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
181 | NULL, |
|
417d0e8d6f3f
Add padding to structs to fix compiler warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
182 | NULL, |
| 9609 | 183 | NULL |
| 184 | }; | |
| 185 | ||
| 186 | static void | |
| 15884 | 187 | init_plugin(PurplePlugin *plugin) |
| 9609 | 188 | { |
| 189 | } | |
| 190 | ||
| 15884 | 191 | PURPLE_INIT_PLUGIN(gtksignalstest, init_plugin, info) |