Mercurial > pidgin-twitter
annotate pidgin-twitter.c @ 239:e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 07 Oct 2008 14:51:22 +0900 |
parents | 1c85aa4acb9d |
children | 405f8b880142 |
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 | |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
21 #include "pidgin-twitter.h" |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
22 |
164 | 23 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
24 /***********/ |
0 | 25 /* globals */ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
26 /***********/ |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
27 #define NUM_REGPS 12 |
200
9a2d727f39b4
removed jisko support as a protest to their expulsion policy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
199
diff
changeset
|
28 #define NUM_SERVICES 3 /* twitter, wassr, identica. */ |
196
b436d72447e8
make use of got_page_cb to obtain icons for jisko.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
194
diff
changeset
|
29 static GRegex *regp[NUM_REGPS]; |
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
|
30 static gboolean suppress_oops = FALSE; |
194
1495b478680b
tentative support for jisko.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
183
diff
changeset
|
31 static GHashTable *icon_hash[NUM_SERVICES]; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
32 static GHashTable *conv_hash = NULL; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
33 static GList *statuseslist = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
34 static GList *postedlist = NULL; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
35 static GList *wassr_parrot_list = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
36 static GList *identica_parrot_list = NULL; |
214
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
37 #ifdef _WIN32 |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
38 static gboolean blink_state = FALSE; |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
39 static gboolean blink_modified = FALSE; |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
40 #endif |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
41 |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
42 static struct _source { |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
43 guint id; |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
44 PurpleConversation *conv; |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
45 } source; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
46 |
217
55908ee1467f
workaround for that mingw's ld does not support weak declaration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
215
diff
changeset
|
47 #ifndef _WIN32 |
210
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
48 extern gchar *sanitize_utf(const gchar *msg, gsize len, gsize *newlen) __attribute__ ((weak)); |
217
55908ee1467f
workaround for that mingw's ld does not support weak declaration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
215
diff
changeset
|
49 #endif |
164 | 50 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
51 /*************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
52 /* functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
53 /*************/ |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
54 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
55 /* this function has been taken from autoaccept plugin */ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
56 static gboolean |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
57 ensure_path_exists(const char *dir) |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
58 { |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
59 if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) { |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
60 if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
61 return FALSE; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
62 } |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
63 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
64 return TRUE; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
65 } |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
66 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
67 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
68 /**********************/ |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
69 /* our implementation */ |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
70 /**********************/ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
71 |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
72 static gchar * |
170
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
73 twitter_memrchr(const gchar *s, int c, size_t n) |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
74 { |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
75 int nn = n; |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
76 |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
77 g_return_val_if_fail(s != NULL, NULL); |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
78 |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
79 while(nn+1) { |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
80 if((int)*(s+nn) == c) |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
81 return (gchar *)(s+nn); |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
82 nn--; |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
83 } |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
84 return NULL; |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
85 } |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
86 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
87 static gchar *html_tags[] = { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
88 "<a href=", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
89 "</a>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
90 "<b>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
91 "</b>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
92 "<p>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
93 "</p>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
94 "<div ", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
95 "</div>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
96 "<span ", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
97 "</span>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
98 "<body>", |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
99 "<body ", |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
100 "</body>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
101 "<i>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
102 "</i>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
103 "<font ", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
104 "</font>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
105 "<br>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
106 "<br/>", |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
107 "<img ", |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
108 "<html>", |
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
109 "<html ", |
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
110 "</html>", |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
111 NULL |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
112 }; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
113 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
114 static gchar * |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
115 strip_html_markup(const gchar *src) |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
116 { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
117 gchar *head, *tail; /* head and tail of html */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
118 gchar *begin, *end; /* begin:< end:> */ |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
119 gchar *html, *str; /* copied src and string to be returned */ |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
120 /* gchar *vis1, *vis2; */ /* begin and end of address part */ |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
121 gchar *startp; /* starting point marker */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
122 gchar **tagp; /* tag iterator */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
123 gchar *tmp, *tmp2; /* scratches */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
124 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
125 g_return_val_if_fail(src != NULL, NULL); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
126 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
127 const gchar *ptr, *ent; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
128 gchar *ptr2; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
129 gint entlen; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
130 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
131 /* unescape &x; */ |
137
97f11d057071
fixed "off by one" bug.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
136
diff
changeset
|
132 html = g_malloc0(strlen(src) + 1); |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
133 ptr2 = html; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
134 for(ptr = src; *ptr; ) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
135 if(*ptr == '&') { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
136 ent = purple_markup_unescape_entity(ptr, &entlen); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
137 if(ent != NULL) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
138 while(*ent) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
139 *ptr2++ = *ent++; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
140 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
141 ptr += entlen; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
142 } |
139
9871186ebf8f
fix a bug that strip_html_markup() stalls if purple_markup_unescape_entity() returns NULL.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
138
diff
changeset
|
143 else { |
9871186ebf8f
fix a bug that strip_html_markup() stalls if purple_markup_unescape_entity() returns NULL.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
138
diff
changeset
|
144 *ptr2++ = *ptr++; |
9871186ebf8f
fix a bug that strip_html_markup() stalls if purple_markup_unescape_entity() returns NULL.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
138
diff
changeset
|
145 } |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
146 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
147 else { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
148 *ptr2++ = *ptr++; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
149 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
150 } /* for */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
151 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
152 str = g_strdup("\0"); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
153 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
154 head = html; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
155 tail = head + strlen(html); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
156 startp = head; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
157 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
158 loop: |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
159 begin = NULL; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
160 end = NULL; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
161 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
162 if(startp >= tail) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
163 g_free(html); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
164 return str; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
165 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
166 |
170
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
167 end = strchr(startp, '>'); |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
168 if(end) { |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
169 begin = twitter_memrchr(startp, '<', end - startp); |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
170 if(begin < startp) |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
171 begin = NULL; |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
172 |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
173 if(!begin) { /* '>' found but no corresponding '<' */ |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
174 tmp = g_strndup(startp, end - startp + 1); /* concat until '>' */ |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
175 tmp2 = g_strconcat(str, tmp, NULL); |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
176 g_free(str); |
228 | 177 g_free(tmp); |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
178 str = tmp2; |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
179 startp = end + 1; |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
180 goto loop; |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
181 } |
170
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
182 } |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
183 else { /* neither '>' nor '<' were found */ |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
184 tmp = g_strconcat(str, startp, NULL); /* concat the rest */ |
170
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
185 g_free(str); |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
186 str = tmp; |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
187 g_free(html); |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
188 return str; |
170
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
189 } |
c3f205ec4619
work in progress asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
168
diff
changeset
|
190 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
191 /* here, both < and > are found */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
192 /* concatenate leading part to dest */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
193 tmp = g_strndup(startp, begin - startp); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
194 tmp2 = g_strconcat(str, tmp, NULL); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
195 g_free(tmp); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
196 g_free(str); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
197 str = tmp2; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
198 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
199 /* find tag */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
200 for(tagp = html_tags; *tagp; tagp++) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
201 if(!g_ascii_strncasecmp(begin, *tagp, strlen(*tagp))) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
202 /* we found a valid tag */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
203 /* if tag is <a href=, extract address. */ |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
204 #if 0 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
205 if(!strcmp(*tagp, "<a href=")) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
206 vis1 = NULL; vis2 = NULL; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
207 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
208 vis1 = strchr(begin, '\''); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
209 if(vis1) |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
210 vis2 = strchr(vis1+1, '\''); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
211 if(!vis1) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
212 vis1 = strchr(begin, '\"'); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
213 if(vis1) |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
214 vis2 = strchr(vis1+1, '\"'); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
215 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
216 if(vis1 && vis2) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
217 *vis2 = '\0'; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
218 /* generate "[ http://example.com/ ] anchor " */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
219 tmp = g_strconcat(str, "[ ", vis1+1, " ]", " ", NULL); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
220 g_free(str); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
221 str = tmp; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
222 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
223 startp = end + 1; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
224 goto loop; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
225 } /* <a href= */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
226 else { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
227 /* anything else: discard whole <>. */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
228 startp = end + 1; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
229 goto loop; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
230 } |
171
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
231 #else |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
232 /* anything else: discard whole <>. */ |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
233 startp = end + 1; |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
234 goto loop; |
dfe644871483
revised asymmetric bracket code.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
170
diff
changeset
|
235 #endif |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
236 } /* valid tag */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
237 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
238 |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
239 /* no valid tag was found: copy <brabra> */ |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
240 tmp = g_strndup(begin, end - begin + 1); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
241 tmp2 = g_strconcat(str, tmp, NULL); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
242 g_free(tmp); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
243 g_free(str); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
244 str = tmp2; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
245 startp = end + 1; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
246 goto loop; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
247 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
248 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
249 /* string utilities */ |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
250 static void |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
251 escape(gchar **str) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
252 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
253 GMatchInfo *match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
254 gchar *newstr = NULL, *match = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
255 gboolean flag = FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
256 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
257 /* search genuine command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
258 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
|
259 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
260 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
261 twitter_debug("command = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
262 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
263 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
264 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
265 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
266 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
267 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
268 |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
269 if(flag) |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
270 return; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
271 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
272 /* if not found, check pseudo command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
273 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
|
274 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
275 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
276 twitter_debug("pseudo = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
277 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
278 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
279 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
280 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
281 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
282 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
283 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
284 /* if there is pseudo one, escape it */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
285 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
286 /* put ". " to the beginning of buffer */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
287 newstr = g_strdup_printf(". %s", *str); |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
288 twitter_debug("*str = %s newstr = %s\n", *str, newstr); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
289 g_free(*str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
290 *str = newstr; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
291 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
292 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
293 |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
294 static void |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
295 strip_markup(gchar **str, gboolean escape) |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
296 { |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
297 gchar *plain; |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
298 |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
299 plain = strip_html_markup(*str); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
300 g_free(*str); |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
301 if(escape) { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
302 *str = g_markup_escape_text(plain, -1); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
303 g_free(plain); |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
304 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
305 else { |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
306 *str = plain; |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
307 } |
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
308 twitter_debug("result=%s\n", *str); |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
309 } |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
310 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
311 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
312 /**************************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
313 /* API base get functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
314 /**************************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
315 /* xml parser */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
316 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
317 parse_user(xmlNode *user, status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
318 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
319 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
320 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
321 for(nptr = user->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
322 if(nptr->type == XML_ELEMENT_NODE) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
323 if(!xmlStrcmp(nptr->name, (xmlChar *)"screen_name")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
324 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
325 st->screen_name = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
326 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
327 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
328 else if(!xmlStrcmp(nptr->name, (xmlChar *)"profile_image_url")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
329 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
330 st->profile_image_url = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
331 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
332 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
333 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
334 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
335 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
336 |
164 | 337 static gchar *day_of_week_name[] = { |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
338 "Sun", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
339 "Mon", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
340 "Tue", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
341 "Wed", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
342 "Thu", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
343 "Fri", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
344 "Sat", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
345 NULL |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
346 }; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
347 |
164 | 348 static gchar *month_name[] = { |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
349 "Jan", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
350 "Feb", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
351 "Mar", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
352 "Apr", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
353 "May", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
354 "Jun", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
355 "Jul", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
356 "Aug", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
357 "Sep", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
358 "Oct", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
359 "Nov", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
360 "Dec", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
361 NULL |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
362 }; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
363 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
364 static void |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
365 read_timestamp(const char *str, struct tm *res) |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
366 { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
367 char day_of_week[4]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
368 char month[4]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
369 char time_offset[6]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
370 int day, hour, minute, second, year; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
371 int i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
372 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
373 if(str == NULL || res == NULL) |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
374 return; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
375 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
376 sscanf(str, "%s %s %d %d:%d:%d %s %d", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
377 day_of_week, month, &day, |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
378 &hour, &minute, &second, |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
379 time_offset, &year); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
380 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
381 for(i=0; i<7; i++) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
382 if(!strcmp(day_of_week_name[i], day_of_week)) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
383 res->tm_wday = i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
384 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
385 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
386 for(i=0; i<12; i++) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
387 if(!strcmp(month_name[i], month)) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
388 res->tm_mon = i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
389 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
390 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
391 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
392 res->tm_mday = day; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
393 res->tm_hour = hour; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
394 res->tm_min = minute; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
395 res->tm_sec = second; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
396 res->tm_year = year - 1900; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
397 #ifndef _WIN32 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
398 int offset = atoi(time_offset); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
399 res->tm_gmtoff = -1 * (60 * 60 * offset / 100); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
400 #endif |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
401 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
402 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
403 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
404 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
405 parse_status(xmlNode *status, status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
406 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
407 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
408 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
409 for(nptr = status->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
410 if(nptr->type == XML_ELEMENT_NODE) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
411 if(!xmlStrcmp(nptr->name, (xmlChar *)"created_at")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
412 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
413 st->created_at = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
414 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
415 /* read time stamp */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
416 struct tm res; |
121
8b58990f5ee9
ensure struct tm cleared before use.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
120
diff
changeset
|
417 memset(&res, 0x00, sizeof(struct tm)); |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
418 read_timestamp(str, &res); |
120
b47bc7b89de6
a better way to keep time sane.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
119
diff
changeset
|
419 tzset(); |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
420 #ifdef _WIN32 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
421 st->time = mktime(&res) - timezone; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
422 #else |
123
76012df4e194
time offset in BSD extension has opposite sign
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
423 st->time = mktime(&res) + res.tm_gmtoff; |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
424 #endif |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
425 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
426 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
427 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
428 else if(!xmlStrcmp(nptr->name, (xmlChar *)"id")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
429 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
430 st->id = atoi(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
431 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
432 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
433 else if(!xmlStrcmp(nptr->name, (xmlChar *)"text")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
434 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
435 st->text = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
436 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
437 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
438 else if(!xmlStrcmp(nptr->name, (xmlChar *)"user")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
439 parse_user(nptr, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
440 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
441 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
442 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
443 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
444 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
445 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
446 free_status(status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
447 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
448 g_free(st->created_at); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
449 g_free(st->text); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
450 g_free(st->screen_name); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
451 g_free(st->profile_image_url); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
452 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
453 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
454 static gboolean |
178
7fb35f47a477
keep posted statuses in the postedlist until they certainly become useless.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
171
diff
changeset
|
455 is_posted_message(status_t *status, guint lastid) |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
456 { |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
457 GList *pp = g_list_first(postedlist); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
458 gboolean rv = FALSE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
459 |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
460 while(pp) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
461 GList *next; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
462 status_t *posted = (status_t *)pp->data; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
463 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
464 next = g_list_next(pp); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
465 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
466 if(posted->id == status->id) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
467 rv = TRUE; |
178
7fb35f47a477
keep posted statuses in the postedlist until they certainly become useless.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
171
diff
changeset
|
468 } |
7fb35f47a477
keep posted statuses in the postedlist until they certainly become useless.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
171
diff
changeset
|
469 |
7fb35f47a477
keep posted statuses in the postedlist until they certainly become useless.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
171
diff
changeset
|
470 if(posted->id <= lastid) { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
471 free_status(posted); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
472 g_free(pp->data); |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
473 postedlist = g_list_delete_link(postedlist, pp); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
474 } |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
475 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
476 pp = next; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
477 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
478 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
479 return rv; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
480 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
481 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
482 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
483 get_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
484 const gchar *url_text, size_t len, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
485 const gchar *error_message) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
486 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
487 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
488 xmlDocPtr doc; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
489 xmlNode *nptr, *nptr2; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
490 static guint lastid = 0; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
491 PurpleConversation *conv; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
492 GList *stp; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
493 const gchar *start; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
494 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
495 g_return_if_fail(url_text != NULL); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
496 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
497 conv = (PurpleConversation *)user_data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
498 if(!conv) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
499 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
500 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
501 /* skip to the beginning of xml */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
502 start = strstr(url_text, "<?xml"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
503 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
504 doc = xmlRecoverMemory(start, len - (start - url_text)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
505 if(doc == NULL) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
506 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
507 |
214
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
508 #ifdef _WIN32 |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
509 /* suppress notification of incoming messages. */ |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
510 if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
511 if(!blink_modified) { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
512 blink_modified = TRUE; |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
513 blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM); |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
514 purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE); |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
515 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
516 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
517 #endif |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
518 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
519 for(nptr = doc->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
520 if(nptr->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
521 !xmlStrcmp(nptr->name, (xmlChar *)"statuses")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
522 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
523 for(nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
524 if(nptr2->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
525 !xmlStrcmp(nptr2->name, (xmlChar *)"status")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
526 status_t *st = g_new0(status_t, 1); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
527 statuseslist = g_list_prepend(statuseslist, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
528 parse_status(nptr2, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
529 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
530 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
531 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
532 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
533 |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
534 xmlFreeDoc(doc); |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
535 xmlCleanupParser(); |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
536 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
537 /* process statuseslist */ |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
538 stp = g_list_first(statuseslist); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
539 while(stp) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
540 GList *next; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
541 status_t *st = (status_t *)stp->data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
542 |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
543 next = g_list_next(stp); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
544 |
178
7fb35f47a477
keep posted statuses in the postedlist until they certainly become useless.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
171
diff
changeset
|
545 if(st->id > lastid && !is_posted_message(st, lastid)) { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
546 gchar *msg = NULL; |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
547 gchar *sender = NULL; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
548 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
549 sender = g_strdup("twitter@twitter.com"); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
550 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
551 PurpleMessageFlags flag = PURPLE_MESSAGE_RECV; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
552 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
553 msg = g_strdup_printf("%s: %s", st->screen_name, st->text); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
554 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
555 /* apply filter*/ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
556 if(purple_prefs_get_bool(OPT_FILTER)) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
557 apply_filter(&sender, &msg, &flag, twitter_service); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
558 } |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
559 if(sender && msg) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
560 purple_conv_im_write(conv->u.im, |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
561 sender, |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
562 msg, |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
563 flag, |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
564 st->time); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
565 } |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
566 lastid = st->id; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
567 |
228 | 568 g_free(sender); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
569 g_free(msg); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
570 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
571 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
572 free_status(st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
573 g_free(stp->data); |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
574 statuseslist = g_list_delete_link(statuseslist, stp); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
575 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
576 stp = next; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
577 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
578 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
579 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
580 /* status fetching function. it will be called periodically. */ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
581 static gboolean |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
582 get_status_with_api(gpointer data) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
583 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
584 /* fetch friends time line */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
585 char *request, *header; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
586 char *basic_auth, *basic_auth_encoded; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
587 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
588 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
589 |
158
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
590 /* if disabled, just return */ |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
591 if(!purple_prefs_get_bool(OPT_API_BASE_POST)) |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
592 return TRUE; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
593 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
594 const char *screen_name = |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
595 purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
596 const char *password = |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
597 purple_prefs_get_string(OPT_PASSWORD_TWITTER); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
598 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
599 if (!screen_name || !password || !screen_name[0] || !password[0]) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
600 twitter_debug("screen_name or password is empty\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
601 return TRUE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
602 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
603 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
604 /* auth */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
605 basic_auth = g_strdup_printf("%s:%s", screen_name, password); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
606 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
607 strlen(basic_auth)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
608 g_free(basic_auth); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
609 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
610 /* header */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
611 header = g_strdup_printf(TWITTER_STATUS_GET, basic_auth_encoded); |
162
1237fc885a92
revised http request. "broken_firewall" no longre needed?
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
161
diff
changeset
|
612 request = g_strconcat(header, "\r\n", NULL); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
613 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
614 /* invoke fetch */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
615 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
616 NULL, TRUE, request, TRUE, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
617 get_status_with_api_cb, data); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
618 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
619 g_free(header); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
620 g_free(basic_auth_encoded); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
621 g_free(request); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
622 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
623 return TRUE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
624 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
625 |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
626 /****************************/ |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
627 /* API based post functions */ |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
628 /****************************/ |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
629 static void |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
630 post_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
631 const gchar *url_text, size_t len, |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
632 const gchar *error_message) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
633 { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
634 twitter_message_t *tm = (twitter_message_t *)user_data; |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
635 gchar *msg = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
636 char *p1 = NULL, *p2 = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
637 int error = 1; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
638 PurpleConversation *conv; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
639 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
640 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
641 "twitter@twitter.com", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
642 tm->account); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
643 if (!conv) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
644 twitter_debug("failed to get conversation\n"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
645 goto fin; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
646 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
647 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
648 if (error_message) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
649 /* connection failed or something */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
650 msg = g_strdup_printf("Local error: %s", error_message); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
651 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
652 int code = -1; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
653 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
654 if ((strncmp(url_text, "HTTP/1.0", strlen("HTTP/1.0")) == 0 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
655 || strncmp(url_text, "HTTP/1.1", strlen("HTTP/1.1")) == 0)) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
656 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
657 p1 = strchr(url_text, ' '); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
658 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
659 if (p1) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
660 p1++; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
661 p2 = strchr(p1, ' '); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
662 if (p2) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
663 p2++; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
664 else |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
665 p2 = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
666 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
667 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
668 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
669 code = atoi(p1); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
670 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
671 if (code == 200) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
672 error = 0; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
673 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
674 switch (code) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
675 case 400: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
676 msg = g_strdup("Invalid request. Too many updates?"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
677 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
678 case 401: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
679 msg = g_strdup("Authorization failed."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
680 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
681 case 403: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
682 msg = g_strdup("Your update has been refused by Twitter server " |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
683 "for some reason."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
684 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
685 case 404: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
686 msg = g_strdup("Requested URI is not found."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
687 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
688 case 500: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
689 msg = g_strdup("Server error."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
690 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
691 case 502: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
692 msg = g_strdup("Twitter is down or under maintenance."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
693 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
694 case 503: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
695 msg = g_strdup("Twitter is extremely crowded. " |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
696 "Try again later."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
697 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
698 default: |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
699 msg = g_strdup_printf("Unknown error. (%d %s)", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
700 code, p2 ? p2 : ""); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
701 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
702 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
703 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
704 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
705 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
706 if (!error) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
707 purple_conv_im_write(conv->u.im, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
708 purple_account_get_username(tm->account), |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
709 tm->status, PURPLE_MESSAGE_SEND, tm->time); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
710 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
711 /* cache message ID that posted via API */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
712 gchar *start = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
713 xmlDocPtr doc; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
714 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
715 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
716 start = strstr(url_text, "<?xml"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
717 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
718 if(!start) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
719 goto fin; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
720 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
721 doc = xmlRecoverMemory(start, len - (start - url_text)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
722 if(doc == NULL) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
723 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
724 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
725 /* enqueue posted message to postedlist */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
726 for(nptr = doc->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
727 if(nptr->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
728 !xmlStrcmp(nptr->name, (xmlChar *)"status")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
729 status_t *st = g_new0(status_t, 1); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
730 postedlist = g_list_prepend(postedlist, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
731 parse_status(nptr, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
732 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
733 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
734 |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
735 xmlFreeDoc(doc); |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
736 xmlCleanupParser(); |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
737 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
738 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
739 gchar *m; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
740 m = g_strdup_printf("%s<BR>%s", |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
741 msg, tm->status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
742 /* FIXME: too strong. it should be more smart */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
743 purple_conv_im_write(conv->u.im, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
744 purple_account_get_username(tm->account), |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
745 m, PURPLE_MESSAGE_ERROR, time(NULL)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
746 g_free(m); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
747 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
748 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
749 fin: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
750 if (msg) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
751 g_free(msg); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
752 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
753 if (tm) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
754 if (tm->status) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
755 g_free(tm->status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
756 g_free(tm); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
757 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
758 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
759 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
760 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
761 static void |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
762 post_status_with_api(PurpleAccount *account, char **buffer) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
763 { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
764 char *request, *status, *header; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
765 const char *url_encoded = purple_url_encode(*buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
766 char *basic_auth, *basic_auth_encoded; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
767 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
768 twitter_message_t *tm; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
769 |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
770 const char *screen_name = |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
771 purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
772 const char *password = purple_prefs_get_string(OPT_PASSWORD_TWITTER); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
773 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
774 twitter_debug("tm.account: %s\n", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
775 purple_account_get_username(account)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
776 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
777 if (!screen_name || !password || !screen_name[0] || !password[0]) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
778 twitter_debug("screen_name or password is empty\n"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
779 return; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
780 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
781 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
782 tm = g_new(twitter_message_t, 1); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
783 tm->account = account; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
784 tm->status = g_strdup(*buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
785 tm->time = time(NULL); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
786 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
787 basic_auth = g_strdup_printf("%s:%s", screen_name, password); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
788 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth, |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
789 strlen(basic_auth)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
790 g_free(basic_auth); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
791 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
792 status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
793 header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
794 (int)strlen(status)); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
795 |
162
1237fc885a92
revised http request. "broken_firewall" no longre needed?
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
161
diff
changeset
|
796 request = g_strconcat(header, "\r\n", status, "\r\n", NULL); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
797 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
798 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE, |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
799 NULL, TRUE, request, TRUE, |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
800 post_status_with_api_cb, tm); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
801 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
802 g_free(header); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
803 g_free(basic_auth_encoded); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
804 g_free(status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
805 g_free(request); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
806 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
807 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
808 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
809 /***********************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
810 /* intrinsic functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
811 /***********************/ |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
812 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
813 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
|
814 void *data) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
815 { |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
816 int utflen, bytes; |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
817 gboolean twitter_ac = FALSE, wassr_ac = FALSE, identica_ac = FALSE; |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
818 twitter_debug("called\n"); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
819 |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
820 twitter_ac = is_twitter_account(account, recipient); |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
821 wassr_ac = is_wassr_account(account, recipient); |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
822 identica_ac = is_identica_account(account, recipient); |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
823 |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
824 /* strip all markups */ |
207
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
825 if(twitter_ac || wassr_ac || identica_ac) { |
210
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
826 gchar *tmp, *plain; |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
827 gsize dummy; |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
828 |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
829 tmp = strip_html_markup(*buffer); |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
830 |
217
55908ee1467f
workaround for that mingw's ld does not support weak declaration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
215
diff
changeset
|
831 #ifndef _WIN32 |
210
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
832 if(sanitize_utf) { |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
833 plain = sanitize_utf(tmp, -1, &dummy); |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
834 g_free(tmp); |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
835 } |
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
836 else |
217
55908ee1467f
workaround for that mingw's ld does not support weak declaration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
215
diff
changeset
|
837 #endif |
210
00e26402de03
apply sanitize_utf() if it is available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
209
diff
changeset
|
838 plain = tmp; |
207
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
839 |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
840 if(wassr_ac) { |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
841 /* store sending message to address parrot problem */ |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
842 wassr_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
843 g_list_prepend(wassr_parrot_list, g_strdup(plain)); |
209
d512d1d8712f
improved parrot blocker slightly.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
208
diff
changeset
|
844 twitter_debug("wassr parrot pushed:%s\n", plain); |
207
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
845 } |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
846 else if(identica_ac) { |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
847 /* store sending message to address parrot problem */ |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
848 identica_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
849 g_list_prepend(identica_parrot_list, g_strdup(plain)); |
209
d512d1d8712f
improved parrot blocker slightly.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
208
diff
changeset
|
850 twitter_debug("identica parrot pushed:%s\n", plain); |
207
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
851 } |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
852 |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
853 g_free(*buffer); |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
854 *buffer = g_markup_escape_text(plain, -1); |
0eac0abcc0aa
improved parrot blocker. the string to be pushed should not be escaped.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
205
diff
changeset
|
855 g_free(plain); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
856 } |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
857 |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
858 /* return here if the message is not to twitter */ |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
859 if(!twitter_ac) |
44 | 860 return FALSE; |
861 | |
862 /* escape pseudo command */ | |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
863 if(twitter_ac && |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
864 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
44 | 865 escape(buffer); |
866 } | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
867 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
868 /* update status with Twitter API instead of IM protocol */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
869 if (purple_prefs_get_bool(OPT_API_BASE_POST)) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
870 if (buffer && *buffer) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
871 post_status_with_api(account, buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
872 (*buffer)[0] = '\0'; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
873 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
874 return FALSE; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
875 } |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
876 |
44 | 877 /* try to suppress oops message */ |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
878 utflen = g_utf8_strlen(*buffer, -1); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
879 bytes = strlen(*buffer); |
44 | 880 twitter_debug("utflen = %d bytes = %d\n", utflen, bytes); |
881 if(bytes > 140 && utflen <= 140) | |
882 suppress_oops = TRUE; | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
883 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
884 return FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
885 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
886 |
1 | 887 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
888 eval(const GMatchInfo *match_info, GString *result, gpointer user_data) |
1 | 889 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
890 eval_data *data = (eval_data *)user_data; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
891 gint which = data->which; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
892 gint service = data->service; |
222
b168502b73c3
expanded size of substitution buffer to 32KB. 128 bytes were not sufficient if both user name and channel name are rather long. tenforward reported this problem and umq pointed out the cause.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
221
diff
changeset
|
893 gchar sub[SUBST_BUF_SIZE]; |
1 | 894 |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
895 twitter_debug("which = %d service = %d\n", which, service); |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
896 |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
897 if(which == RECIPIENT) { |
223
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
898 gchar *match1 = g_match_info_fetch(match_info, 1); /* preceding \s */ |
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
899 gchar *match2 = g_match_info_fetch(match_info, 2); /* recipient */ |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
900 const gchar *format = NULL; |
223
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
901 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
902 switch(service) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
903 case twitter_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
904 format = RECIPIENT_FORMAT_TWITTER; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
905 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
906 case wassr_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
907 format = RECIPIENT_FORMAT_WASSR; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
908 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
909 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
910 format = RECIPIENT_FORMAT_IDENTICA; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
911 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
912 default: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
913 twitter_debug("unknown service\n"); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
914 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
915 } |
223
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
916 g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); |
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
917 g_free(match1); |
c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
222
diff
changeset
|
918 g_free(match2); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
919 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
920 else if(which == SENDER) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
921 gchar *match1 = g_match_info_fetch(match_info, 1); /*preceding CR|LF*/ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
922 gchar *match2 = g_match_info_fetch(match_info, 2); /* sender */ |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
923 const gchar *format = NULL; |
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
|
924 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
925 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
926 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
927 format = SENDER_FORMAT_TWITTER; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
928 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
929 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
930 format = SENDER_FORMAT_WASSR; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
931 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
932 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
933 format = SENDER_FORMAT_IDENTICA; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
934 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
935 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
936 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
937 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
938 } |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
939 |
222
b168502b73c3
expanded size of substitution buffer to 32KB. 128 bytes were not sufficient if both user name and channel name are rather long. tenforward reported this problem and umq pointed out the cause.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
221
diff
changeset
|
940 g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
941 |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
942 g_free(match1); |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
943 g_free(match2); |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
944 } |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
945 else if(which == CHANNEL_WASSR && service == wassr_service) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
946 gchar *match1 = g_match_info_fetch(match_info, 1); /*before channel*/ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
947 gchar *match2 = g_match_info_fetch(match_info, 2); /* channel */ |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
948 const gchar *format = CHANNEL_FORMAT_WASSR; |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
949 |
222
b168502b73c3
expanded size of substitution buffer to 32KB. 128 bytes were not sufficient if both user name and channel name are rather long. tenforward reported this problem and umq pointed out the cause.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
221
diff
changeset
|
950 g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
951 |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
952 g_free(match1); |
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
953 g_free(match2); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
954 } |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
955 else if(which == TAG_IDENTICA && service == identica_service) { |
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
956 gchar *match = g_match_info_fetch(match_info, 1); |
229
29c741b1b921
supports identi.ca's quirky tag notation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
228
diff
changeset
|
957 gchar *link = g_ascii_strdown(match, -1); |
231
a93a85623a92
identi.ca tag requires '-' to be stripped as well.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
229
diff
changeset
|
958 purple_str_strip_char(link, '-'); |
229
29c741b1b921
supports identi.ca's quirky tag notation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
228
diff
changeset
|
959 purple_str_strip_char(link, '_'); |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
960 const gchar *format = TAG_FORMAT_IDENTICA; |
229
29c741b1b921
supports identi.ca's quirky tag notation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
228
diff
changeset
|
961 g_snprintf(sub, SUBST_BUF_SIZE, format, link, match); |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
962 g_free(match); |
229
29c741b1b921
supports identi.ca's quirky tag notation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
228
diff
changeset
|
963 g_free(link); |
202
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
964 } |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
965 else if(which == EXCESS_LF) { |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
966 g_snprintf(sub, SUBST_BUF_SIZE, "%s", "\n\n"); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
967 } |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
968 |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
969 g_string_append(result, sub); |
6 | 970 twitter_debug("sub = %s\n", sub); |
1 | 971 |
972 return FALSE; | |
973 } | |
0 | 974 |
8 | 975 static void |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
976 translate(gchar **str, gint regp_id, gint service) |
0 | 977 { |
1 | 978 gchar *newstr; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
979 eval_data *data = g_new0(eval_data, 1); |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
980 |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
981 data->which = regp_id; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
982 data->service = service; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
983 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
984 newstr = g_regex_replace_eval(regp[regp_id], /* compiled regex */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
985 *str, /* subject string */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
986 -1, /* length of the subject string */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
987 0, /* start position */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
988 0, /* match options */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
989 eval, /* function to be called for each match */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
990 data, /* user data */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
991 NULL); /* error handler */ |
1 | 992 |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
993 g_free(data); data = NULL; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
994 |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
995 twitter_debug("which = %d *str = %s newstr = %s\n", regp_id, *str, newstr); |
1 | 996 |
997 g_free(*str); | |
998 *str = newstr; | |
999 } | |
0 | 1000 |
8 | 1001 static void |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1002 playsound(gchar **str, gint which) |
1 | 1003 { |
1004 GMatchInfo *match_info; | |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1005 const gchar *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
|
1006 gchar **candidates = NULL, **candidate = NULL; |
0 | 1007 |
31 | 1008 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : |
1009 OPT_USERLIST_RECIPIENT); | |
5
6ac1867d7e8e
string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2
diff
changeset
|
1010 g_return_if_fail(list != NULL); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1011 if(strstr(list, DEFAULT_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
|
1012 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
|
1013 |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
1014 candidates = g_strsplit_set(list, " ,:;", 0); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
1015 g_return_if_fail(candidates != NULL); |
1 | 1016 |
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
|
1017 g_regex_match(regp[which], *str, 0, &match_info); |
6 | 1018 while(g_match_info_matches(match_info)) { |
52
ac1259fde1d0
due to adaptation to msn style, username of sender has been carried down by one.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
51
diff
changeset
|
1019 gchar *user = NULL; |
ac1259fde1d0
due to adaptation to msn style, username of sender has been carried down by one.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
51
diff
changeset
|
1020 if(which == RECIPIENT) |
ac1259fde1d0
due to adaptation to msn style, username of sender has been carried down by one.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
51
diff
changeset
|
1021 user = g_match_info_fetch(match_info, 1); |
ac1259fde1d0
due to adaptation to msn style, username of sender has been carried down by one.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
51
diff
changeset
|
1022 else if(which == SENDER) |
ac1259fde1d0
due to adaptation to msn style, username of sender has been carried down by one.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
51
diff
changeset
|
1023 user = g_match_info_fetch(match_info, 2); |
1 | 1024 twitter_debug("user = %s\n", user); |
0 | 1025 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1026 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
|
1027 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
|
1028 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
|
1029 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
|
1030 if(!strcmp(user, *candidate)) { |
1 | 1031 twitter_debug("match. play sound\n"); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1032 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
|
1033 (which ? OPT_SOUNDID_SENDER : |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1034 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
|
1035 break; |
1 | 1036 } |
1037 } | |
6 | 1038 g_free(user); |
1039 g_match_info_next(match_info, NULL); | |
1 | 1040 } |
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
|
1041 g_strfreev(candidates); |
6 | 1042 g_match_info_free(match_info); |
0 | 1043 } |
1044 | |
1 | 1045 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1046 writing_im_cb(PurpleAccount *account, char *sender, char **buffer, |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1047 PurpleConversation *conv, int flags, void *data) |
0 | 1048 { |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1049 twitter_debug("called\n"); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1050 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1051 gint service = get_service_type(conv); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1052 |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1053 /* check if the conversation is between twitter */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1054 if(service == unknown_service) |
44 | 1055 return FALSE; |
1056 | |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1057 /* add screen_name if the current message is posted by myself */ |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1058 if (flags & PURPLE_MESSAGE_SEND) { |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1059 gchar *m = NULL; |
145
f220da0c089e
screen_name should be initialized.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
142
diff
changeset
|
1060 const char *screen_name = NULL; |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1061 |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1062 switch(service) { |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1063 case twitter_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1064 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1065 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1066 case wassr_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1067 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1068 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1069 case identica_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1070 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1071 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1072 } |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
1073 |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1074 if (screen_name) { |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1075 m = g_strdup_printf("%s: %s", screen_name, *buffer); |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1076 g_free(*buffer); |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1077 *buffer = m; |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1078 } |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1079 } |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
1080 |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1081 /* strip all markups */ |
136
e67b0231ba56
completely re-wrote strip_html_markup(). new function permits non-tag strings surrounded by <>.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
135
diff
changeset
|
1082 strip_markup(buffer, TRUE); |
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
|
1083 |
44 | 1084 /* playsound */ |
1085 if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) { | |
1086 playsound(buffer, SENDER); | |
1087 } | |
1088 if(purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)) { | |
1089 playsound(buffer, RECIPIENT); | |
1090 } | |
41
0a81ccfa1941
strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
40
diff
changeset
|
1091 |
44 | 1092 /* translate */ |
1093 if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) { | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1094 translate(buffer, SENDER, service); |
44 | 1095 } |
202
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
1096 if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) { |
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
1097 translate(buffer, RECIPIENT, service); |
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
1098 } |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
1099 if(service == wassr_service && |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
1100 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) { |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
1101 translate(buffer, CHANNEL_WASSR, service); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
1102 } |
202
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
1103 if(service == identica_service && |
67d8eaba446d
preliminary identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
201
diff
changeset
|
1104 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) { |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
1105 translate(buffer, TAG_IDENTICA, service); |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
1106 } |
44 | 1107 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1108 /* escape pseudo command (to show the same result as sending message) */ |
146
62b90f3b0b8a
replaced a occurrence of is_twitter_conv()
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
145
diff
changeset
|
1109 if(service == twitter_service && |
62b90f3b0b8a
replaced a occurrence of is_twitter_conv()
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
145
diff
changeset
|
1110 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
44 | 1111 escape(buffer); |
1112 } | |
1113 | |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
1114 if(purple_prefs_get_bool(OPT_STRIP_EXCESS_LF)) { |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
1115 translate(buffer, EXCESS_LF, service); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
1116 } |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
1117 |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
1118 return FALSE; |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
1119 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
1120 |
31 | 1121 static void |
1122 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1123 gchar *new_text, gint new_text_length, gpointer user_data) | |
1124 { | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1125 PurpleConversation *conv = (PurpleConversation *)user_data; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1126 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1127 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1128 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1129 gchar *markup = NULL; |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1130 gint service = get_service_type(conv); |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1131 guint count; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1132 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1133 g_return_if_fail(gtkconv != NULL); |
31 | 1134 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1135 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1136 case twitter_service: |
208
5d1b8528e144
changed length limit for identi.ca from 140 bytes to 140 characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
207
diff
changeset
|
1137 case identica_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1138 count = gtk_text_buffer_get_char_count(textbuffer) + |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1139 (unsigned int)g_utf8_strlen(new_text, -1); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1140 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1141 count <= 140 ? "black" : "red", count); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1142 break; |
199
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1143 case wassr_service: |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1144 count = gtk_text_buffer_get_char_count(textbuffer) + |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1145 (unsigned int)g_utf8_strlen(new_text, -1); |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1146 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1147 count <= 255 ? "black" : "red", count); |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1148 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1149 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1150 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1151 break; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1152 } |
31 | 1153 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1154 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1155 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
|
1156 if(counter) |
31 | 1157 gtk_label_set_markup(GTK_LABEL(counter), markup); |
1158 | |
1159 g_free(markup); | |
1160 } | |
1161 | |
1162 static void | |
1163 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1164 GtkTextIter *end_pos, gpointer user_data) | |
1165 { | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1166 PurpleConversation *conv = (PurpleConversation *)user_data; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1167 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1168 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1169 gchar *markup = NULL; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1170 gint service = get_service_type(conv); |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1171 guint count = 0; |
31 | 1172 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1173 g_return_if_fail(gtkconv != NULL); |
31 | 1174 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1175 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1176 case twitter_service: |
208
5d1b8528e144
changed length limit for identi.ca from 140 bytes to 140 characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
207
diff
changeset
|
1177 case identica_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1178 count= gtk_text_buffer_get_char_count(textbuffer) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1179 (gtk_text_iter_get_offset(end_pos) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1180 gtk_text_iter_get_offset(start_pos)); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1181 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1182 count <= 140 ? "black" : "red", count); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1183 break; |
199
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1184 case wassr_service: |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1185 count= gtk_text_buffer_get_char_count(textbuffer) - |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1186 (gtk_text_iter_get_offset(end_pos) - |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1187 gtk_text_iter_get_offset(start_pos)); |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1188 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1189 count <= 255 ? "black" : "red", count); |
5ddf8bee768d
according to mojin, jisko limits each post to 140 bytes and requires at least 5 bytes. now letter counter for jisko takes account of this limit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
198
diff
changeset
|
1190 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1191 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1192 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1193 break; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1194 } |
31 | 1195 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1196 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1197 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
|
1198 if(counter) |
31 | 1199 gtk_label_set_markup(GTK_LABEL(counter), markup); |
1200 | |
1201 g_free(markup); | |
1202 } | |
1203 | |
1204 static void | |
1205 detach_from_window(void) | |
1206 { | |
1207 GList *list; | |
1208 | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1209 /* find twitter conv window out and detach from that */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1210 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
|
1211 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1212 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1213 pidgin_conv_window_get_active_conversation(win); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1214 gint service = get_service_type(conv); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1215 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1216 case twitter_service: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1217 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1218 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1219 detach_from_conv(conv, NULL); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1220 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1221 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1222 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1223 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1224 } |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1225 } |
31 | 1226 } |
1227 | |
1228 static void | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1229 detach_from_conv(PurpleConversation *conv, gpointer null) |
31 | 1230 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1231 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1232 GtkWidget *box, *counter = NULL, *sep = NULL; |
31 | 1233 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1234 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1235 (GFunc) insert_text_cb, conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1236 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1237 (GFunc) delete_text_cb, conv); |
31 | 1238 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1239 box = gtkconv->toolbar; |
31 | 1240 |
1241 /* remove counter */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1242 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
|
1243 if(counter) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1244 gtk_container_remove(GTK_CONTAINER(box), counter); |
31 | 1245 g_object_unref(counter); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1246 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL); |
31 | 1247 } |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
1248 |
31 | 1249 /* remove separator */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1250 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
|
1251 if(sep) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1252 gtk_container_remove(GTK_CONTAINER(box), sep); |
31 | 1253 g_object_unref(sep); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1254 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", NULL); |
31 | 1255 } |
1256 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1257 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 1258 } |
1259 | |
1260 static void | |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1261 remove_marks_func(gpointer key, gpointer value, gpointer user_data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1262 { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1263 icon_data *data = (icon_data *)value; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1264 GtkTextBuffer *text_buffer = (GtkTextBuffer *)user_data; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1265 GList *mark_list = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1266 GList *current; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1267 |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1268 if(!data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1269 return; |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1270 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1271 if(data->request_list) |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1272 mark_list = data->request_list; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1273 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1274 /* remove the marks in its GtkTextBuffers */ |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1275 current = g_list_first(mark_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1276 while(current) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1277 GtkTextMark *current_mark = current->data; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1278 GtkTextBuffer *current_text_buffer = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1279 gtk_text_mark_get_buffer(current_mark); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1280 GList *next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1281 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1282 next = g_list_next(current); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1283 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1284 if(!current_text_buffer) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1285 continue; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1286 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1287 if(text_buffer) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1288 if(current_text_buffer == text_buffer) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1289 /* the mark will be freed in this function */ |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1290 gtk_text_buffer_delete_mark(current_text_buffer, |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1291 current_mark); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1292 current->data = NULL; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1293 mark_list = g_list_delete_link(mark_list, current); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1294 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1295 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1296 else { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1297 gtk_text_buffer_delete_mark(current_text_buffer, current_mark); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1298 current->data = NULL; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1299 mark_list = g_list_delete_link(mark_list, current); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1300 } |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1301 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1302 current = next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1303 } |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1304 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1305 data->request_list = mark_list; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1306 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1307 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1308 static void |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1309 delete_requested_icon_marks(PidginConversation *conv, GHashTable *table) { |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1310 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1311 GTK_TEXT_VIEW(conv->imhtml)); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1312 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1313 g_hash_table_foreach(table, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1314 (GHFunc)remove_marks_func, |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1315 (gpointer)text_buffer); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1316 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1317 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1318 static void |
31 | 1319 attach_to_window(void) |
1320 { | |
1321 GList *list; | |
1322 | |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1323 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1324 |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1325 /* find twitter conv window out and attach to that */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1326 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
|
1327 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1328 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1329 pidgin_conv_window_get_active_conversation(win); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1330 gint service = get_service_type(conv); |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1331 /* only attach to twitter conversation window */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1332 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1333 case twitter_service: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1334 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1335 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1336 attach_to_conv(conv, NULL); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1337 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1338 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1339 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1340 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1341 } |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1342 } |
31 | 1343 } |
1344 | |
1345 static void | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1346 attach_to_conv(PurpleConversation *conv, gpointer null) |
31 | 1347 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1348 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
50
3e0d4fd75b03
added that to disable widgets that decorate or link text.
mikanbako <maoutwo@gmail.com>
parents:
49
diff
changeset
|
1349 GtkWidget *box, *sep, *counter, *menus; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1350 GtkIMHtml *imhtml; |
31 | 1351 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1352 box = gtkconv->toolbar; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1353 imhtml = GTK_IMHTML(gtkconv->imhtml); |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1354 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1355 /* Disable widgets that decorate or add link to composing text |
53 | 1356 * because Twitter cannot receive marked up string. For lean-view |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1357 * and wide-view, see pidgin/gtkimhtmltoolbar.c. |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1358 */ |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1359 menus = g_object_get_data(G_OBJECT(box), "lean-view"); |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1360 if(menus) { |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1361 gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1362 } |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1363 menus = g_object_get_data(G_OBJECT(box), "wide-view"); |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1364 if(menus) { |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1365 gtk_widget_set_sensitive(GTK_WIDGET(menus), FALSE); |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1366 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1367 |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1368 purple_conversation_set_features( |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1369 gtkconv->active_conv, |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1370 purple_conversation_get_features(gtkconv->active_conv) & |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1371 ~PURPLE_CONNECTION_HTML); |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1372 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1373 /* check if the counter is enabled */ |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1374 if(!purple_prefs_get_bool(OPT_COUNTER)) |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1375 return; |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1376 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1377 /* get counter object */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1378 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
|
1379 g_return_if_fail(counter == NULL); |
31 | 1380 |
1381 /* make counter object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1382 counter = gtk_label_new(NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1383 gtk_widget_set_name(counter, "counter_label"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1384 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
|
1385 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
|
1386 gtk_widget_show_all(counter); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1387 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", counter); |
31 | 1388 |
1389 /* make separator object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1390 sep = gtk_vseparator_new(); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1391 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
|
1392 gtk_widget_show_all(sep); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1393 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep); |
31 | 1394 |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1395 /* connect to signals */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1396 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1397 G_CALLBACK(insert_text_cb), conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1398 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1399 G_CALLBACK(delete_text_cb), conv); |
31 | 1400 |
1401 /* redraw window */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1402 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 1403 } |
1404 | |
1405 static gboolean | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1406 is_twitter_account(PurpleAccount *account, const char *name) |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1407 { |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1408 const gchar *proto = purple_account_get_protocol_id(account); |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1409 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1410 if(g_strstr_len(name, 19, "twitter@twitter.com") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1411 g_strstr_len(proto, 11, "prpl-jabber")) { |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1412 return TRUE; |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1413 } |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1414 |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1415 return FALSE; |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1416 } |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1417 |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1418 static gboolean |
31 | 1419 is_twitter_conv(PurpleConversation *conv) |
1420 { | |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1421 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1422 |
31 | 1423 const char *name = purple_conversation_get_name(conv); |
1424 PurpleAccount *account = purple_conversation_get_account(conv); | |
1425 | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1426 return is_twitter_account(account, name); |
31 | 1427 } |
1428 | |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1429 static gboolean |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1430 is_wassr_account(PurpleAccount *account, const char *name) |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1431 { |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1432 const gchar *proto = purple_account_get_protocol_id(account); |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1433 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1434 if(g_strstr_len(name, 18, "wassr-bot@wassr.jp") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1435 g_strstr_len(proto, 11, "prpl-jabber")) { |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1436 return TRUE; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1437 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1438 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1439 return FALSE; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1440 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1441 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1442 static gboolean |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1443 is_wassr_conv(PurpleConversation *conv) |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1444 { |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1445 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1446 |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1447 const char *name = purple_conversation_get_name(conv); |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1448 PurpleAccount *account = purple_conversation_get_account(conv); |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1449 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1450 return is_wassr_account(account, name); |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1451 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1452 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1453 static gboolean |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1454 is_identica_account(PurpleAccount *account, const char *name) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1455 { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1456 const gchar *proto = purple_account_get_protocol_id(account); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1457 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1458 if(g_strstr_len(name, 16, "update@identi.ca") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1459 g_strstr_len(proto, 11, "prpl-jabber")) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1460 return TRUE; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1461 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1462 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1463 return FALSE; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1464 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1465 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1466 static gboolean |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1467 is_identica_conv(PurpleConversation *conv) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1468 { |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1469 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1470 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1471 const char *name = purple_conversation_get_name(conv); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1472 PurpleAccount *account = purple_conversation_get_account(conv); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1473 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1474 return is_identica_account(account, name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1475 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1476 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1477 static gint |
219
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1478 get_service_type_by_account(PurpleAccount *account, const char *sender) |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1479 { |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1480 gint service = unknown_service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1481 |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1482 g_return_val_if_fail(account != NULL, unknown_service); |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1483 g_return_val_if_fail(sender != NULL, unknown_service); |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1484 |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1485 if(is_twitter_account(account, sender)) |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1486 service = twitter_service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1487 else if(is_wassr_account(account, sender)) |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1488 service = wassr_service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1489 else if(is_identica_account(account, sender)) |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1490 service = identica_service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1491 |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1492 return service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1493 } |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1494 |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1495 static gint |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1496 get_service_type(PurpleConversation *conv) |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1497 { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1498 gint service = unknown_service; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1499 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1500 g_return_val_if_fail(conv != NULL, unknown_service); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1501 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1502 if(is_twitter_conv(conv)) |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1503 service = twitter_service; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1504 else if(is_wassr_conv(conv)) |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1505 service = wassr_service; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1506 else if(is_identica_conv(conv)) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1507 service = identica_service; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1508 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1509 return service; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1510 } |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1511 |
31 | 1512 static void |
1513 conv_created_cb(PurpleConversation *conv, gpointer null) | |
1514 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1515 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1516 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1517 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1518 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1519 g_return_if_fail(gtkconv != NULL); |
31 | 1520 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1521 gint service = get_service_type(conv); |
31 | 1522 /* only attach to twitter conversation window */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1523 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1524 case twitter_service: |
158
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
1525 get_status_with_api((gpointer)conv); |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
1526 source.id = g_timeout_add_seconds( |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
1527 purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL), |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
1528 get_status_with_api, (gpointer)conv); |
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
1529 source.conv = conv; |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1530 attach_to_conv(conv, NULL); |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1531 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1532 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1533 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1534 attach_to_conv(conv, NULL); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1535 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1536 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1537 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1538 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1539 } |
31 | 1540 } |
1541 | |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1542 static void |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1543 deleting_conv_cb(PurpleConversation *conv) |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1544 { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1545 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1546 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1547 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1548 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1549 g_return_if_fail(gtkconv != NULL); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1550 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1551 gint service = get_service_type(conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1552 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1553 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1554 /* only attach to twitter conversation window */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1555 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1556 case twitter_service: |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
1557 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1558 g_source_remove_by_user_data((gpointer)conv); |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
1559 source.id = 0; |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
1560 source.conv = NULL; |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
1561 } |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1562 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1563 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1564 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1565 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1566 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1567 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1568 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1569 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1570 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1571 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1572 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1573 } |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1574 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1575 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1576 delete_requested_icon_marks(gtkconv, hash); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1577 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1578 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1579 static void |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1580 apply_filter(gchar **sender, gchar **buffer, PurpleMessageFlags *flags, int service) |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1581 { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1582 GMatchInfo *match_info; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1583 const gchar *list = NULL; |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1584 gchar *screen_name = NULL; |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1585 gchar **candidates = NULL, **candidate = NULL; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1586 |
212
8670e1572be8
fix for a bug that apply_filter() would crash if both sender and buffer have been cleared.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
211
diff
changeset
|
1587 g_return_if_fail(*sender != NULL); |
8670e1572be8
fix for a bug that apply_filter() would crash if both sender and buffer have been cleared.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
211
diff
changeset
|
1588 g_return_if_fail(*buffer != NULL); |
8670e1572be8
fix for a bug that apply_filter() would crash if both sender and buffer have been cleared.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
211
diff
changeset
|
1589 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1590 gchar *plain = strip_html_markup(*buffer); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1591 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1592 switch(service) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1593 case twitter_service: |
219
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1594 default: |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1595 list = purple_prefs_get_string(OPT_FILTER_TWITTER); |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1596 screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER)); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1597 break; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1598 case wassr_service: |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1599 list = purple_prefs_get_string(OPT_FILTER_WASSR); |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1600 screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_WASSR)); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1601 break; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1602 case identica_service: |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1603 list = purple_prefs_get_string(OPT_FILTER_IDENTICA); |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1604 screen_name = g_strdup_printf("@%s", purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA)); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1605 break; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1606 } |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1607 g_return_if_fail(list != NULL); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1608 if(strstr(list, DEFAULT_LIST)) |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1609 return; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1610 |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1611 /* find @myself */ |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1612 if(purple_prefs_get_bool(OPT_FILTER_EXCLUDE_REPLY) && |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1613 strstr(plain, screen_name)) { |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1614 g_free(plain); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1615 g_free(screen_name); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1616 return; |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1617 } |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1618 else |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1619 g_free(screen_name); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1620 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1621 candidates = g_strsplit_set(list, " ,:;", 0); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1622 g_return_if_fail(candidates != NULL); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1623 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1624 g_regex_match(regp[SENDER], plain, 0, &match_info); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1625 while(g_match_info_matches(match_info)) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1626 gchar *user = NULL; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1627 user = g_match_info_fetch(match_info, 2); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1628 twitter_debug("user = %s\n", user); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1629 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1630 for(candidate = candidates; *candidate; candidate++) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1631 if(!strcmp(*candidate, "")) |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1632 continue; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1633 twitter_debug("candidate = %s\n", *candidate); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1634 if(!strcmp(user, *candidate)) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1635 twitter_debug("match. filter %s\n", user); |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1636 /* pidgin should handle this flag properly --yaz */ |
219
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1637 // *flags |= PURPLE_MESSAGE_INVISIBLE; |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1638 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1639 /* temporal workaround */ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1640 g_free(*sender); *sender = NULL; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1641 g_free(*buffer); *buffer = NULL; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1642 break; |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1643 } |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1644 } |
212
8670e1572be8
fix for a bug that apply_filter() would crash if both sender and buffer have been cleared.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
211
diff
changeset
|
1645 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1646 g_free(user); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1647 g_match_info_next(match_info, NULL); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1648 } |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
1649 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1650 g_free(plain); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1651 g_strfreev(candidates); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1652 g_match_info_free(match_info); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1653 } |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1654 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1655 |
8 | 1656 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
|
1657 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
|
1658 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
|
1659 { |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1660 twitter_debug("called\n"); |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
1661 twitter_debug("buffer = %s suppress_oops = %d\n", *buffer, 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
|
1662 |
219
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1663 gint service; |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1664 |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1665 service = get_service_type_by_account(account, *sender); |
739ed7a4426c
revised receiving_im_cb(). conv may be NULL so that filter might not work for messages which arrived at before conversation has been established.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
218
diff
changeset
|
1666 twitter_debug("service = %d\n", service); |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1667 |
214
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1668 #ifdef _WIN32 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1669 /* suppress notification of incoming messages. */ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1670 if(service != unknown_service && |
214
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1671 purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1672 if(!blink_modified) { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1673 blink_modified = TRUE; |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1674 blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM); |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1675 purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE); |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1676 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1677 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1678 else { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1679 if(blink_modified) { |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1680 purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, blink_state); |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1681 blink_modified = FALSE; |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1682 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1683 } |
148fa8a8be8e
- trying a new way to suppress window blinking in WIN32
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
212
diff
changeset
|
1684 #endif |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1685 |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1686 if(service == wassr_service) { |
218
27651b73a638
fix for a bug that post to wassr's channel which contains entity reference got through parrot blocker.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
217
diff
changeset
|
1687 gchar *stripped = strip_html_markup(*buffer); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1688 /* suppress annoying completion message from wassr */ |
221
b5fa0c295ff5
pushed message must be matched with received message, otherwise it leaks.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
220
diff
changeset
|
1689 if(strstr(*buffer, "<body>チャンネル投稿完了:")) { |
b5fa0c295ff5
pushed message must be matched with received message, otherwise it leaks.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
220
diff
changeset
|
1690 twitter_debug("clearing channel parrot message\n"); |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1691 g_free(*sender); *sender = NULL; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1692 g_free(*buffer); *buffer = NULL; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1693 } |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1694 /* discard parrot message */ |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1695 else { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1696 GList *current = g_list_first(wassr_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1697 while(current) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1698 GList *next = g_list_next(current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1699 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1700 if(strstr(stripped, current->data)) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1701 twitter_debug("parrot clearing: buf = %s post = %s\n", |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1702 *buffer, (char *)current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1703 g_free(*sender); *sender = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1704 g_free(*buffer); *buffer = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1705 g_free(current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1706 current->data = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1707 wassr_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1708 g_list_delete_link(wassr_parrot_list, current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1709 break; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1710 } |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1711 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1712 current = next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1713 } |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1714 } |
218
27651b73a638
fix for a bug that post to wassr's channel which contains entity reference got through parrot blocker.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
217
diff
changeset
|
1715 g_free(stripped); |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1716 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1717 |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1718 if(service == identica_service) { |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1719 /* discard parrot message */ |
201
0aeeafe37ef7
revised parrot blocker for identi.ca. now it compares stripped text and the stored message.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
200
diff
changeset
|
1720 gchar *stripped = strip_html_markup(*buffer); |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1721 GList *current = g_list_first(identica_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1722 while(current) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1723 GList *next = g_list_next(current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1724 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1725 if(strstr(stripped, current->data)) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1726 twitter_debug("identica parrot clearing: buf = %s post = %s\n", |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1727 *buffer, (char *)current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1728 g_free(*sender); *sender = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1729 g_free(*buffer); *buffer = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1730 g_free(current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1731 current->data = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1732 identica_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1733 g_list_delete_link(identica_parrot_list, current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1734 break; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1735 } |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1736 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
1737 current = next; |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1738 } |
201
0aeeafe37ef7
revised parrot blocker for identi.ca. now it compares stripped text and the stored message.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
200
diff
changeset
|
1739 g_free(stripped); |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1740 } |
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1741 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1742 /* filtering */ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1743 if(purple_prefs_get_bool(OPT_FILTER)) { |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1744 apply_filter(sender, buffer, flags, service); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1745 } |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1746 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
1747 /* return here if it is not twitter */ |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
1748 if(service != twitter_service) { |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
1749 return FALSE; |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
1750 } |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
1751 |
194
1495b478680b
tentative support for jisko.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
183
diff
changeset
|
1752 /* if we use api, discard all incoming IM messages. */ |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1753 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1754 g_free(*sender); *sender = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1755 g_free(*buffer); *buffer = NULL; |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1756 } |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1757 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
1758 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
|
1759 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
|
1760 |
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
|
1761 if(strstr(*buffer, OOPS_MESSAGE)) { |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
1762 twitter_debug("clearing sender and buffer\n"); |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1763 g_free(*sender); *sender = NULL; |
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1764 g_free(*buffer); *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
|
1765 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
|
1766 } |
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
|
1767 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
|
1768 } |
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
|
1769 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1770 static void |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1771 insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data) |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1772 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1773 got_icon_data *gotdata = (got_icon_data *)user_data; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1774 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1775 gchar *user_name = gotdata->user_name; |
86 | 1776 gint service = gotdata->service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1777 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1778 GList *win_list; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1779 GtkIMHtml *target_imhtml = NULL; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1780 GtkTextBuffer *target_buffer = NULL; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
1781 GtkTextIter insertion_point; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1782 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1783 GHashTable *hash = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1784 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1785 twitter_debug("called: service = %d\n", service); |
70
74524f379440
trying simple search in insert_requested_icon() due to malfunction under linux environment.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
69
diff
changeset
|
1786 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1787 /* find the conversation that contains the mark */ |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1788 for(win_list = pidgin_conv_windows_get_list(); win_list; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1789 win_list = win_list->next) { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1790 PidginWindow *win = win_list->data; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1791 GList *conv_list; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1792 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1793 for(conv_list = pidgin_conv_window_get_gtkconvs(win); conv_list; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1794 conv_list = conv_list->next) { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1795 PidginConversation *conv = conv_list->data; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1796 PurpleConversation *purple_conv = conv->active_conv; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1797 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1798 gint service = get_service_type(purple_conv); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1799 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1800 if(service != unknown_service) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1801 GtkIMHtml *current_imhtml = GTK_IMHTML(conv->imhtml); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1802 GtkTextBuffer *current_buffer = gtk_text_view_get_buffer( |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1803 GTK_TEXT_VIEW(current_imhtml)); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1804 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1805 if(current_buffer == gtk_text_mark_get_buffer(requested_mark)) { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1806 target_imhtml = current_imhtml; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1807 target_buffer = current_buffer; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1808 break; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1809 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1810 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1811 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1812 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1813 if(!(target_imhtml && target_buffer)) { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1814 return; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1815 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1816 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1817 /* insert icon to the mark */ |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1818 gtk_text_buffer_get_iter_at_mark(target_buffer, |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
1819 &insertion_point, requested_mark); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1820 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1821 /* insert icon */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1822 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1823 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1824 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1825 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1826 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1827 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1828 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1829 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1830 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1831 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1832 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1833 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1834 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1835 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1836 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1837 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1838 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1839 |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1840 /* in this function, we put an icon for pending marks. we should |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1841 * not invalidate the icon here, otherwise it may result in |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1842 * thrashing. --yaz */ |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1843 |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
1844 if(!data || !data->pixbuf) { |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1845 return; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1846 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1847 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1848 /* insert icon actually */ |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1849 if(purple_prefs_get_bool(OPT_SHOW_ICON)) { |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1850 gtk_text_buffer_insert_pixbuf(target_buffer, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1851 &insertion_point, |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
1852 data->pixbuf); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1853 data->use_count++; |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1854 } |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1855 gtk_text_buffer_delete_mark(target_buffer, requested_mark); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1856 requested_mark = NULL; |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1857 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1858 |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1859 static void |
86 | 1860 insert_requested_icon(const gchar *user_name, gint service) |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1861 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1862 icon_data *data = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1863 GList *mark_list = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1864 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1865 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1866 twitter_debug("called\n"); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1867 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1868 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1869 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1870 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1871 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1872 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1873 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1874 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1875 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1876 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1877 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1878 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1879 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1880 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1881 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1882 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1883 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1884 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1885 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1886 if(!data) |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1887 return; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1888 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1889 mark_list = data->request_list; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1890 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1891 got_icon_data *gotdata = g_new0(got_icon_data, 1); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1892 gotdata->user_name = g_strdup(user_name); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1893 gotdata->service = service; |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
1894 |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
1895 twitter_debug("about to insert icon for pending requests\n"); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1896 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1897 if(mark_list) { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1898 g_list_foreach(mark_list, (GFunc) insert_icon_at_mark, gotdata); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1899 mark_list = g_list_remove_all(mark_list, NULL); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1900 g_list_free(mark_list); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1901 data->request_list = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1902 } |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
1903 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1904 g_free(gotdata->user_name); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1905 g_free(gotdata); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1906 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1907 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1908 /* this function will be called when profile page has been retrieved */ |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1909 static void |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1910 got_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1911 const gchar *url_text, gsize len, const gchar *error_message) |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1912 { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1913 got_icon_data *gotdata = (got_icon_data *)user_data; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1914 gchar *user_name = gotdata->user_name; |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1915 gint service = gotdata->service; |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1916 GMatchInfo *match_info = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1917 icon_data *data = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1918 gchar *url = NULL; |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1919 gint regp_id = -1; |
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1920 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1921 if(service == twitter_service) { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1922 data = (icon_data *)g_hash_table_lookup( |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1923 icon_hash[twitter_service], user_name); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1924 regp_id = IMAGE_TWITTER; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1925 } |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1926 else if(service == wassr_service) { |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1927 data = (icon_data *)g_hash_table_lookup( |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1928 icon_hash[wassr_service], user_name); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1929 regp_id = IMAGE_WASSR; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1930 } |
196
b436d72447e8
make use of got_page_cb to obtain icons for jisko.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
194
diff
changeset
|
1931 else if(service == identica_service) { |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1932 data = (icon_data *)g_hash_table_lookup( |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1933 icon_hash[identica_service], user_name); |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1934 regp_id = IMAGE_IDENTICA; |
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1935 } |
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1936 |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1937 if(!url_text) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1938 if(data) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1939 data->requested = FALSE; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1940 data->fetch_data = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1941 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1942 g_free(gotdata->user_name); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1943 g_free(gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1944 return; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1945 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1946 |
160
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1947 /* setup image url */ /* xxx need simplify --yaz */ |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
1948 g_regex_match(regp[regp_id], url_text, 0, &match_info); |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1949 if(!g_match_info_matches(match_info)) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1950 g_match_info_free(match_info); |
160
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1951 |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1952 if(service == twitter_service) { |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1953 twitter_debug("fall back to twitter default icon\n"); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1954 url = g_strdup(TWITTER_DEFAULT_ICON_URL); |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1955 } |
160
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1956 else { |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1957 twitter_debug("no image url found\n"); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1958 if(data) { |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1959 data->requested = FALSE; |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1960 data->fetch_data = NULL; |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1961 } |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1962 g_free(gotdata->user_name); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1963 g_free(gotdata); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1964 return; |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1965 } |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1966 } |
160
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1967 else { |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1968 url = g_match_info_fetch(match_info, 1); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1969 g_match_info_free(match_info); |
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
1970 } |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1971 |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1972 /* find out basename */ |
142
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
1973 gchar *slash = strrchr(url, '/'); |
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
1974 *slash = '\0'; |
154
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1975 |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1976 gchar *lower = g_ascii_strdown(slash+1, -1); |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1977 |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1978 if(strstr(lower, ".png")) |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1979 data->img_type = "png"; |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1980 else if(strstr(lower, ".gif")) |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1981 data->img_type = "gif"; |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1982 else if(strstr(lower, ".jpg") || strstr(lower, ".jpeg")) |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1983 data->img_type = "jpg"; |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1984 |
d6ecbdee0afa
fixed a bug around strchr() pointed out by mojin.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
153
diff
changeset
|
1985 g_free(lower); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
1986 |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1987 gchar *tmp; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1988 /* url encode basename. twitter needs this. */ |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1989 if(service == twitter_service) |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1990 tmp = g_strdup_printf("%s/%s", url, |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1991 purple_url_encode(slash+1)); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1992 else if(service == wassr_service) { |
205
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1993 gchar *tmp0 = NULL; |
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1994 tmp0 = g_regex_replace(regp[SIZE_128_WASSR], slash+1, |
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1995 -1, 0, ".64.", 0, NULL); |
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1996 tmp = g_strdup_printf("http://wassr.jp%s/%s", url, |
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1997 tmp0 ? tmp0 : slash+1); |
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
1998 g_free(tmp0); |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
1999 } |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2000 else { |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2001 tmp = g_strdup_printf("%s/%s", url, slash+1); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2002 } |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2003 |
142
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2004 g_free(url); |
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2005 url = tmp; |
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2006 |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2007 /* if requesting icon url is the same as old, return. */ |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2008 if(url && data->icon_url && !strcmp(data->icon_url, url)) { |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2009 twitter_debug("old url = %s new url = %s\n", data->icon_url, url); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2010 data->requested = FALSE; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2011 data->fetch_data = NULL; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2012 g_free(url); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2013 return; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2014 } |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2015 |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2016 if(data && data->pixbuf) { |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2017 gdk_pixbuf_unref(data->pixbuf); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2018 data->pixbuf = NULL; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2019 } |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2020 |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2021 g_free(data->icon_url); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2022 data->icon_url = g_strdup(url); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2023 |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2024 data->use_count = 0; |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2025 data->mtime = time(NULL); /* xxx is there a better way? */ |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2026 |
160
aef26b56a54b
now it falls back to twitter default icon if the user has not set custom icon.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
159
diff
changeset
|
2027 twitter_debug("requested url=%s\n", url); |
140
dcf980ba3f8b
url encode icon url before requesting.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
139
diff
changeset
|
2028 |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2029 /* request fetch image */ |
142
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2030 if(url) { |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2031 /* reuse gotdata. just pass given one */ |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2032 /* gotdata will be released in got_icon_cb */ |
142
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2033 data->fetch_data = purple_util_fetch_url(url, |
141
fc1bf6b9b540
fixed a silly bug introduced in 140.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
140
diff
changeset
|
2034 TRUE, NULL, TRUE, |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2035 got_icon_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2036 twitter_debug("request %s's icon\n", user_name); |
142
b573b534f32d
modified the way of encoding icon url.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
141
diff
changeset
|
2037 g_free(url); |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2038 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2039 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2040 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2041 static GdkPixbuf * |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2042 make_scaled_pixbuf(const gchar *url_text, gsize len) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2043 { |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2044 /* make pixbuf */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2045 GdkPixbufLoader *loader; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2046 GdkPixbuf *src = NULL, *dest = NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2047 gint size; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2048 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2049 g_return_val_if_fail(url_text != NULL, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2050 g_return_val_if_fail(len > 0, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2051 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2052 loader = gdk_pixbuf_loader_new(); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2053 gdk_pixbuf_loader_write(loader, (guchar *)url_text, len, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2054 gdk_pixbuf_loader_close(loader, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2055 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2056 src = gdk_pixbuf_loader_get_pixbuf(loader); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2057 if(!src) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2058 return NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2059 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2060 size = purple_prefs_get_int(OPT_ICON_SIZE); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2061 if(size == 0) |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2062 size = DEFAULT_ICON_SIZE; |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2063 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2064 dest = gdk_pixbuf_scale_simple(src, size, size, GDK_INTERP_HYPER); |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2065 gdk_pixbuf_unref(src); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2066 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2067 return dest; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2068 } |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2069 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2070 static gchar *ext_list[] = { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2071 "png", |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2072 "gif", |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2073 "jpg", |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2074 NULL |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2075 }; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2076 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
2077 /* this function will be called when requested icon has been retrieved */ |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2078 static void |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
2079 got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2080 const gchar *url_text, gsize len, const gchar *error_message) |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2081 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2082 got_icon_data *gotdata = (got_icon_data *)user_data; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2083 gchar *user_name = gotdata->user_name; |
86 | 2084 gint service = gotdata->service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2085 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2086 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2087 GHashTable *hash = NULL; |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2088 GdkPixbuf *pixbuf = NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2089 const gchar *dirname = NULL; |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2090 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2091 twitter_debug("called: service = %d\n", service); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2092 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2093 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2094 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2095 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2096 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2097 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2098 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2099 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2100 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2101 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2102 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2103 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2104 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2105 } |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2106 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2107 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2108 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2109 |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2110 /* return if download failed */ |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2111 if(!url_text) { |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2112 twitter_debug("downloading %s's icon failed : %s\n", |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2113 user_name, error_message); |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2114 if(data) |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2115 data->requested = FALSE; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2116 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2117 goto fin_got_icon_cb; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2118 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2119 |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2120 if(data) { |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2121 /* remove download request */ |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2122 data->requested = FALSE; |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2123 data->fetch_data = NULL; |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2124 |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2125 /* return if user's icon had been downloaded */ |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2126 if(data->pixbuf) { |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2127 twitter_debug("%s's icon has already been downloaded\n", |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2128 user_name); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2129 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2130 goto fin_got_icon_cb; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2131 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2132 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2133 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2134 pixbuf = make_scaled_pixbuf(url_text, len); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2135 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2136 if(!pixbuf) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2137 goto fin_got_icon_cb; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2138 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2139 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2140 if(!data) { |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2141 twitter_debug("allocate icon_data (shouldn't be called)\n"); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2142 data = g_new0(icon_data, 1); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2143 } |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2144 |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2145 data->pixbuf = pixbuf; |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2146 |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2147 twitter_debug("new icon pixbuf = %p size = %d\n", |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2148 pixbuf, |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2149 gdk_pixbuf_get_rowstride(pixbuf) * |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2150 gdk_pixbuf_get_height(pixbuf)); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2151 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2152 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2153 g_hash_table_insert(hash, g_strdup(user_name), data); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2154 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2155 dirname = purple_prefs_get_string(OPT_ICON_DIR); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2156 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2157 /* store retrieved image to a file in icon dir */ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2158 if(ensure_path_exists(dirname)) { |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2159 gchar *filename = NULL; |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2160 gchar *path = NULL; |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2161 const gchar *suffix = NULL; |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2162 gchar **extp; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2163 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2164 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2165 case twitter_service: |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2166 suffix = "twitter"; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2167 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2168 case wassr_service: |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2169 suffix = "wassr"; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2170 break; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2171 case identica_service: |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2172 suffix = "identica"; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2173 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2174 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2175 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2176 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2177 } |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2178 |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2179 /* remove old file first */ |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2180 for(extp = ext_list; *extp; extp++) { |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2181 filename = g_strdup_printf("%s_%s.%s", |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2182 user_name, suffix, *extp); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2183 path = g_build_filename(dirname, filename, NULL); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2184 g_remove(path); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2185 |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2186 g_free(filename); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2187 g_free(path); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2188 } |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2189 |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2190 /* setup path */ |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2191 filename = g_strdup_printf("%s_%s.%s", |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2192 user_name, suffix, data->img_type); |
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2193 |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2194 path = g_build_filename(dirname, filename, NULL); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2195 g_free(filename); filename = NULL; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2196 |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2197 g_file_set_contents(path, url_text, len, NULL); |
159
b771ddf0b683
should remove old icon files when pidgin-twitter create new one.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
158
diff
changeset
|
2198 g_free(path); path = NULL; |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2199 |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2200 data->mtime = time(NULL); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2201 } |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2202 |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2203 twitter_debug("Downloading %s's icon has been complete.\n", |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2204 user_name); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2205 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2206 /* Insert the icon to messages that had been received. */ |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2207 insert_requested_icon(user_name, service); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2208 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2209 fin_got_icon_cb: |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2210 g_free(gotdata->user_name); |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
2211 g_free(gotdata); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2212 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2213 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2214 static void |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2215 request_icon(const char *user_name, gint service, gboolean renew) |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2216 { |
63
760006015519
added that to show follower's icons through http://twitter.g.hatena.ne.jp/ikko615/20080107/1199703400
mikanbako <maoutwo@gmail.com>
parents:
62
diff
changeset
|
2217 gchar *url = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2218 |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2219 /* look local icon cache for the requested icon */ |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2220 gchar *path = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2221 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2222 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2223 const gchar *suffix = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2224 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2225 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2226 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2227 hash = icon_hash[twitter_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2228 suffix = "twitter"; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2229 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2230 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2231 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2232 suffix = "wassr"; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2233 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2234 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2235 suffix = "identica"; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2236 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2237 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2238 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2239 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2240 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2241 } |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2242 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2243 if(!hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2244 return; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2245 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2246 /* since this function is called after mark_icon_for_user(), data |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2247 * must exist here. */ |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2248 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2249 |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2250 /* if img has been registerd, just return */ |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2251 if(data && data->pixbuf && !renew) |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2252 return; |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2253 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2254 /* check if saved file exists */ |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2255 if(suffix && !renew) { |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2256 gchar *filename = NULL; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2257 gchar **extp; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2258 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2259 for(extp = ext_list; *extp; extp++) { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2260 filename = g_strdup_printf("%s_%s.%s", user_name, suffix, *extp); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2261 path = g_build_filename(purple_prefs_get_string(OPT_ICON_DIR), |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2262 filename, NULL); |
228 | 2263 g_free(filename); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2264 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2265 twitter_debug("path = %s\n", path); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2266 |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2267 /* build image from file, if file exists */ |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2268 if(g_file_test(path, G_FILE_TEST_EXISTS)) { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2269 gchar *imgdata = NULL; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2270 size_t len; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2271 GError *err = NULL; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2272 GdkPixbuf *pixbuf = NULL; |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2273 struct stat buf; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2274 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2275 if (!g_file_get_contents(path, &imgdata, &len, &err)) { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2276 twitter_debug("Error reading %s: %s\n", |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2277 path, err->message); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2278 g_error_free(err); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2279 } |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2280 |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2281 if(stat(path, &buf)) |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2282 data->mtime = buf.st_mtime; |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2283 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2284 pixbuf = make_scaled_pixbuf(imgdata, len); |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2285 g_free(imgdata); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2286 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2287 if(pixbuf) { |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2288 data->pixbuf = pixbuf; |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2289 |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2290 twitter_debug("new icon pixbuf = %p size = %d\n", |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2291 pixbuf, |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2292 gdk_pixbuf_get_rowstride(pixbuf) * |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2293 gdk_pixbuf_get_height(pixbuf)); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2294 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2295 data->img_type = *extp; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2296 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2297 twitter_debug("icon data has been loaded from file\n"); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2298 insert_requested_icon(user_name, service); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2299 } |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2300 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2301 g_free(path); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2302 return; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2303 } |
228 | 2304 |
2305 g_free(path); | |
2306 | |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2307 } /* for */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2308 } /* suffix */ |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
2309 |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
2310 /* Return if user's icon has been requested already. */ |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2311 if(data->requested) |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
2312 return; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2313 else |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2314 data->requested = TRUE; |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
2315 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2316 /* Create the URL for an user's icon. */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2317 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2318 case twitter_service: |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
2319 url = g_strdup_printf("http://twitter.com/%s", user_name); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2320 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2321 case wassr_service: |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2322 url = g_strdup_printf("http://wassr.jp/user/%s", user_name); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2323 break; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2324 case identica_service: |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2325 url = g_strdup_printf("http://identi.ca/%s", user_name); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2326 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2327 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2328 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2329 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2330 } |
63
760006015519
added that to show follower's icons through http://twitter.g.hatena.ne.jp/ikko615/20080107/1199703400
mikanbako <maoutwo@gmail.com>
parents:
62
diff
changeset
|
2331 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2332 if(url) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2333 got_icon_data *gotdata = g_new0(got_icon_data, 1); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2334 gotdata->user_name = g_strdup(user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2335 gotdata->service = service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2336 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2337 /* gotdata will be released in got_icon_cb */ |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2338 if(service == twitter_service || |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2339 service == wassr_service || |
200
9a2d727f39b4
removed jisko support as a protest to their expulsion policy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
199
diff
changeset
|
2340 service == identica_service) { |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2341 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2342 got_page_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2343 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2344 else { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2345 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2346 got_icon_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2347 } |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2348 g_free(url); url = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2349 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2350 twitter_debug("request %s's icon\n", user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2351 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2352 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2353 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2354 static void |
86 | 2355 mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service) |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2356 { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2357 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2358 GHashTable *hash = NULL; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2359 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2360 twitter_debug("called\n"); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2361 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2362 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2363 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2364 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2365 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2366 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2367 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2368 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2369 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2370 hash = icon_hash[identica_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2371 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2372 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2373 twitter_debug("unknown service\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2374 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2375 } |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2376 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2377 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2378 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2379 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2380 /* proper place to allocate icon_data */ |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2381 if(!data) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2382 data = g_new0(icon_data, 1); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2383 g_hash_table_insert(hash, g_strdup(user_name), data); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2384 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2385 |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2386 data->request_list = g_list_prepend(data->request_list, mark); |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2387 } |
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2388 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2389 static gboolean |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2390 displaying_im_cb(PurpleAccount *account, const char *who, char **message, |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2391 PurpleConversation *conv, PurpleMessageFlags flags, |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2392 void *unused) |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2393 { |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2394 GtkIMHtml *imhtml; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2395 GtkTextBuffer *text_buffer; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2396 gint service = get_service_type(conv); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2397 gint linenumber = 0; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2398 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2399 twitter_debug("called\n"); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2400 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2401 if(service == unknown_service) { |
222
b168502b73c3
expanded size of substitution buffer to 32KB. 128 bytes were not sufficient if both user name and channel name are rather long. tenforward reported this problem and umq pointed out the cause.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
221
diff
changeset
|
2402 twitter_debug("neither twitter nor wassr conv\n"); |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2403 return FALSE; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2404 } |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2405 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2406 /* get text buffer */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2407 imhtml = GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2408 text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2409 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2410 /* store number of lines */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2411 linenumber = gtk_text_buffer_get_line_count(text_buffer); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2412 g_hash_table_insert(conv_hash, conv, GINT_TO_POINTER(linenumber)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2413 twitter_debug("conv = %p linenumber = %d\n", conv, linenumber); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2414 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2415 return FALSE; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2416 } |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2417 |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2418 static void |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2419 displayed_im_cb(PurpleAccount *account, const char *who, char *message, |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2420 PurpleConversation *conv, PurpleMessageFlags flags) |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2421 { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2422 GMatchInfo *match_info = NULL; |
70
74524f379440
trying simple search in insert_requested_icon() due to malfunction under linux environment.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
69
diff
changeset
|
2423 gchar *user_name = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2424 GtkIMHtml *imhtml; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2425 GtkTextBuffer *text_buffer; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2426 GtkTextIter insertion_point; |
86 | 2427 gint service = get_service_type(conv); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2428 icon_data *data = NULL; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2429 gint linenumber; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2430 GHashTable *hash = NULL; |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2431 gboolean renew = FALSE; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2432 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2433 twitter_debug("called\n"); |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2434 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2435 if(service == unknown_service) { |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2436 twitter_debug("unknown service\n"); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2437 return; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2438 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2439 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2440 /* get user's name */ |
226
8da85ae0aa2c
tweaked user pattern and channel pattern so that they can be matched regardless of surrounding anchor markups.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
223
diff
changeset
|
2441 g_regex_match(regp[USER], message, 0, &match_info); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2442 if(!g_match_info_matches(match_info)) { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2443 twitter_debug("message was not matched : %s\n", message); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2444 g_match_info_free(match_info); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2445 return; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2446 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2447 |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2448 user_name = g_match_info_fetch(match_info, 1); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2449 g_match_info_free(match_info); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2450 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2451 /* insert icon */ |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2452 imhtml = GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2453 text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2454 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2455 /* get GtkTextIter in the target line */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2456 linenumber = GPOINTER_TO_INT(g_hash_table_lookup(conv_hash, conv)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2457 gtk_text_buffer_get_iter_at_line(text_buffer, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2458 &insertion_point, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2459 linenumber); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2460 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2461 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2462 case twitter_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2463 hash = icon_hash[twitter_service]; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2464 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2465 case wassr_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2466 hash = icon_hash[wassr_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2467 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2468 case identica_service: |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2469 hash = icon_hash[identica_service]; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2470 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2471 default: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2472 twitter_debug("unknown service\n"); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2473 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2474 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2475 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2476 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2477 data = g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2478 |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2479 if(data) { |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2480 /* check validity of icon */ |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2481 int count_thres = purple_prefs_get_int(OPT_ICON_MAX_COUNT); |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2482 int days_thres = DAYS_TO_SECONDS( |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2483 purple_prefs_get_int(OPT_ICON_MAX_DAYS)); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2484 |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2485 if(data->use_count > count_thres || |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2486 (data->mtime && ((time(NULL) - data->mtime)) > days_thres)) { |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2487 twitter_debug("count=%d mtime=%d\n", |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2488 data->use_count, (int)(data->mtime)); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2489 renew = TRUE; |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2490 request_icon(user_name, service, renew); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2491 } |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2492 } |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2493 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2494 /* if we don't have the icon for this user, put a mark instead and |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2495 * request the icon */ |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2496 if(!data || !data->pixbuf) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2497 twitter_debug("%s's icon is not in memory.\n", user_name); |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2498 mark_icon_for_user(gtk_text_buffer_create_mark( |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2499 text_buffer, NULL, &insertion_point, FALSE), |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2500 user_name, service); |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2501 /* request to attach icon to the buffer */ |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2502 request_icon(user_name, service, renew); |
70
74524f379440
trying simple search in insert_requested_icon() due to malfunction under linux environment.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
69
diff
changeset
|
2503 g_free(user_name); user_name = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2504 return; |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2505 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2506 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2507 /* if we have icon for this user, insert icon immediately */ |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2508 if(purple_prefs_get_bool(OPT_SHOW_ICON)) { |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2509 gtk_text_buffer_insert_pixbuf(text_buffer, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2510 &insertion_point, |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2511 data->pixbuf); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
2512 data->use_count++; |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2513 } |
70
74524f379440
trying simple search in insert_requested_icon() due to malfunction under linux environment.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
69
diff
changeset
|
2514 g_free(user_name); user_name = NULL; |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2515 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2516 twitter_debug("reach end of function\n"); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2517 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2518 |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2519 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2520 static void |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2521 signed_on_cb(PurpleConnection *gc) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2522 { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2523 PurpleBuddyList *list = purple_get_blist(); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2524 PurpleBlistNode *gnode, *cnode, *bnode; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2525 PurpleBuddy *b; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2526 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2527 twitter_debug("called\n"); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2528 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2529 if(!purple_prefs_get_bool(OPT_API_BASE_POST)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2530 return; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2531 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2532 if (!list) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2533 return; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2534 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2535 twitter_debug("scan list\n"); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2536 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2537 for (gnode = list->root; gnode; gnode = gnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2538 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2539 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2540 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2541 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2542 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2543 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2544 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2545 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2546 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2547 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2548 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2549 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2550 b = (PurpleBuddy *)bnode; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2551 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2552 if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2553 const char *name; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2554 PurpleAccount *account; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2555 name = purple_buddy_get_name(b); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2556 account = purple_buddy_get_account(b); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2557 if (is_twitter_account(account, name)) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2558 PurpleConversation *gconv; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2559 gconv = purple_find_conversation_with_account( |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2560 PURPLE_CONV_TYPE_IM, name, account); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2561 if (!gconv) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2562 gconv = purple_conversation_new( |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2563 PURPLE_CONV_TYPE_IM, account, name); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2564 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2565 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2566 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2567 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2568 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2569 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2570 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2571 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2572 static void |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2573 api_base_post_cb(const char *name, PurplePrefType type, gconstpointer value, |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2574 gpointer data) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2575 { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2576 signed_on_cb(NULL); |
158
ae09f0d93b17
fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
157
diff
changeset
|
2577 get_status_with_api((gpointer)(source.conv)); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2578 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2579 |
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
|
2580 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2581 load_plugin(PurplePlugin *plugin) |
0 | 2582 { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2583 int i; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2584 |
6 | 2585 /* connect to signal */ |
2586 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
|
2587 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
|
2588 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
|
2589 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
|
2590 purple_signal_connect(purple_conversations_get_handle(), |
31 | 2591 "conversation-created", |
2592 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
|
2593 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
|
2594 plugin, PURPLE_CALLBACK(receiving_im_cb), NULL); |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2595 purple_signal_connect(pidgin_conversations_get_handle(), "displaying-im-msg", |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2596 plugin, PURPLE_CALLBACK(displaying_im_cb), NULL); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2597 |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2598 purple_signal_connect(pidgin_conversations_get_handle(), "displayed-im-msg", |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2599 plugin, PURPLE_CALLBACK(displayed_im_cb), NULL); |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2600 purple_signal_connect(purple_conversations_get_handle(), |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2601 "deleting-conversation", |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2602 plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2603 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2604 plugin, PURPLE_CALLBACK(signed_on_cb), NULL); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2605 |
0 | 2606 |
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
|
2607 /* compile regex */ |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
2608 regp[RECIPIENT] = g_regex_new(P_RECIPIENT, 0, 0, NULL); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
2609 regp[SENDER] = g_regex_new(P_SENDER, 0, 0, NULL); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
2610 regp[COMMAND] = g_regex_new(P_COMMAND, G_REGEX_RAW, 0, NULL); |
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
2611 regp[PSEUDO] = g_regex_new(P_PSEUDO, G_REGEX_RAW, 0, NULL); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2612 regp[USER] = g_regex_new(P_USER, 0, 0, NULL); |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
2613 regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL); |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2614 regp[IMAGE_TWITTER] = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL); |
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
2615 regp[IMAGE_WASSR] = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL); |
134
9e80267fe566
- changed the way of retrieving icons from twitter. now pidgin-twitter retrieves icon which is embedded in user page.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
130
diff
changeset
|
2616 regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL); |
203
6c6fe6375ce4
revised identi.ca tag support.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
202
diff
changeset
|
2617 regp[TAG_IDENTICA] = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL); |
205
bc1448e72b1b
workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
204
diff
changeset
|
2618 regp[SIZE_128_WASSR] = g_regex_new(P_SIZE_128_WASSR, 0, 0, NULL); |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
2619 regp[EXCESS_LF] = g_regex_new(P_EXCESS_LF, 0, 0, NULL); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2620 |
194
1495b478680b
tentative support for jisko.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
183
diff
changeset
|
2621 for(i = twitter_service; i < NUM_SERVICES; i++) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2622 icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal, |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2623 g_free, NULL); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2624 } |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2625 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2626 conv_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2627 NULL, 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
|
2628 |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2629 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2630 /* attach counter to the existing twitter window */ |
51
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
2631 if(purple_prefs_get_bool(OPT_COUNTER)) { |
31 | 2632 attach_to_window(); |
2633 } | |
2634 | |
6 | 2635 return TRUE; |
0 | 2636 } |
2637 | |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2638 static void |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2639 cancel_fetch_func(gpointer key, gpointer value, gpointer user_data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2640 { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2641 icon_data *data = (icon_data *)value; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2642 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2643 if(!data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2644 return; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2645 |
227
ed227c5765a2
fix for a problem that cancel_fetch_func() sometimes triggered double free caused by a design flaw in purple_proxy_connect_*().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
226
diff
changeset
|
2646 if(data->requested) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2647 purple_util_fetch_url_cancel(data->fetch_data); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2648 data->fetch_data = NULL; |
227
ed227c5765a2
fix for a problem that cancel_fetch_func() sometimes triggered double free caused by a design flaw in purple_proxy_connect_*().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
226
diff
changeset
|
2649 data->requested = FALSE; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2650 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2651 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2652 if(data->request_list) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2653 twitter_debug("somehow, request_list != NULL\n"); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2654 } |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2655 } |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2656 |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2657 static void |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2658 cleanup_hash_entry_func(gpointer key, gpointer value, gpointer user_data) |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2659 { |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2660 remove_marks_func(key, value, user_data); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2661 cancel_fetch_func(key, value, user_data); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2662 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2663 |
8 | 2664 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2665 unload_plugin(PurplePlugin *plugin) |
0 | 2666 { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2667 int i; |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2668 GList *current; |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2669 |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
2670 twitter_debug("called\n"); |
0 | 2671 |
31 | 2672 /* disconnect from signal */ |
2673 purple_signal_disconnect(purple_conversations_get_handle(), | |
2674 "writing-im-msg", | |
2675 plugin, PURPLE_CALLBACK(writing_im_cb)); | |
2676 purple_signal_disconnect(purple_conversations_get_handle(), | |
2677 "sending-im-msg", | |
2678 plugin, PURPLE_CALLBACK(sending_im_cb)); | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2679 purple_signal_disconnect(purple_conversations_get_handle(), |
31 | 2680 "conversation-created", |
2681 plugin, PURPLE_CALLBACK(conv_created_cb)); | |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2682 purple_signal_disconnect(pidgin_conversations_get_handle(), |
135
cae8d5dd24d0
disconnect displaying_im_cb when unload.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
134
diff
changeset
|
2683 "displaying-im-msg", |
cae8d5dd24d0
disconnect displaying_im_cb when unload.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
134
diff
changeset
|
2684 plugin, PURPLE_CALLBACK(displaying_im_cb)); |
cae8d5dd24d0
disconnect displaying_im_cb when unload.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
134
diff
changeset
|
2685 purple_signal_disconnect(pidgin_conversations_get_handle(), |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2686 "displayed-im-msg", |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2687 plugin, PURPLE_CALLBACK(displayed_im_cb)); |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2688 purple_signal_disconnect(purple_conversations_get_handle(), |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2689 "receiving-im-msg", |
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
2690 plugin, PURPLE_CALLBACK(receiving_im_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
|
2691 purple_signal_disconnect(purple_conversations_get_handle(), |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2692 "deleting-conversation", |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2693 plugin, PURPLE_CALLBACK(deleting_conv_cb)); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2694 purple_signal_disconnect(purple_connections_get_handle(), |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2695 "signed-on", |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2696 plugin, PURPLE_CALLBACK(signed_on_cb)); |
31 | 2697 |
2698 /* unreference regp */ | |
196
b436d72447e8
make use of got_page_cb to obtain icons for jisko.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
194
diff
changeset
|
2699 for(i = 0; i < NUM_REGPS; i++) { |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2700 g_regex_unref(regp[i]); |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2701 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2702 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2703 /* remove mark list in each hash entry */ |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2704 /* cancel request that has not been finished yet */ |
194
1495b478680b
tentative support for jisko.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
183
diff
changeset
|
2705 for(i = twitter_service; i < NUM_SERVICES; i++) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2706 /* delete mark list and stop requeset for each hash table */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2707 g_hash_table_foreach(icon_hash[i], |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2708 (GHFunc)cleanup_hash_entry_func, NULL); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2709 /* destroy hash table for icon_data */ |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2710 g_hash_table_destroy(icon_hash[i]); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2711 } |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2712 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2713 g_hash_table_destroy(conv_hash); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
2714 |
31 | 2715 /* detach from twitter window */ |
2716 detach_from_window(); | |
2717 | |
220
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2718 /* free wassr_parrot_list */ |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2719 current = g_list_first(wassr_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2720 while(current) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2721 GList *next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2722 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2723 next = g_list_next(current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2724 g_free(current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2725 wassr_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2726 g_list_delete_link(wassr_parrot_list, current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2727 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2728 current = next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2729 } |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2730 g_list_free(wassr_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2731 wassr_parrot_list = NULL; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2732 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2733 /* free identica_parot_list */ |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2734 current = g_list_first(identica_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2735 while(current) { |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2736 GList *next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2737 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2738 next = g_list_next(current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2739 g_free(current->data); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2740 identica_parrot_list = |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2741 g_list_delete_link(identica_parrot_list, current); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2742 |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2743 current = next; |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2744 } |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2745 g_list_free(identica_parrot_list); |
1ebef23bbccb
- made parrot buffers lists so that delayed echo back message can be properly blocked.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
219
diff
changeset
|
2746 identica_parrot_list = NULL; |
138
eaf5d2c4ada0
temporal fix for identi.ca problems:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
137
diff
changeset
|
2747 |
6 | 2748 return TRUE; |
0 | 2749 } |
2750 | |
31 | 2751 static void |
2752 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
|
2753 gconstpointer val, gpointer data) |
31 | 2754 { |
2755 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
2756 |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2757 if(enabled) |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
2758 attach_to_window(); |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2759 else |
31 | 2760 detach_from_window(); |
2761 } | |
2762 | |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2763 static void |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2764 invalidate_icon_data_func(gpointer key, gpointer value, gpointer user_data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2765 { |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2766 icon_data *data = (icon_data *)value; |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2767 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2768 g_return_if_fail(data != NULL); |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2769 |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2770 g_object_unref(data->pixbuf); |
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2771 data->pixbuf = NULL; |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2772 } |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2773 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2774 static void |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2775 icon_size_prefs_cb(const char *name, PurplePrefType type, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2776 gconstpointer val, gpointer data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2777 { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2778 int i; |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2779 |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2780 /* invalidate icon cache */ |
194
1495b478680b
tentative support for jisko.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
183
diff
changeset
|
2781 for(i = twitter_service; i < NUM_SERVICES; i++) { |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2782 g_hash_table_foreach(icon_hash[i], |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2783 (GHFunc)invalidate_icon_data_func, NULL); |
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2784 } |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2785 } |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2786 |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2787 static void |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2788 interval_prefs_cb(const char *name, PurplePrefType type, |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2789 gconstpointer val, gpointer data) |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2790 { |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2791 /* remove idle func */ |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2792 g_source_remove_by_user_data((gpointer)(source.conv)); |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2793 |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2794 /* add idle func */ |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2795 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2796 source.id = g_timeout_add_seconds( |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2797 purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL), |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2798 get_status_with_api, (gpointer)(source.conv)); |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2799 } |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2800 } |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2801 |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2802 static void |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2803 text_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2804 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2805 const gchar *text; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2806 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2807 text = gtk_entry_get_text(GTK_ENTRY(data)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2808 purple_prefs_set_string(pref, text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2809 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2810 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2811 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2812 bool_toggled_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2813 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2814 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2815 gboolean value = purple_prefs_get_bool(pref); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2816 purple_prefs_set_bool(pref, !value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2817 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2818 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2819 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2820 spin_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2821 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2822 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2823 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2824 twitter_debug("called\n"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2825 |
164 | 2826 purple_prefs_set_int(pref, |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2827 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data))); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2828 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2829 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2830 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2831 combo_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2832 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2833 gint position; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2834 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2835 position = gtk_combo_box_get_active(GTK_COMBO_BOX(data)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2836 purple_prefs_set_int(pref, position); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2837 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2838 |
157
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2839 static void |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2840 disconnect_prefs_cb(GtkObject *object, gpointer data) |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2841 { |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2842 PurplePlugin *plugin = (PurplePlugin *)data; |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2843 |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2844 purple_prefs_disconnect_by_handle(plugin); |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2845 } |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2846 |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2847 static GtkWidget * |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2848 prefs_get_frame(PurplePlugin *plugin) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2849 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2850 GtkBuilder *builder; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2851 GError *err = NULL; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2852 gchar *filename; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2853 GtkWidget *window, *notebook, *e; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2854 const gchar *text; |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2855 GtkSpinButton *spin; |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2856 GtkObject *adjust; |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2857 gint value; |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2858 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2859 builder = gtk_builder_new(); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2860 |
129
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2861 #ifdef _WIN32 |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2862 filename = g_build_filename(purple_user_dir(), |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2863 "pidgin-twitter", "prefs.ui", NULL); |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2864 #else |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2865 filename = g_build_filename(DATADIR, |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2866 "pidgin-twitter", "prefs.ui", NULL); |
686498cc1e7a
in win 32 environment, DATADIR cannot be resolved at compile time, so that use purple_user_dir() instead.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
128
diff
changeset
|
2867 #endif |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2868 gtk_builder_add_from_file(builder, filename, &err); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2869 if(err) { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2870 twitter_debug("%s\n", err->message); |
167
10516b7b05a9
- ceased use of purple_imgstore_*
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
166
diff
changeset
|
2871 g_free(filename); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2872 return NULL; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2873 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2874 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2875 g_free(filename); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2876 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2877 gtk_builder_connect_signals(builder, NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2878 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2879 window = GTK_WIDGET(gtk_builder_get_object(builder, "prefswindow")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2880 notebook = GTK_WIDGET(gtk_builder_get_object(builder, "prefsnotebook")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2881 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2882 gtk_container_remove(GTK_CONTAINER(window), notebook); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2883 |
157
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2884 g_signal_connect(notebook, "destroy", |
fbe526b20885
revised handler for destroy signal in config dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
156
diff
changeset
|
2885 G_CALLBACK(disconnect_prefs_cb), plugin); |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2886 |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2887 |
164 | 2888 /**********************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2889 /* connect to signals */ |
164 | 2890 /**********************/ |
2891 | |
2892 /****************/ | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2893 /* account page */ |
164 | 2894 /****************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2895 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_twitter")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2896 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_TWITTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2897 text = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2898 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2899 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2900 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2901 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2902 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_wassr")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2903 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_WASSR); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2904 text = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2905 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2906 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2907 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2908 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2909 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_identica")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2910 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_IDENTICA); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2911 text = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2912 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2913 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2914 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2915 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2916 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2917 g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_POST); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2918 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2919 purple_prefs_get_bool(OPT_API_BASE_POST)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2920 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2921 G_CALLBACK(bool_toggled_cb), &e); |
148
4e9d0fd93fb6
- in saving icon file for twitter, proper extension is used.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
147
diff
changeset
|
2922 purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, /* xxx divide? */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2923 api_base_post_cb, NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2924 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2925 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api_password")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2926 g_object_set_data(G_OBJECT(e), "pref", OPT_PASSWORD_TWITTER); |
130
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2927 |
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2928 gtk_entry_set_visibility(GTK_ENTRY(e), FALSE); |
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2929 if (gtk_entry_get_invisible_char(GTK_ENTRY(e)) == '*') |
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2930 gtk_entry_set_invisible_char(GTK_ENTRY(e), PIDGIN_INVISIBLE_CHAR); |
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2931 |
30f3695bb969
made password invisible.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
129
diff
changeset
|
2932 text = purple_prefs_get_string(OPT_PASSWORD_TWITTER); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2933 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2934 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2935 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2936 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2937 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2938 /* interval spin */ |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2939 e = GTK_WIDGET(gtk_builder_get_object (builder, |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2940 "account_api_get_interval_spin")); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2941 g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_GET_INTERVAL); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2942 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2943 spin = GTK_SPIN_BUTTON(e); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2944 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2945 value = purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2946 twitter_debug("spin value = %d\n", value); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2947 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2948 adjust = gtk_adjustment_new(value, 40, 3600, 10, 100, 100); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2949 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2950 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2951 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2952 if(value == 0) { |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2953 value = TWITTER_DEFAULT_INTERVAL; |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2954 purple_prefs_set_int(OPT_API_BASE_GET_INTERVAL, value); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2955 } |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2956 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2957 g_signal_connect(e, "value-changed", |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2958 G_CALLBACK(spin_changed_cb), &e); |
156
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2959 purple_prefs_connect_callback(plugin, OPT_API_BASE_GET_INTERVAL, |
e65f81211340
now interval setting from UI takes effect immediately.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
155
diff
changeset
|
2960 interval_prefs_cb, NULL); |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2961 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2962 |
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
2963 |
164 | 2964 /********************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2965 /* translation page */ |
164 | 2966 /********************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2967 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_recipient")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2968 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2969 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2970 purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2971 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2972 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2973 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2974 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_sender")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2975 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2976 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2977 purple_prefs_get_bool(OPT_TRANSLATE_SENDER)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2978 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2979 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2980 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2981 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_channel")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2982 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_CHANNEL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2983 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2984 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2985 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2986 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2987 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2988 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
2989 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2990 /***************/ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2991 /* filter page */ |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2992 /***************/ |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
2993 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_filter_check")); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2994 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2995 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2996 purple_prefs_get_bool(OPT_FILTER)); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2997 g_signal_connect(e, "toggled", |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2998 G_CALLBACK(bool_toggled_cb), &e); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
2999 |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3000 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_exclude_reply_check")); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3001 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_EXCLUDE_REPLY); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3002 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3003 purple_prefs_get_bool(OPT_FILTER_EXCLUDE_REPLY)); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3004 g_signal_connect(e, "toggled", |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3005 G_CALLBACK(bool_toggled_cb), &e); |
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3006 |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3007 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_twitter")); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3008 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_TWITTER); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3009 text = purple_prefs_get_string(OPT_FILTER_TWITTER); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3010 gtk_entry_set_text(GTK_ENTRY(e), text); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3011 g_signal_connect(e, "changed", |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3012 G_CALLBACK(text_changed_cb), &e); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3013 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3014 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_wassr")); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3015 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_WASSR); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3016 text = purple_prefs_get_string(OPT_FILTER_WASSR); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3017 gtk_entry_set_text(GTK_ENTRY(e), text); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3018 g_signal_connect(e, "changed", |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3019 G_CALLBACK(text_changed_cb), &e); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3020 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3021 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_identica")); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3022 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_IDENTICA); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3023 text = purple_prefs_get_string(OPT_FILTER_IDENTICA); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3024 gtk_entry_set_text(GTK_ENTRY(e), text); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3025 g_signal_connect(e, "changed", |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3026 G_CALLBACK(text_changed_cb), &e); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3027 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3028 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3029 |
164 | 3030 /*************/ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3031 /* icon page */ |
164 | 3032 /*************/ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3033 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_show_icon")); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3034 g_object_set_data(G_OBJECT(e), "pref", OPT_SHOW_ICON); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3035 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3036 purple_prefs_get_bool(OPT_SHOW_ICON)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3037 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3038 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3039 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3040 /* icon size spin */ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3041 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_icon_size_spin")); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3042 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_SIZE); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3043 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3044 spin = GTK_SPIN_BUTTON(e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3045 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3046 value = purple_prefs_get_int(OPT_ICON_SIZE); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3047 twitter_debug("spin value = %d\n", value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3048 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3049 adjust = gtk_adjustment_new(value, 16, 128, 4, 4, 4); |
128 | 3050 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); |
3051 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3052 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3053 if(value == 0) { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3054 value = DEFAULT_ICON_SIZE; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3055 purple_prefs_set_int(OPT_ICON_SIZE, value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3056 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3057 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3058 g_signal_connect(e, "value-changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3059 G_CALLBACK(spin_changed_cb), &e); |
128 | 3060 purple_prefs_connect_callback(plugin, OPT_ICON_SIZE, |
3061 icon_size_prefs_cb, NULL); | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3062 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3063 /* enable update */ |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3064 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_enable_update")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3065 g_object_set_data(G_OBJECT(e), "pref", OPT_UPDATE_ICON); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3066 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3067 purple_prefs_get_bool(OPT_UPDATE_ICON)); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3068 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3069 G_CALLBACK(bool_toggled_cb), &e); |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3070 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3071 /* max count spin */ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3072 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_count_spin")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3073 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_COUNT); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3074 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3075 spin = GTK_SPIN_BUTTON(e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3076 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3077 value = purple_prefs_get_int(OPT_ICON_MAX_COUNT); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3078 twitter_debug("spin value = %d\n", value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3079 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3080 adjust = gtk_adjustment_new(value, 2, 10000, 1, 10, 10); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3081 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3082 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3083 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3084 if(value == 0) { |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3085 value = DEFAULT_ICON_MAX_COUNT; |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3086 purple_prefs_set_int(OPT_ICON_MAX_COUNT, value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3087 } |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3088 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3089 g_signal_connect(e, "value-changed", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3090 G_CALLBACK(spin_changed_cb), &e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3091 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3092 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3093 /* max days spin */ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3094 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_days_spin")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3095 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_DAYS); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3096 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3097 spin = GTK_SPIN_BUTTON(e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3098 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3099 value = purple_prefs_get_int(OPT_ICON_MAX_DAYS); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3100 twitter_debug("spin value = %d\n", value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3101 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3102 adjust = gtk_adjustment_new(value, 1, 180, 1, 10, 10); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3103 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3104 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3105 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3106 if(value == 0) { |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3107 value = DEFAULT_ICON_MAX_DAYS; |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3108 purple_prefs_set_int(OPT_ICON_MAX_DAYS, value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3109 } |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3110 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3111 g_signal_connect(e, "value-changed", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3112 G_CALLBACK(spin_changed_cb), &e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3113 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3114 |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3115 |
164 | 3116 /**************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3117 /* sound page */ |
164 | 3118 /**************/ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3119 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_check")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3120 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3121 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3122 purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3123 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3124 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3125 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3126 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_list")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3127 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3128 text = purple_prefs_get_string(OPT_USERLIST_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3129 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3130 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3131 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3132 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3133 /* recipient combobox */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3134 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_combo")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3135 gtk_combo_box_set_active(GTK_COMBO_BOX(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3136 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3137 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3138 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3139 G_CALLBACK(combo_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3140 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3141 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3142 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3143 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_check")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3144 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3145 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3146 purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3147 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3148 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3149 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3150 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_list")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3151 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3152 text = purple_prefs_get_string(OPT_USERLIST_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3153 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3154 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3155 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3156 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3157 /* sender combobox */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3158 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_combo")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3159 gtk_combo_box_set_active(GTK_COMBO_BOX(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3160 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3161 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3162 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3163 G_CALLBACK(combo_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3164 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3165 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3166 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3167 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3168 /****************/ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3169 /* utility page */ |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3170 /****************/ |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3171 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_counter")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3172 g_object_set_data(G_OBJECT(e), "pref", OPT_COUNTER); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3173 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3174 purple_prefs_get_bool(OPT_COUNTER)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3175 g_signal_connect(e, "toggled", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3176 G_CALLBACK(bool_toggled_cb), &e); |
198
85484ddf8823
- changed the way of fetching icons for wassr. now pidgin-twitter downloads html first even for wassr.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
196
diff
changeset
|
3177 purple_prefs_connect_callback(plugin, OPT_COUNTER, |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3178 counter_prefs_cb, NULL); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3179 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3180 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_pseudo")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3181 g_object_set_data(G_OBJECT(e), "pref", OPT_ESCAPE_PSEUDO); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3182 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3183 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3184 g_signal_connect(e, "toggled", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3185 G_CALLBACK(bool_toggled_cb), &e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3186 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3187 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_oops")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3188 g_object_set_data(G_OBJECT(e), "pref", OPT_SUPPRESS_OOPS); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3189 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3190 purple_prefs_get_bool(OPT_SUPPRESS_OOPS)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3191 g_signal_connect(e, "toggled", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3192 G_CALLBACK(bool_toggled_cb), &e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3193 |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3194 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_strip_excess_lf")); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3195 g_object_set_data(G_OBJECT(e), "pref", OPT_STRIP_EXCESS_LF); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3196 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3197 purple_prefs_get_bool(OPT_STRIP_EXCESS_LF)); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3198 g_signal_connect(e, "toggled", |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3199 G_CALLBACK(bool_toggled_cb), &e); |
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3200 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3201 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_notify")); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3202 g_object_set_data(G_OBJECT(e), "pref", OPT_PREVENT_NOTIFICATION); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3203 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3204 purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3205 g_signal_connect(e, "toggled", |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3206 G_CALLBACK(bool_toggled_cb), &e); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3207 |
168
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3208 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_log_output")); |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3209 g_object_set_data(G_OBJECT(e), "pref", OPT_LOG_OUTPUT); |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3210 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3211 purple_prefs_get_bool(OPT_LOG_OUTPUT)); |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3212 g_signal_connect(e, "toggled", |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3213 G_CALLBACK(bool_toggled_cb), &e); |
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3214 |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3215 |
155
0921655b4ae1
added UI for configuring retrieve interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
154
diff
changeset
|
3216 /* all done */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3217 gtk_widget_show_all(notebook); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3218 return notebook; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3219 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3220 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3221 static PidginPluginUiInfo ui_info = { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3222 prefs_get_frame, |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3223 0, /* page number - reserved */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3224 NULL, /* reserved 1 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3225 NULL, /* reserved 2 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3226 NULL, /* reserved 3 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3227 NULL /* reserved 4 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3228 }; |
0 | 3229 |
6 | 3230 static PurplePluginInfo info = { |
3231 PURPLE_PLUGIN_MAGIC, | |
3232 PURPLE_MAJOR_VERSION, | |
3233 PURPLE_MINOR_VERSION, | |
3234 PURPLE_PLUGIN_STANDARD, /**< type */ | |
147
3abee459c81c
removed old prefs stuff.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
146
diff
changeset
|
3235 PIDGIN_PLUGIN_TYPE, /**< ui_req */ |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
3236 0, /**< flags */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
3237 NULL, /**< deps */ |
6 | 3238 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
232
1c85aa4acb9d
- bumped version to 0.8.0b1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
231
diff
changeset
|
3239 PLUGIN_ID, /**< id */ |
6 | 3240 "Pidgin-Twitter", /**< name */ |
232
1c85aa4acb9d
- bumped version to 0.8.0b1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
231
diff
changeset
|
3241 "0.8.0b1", /**< version */ |
76
63bd9ca28be0
- added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
74
diff
changeset
|
3242 "provides useful features for twitter", /** summary */ |
63bd9ca28be0
- added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
74
diff
changeset
|
3243 "provides useful features for twitter", /** desc */ |
183 | 3244 "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, \nmojin, umq, \nthe pidging-twitter team", /**< author */ |
164 | 3245 "http://www.honeyplanet.jp/pidgin-twitter/", /**< homepage */ |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
3246 load_plugin, /**< load */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
3247 unload_plugin, /**< unload */ |
6 | 3248 NULL, /**< destroy */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3249 &ui_info, /**< ui_info */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3250 NULL, /**< extra_info */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
3251 NULL, /**< pref info */ |
6 | 3252 NULL |
0 | 3253 }; |
3254 | |
8 | 3255 static void |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
3256 init_plugin(PurplePlugin *plugin) |
0 | 3257 { |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
3258 char *dirname = NULL; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
3259 |
6 | 3260 g_type_init(); |
67
000575bce35d
path should not be hard-coded. windows uses another delimiter.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
66
diff
changeset
|
3261 dirname = g_build_filename(purple_user_dir(), "pidgin-twitter", "icons", NULL); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
3262 if(dirname) |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
3263 purple_prefs_add_string(OPT_ICON_DIR, dirname); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
3264 g_free(dirname); |
0 | 3265 |
6 | 3266 /* add plugin preferences */ |
3267 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
|
3268 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
|
3269 purple_prefs_add_bool(OPT_TRANSLATE_SENDER, TRUE); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
3270 purple_prefs_add_bool(OPT_TRANSLATE_CHANNEL, TRUE); |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
3271 purple_prefs_add_bool(OPT_ESCAPE_PSEUDO, TRUE); |
239
e3a24c98772d
added a new feature that strips excessive consecutive new line characters.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
232
diff
changeset
|
3272 purple_prefs_add_bool(OPT_STRIP_EXCESS_LF, TRUE); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
3273 |
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
|
3274 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
|
3275 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
|
3276 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
|
3277 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
|
3278 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
|
3279 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); |
31 | 3280 |
3281 purple_prefs_add_bool(OPT_COUNTER, TRUE); | |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
3282 purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); |
99
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
3283 purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE); |
59
3f9148c1dc60
added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents:
56
diff
changeset
|
3284 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
3285 purple_prefs_add_bool(OPT_API_BASE_POST, FALSE); |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3286 purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
3287 purple_prefs_add_string(OPT_SCREEN_NAME_TWITTER, EMPTY); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
3288 purple_prefs_add_string(OPT_PASSWORD_TWITTER, EMPTY); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
3289 purple_prefs_add_string(OPT_SCREEN_NAME_WASSR, EMPTY); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
3290 purple_prefs_add_string(OPT_SCREEN_NAME_IDENTICA, EMPTY); |
153
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3291 |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3292 purple_prefs_add_bool(OPT_SHOW_ICON, TRUE); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3293 purple_prefs_add_int(OPT_ICON_SIZE, DEFAULT_ICON_SIZE); |
07cedffb1c63
implemented UI for configuring icon update.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
152
diff
changeset
|
3294 purple_prefs_add_bool(OPT_UPDATE_ICON, TRUE); |
152
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
3295 purple_prefs_add_int(OPT_ICON_MAX_COUNT, DEFAULT_ICON_MAX_COUNT); |
588da540685a
work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
151
diff
changeset
|
3296 purple_prefs_add_int(OPT_ICON_MAX_DAYS, DEFAULT_ICON_MAX_DAYS); |
168
56e3873e58a8
made log output configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
167
diff
changeset
|
3297 purple_prefs_add_bool(OPT_LOG_OUTPUT, FALSE); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3298 |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3299 purple_prefs_add_bool(OPT_FILTER, TRUE); |
215
6b258bdd9c49
added a feature of excluding reply to me from filter application.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
214
diff
changeset
|
3300 purple_prefs_add_bool(OPT_FILTER_EXCLUDE_REPLY, TRUE); |
211
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3301 purple_prefs_add_string(OPT_FILTER_TWITTER, DEFAULT_LIST); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3302 purple_prefs_add_string(OPT_FILTER_WASSR, DEFAULT_LIST); |
e13103257b33
implemented filtering functionality.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
210
diff
changeset
|
3303 purple_prefs_add_string(OPT_FILTER_IDENTICA, DEFAULT_LIST); |
0 | 3304 } |
3305 | |
3306 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) |