Mercurial > pidgin-twitter
annotate pidgin-twitter.c @ 34:44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sat, 10 May 2008 20:18:20 +0900 |
parents | 92715b489de6 |
children | 7d07fcb9c616 |
rev | line source |
---|---|
0 | 1 /* |
2 * Pidgin-Twitter plugin. | |
3 * | |
4 * This program is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU General Public License as | |
6 * published by the Free Software Foundation; either version 2 of the | |
7 * License, or (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, but | |
10 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
17 * 02111-1307, USA. | |
18 */ | |
19 #define PURPLE_PLUGINS 1 | |
20 | |
21 #include <stdio.h> | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 #include <glib.h> | |
25 | |
26 #include "gtkplugin.h" | |
27 #include "util.h" | |
28 #include "debug.h" | |
29 #include "connection.h" | |
30 #include "version.h" | |
1 | 31 #include "sound.h" |
31 | 32 #include "gtkconv.h" |
0 | 33 |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
34 #define RECIPIENT 0 |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
35 #define SENDER 1 |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
36 #define COMMAND 2 |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
37 #define PSEUDO 3 |
34
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
38 #define SENDER_WITH_LINK 4 |
0 | 39 |
31 | 40 #define PLUGIN_ID "gtk-honeyplanet-pidgin_twitter" |
41 #define PLUGIN_NAME "pidgin-twitter" | |
42 | |
0 | 43 #define OPT_PIDGINTWITTER "/plugins/pidgin_twitter" |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
44 #define OPT_TRANSLATE_RECIPIENT OPT_PIDGINTWITTER "/translate_recipient" |
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
45 #define OPT_TRANSLATE_SENDER OPT_PIDGINTWITTER "/translate_sender" |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
46 #define OPT_PLAYSOUND_RECIPIENT OPT_PIDGINTWITTER "/playsound_recipient" |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
47 #define OPT_PLAYSOUND_SENDER OPT_PIDGINTWITTER "/playsound_sender" |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
48 #define OPT_SOUNDID_RECIPIENT OPT_PIDGINTWITTER "/soundid_recipient" |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
49 #define OPT_SOUNDID_SENDER OPT_PIDGINTWITTER "/soundid_sender" |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
50 #define OPT_ESCAPE_PSEUDO OPT_PIDGINTWITTER "/escape_pseudo" |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
51 #define OPT_USERLIST_RECIPIENT OPT_PIDGINTWITTER "/userlist_recipient" |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
52 #define OPT_USERLIST_SENDER OPT_PIDGINTWITTER "/userlist_sender" |
31 | 53 #define OPT_COUNTER OPT_PIDGINTWITTER "/counter" |
54 | |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
55 #define RECIPIENT_FORMAT "@<a href='http://twitter.com/%s'>%s</a>" |
14
e58e7c1fcbe5
fixed typo. pointed out by nosuke too. :D
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
13
diff
changeset
|
56 #define SENDER_FORMAT "<a href='http://twitter.com/%s'>%s</a>: " |
31 | 57 #define DEFAULT_LIST "(list of users: separated with ' ,:;')" |
58 | |
0 | 59 |
31 | 60 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, \ |
6 | 61 fmt, ## __VA_ARGS__); |
31 | 62 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, \ |
0 | 63 |
64 /* globals */ | |
34
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
65 static GRegex *regp[5]; |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
66 |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
67 static void |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
68 delete_sender_with_link(gchar **str) |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
69 { |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
70 gchar *newstr = NULL; |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
71 |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
72 /* replace senders with link */ |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
73 newstr = g_regex_replace(regp[SENDER_WITH_LINK], *str, -1, 0, "@\\1", 0, NULL); |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
74 twitter_debug("*str = %s\n", *str); |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
75 twitter_debug("rnewstr = %s\n", newstr); |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
76 |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
77 g_free(*str); |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
78 *str = newstr; |
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
79 } |
0 | 80 |
31 | 81 /* prototypes */ |
82 static gboolean is_twitter_conv(PurpleConversation *conv); | |
83 static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null); | |
84 static void detach_from_gtkconv(PidginConversation *gtkconv, gpointer null); | |
85 static void escape(gchar **str); | |
86 | |
87 | |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
88 static void |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
89 escape(gchar **str) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
90 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
91 GMatchInfo *match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
92 gchar *newstr = NULL, *match = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
93 gboolean flag = FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
94 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
95 /* search genuine command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
96 g_regex_match(regp[COMMAND], *str, 0, &match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
97 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
98 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
99 twitter_debug("command = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
100 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
101 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
102 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
103 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
104 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
105 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
106 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
107 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
108 return; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
109 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
110 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
111 /* if not found, check pseudo command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
112 g_regex_match(regp[PSEUDO], *str, 0, &match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
113 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
114 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
115 twitter_debug("pseudo = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
116 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
117 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
118 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
119 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
120 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
121 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
122 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
123 /* if there is pseudo one, escape it */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
124 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
125 /* put ". " to the beginning of buffer */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
126 newstr = g_strdup_printf(". %s", *str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
127 twitter_debug("*str = %s\n", *str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
128 twitter_debug("newstr = %s\n", newstr); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
129 g_free(*str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
130 *str = newstr; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
131 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
132 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
133 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
134 static gboolean |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
135 sending_im_cb(PurpleAccount * account, char *recipient, char **buffer, |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
136 void *data) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
137 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
138 const gchar *proto; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
139 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
140 /* check if the message is from twitter */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
141 proto = purple_account_get_protocol_id(account); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
142 twitter_debug("sending_im_cb\n"); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
143 twitter_debug("proto = %s\n", proto); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
144 twitter_debug("recipient = %s\n", recipient); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
145 |
31 | 146 if(!strcmp(proto, "prpl-jabber") && |
147 !strcmp(recipient, "twitter@twitter.com")) { | |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
148 /* escape */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
149 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
150 escape(buffer); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
151 } |
34
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
152 delete_sender_with_link(buffer); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
153 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
154 return FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
155 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
156 |
1 | 157 static gboolean |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
158 eval(const GMatchInfo * match_info, GString * result, gpointer user_data) |
1 | 159 { |
160 gchar sub[128]; | |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
161 gchar *match = g_match_info_fetch(match_info, 1); |
1 | 162 |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
163 int which = *(int *)user_data; |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
164 |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
165 snprintf(sub, 128, which ? SENDER_FORMAT : RECIPIENT_FORMAT, match, match); |
6 | 166 twitter_debug("sub = %s\n", sub); |
1 | 167 g_string_append(result, sub); |
168 g_free(match); | |
169 | |
170 return FALSE; | |
171 } | |
0 | 172 |
8 | 173 static void |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
174 translate(gchar **str, int which) |
0 | 175 { |
1 | 176 gchar *newstr; |
177 | |
178 twitter_debug("*str = %s\n", *str); | |
0 | 179 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
180 newstr = g_regex_replace_eval(regp[which], // compiled regex |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
181 *str, // subject string |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
182 -1, // length of the subject string |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
183 0, // start position |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
184 0, // match options |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
185 eval, // function to call for each match |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
186 &which, // user data |
6 | 187 NULL); // error handler |
1 | 188 |
189 twitter_debug("newstr = %s\n", newstr); | |
190 | |
191 g_free(*str); | |
192 *str = newstr; | |
193 } | |
0 | 194 |
8 | 195 static void |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
196 playsound(gchar **str, int which) |
1 | 197 { |
198 GMatchInfo *match_info; | |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
199 const gchar *list; |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
200 gchar **candidates = NULL, **candidate = NULL; |
0 | 201 |
31 | 202 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : |
203 OPT_USERLIST_RECIPIENT); | |
5
6ac1867d7e8e
string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2
diff
changeset
|
204 g_return_if_fail(list != NULL); |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
205 if(!strcmp(list, DEFAULT_LIST)) |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
206 return; |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
207 |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
208 candidates = g_strsplit_set(list, " ,:;", 0); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
209 g_return_if_fail(candidates != NULL); |
1 | 210 |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
211 g_regex_match(regp[which], *str, 0, &match_info); |
6 | 212 while(g_match_info_matches(match_info)) { |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
213 gchar *user = g_match_info_fetch(match_info, 1); |
1 | 214 twitter_debug("user = %s\n", user); |
0 | 215 |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
216 for(candidate = candidates; *candidate ; candidate++) { |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
217 if(!strcmp(*candidate, "")) |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
218 continue; |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
219 twitter_debug("candidate = %s\n", *candidate); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
220 if(!strcmp(user, *candidate)) { |
1 | 221 twitter_debug("match. play sound\n"); |
8 | 222 purple_sound_play_event( |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
223 purple_prefs_get_int(which ? OPT_SOUNDID_SENDER : OPT_SOUNDID_RECIPIENT), NULL); |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
224 break; |
1 | 225 } |
226 } | |
6 | 227 g_free(user); |
228 g_match_info_next(match_info, NULL); | |
1 | 229 } |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
230 g_strfreev(candidates); |
6 | 231 g_match_info_free(match_info); |
0 | 232 } |
233 | |
1 | 234 static gboolean |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
235 writing_im_cb(PurpleAccount * account, char *sender, char **buffer, |
6 | 236 PurpleConversation * conv, int *flags, void *data) |
0 | 237 { |
238 const gchar *proto; | |
239 | |
1 | 240 /* check if the message is from twitter */ |
0 | 241 proto = purple_account_get_protocol_id(account); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
242 twitter_debug("writing_im_cb\n"); |
1 | 243 twitter_debug("proto = %s\n", proto); |
244 twitter_debug("sender = %s\n", sender); | |
0 | 245 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
246 if(!strcmp(sender, "twitter@twitter.com") && |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
247 !strcmp(proto, "prpl-jabber")) { |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
248 /* playsound */ |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
249 if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) { |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
250 playsound(buffer, SENDER); |
1 | 251 } |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
252 if(purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)) { |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
253 playsound(buffer, RECIPIENT); |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
254 } |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
255 |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
256 /* translate */ |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
257 if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) { |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
258 translate(buffer, SENDER); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
259 } |
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
260 if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) { |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
261 translate(buffer, RECIPIENT); |
1 | 262 } |
0 | 263 |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
264 /* escape */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
265 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
266 escape(buffer); |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
267 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
268 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
269 return FALSE; |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
270 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
271 |
31 | 272 static void |
273 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
274 gchar *new_text, gint new_text_length, gpointer user_data) | |
275 { | |
276 PidginConversation *gtkconv = (PidginConversation *)user_data; | |
277 GtkWidget *box, *counter = NULL; | |
278 gchar *markup = NULL; | |
279 | |
280 g_return_if_fail(gtkconv != NULL); | |
281 | |
282 guint count = gtk_text_buffer_get_char_count(textbuffer) + | |
283 (unsigned int)g_utf8_strlen(new_text, -1); | |
284 | |
32
92715b489de6
commented out an annoying debug message
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
31
diff
changeset
|
285 // twitter_debug("new_text = %s utf8_strlen = %ld new_text_length = %d\n", |
92715b489de6
commented out an annoying debug message
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
31
diff
changeset
|
286 // new_text, g_utf8_strlen(new_text, -1), new_text_length); |
31 | 287 |
288 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
289 count<=140 ? "black" : "red", | |
290 count); | |
291 | |
292 box = gtkconv->toolbar; | |
293 counter = g_object_get_data(G_OBJECT(box), | |
294 PLUGIN_ID "-counter"); | |
295 if (counter) | |
296 gtk_label_set_markup(GTK_LABEL(counter), markup); | |
297 | |
298 g_free(markup); | |
299 } | |
300 | |
301 static void | |
302 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
303 GtkTextIter *end_pos, gpointer user_data) | |
304 { | |
305 PidginConversation *gtkconv = (PidginConversation *)user_data; | |
306 GtkWidget *box, *counter = NULL; | |
307 gchar *markup = NULL; | |
308 | |
309 g_return_if_fail(gtkconv != NULL); | |
310 | |
311 guint count = gtk_text_buffer_get_char_count(textbuffer) - | |
312 (gtk_text_iter_get_offset(end_pos) - | |
313 gtk_text_iter_get_offset(start_pos)); | |
314 | |
315 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
316 count<=140 ? "black" : "red", | |
317 count); | |
318 | |
319 box = gtkconv->toolbar; | |
320 counter = g_object_get_data(G_OBJECT(box), | |
321 PLUGIN_ID "-counter"); | |
322 if (counter) | |
323 gtk_label_set_markup(GTK_LABEL(counter), markup); | |
324 | |
325 g_free(markup); | |
326 } | |
327 | |
328 | |
329 static void | |
330 detach_from_window(void) | |
331 { | |
332 GList *list; | |
333 | |
334 for (list = pidgin_conv_windows_get_list(); list; list = list->next) { | |
335 PidginWindow *win = list->data; | |
336 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | |
337 if(is_twitter_conv(conv)) | |
338 detach_from_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
339 } | |
340 } | |
341 | |
342 static void | |
343 detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) | |
344 { | |
345 GtkWidget *box, *counter = NULL, *sep = NULL; | |
346 | |
347 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), | |
348 (GFunc)insert_text_cb, gtkconv); | |
349 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), | |
350 (GFunc)delete_text_cb, gtkconv); | |
351 | |
352 box = gtkconv->toolbar; | |
353 | |
354 /* remove counter */ | |
355 counter = g_object_get_data(G_OBJECT(box), | |
356 PLUGIN_ID "-counter"); | |
357 if (counter) { | |
358 gtk_container_remove(GTK_CONTAINER(box), counter); | |
359 g_object_unref(counter); | |
360 g_object_set_data(G_OBJECT(box), | |
361 PLUGIN_ID "-counter", NULL); | |
362 } | |
363 /* remove separator */ | |
364 sep = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-sep"); | |
365 if (sep) { | |
366 gtk_container_remove(GTK_CONTAINER(box), sep); | |
367 g_object_unref(sep); | |
368 g_object_set_data(G_OBJECT(box), | |
369 PLUGIN_ID "-sep", NULL); | |
370 } | |
371 | |
372 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); | |
373 } | |
374 | |
375 static void | |
376 attach_to_window(void) | |
377 { | |
378 GList *list; | |
379 | |
380 for (list = pidgin_conv_windows_get_list(); list; list = list->next) { | |
381 PidginWindow *win = list->data; | |
382 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | |
383 if(is_twitter_conv(conv)) | |
384 attach_to_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
385 } | |
386 } | |
387 | |
388 static void | |
389 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) | |
390 { | |
391 GtkWidget *box, *sep, *counter; | |
392 | |
393 box = gtkconv->toolbar; | |
394 counter = g_object_get_data(G_OBJECT(box), | |
395 PLUGIN_ID "-counter"); | |
396 g_return_if_fail(counter == NULL); | |
397 | |
398 /* make counter object */ | |
399 counter = gtk_label_new(NULL); | |
400 gtk_widget_set_name(counter, "counter_label"); | |
401 gtk_label_set_text(GTK_LABEL(counter), "0"); | |
402 gtk_box_pack_end(GTK_BOX(box), counter, FALSE, FALSE, 0); | |
403 gtk_widget_show_all(counter); | |
404 g_object_set_data(G_OBJECT(box), | |
405 PLUGIN_ID "-counter", counter); | |
406 | |
407 /* make separator object */ | |
408 sep = gtk_vseparator_new(); | |
409 gtk_box_pack_end(GTK_BOX(box), sep, FALSE, FALSE, 0); | |
410 gtk_widget_show_all(sep); | |
411 g_object_set_data(G_OBJECT(box), | |
412 PLUGIN_ID "-sep", sep); | |
413 | |
414 /* connect signals, etc. */ | |
415 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
416 G_CALLBACK(insert_text_cb), gtkconv); | |
417 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
418 G_CALLBACK(delete_text_cb), gtkconv); | |
419 | |
420 /* redraw window */ | |
421 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); | |
422 } | |
423 | |
424 static gboolean | |
425 is_twitter_conv(PurpleConversation *conv) | |
426 { | |
427 const char *name = purple_conversation_get_name(conv); | |
428 PurpleAccount *account = purple_conversation_get_account(conv); | |
429 const gchar *proto = purple_account_get_protocol_id(account); | |
430 | |
431 twitter_debug("is_twitter_conv\n"); | |
432 twitter_debug("name = %s\n", name); | |
433 twitter_debug("proto = %s\n", proto); | |
434 | |
435 if(!strcmp(name, "twitter@twitter.com") && | |
436 !strcmp(proto, "prpl-jabber")) { | |
437 return TRUE; | |
438 } | |
439 | |
440 return FALSE; | |
441 } | |
442 | |
443 static void | |
444 conv_created_cb(PurpleConversation *conv, gpointer null) | |
445 { | |
446 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | |
447 g_return_if_fail(gtkconv != NULL); | |
448 | |
449 /* only attach to twitter conversation window */ | |
450 if(is_twitter_conv(conv)) { | |
451 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
452 if(enabled) { | |
453 attach_to_gtkconv(gtkconv, NULL); | |
454 } | |
455 } | |
456 } | |
457 | |
8 | 458 static gboolean |
459 load_plugin(PurplePlugin * plugin) | |
0 | 460 { |
6 | 461 /* connect to signal */ |
462 purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
463 plugin, PURPLE_CALLBACK(writing_im_cb), NULL); |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
464 purple_signal_connect(purple_conversations_get_handle(), "sending-im-msg", |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
465 plugin, PURPLE_CALLBACK(sending_im_cb), NULL); |
31 | 466 purple_signal_connect(purple_conversations_get_handle(), |
467 "conversation-created", | |
468 plugin, PURPLE_CALLBACK(conv_created_cb), NULL); | |
0 | 469 |
28
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
470 /* compile regex */ |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
471 regp[RECIPIENT] = g_regex_new("@([A-Za-z0-9_]+)", 0, 0, NULL); |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
472 regp[SENDER] = g_regex_new("<body>([A-Za-z0-9_]+): ", 0, 0, NULL); |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
473 regp[COMMAND] = g_regex_new( |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
474 "^(?:\\s*)([dDfFgGlLmMnNtTwW]{1}\\s+[A-Za-z0-9_]+\\Z)", |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
475 G_REGEX_RAW, 0, NULL); |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
476 regp[PSEUDO] = g_regex_new( |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
477 "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)", |
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
478 G_REGEX_RAW, 0, NULL); |
34
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
479 regp[SENDER_WITH_LINK] = g_regex_new("@<a href=.+?>([A-Za-z0-9_]+?)</a>", 0, 0, NULL); |
28
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
480 |
31 | 481 /* attach counter to the existing twitter window*/ |
482 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
483 if(enabled) { | |
484 attach_to_window(); | |
485 } | |
486 | |
6 | 487 return TRUE; |
0 | 488 } |
489 | |
8 | 490 static gboolean |
491 unload_plugin(PurplePlugin * plugin) | |
0 | 492 { |
6 | 493 twitter_debug("pidgin-twitter unload called\n"); |
0 | 494 |
31 | 495 /* disconnect from signal */ |
496 purple_signal_disconnect(purple_conversations_get_handle(), | |
497 "writing-im-msg", | |
498 plugin, PURPLE_CALLBACK(writing_im_cb)); | |
499 purple_signal_disconnect(purple_conversations_get_handle(), | |
500 "sending-im-msg", | |
501 plugin, PURPLE_CALLBACK(sending_im_cb)); | |
502 purple_signal_disconnect(purple_conversations_get_handle(), | |
503 "conversation-created", | |
504 plugin, PURPLE_CALLBACK(conv_created_cb)); | |
505 | |
506 /* unreference regp */ | |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
507 g_regex_unref(regp[RECIPIENT]); |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
508 g_regex_unref(regp[SENDER]); |
21
38fe566b5ee1
unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
20
diff
changeset
|
509 g_regex_unref(regp[COMMAND]); |
38fe566b5ee1
unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
20
diff
changeset
|
510 g_regex_unref(regp[PSEUDO]); |
34
44ffbd056f33
added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
32
diff
changeset
|
511 g_regex_unref(regp[SENDER_WITH_LINK]); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
512 |
31 | 513 /* detach from twitter window */ |
514 detach_from_window(); | |
515 | |
6 | 516 return TRUE; |
0 | 517 } |
518 | |
31 | 519 static void |
520 counter_prefs_cb(const char *name, PurplePrefType type, | |
521 gconstpointer val, gpointer data) | |
522 { | |
523 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
524 if(enabled) { | |
525 attach_to_window(); //xxx shoud check whether already attached or not. | |
526 } | |
527 else { | |
528 detach_from_window(); | |
529 } | |
530 } | |
531 | |
8 | 532 static PurplePluginPrefFrame * |
533 get_plugin_pref_frame(PurplePlugin * plugin) | |
0 | 534 { |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
535 /* create gtk elements for the plugin preferences */ |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
536 |
6 | 537 PurplePluginPref *pref; |
538 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); | |
0 | 539 |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
540 /* frame title */ |
31 | 541 pref = purple_plugin_pref_new_with_label("Translation Configurations"); |
6 | 542 purple_plugin_pref_frame_add(frame, pref); |
0 | 543 |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
544 /* translation settings */ |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
545 pref = purple_plugin_pref_new_with_name_and_label( |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
546 OPT_TRANSLATE_RECIPIENT, |
12 | 547 "Translate @username to link"); |
6 | 548 purple_plugin_pref_frame_add(frame, pref); |
0 | 549 |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
550 pref = purple_plugin_pref_new_with_name_and_label( |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
551 OPT_TRANSLATE_SENDER, |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
552 "Translate sender name to link"); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
553 purple_plugin_pref_frame_add(frame, pref); |
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
554 |
31 | 555 |
556 | |
557 | |
558 | |
559 /* frame title */ | |
560 pref = purple_plugin_pref_new_with_label("Miscellaneous Configurations"); | |
561 purple_plugin_pref_frame_add(frame, pref); | |
562 | |
563 /* escape pseudo command setting */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
564 pref = purple_plugin_pref_new_with_name_and_label( |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
565 OPT_ESCAPE_PSEUDO, |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
566 "Escape pseudo command string"); |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
567 purple_plugin_pref_frame_add(frame, pref); |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
568 |
31 | 569 /* comaescape pseudo command setting */ |
570 pref = purple_plugin_pref_new_with_name_and_label( | |
571 OPT_COUNTER, | |
572 "Show text counter"); | |
573 purple_plugin_pref_frame_add(frame, pref); | |
574 | |
575 /* xxx */ | |
576 purple_prefs_connect_callback(plugin, OPT_COUNTER, | |
577 counter_prefs_cb, NULL); | |
578 | |
579 | |
580 | |
581 | |
582 | |
583 /* frame title */ | |
584 pref = purple_plugin_pref_new_with_label("Sound Configurations"); | |
585 purple_plugin_pref_frame_add(frame, pref); | |
586 | |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
587 /* sound settings for recipient */ |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
588 pref = purple_plugin_pref_new_with_name_and_label( |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
589 OPT_PLAYSOUND_RECIPIENT, |
12 | 590 "Play sound on a reply to the user in the recipient list"); |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
591 purple_plugin_pref_frame_add(frame, pref); |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
592 |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
593 /* recipient list */ |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
594 pref = purple_plugin_pref_new_with_name_and_label( |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
595 OPT_USERLIST_RECIPIENT, |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
596 "Recipient List"); |
6 | 597 purple_plugin_pref_frame_add(frame, pref); |
1 | 598 |
8 | 599 /* sound id selector */ |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
600 pref = purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_RECIPIENT, "Recipient Sound"); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
601 |
8 | 602 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
603 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0)); | |
604 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1)); | |
605 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); | |
606 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3)); | |
607 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4)); | |
608 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5)); | |
609 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6)); | |
610 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7)); | |
611 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8)); | |
612 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9)); | |
613 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); | |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
614 |
8 | 615 purple_plugin_pref_frame_add(frame, pref); |
616 | |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
617 |
31 | 618 /* sound setting for sender */ |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
619 pref = purple_plugin_pref_new_with_name_and_label( |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
620 OPT_PLAYSOUND_SENDER, |
12 | 621 "Play sound if sender of a message is in the sender list"); |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
622 purple_plugin_pref_frame_add(frame, pref); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
623 |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
624 /* sender list */ |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
625 pref = purple_plugin_pref_new_with_name_and_label( |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
626 OPT_USERLIST_SENDER, |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
627 "Sender List"); |
7
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
628 purple_plugin_pref_frame_add(frame, pref); |
1 | 629 |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
630 /* sound id selector */ |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
631 pref = purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_SENDER, "Sender Sound"); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
632 |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
633 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
634 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
635 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
636 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
637 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
638 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
639 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
640 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
641 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
642 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
643 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
644 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
645 |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
646 purple_plugin_pref_frame_add(frame, pref); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
647 |
6 | 648 return frame; |
0 | 649 } |
650 | |
6 | 651 static PurplePluginUiInfo pref_info = { |
652 get_plugin_pref_frame | |
0 | 653 }; |
654 | |
6 | 655 static PurplePluginInfo info = { |
656 PURPLE_PLUGIN_MAGIC, | |
657 PURPLE_MAJOR_VERSION, | |
658 PURPLE_MINOR_VERSION, | |
659 PURPLE_PLUGIN_STANDARD, /**< type */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
660 NULL, /**< ui_req */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
661 0, /**< flags */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
662 NULL, /**< deps */ |
6 | 663 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
31 | 664 PLUGIN_ID, /**< id */ |
6 | 665 "Pidgin-Twitter", /**< name */ |
31 | 666 "0.6.0", /**< version */ |
30 | 667 "replaces usernames with links and play sounds", /** summary */ |
668 "replaces usernames with links and play sounds", /** desc */ | |
6 | 669 "Yoshiki Yazawa (yaz@honeyplanet.jp)", /**< author */ |
670 "http://www.honeyplanet.jp/", /**< homepage */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
671 load_plugin, /**< load */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
672 unload_plugin, /**< unload */ |
6 | 673 NULL, /**< destroy */ |
674 NULL, /**< ui_info */ | |
675 NULL, /**< extra_info */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
676 &pref_info, /**< pref info */ |
6 | 677 NULL |
0 | 678 }; |
679 | |
8 | 680 static void |
681 init_plugin(PurplePlugin * plugin) | |
0 | 682 { |
6 | 683 g_type_init(); |
0 | 684 |
6 | 685 /* add plugin preferences */ |
686 purple_prefs_add_none(OPT_PIDGINTWITTER); | |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
687 purple_prefs_add_bool(OPT_TRANSLATE_RECIPIENT, TRUE); |
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
688 purple_prefs_add_bool(OPT_TRANSLATE_SENDER, TRUE); |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
689 purple_prefs_add_bool(OPT_ESCAPE_PSEUDO, TRUE); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
690 |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
691 purple_prefs_add_bool(OPT_PLAYSOUND_RECIPIENT, TRUE); |
15
6be35fe9d18c
changed default value of playsound for sender. now it is enabled by default.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
14
diff
changeset
|
692 purple_prefs_add_bool(OPT_PLAYSOUND_SENDER, TRUE); |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
693 purple_prefs_add_int(OPT_SOUNDID_RECIPIENT, PURPLE_SOUND_POUNCE_DEFAULT); |
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
694 purple_prefs_add_string(OPT_USERLIST_RECIPIENT, DEFAULT_LIST); |
16
728c068534d1
default soundid for sender has been changed to pounce default since anything other may be disabled by configuration so that it may be confusing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
15
diff
changeset
|
695 purple_prefs_add_int(OPT_SOUNDID_SENDER, PURPLE_SOUND_POUNCE_DEFAULT); |
11
7ea2a717af42
now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
10
diff
changeset
|
696 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); |
31 | 697 |
698 purple_prefs_add_bool(OPT_COUNTER, TRUE); | |
0 | 699 } |
700 | |
701 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) |