Mercurial > pidgin-twitter
annotate pidgin-twitter.c @ 38:625e385036c3
applied indent to fix indentations
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Mon, 12 May 2008 19:46:10 +0900 |
parents | bafe2abf2d3b |
children | 2ac81c0afb53 |
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 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
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" |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
54 #define OPT_SUPPRESS_OOPS OPT_PIDGINTWITTER "/suppress_oops" |
31 | 55 |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
56 #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
|
57 #define SENDER_FORMAT "<a href='http://twitter.com/%s'>%s</a>: " |
31 | 58 #define DEFAULT_LIST "(list of users: separated with ' ,:;')" |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
59 #define OOPS_MESSAGE "<body>Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).<BR></body>" |
0 | 60 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
61 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, fmt, ## __VA_ARGS__); |
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
62 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, fmt, ## __VA_ARGS__); |
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]; |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
66 static gboolean suppress_oops = FALSE; |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
67 |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
68 /* prototypes */ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
69 static gboolean is_twitter_conv(PurpleConversation *conv); |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
70 static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null); |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
71 static void detach_from_gtkconv(PidginConversation *gtkconv, gpointer null); |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
72 static void escape(gchar **str); |
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
|
73 |
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 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
|
75 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
|
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 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
|
78 |
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 /* replace senders with link */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
80 newstr = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
81 g_regex_replace(regp[SENDER_WITH_LINK], *str, -1, 0, "@\\1", 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
|
82 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
|
83 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
|
84 |
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
|
85 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
|
86 *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
|
87 } |
0 | 88 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
89 static void |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
90 escape(gchar **str) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
91 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
92 GMatchInfo *match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
93 gchar *newstr = NULL, *match = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
94 gboolean flag = FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
95 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
96 /* search genuine command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
97 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
|
98 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
99 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
100 twitter_debug("command = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
101 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
102 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
103 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
104 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
105 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
106 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
107 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
108 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
109 return; |
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 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
112 /* if not found, check pseudo command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
113 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
|
114 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
115 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
116 twitter_debug("pseudo = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
117 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
118 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
119 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
120 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
121 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
122 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
123 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
124 /* if there is pseudo one, escape it */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
125 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
126 /* put ". " to the beginning of buffer */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
127 newstr = g_strdup_printf(". %s", *str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
128 twitter_debug("*str = %s\n", *str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
129 twitter_debug("newstr = %s\n", newstr); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
130 g_free(*str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
131 *str = newstr; |
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 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
135 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
136 sending_im_cb(PurpleAccount *account, char *recipient, char **buffer, |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
137 void *data) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
138 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
139 const gchar *proto; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
140 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
141 /* check if the message is from twitter */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
142 proto = purple_account_get_protocol_id(account); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
143 twitter_debug("sending_im_cb\n"); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
144 twitter_debug("proto = %s\n", proto); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
145 twitter_debug("recipient = %s\n", recipient); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
146 |
31 | 147 if(!strcmp(proto, "prpl-jabber") && |
148 !strcmp(recipient, "twitter@twitter.com")) { | |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
149 /* escape */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
150 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
151 escape(buffer); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
152 } |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
153 /* strip excessive link from @username */ |
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
|
154 delete_sender_with_link(buffer); |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
155 |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
156 /* try to suppress Oops message */ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
157 gint utflen = g_utf8_strlen(*buffer, -1); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
158 gint bytes = strlen(*buffer); |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
159 twitter_debug("utflen = %d bytes = %d\n", utflen, bytes); |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
160 if(bytes > 140 && utflen <= 140) |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
161 suppress_oops = TRUE; |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
162 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
163 return FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
164 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
165 |
1 | 166 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
167 eval(const GMatchInfo *match_info, GString *result, gpointer user_data) |
1 | 168 { |
169 gchar sub[128]; | |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
170 gchar *match = g_match_info_fetch(match_info, 1); |
1 | 171 |
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
|
172 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
|
173 |
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 snprintf(sub, 128, which ? SENDER_FORMAT : RECIPIENT_FORMAT, match, match); |
6 | 175 twitter_debug("sub = %s\n", sub); |
1 | 176 g_string_append(result, sub); |
177 g_free(match); | |
178 | |
179 return FALSE; | |
180 } | |
0 | 181 |
8 | 182 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
|
183 translate(gchar **str, int which) |
0 | 184 { |
1 | 185 gchar *newstr; |
186 | |
187 twitter_debug("*str = %s\n", *str); | |
0 | 188 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
189 newstr = g_regex_replace_eval(regp[which], // compiled regex |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
190 *str, // subject string |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
191 -1, // length of the subject string |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
192 0, // start position |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
193 0, // match options |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
194 eval, // function to be called for each match |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
195 &which, // user data |
6 | 196 NULL); // error handler |
1 | 197 |
198 twitter_debug("newstr = %s\n", newstr); | |
199 | |
200 g_free(*str); | |
201 *str = newstr; | |
202 } | |
0 | 203 |
8 | 204 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
|
205 playsound(gchar **str, int which) |
1 | 206 { |
207 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
|
208 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
|
209 gchar **candidates = NULL, **candidate = NULL; |
0 | 210 |
31 | 211 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : |
212 OPT_USERLIST_RECIPIENT); | |
5
6ac1867d7e8e
string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 |
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 candidates = g_strsplit_set(list, " ,:;", 0); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
218 g_return_if_fail(candidates != NULL); |
1 | 219 |
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
|
220 g_regex_match(regp[which], *str, 0, &match_info); |
6 | 221 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
|
222 gchar *user = g_match_info_fetch(match_info, 1); |
1 | 223 twitter_debug("user = %s\n", user); |
0 | 224 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
225 for(candidate = candidates; *candidate; candidate++) { |
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
|
226 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
|
227 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
|
228 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
|
229 if(!strcmp(user, *candidate)) { |
1 | 230 twitter_debug("match. play sound\n"); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
231 purple_sound_play_event(purple_prefs_get_int |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
232 (which ? OPT_SOUNDID_SENDER : |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
233 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
|
234 break; |
1 | 235 } |
236 } | |
6 | 237 g_free(user); |
238 g_match_info_next(match_info, NULL); | |
1 | 239 } |
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
|
240 g_strfreev(candidates); |
6 | 241 g_match_info_free(match_info); |
0 | 242 } |
243 | |
1 | 244 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
245 writing_im_cb(PurpleAccount *account, char *sender, char **buffer, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
246 PurpleConversation *conv, int *flags, void *data) |
0 | 247 { |
248 const gchar *proto; | |
249 | |
1 | 250 /* check if the message is from twitter */ |
0 | 251 proto = purple_account_get_protocol_id(account); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
252 twitter_debug("writing_im_cb\n"); |
1 | 253 twitter_debug("proto = %s\n", proto); |
254 twitter_debug("sender = %s\n", sender); | |
0 | 255 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
256 if(!strcmp(sender, "twitter@twitter.com") && !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
|
257 /* 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
|
258 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
|
259 playsound(buffer, SENDER); |
1 | 260 } |
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 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
|
262 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
|
263 } |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
264 |
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
265 /* translate */ |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
266 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
|
267 translate(buffer, SENDER); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
268 } |
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
269 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
|
270 translate(buffer, RECIPIENT); |
1 | 271 } |
0 | 272 |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
273 /* escape */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
274 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
|
275 escape(buffer); |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
276 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
277 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
278 return FALSE; |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
279 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
280 |
31 | 281 static void |
282 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
283 gchar *new_text, gint new_text_length, gpointer user_data) | |
284 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
285 PidginConversation *gtkconv = (PidginConversation *)user_data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
286 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
287 gchar *markup = NULL; |
31 | 288 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
289 g_return_if_fail(gtkconv != NULL); |
31 | 290 |
291 guint count = gtk_text_buffer_get_char_count(textbuffer) + | |
292 (unsigned int)g_utf8_strlen(new_text, -1); | |
293 | |
32
92715b489de6
commented out an annoying debug message
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
31
diff
changeset
|
294 // 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
|
295 // new_text, g_utf8_strlen(new_text, -1), new_text_length); |
31 | 296 |
297 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
298 count <= 140 ? "black" : "red", count); |
31 | 299 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
300 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
301 counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
302 if(counter) |
31 | 303 gtk_label_set_markup(GTK_LABEL(counter), markup); |
304 | |
305 g_free(markup); | |
306 } | |
307 | |
308 static void | |
309 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
310 GtkTextIter *end_pos, gpointer user_data) | |
311 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
312 PidginConversation *gtkconv = (PidginConversation *)user_data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
313 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
314 gchar *markup = NULL; |
31 | 315 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
316 g_return_if_fail(gtkconv != NULL); |
31 | 317 |
318 guint count = gtk_text_buffer_get_char_count(textbuffer) - | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
319 (gtk_text_iter_get_offset(end_pos) - |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
320 gtk_text_iter_get_offset(start_pos)); |
31 | 321 |
322 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
323 count <= 140 ? "black" : "red", count); |
31 | 324 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
325 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
326 counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
327 if(counter) |
31 | 328 gtk_label_set_markup(GTK_LABEL(counter), markup); |
329 | |
330 g_free(markup); | |
331 } | |
332 | |
333 | |
334 static void | |
335 detach_from_window(void) | |
336 { | |
337 GList *list; | |
338 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
339 for(list = pidgin_conv_windows_get_list(); list; list = list->next) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
340 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
341 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
342 pidgin_conv_window_get_active_conversation(win); |
31 | 343 if(is_twitter_conv(conv)) |
344 detach_from_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
345 } |
31 | 346 } |
347 | |
348 static void | |
349 detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) | |
350 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
351 GtkWidget *box, *counter = NULL, *sep = NULL; |
31 | 352 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
353 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
354 (GFunc) insert_text_cb, gtkconv); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
355 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
356 (GFunc) delete_text_cb, gtkconv); |
31 | 357 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
358 box = gtkconv->toolbar; |
31 | 359 |
360 /* remove counter */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
361 counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
362 if(counter) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
363 gtk_container_remove(GTK_CONTAINER(box), counter); |
31 | 364 g_object_unref(counter); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
365 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL); |
31 | 366 } |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
367 |
31 | 368 /* remove separator */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
369 sep = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-sep"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
370 if(sep) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
371 gtk_container_remove(GTK_CONTAINER(box), sep); |
31 | 372 g_object_unref(sep); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
373 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", NULL); |
31 | 374 } |
375 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
376 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 377 } |
378 | |
379 static void | |
380 attach_to_window(void) | |
381 { | |
382 GList *list; | |
383 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
384 for(list = pidgin_conv_windows_get_list(); list; list = list->next) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
385 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
386 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
387 pidgin_conv_window_get_active_conversation(win); |
31 | 388 if(is_twitter_conv(conv)) |
389 attach_to_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
390 } |
31 | 391 } |
392 | |
393 static void | |
394 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) | |
395 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
396 GtkWidget *box, *sep, *counter; |
31 | 397 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
398 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
399 counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
400 g_return_if_fail(counter == NULL); |
31 | 401 |
402 /* make counter object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
403 counter = gtk_label_new(NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
404 gtk_widget_set_name(counter, "counter_label"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
405 gtk_label_set_text(GTK_LABEL(counter), "0"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
406 gtk_box_pack_end(GTK_BOX(box), counter, FALSE, FALSE, 0); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
407 gtk_widget_show_all(counter); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
408 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", counter); |
31 | 409 |
410 /* make separator object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
411 sep = gtk_vseparator_new(); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
412 gtk_box_pack_end(GTK_BOX(box), sep, FALSE, FALSE, 0); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
413 gtk_widget_show_all(sep); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
414 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep); |
31 | 415 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
416 /* connect signals, etc. */ |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
417 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
418 G_CALLBACK(insert_text_cb), gtkconv); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
419 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
420 G_CALLBACK(delete_text_cb), gtkconv); |
31 | 421 |
422 /* redraw window */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
423 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 424 } |
425 | |
426 static gboolean | |
427 is_twitter_conv(PurpleConversation *conv) | |
428 { | |
429 const char *name = purple_conversation_get_name(conv); | |
430 PurpleAccount *account = purple_conversation_get_account(conv); | |
431 const gchar *proto = purple_account_get_protocol_id(account); | |
432 | |
433 twitter_debug("is_twitter_conv\n"); | |
434 twitter_debug("name = %s\n", name); | |
435 twitter_debug("proto = %s\n", proto); | |
436 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
437 if(!strcmp(name, "twitter@twitter.com") && !strcmp(proto, "prpl-jabber")) { |
31 | 438 return TRUE; |
439 } | |
440 | |
441 return FALSE; | |
442 } | |
443 | |
444 static void | |
445 conv_created_cb(PurpleConversation *conv, gpointer null) | |
446 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
447 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
448 g_return_if_fail(gtkconv != NULL); |
31 | 449 |
450 /* only attach to twitter conversation window */ | |
451 if(is_twitter_conv(conv)) { | |
452 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
453 if(enabled) { | |
454 attach_to_gtkconv(gtkconv, NULL); | |
455 } | |
456 } | |
457 } | |
458 | |
8 | 459 static gboolean |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
460 receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
461 PurpleConversation *conv, PurpleMessageFlags *flags, void *data) |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
462 { |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
463 twitter_debug("receiving_im_cb: buffer = %s\n", *buffer); |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
464 twitter_debug("receiving_im_cb: suppress_oops = %d\n", suppress_oops); |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
465 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
466 if(!suppress_oops || !purple_prefs_get_bool(OPT_SUPPRESS_OOPS)) |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
467 return FALSE; |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
468 |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
469 if(strstr(*buffer, OOPS_MESSAGE)) { |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
470 twitter_debug("receiving_im_cb: clearing sender and buffer\n"); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
471 g_free(*sender); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
472 *sender = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
473 g_free(*buffer); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
474 *buffer = NULL; |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
475 suppress_oops = FALSE; |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
476 } |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
477 return FALSE; |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
478 } |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
479 |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
480 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
481 load_plugin(PurplePlugin *plugin) |
0 | 482 { |
6 | 483 /* connect to signal */ |
484 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
|
485 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
|
486 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
|
487 plugin, PURPLE_CALLBACK(sending_im_cb), NULL); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
488 purple_signal_connect(purple_conversations_get_handle(), |
31 | 489 "conversation-created", |
490 plugin, PURPLE_CALLBACK(conv_created_cb), NULL); | |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
491 purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg", |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
492 plugin, PURPLE_CALLBACK(receiving_im_cb), NULL); |
0 | 493 |
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
|
494 /* 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
|
495 regp[RECIPIENT] = g_regex_new("@([A-Za-z0-9_]+)", 0, 0, NULL); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
496 regp[SENDER] = g_regex_new("<body>([A-Za-z0-9_]+): ", 0, 0, NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
497 regp[COMMAND] = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
498 g_regex_new("^(?:\\s*)([dDfFgGlLmMnNtTwW]{1}\\s+[A-Za-z0-9_]+\\Z)", |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
499 G_REGEX_RAW, 0, NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
500 regp[PSEUDO] = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
501 g_regex_new |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
502 ("^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)", |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
503 G_REGEX_RAW, 0, NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
504 regp[SENDER_WITH_LINK] = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
505 g_regex_new |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
506 ("@(?:<font .+?>)?<a href=.+?>([A-Za-z0-9_]+?)</a>(?:</font>)?", 0, 0, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
507 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
|
508 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
509 /* attach counter to the existing twitter window */ |
31 | 510 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); |
511 if(enabled) { | |
512 attach_to_window(); | |
513 } | |
514 | |
6 | 515 return TRUE; |
0 | 516 } |
517 | |
8 | 518 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
519 unload_plugin(PurplePlugin *plugin) |
0 | 520 { |
6 | 521 twitter_debug("pidgin-twitter unload called\n"); |
0 | 522 |
31 | 523 /* disconnect from signal */ |
524 purple_signal_disconnect(purple_conversations_get_handle(), | |
525 "writing-im-msg", | |
526 plugin, PURPLE_CALLBACK(writing_im_cb)); | |
527 purple_signal_disconnect(purple_conversations_get_handle(), | |
528 "sending-im-msg", | |
529 plugin, PURPLE_CALLBACK(sending_im_cb)); | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
530 purple_signal_disconnect(purple_conversations_get_handle(), |
31 | 531 "conversation-created", |
532 plugin, PURPLE_CALLBACK(conv_created_cb)); | |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
533 purple_signal_disconnect(purple_conversations_get_handle(), |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
534 "receiving-im-msg", |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
535 plugin, PURPLE_CALLBACK(receiving_im_cb)); |
31 | 536 |
537 /* 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
|
538 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
|
539 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
|
540 g_regex_unref(regp[COMMAND]); |
38fe566b5ee1
unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
20
diff
changeset
|
541 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
|
542 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
|
543 |
31 | 544 /* detach from twitter window */ |
545 detach_from_window(); | |
546 | |
6 | 547 return TRUE; |
0 | 548 } |
549 | |
31 | 550 static void |
551 counter_prefs_cb(const char *name, PurplePrefType type, | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
552 gconstpointer val, gpointer data) |
31 | 553 { |
554 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
555 if(enabled) { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
556 attach_to_window(); //xxx should check whether already attached or not? |
31 | 557 } |
558 else { | |
559 detach_from_window(); | |
560 } | |
561 } | |
562 | |
8 | 563 static PurplePluginPrefFrame * |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
564 get_plugin_pref_frame(PurplePlugin *plugin) |
0 | 565 { |
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
|
566 /* create gtk elements for the plugin preferences */ |
6 | 567 PurplePluginPref *pref; |
568 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); | |
0 | 569 |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
570 /************************/ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
571 /* translatione heading */ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
572 /************************/ |
31 | 573 pref = purple_plugin_pref_new_with_label("Translation Configurations"); |
6 | 574 purple_plugin_pref_frame_add(frame, pref); |
0 | 575 |
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
|
576 /* translation settings */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
577 pref = purple_plugin_pref_new_with_name_and_label(OPT_TRANSLATE_RECIPIENT, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
578 "Translate @username to link"); |
6 | 579 purple_plugin_pref_frame_add(frame, pref); |
0 | 580 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
581 pref = purple_plugin_pref_new_with_name_and_label(OPT_TRANSLATE_SENDER, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
582 "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
|
583 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
|
584 |
31 | 585 |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
586 /*************************/ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
587 /* miscellaneous heading */ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
588 /*************************/ |
31 | 589 pref = purple_plugin_pref_new_with_label("Miscellaneous Configurations"); |
590 purple_plugin_pref_frame_add(frame, pref); | |
591 | |
592 /* escape pseudo command setting */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
593 pref = purple_plugin_pref_new_with_name_and_label(OPT_ESCAPE_PSEUDO, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
594 "Escape pseudo command string"); |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
595 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
|
596 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
597 /* show text counter */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
598 pref = purple_plugin_pref_new_with_name_and_label(OPT_COUNTER, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
599 "Show text counter"); |
31 | 600 purple_plugin_pref_frame_add(frame, pref); |
601 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
602 purple_prefs_connect_callback(plugin, OPT_COUNTER, counter_prefs_cb, NULL); |
31 | 603 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
604 /* suppress oops message */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
605 pref = purple_plugin_pref_new_with_name_and_label(OPT_SUPPRESS_OOPS, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
606 "Suppress oops message"); |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
607 purple_plugin_pref_frame_add(frame, pref); |
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
608 |
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
609 |
36
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
610 /*****************/ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
611 /* sound heading */ |
ae1d059fa6fe
added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
35
diff
changeset
|
612 /*****************/ |
31 | 613 pref = purple_plugin_pref_new_with_label("Sound Configurations"); |
614 purple_plugin_pref_frame_add(frame, pref); | |
615 | |
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
|
616 /* sound settings for recipient */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
617 pref = purple_plugin_pref_new_with_name_and_label(OPT_PLAYSOUND_RECIPIENT, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
618 "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
|
619 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
|
620 |
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
|
621 /* recipient list */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
622 pref = purple_plugin_pref_new_with_name_and_label(OPT_USERLIST_RECIPIENT, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
623 "Recipient List"); |
6 | 624 purple_plugin_pref_frame_add(frame, pref); |
1 | 625 |
8 | 626 /* sound id selector */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
627 pref = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
628 purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_RECIPIENT, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
629 "Recipient Sound"); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
630 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
631 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
632 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
633 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
634 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
635 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
636 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
637 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
638 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
639 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
640 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
641 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
642 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
|
643 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
644 purple_plugin_pref_frame_add(frame, pref); |
8 | 645 |
31 | 646 /* sound setting for sender */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
647 pref = purple_plugin_pref_new_with_name_and_label(OPT_PLAYSOUND_SENDER, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
648 "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
|
649 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
|
650 |
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
|
651 /* sender list */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
652 pref = purple_plugin_pref_new_with_name_and_label(OPT_USERLIST_SENDER, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
653 "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
|
654 purple_plugin_pref_frame_add(frame, pref); |
1 | 655 |
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
|
656 /* sound id selector */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
657 pref = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
658 purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_SENDER, |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
659 "Sender Sound"); |
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
|
660 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
661 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
662 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
663 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
664 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
665 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
666 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
667 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
668 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
669 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
670 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
671 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9)); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
672 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); |
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
|
673 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
674 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
|
675 |
6 | 676 return frame; |
0 | 677 } |
678 | |
6 | 679 static PurplePluginUiInfo pref_info = { |
680 get_plugin_pref_frame | |
0 | 681 }; |
682 | |
6 | 683 static PurplePluginInfo info = { |
684 PURPLE_PLUGIN_MAGIC, | |
685 PURPLE_MAJOR_VERSION, | |
686 PURPLE_MINOR_VERSION, | |
687 PURPLE_PLUGIN_STANDARD, /**< type */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
688 NULL, /**< ui_req */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
689 0, /**< flags */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
690 NULL, /**< deps */ |
6 | 691 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
31 | 692 PLUGIN_ID, /**< id */ |
6 | 693 "Pidgin-Twitter", /**< name */ |
31 | 694 "0.6.0", /**< version */ |
30 | 695 "replaces usernames with links and play sounds", /** summary */ |
696 "replaces usernames with links and play sounds", /** desc */ | |
6 | 697 "Yoshiki Yazawa (yaz@honeyplanet.jp)", /**< author */ |
698 "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
|
699 load_plugin, /**< load */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
700 unload_plugin, /**< unload */ |
6 | 701 NULL, /**< destroy */ |
702 NULL, /**< ui_info */ | |
703 NULL, /**< extra_info */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
704 &pref_info, /**< pref info */ |
6 | 705 NULL |
0 | 706 }; |
707 | |
8 | 708 static void |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
709 init_plugin(PurplePlugin *plugin) |
0 | 710 { |
6 | 711 g_type_init(); |
0 | 712 |
6 | 713 /* add plugin preferences */ |
714 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
|
715 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
|
716 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
|
717 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
|
718 |
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
|
719 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
|
720 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
|
721 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
|
722 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
|
723 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
|
724 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); |
31 | 725 |
726 purple_prefs_add_bool(OPT_COUNTER, TRUE); | |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
727 purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); |
0 | 728 } |
729 | |
730 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) |