annotate pidgin-twitter.c @ 85:fb9831fae969

- fixed the bug that icons didn't appear correctly for wassr conversation. - new function get_service_type() has been added. it takes PurpleConversation and returns service type number. - numerous is_*_conv() have been replaced with get_service_type() and switch clause.
author Yoshiki Yazawa <yaz@honeyplnaet.jp>
date Sun, 06 Jul 2008 01:51:07 +0900
parents 0c1f63882b8a
children 89f52081f115 2b7ef3538cd3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1 /*
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
2 * Pidgin-Twitter plugin.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
3 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
5 * modify it under the terms of the GNU General Public License as
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
6 * published by the Free Software Foundation; either version 2 of the
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
7 * License, or (at your option) any later version.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
8 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful, but
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
12 * General Public License for more details.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
13 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
17 * 02111-1307, USA.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
18 */
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
19 #define PURPLE_PLUGINS 1
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
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"
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
22
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
23 /* globals */
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
24 static GRegex *regp[7];
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
25 static gboolean suppress_oops = FALSE;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
26 static GHashTable *icon_data_by_user = NULL;
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
27 static GHashTable *icon_data_by_user2 = NULL;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
28
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
29 #define WASSR_POST_LEN (255 * 4)
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
30 static gchar *wassr_post = NULL;
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
31
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
32 typedef struct _icon_data {
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
33 gint icon_id; // image id
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
34 gboolean requested; // TRUE if download icon has been requested
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
35 GList *request_list; // marker list
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
36 PurpleUtilFetchUrlData *fetch_data; // icon fetch data
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
37 } icon_data;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
38
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
39 enum {
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
40 unknown_service,
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
41 twitter_service,
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
42 wassr_service
83
15f4886720e4 build fix
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 82
diff changeset
43 };
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
44
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
45 typedef struct _eval_data {
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
46 gint which;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
47 gint service;
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
48 } eval_data;
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
49
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
50 typedef struct _got_icon_data {
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
51 gchar *user_name;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
52 gint service;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
53 } got_icon_data;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
54
49
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
55 /* this function is a modified clone of purple_markup_strip_html() */
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
56 static char *
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
57 strip_html_markup(const char *str)
34
44ffbd056f33 added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 32
diff changeset
58 {
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
59 int i, j, k, entlen;
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
60 gboolean visible = TRUE;
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
61 gboolean closing_td_p = FALSE;
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
62 gchar *str2;
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 const gchar *cdata_close_tag = NULL, *ent;
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
64 gchar *href = 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
65 int href_st = 0;
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
66
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
67 if(!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
68 return 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
69
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
70 str2 = g_strdup(str);
34
44ffbd056f33 added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 32
diff changeset
71
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
72 for (i = 0, j = 0; str2[i]; i++)
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
73 {
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
74 if (str2[i] == '<')
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
75 {
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
76 if (cdata_close_tag)
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
77 {
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
78 /* Note: Don't even assume any other tag is a tag in CDATA */
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
79 if (g_ascii_strncasecmp(str2 + i, cdata_close_tag,
49
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
80 strlen(cdata_close_tag)) == 0)
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
81 {
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
82 i += strlen(cdata_close_tag) - 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
83 cdata_close_tag = 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
84 }
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
85 continue;
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
86 }
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
87 else if (g_ascii_strncasecmp(str2 + i, "<td", 3) == 0 && closing_td_p)
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
88 {
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
89 str2[j++] = '\t';
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
90 visible = TRUE;
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
91 }
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
92 else if (g_ascii_strncasecmp(str2 + i, "</td>", 5) == 0)
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
93 {
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
94 closing_td_p = TRUE;
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
95 visible = FALSE;
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
96 }
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
97 else
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
98 {
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
99 closing_td_p = FALSE;
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
100 visible = TRUE;
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
101 }
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
102
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
103 k = i + 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
104
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
105 if(g_ascii_isspace(str2[k]))
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
106 visible = TRUE;
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
107 else if (str2[k])
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
108 {
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
109 /* Scan until we end the tag either implicitly (closed start
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
110 * tag) or explicitly, using a sloppy method (i.e., < or >
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
111 * inside quoted attributes will screw us up)
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
112 */
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
113 while (str2[k] && str2[k] != '<' && str2[k] != '>')
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
114 {
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
115 k++;
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
116 }
42
68db38b5b401 fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents: 41
diff changeset
117
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
118 /* If we've got an <a> tag with an href, save the address
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
119 * to print later. */
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
120 if (g_ascii_strncasecmp(str2 + i, "<a", 2) == 0 &&
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
121 g_ascii_isspace(str2[i+2]))
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
122 {
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
123 int st; /* start of href, inclusive [ */
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
124 int end; /* end of href, exclusive ) */
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
125 char delim = ' ';
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
126 /* Find start of href */
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
127 for (st = i + 3; st < k; st++)
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
128 {
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
129 if (g_ascii_strncasecmp(str2+st, "href=", 5) == 0)
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
130 {
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
131 st += 5;
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
132 if (str2[st] == '"' || str2[st] == '\'')
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
133 {
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
134 delim = str2[st];
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
135 st++;
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
136 }
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
137 break;
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
138 }
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
139 }
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
140 /* find end of address */
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
141 for (end = st; end < k && str2[end] != delim; end++)
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
142 {
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
143 /* All the work is done in the loop construct above. */
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
144 }
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
145
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
146 /* If there's an address, save it. If there was
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
147 * already one saved, kill it. */
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
148 if (st < k)
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
149 {
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
150 char *tmp;
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
151 g_free(href);
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
152 tmp = g_strndup(str2 + st, end - st);
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
153 href = purple_unescape_html(tmp);
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
154 g_free(tmp);
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
155 href_st = j;
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
156 }
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
157 }
42
68db38b5b401 fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents: 41
diff changeset
158
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
159 /* Check for tags which should be mapped to newline */
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
160 else if (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0
49
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
161 || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
162 || g_ascii_strncasecmp(str2 + i, "<br", 3) == 0
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
163 || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
164 || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
165 || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
166 || g_ascii_strncasecmp(str2 + i, "</table>", 8) == 0)
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
167 {
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
168 str2[j++] = '\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
169 }
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
170 else if (g_ascii_strncasecmp(str2 + i, "<script", 7) == 0)
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
171 {
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
172 cdata_close_tag = "</script>";
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
173 }
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
174 else if (g_ascii_strncasecmp(str2 + i, "<style", 6) == 0)
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
175 {
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
176 cdata_close_tag = "</style>";
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
177 }
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
178 /* Update the index and continue checking after the tag */
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
179 i = (str2[k] == '<' || str2[k] == '\0')? k - 1: k;
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
180 continue;
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
181 }
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
182 }
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
183 else if (cdata_close_tag)
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
184 {
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
185 continue;
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
186 }
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
187 else if (!g_ascii_isspace(str2[i]))
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
188 {
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
189 visible = TRUE;
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
190 }
39
2ac81c0afb53 - new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 38
diff changeset
191
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
192 if (str2[i] == '&' &&
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
193 (ent = purple_markup_unescape_entity(str2 + i, &entlen)) != 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
194 {
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
195 while (*ent)
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
196 str2[j++] = *ent++;
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
197 i += entlen - 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
198 continue;
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
199 }
34
44ffbd056f33 added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 32
diff changeset
200
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
201 if (visible)
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
202 str2[j++] = g_ascii_isspace(str2[i])? ' ': str2[i];
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
203 }
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
204
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
205 g_free(href);
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
206
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
207 str2[j] = '\0';
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
208
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
209 return str2;
34
44ffbd056f33 added patch to strip excessive hyper link on @username when it copied and pasted from message window. patch by mikanbako (maoutwo@gmail.com).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 32
diff changeset
210 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
211
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
212 /* 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
213 static gboolean
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
214 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
215 {
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
216 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
217 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
218 return FALSE;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
219 }
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
220
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
221 return TRUE;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
222 }
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
223
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
224
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
225 /**********************/
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
226 /* our implementation */
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
227 /**********************/
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
228 static void
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
229 escape(gchar **str)
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
230 {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
231 GMatchInfo *match_info = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
232 gchar *newstr = NULL, *match = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
233 gboolean flag = FALSE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
234
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
235 /* search genuine command */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
236 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
237 while(g_match_info_matches(match_info)) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
238 match = g_match_info_fetch(match_info, 1);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
239 twitter_debug("command = %s\n", match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
240 g_free(match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
241 g_match_info_next(match_info, NULL);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
242 flag = TRUE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
243 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
244 g_match_info_free(match_info);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
245 match_info = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
246
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
247 if(flag)
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
248 return;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
249
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
250 /* if not found, check pseudo command */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
251 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
252 while(g_match_info_matches(match_info)) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
253 match = g_match_info_fetch(match_info, 1);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
254 twitter_debug("pseudo = %s\n", match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
255 g_free(match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
256 g_match_info_next(match_info, NULL);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
257 flag = TRUE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
258 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
259 g_match_info_free(match_info);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
260 match_info = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
261
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
262 /* if there is pseudo one, escape it */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
263 if(flag) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
264 /* put ". " to the beginning of buffer */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
265 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
266 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
267 g_free(*str);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
268 *str = newstr;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
269 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
270 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
271
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
272 static void
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
273 strip_markup(gchar **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
274 {
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
275 char *plain;
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
276
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
277 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
278 g_free(*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
279 *str = plain;
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
280 }
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
281
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
282 #define TWITTER_STATUS_POST "POST /statuses/update.xml HTTP/1.0\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
283 "Host: twitter.com\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
284 "User-Agent: Pidgin-Twitter\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
285 "Authorization: Basic %s\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
286 "Content-Length: %d\r\n\r\n"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
287
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
288 #define TWITTER_STATUS_FORMAT "status=%s"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
289 #define TWITTER_STATUS_TERMINATOR "\r\n\r\n"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
290
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
291 #define TWITTER_BASE_URL "http://twitter.com"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
292
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
293 typedef struct twitter_message {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
294 PurpleAccount *account;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
295 char *status;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
296 time_t time;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
297 } twitter_message_t;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
298
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
299 static void
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
300 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
301 const gchar *url_text, size_t len,
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
302 const gchar *error_message)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
303 {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
304 twitter_message_t *tm = (struct twitter_message *)user_data;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
305 gchar *msg = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
306 char *p1 = NULL, *p2 = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
307 int error = 1;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
308 PurpleConversation *conv;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
309
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
310 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
311 "twitter@twitter.com",
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
312 tm->account);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
313 if (!conv) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
314 twitter_debug("failed to get conversation\n");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
315 goto fin;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
316 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
317
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
318 if (error_message) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
319 /* connection failed or something */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
320 msg = g_strdup_printf("Local error: %s", error_message);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
321 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
322 int code = -1;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
323
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
324 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
325 || 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
326
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
327 p1 = strchr(url_text, ' ');
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
328
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
329 if (p1) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
330 p1++;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
331 p2 = strchr(p1, ' ');
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
332 if (p2)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
333 p2++;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
334 else
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
335 p2 = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
336 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
337 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
338
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
339 code = atoi(p1);
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
340
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
341 if (code == 200) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
342 error = 0;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
343 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
344 switch (code) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
345 case 400:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
346 msg = g_strdup("Invalid request. Too many updates?");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
347 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
348 case 401:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
349 msg = g_strdup("Authorization failed.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
350 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
351 case 403:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
352 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
353 "for some reason.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
354 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
355 case 404:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
356 msg = g_strdup("Requested URI is not found.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
357 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
358 case 500:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
359 msg = g_strdup("Server error.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
360 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
361 case 502:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
362 msg = g_strdup("Twitter is down or under maintenance.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
363 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
364 case 503:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
365 msg = g_strdup("Twitter is extremely crowded. "
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
366 "Try again later.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
367 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
368 default:
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
369 msg = g_strdup_printf("Unknown error. (%d %s)",
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
370 code, p2 ? p2 : "");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
371 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
372 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
373 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
374 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
375
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
376 if (!error) {
73
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
377 gchar *m = NULL;
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
378 const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
379 if (screen_name)
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
380 m = g_strdup_printf("%s: %s", screen_name, tm->status);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
381 else
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
382 m = "";
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
383
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
384 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
385 purple_account_get_username(tm->account),
73
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
386 m, PURPLE_MESSAGE_SEND, tm->time);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
387
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
388 g_free(m);
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
389 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
390 gchar *m;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
391 m = g_strdup_printf("%s<BR>%s",
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
392 msg, tm->status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
393 /* FIXME: too strong. it should be more smart */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
394 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
395 purple_account_get_username(tm->account),
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
396 m, PURPLE_MESSAGE_ERROR, time(NULL));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
397 g_free(m);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
398 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
399
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
400 fin:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
401 if (msg)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
402 g_free(msg);
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
403
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
404 if (tm) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
405 if (tm->status)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
406 g_free(tm->status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
407 g_free(tm);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
408 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
409
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
410 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
411
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
412 static void
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
413 post_status_with_api(PurpleAccount *account, char **buffer)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
414 {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
415 char *request, *status, *header;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
416 const char *url_encoded = purple_url_encode(*buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
417 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
418
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
419 twitter_message_t *tm;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
420
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
421 const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
422 const char *password = purple_prefs_get_string(OPT_PASSWORD);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
423
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
424 twitter_debug("tm.account: %s\n",
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
425 purple_account_get_username(account));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
426
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
427 if (!screen_name || !password || !screen_name[0] || !password[0]) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
428 twitter_debug("screen_name or password is empty\n");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
429 return;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
430 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
431
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
432 tm = g_new(twitter_message_t, 1);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
433 tm->account = account;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
434 tm->status = g_strdup(*buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
435 tm->time = time(NULL);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
436
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
437 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
438 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
439 strlen(basic_auth));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
440 g_free(basic_auth);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
441
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
442 status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
443
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
444 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
445 (int)strlen(status));
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
446
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
447 request = g_strconcat(header, status, TWITTER_STATUS_TERMINATOR, NULL);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
448
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
449 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
450 NULL, TRUE, request, TRUE,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
451 post_status_with_api_cb, tm);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
452
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
453 g_free(header);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
454 g_free(basic_auth_encoded);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
455 g_free(status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
456 g_free(request);
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
457
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
458 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
459
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
460 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
461 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
462 void *data)
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
463 {
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
464 int utflen, bytes;
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
465
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
466 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
467
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
468 if(is_wassr_account(account, recipient)) {
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
469 /* store sending message to address parrot problem */
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
470 g_strlcpy(wassr_post, *buffer, WASSR_POST_LEN);
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
471 twitter_debug("parrot pushed:%s\n", *buffer);
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
472 }
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
473
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
474 /* check if the message is from twitter */
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
475 if(!is_twitter_account(account, recipient))
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
476 return FALSE;
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
477
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
478 /* strip all markups */
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
479 strip_markup(buffer);
41
0a81ccfa1941 strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 40
diff changeset
480
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
481 /* escape pseudo command */
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
482 if(is_twitter_account(account, recipient) &&
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
483 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
484 escape(buffer);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
485 }
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
486
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
487 /* update status with Twitter API instead of IM protocol */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
488 if (purple_prefs_get_bool(OPT_API_BASE_POST)) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
489 if (buffer && *buffer) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
490 post_status_with_api(account, buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
491 (*buffer)[0] = '\0';
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
492 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
493 return FALSE;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
494 }
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
495
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
496 /* 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
497 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
498 bytes = strlen(*buffer);
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
499 twitter_debug("utflen = %d bytes = %d\n", utflen, bytes);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
500 if(bytes > 140 && utflen <= 140)
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
501 suppress_oops = TRUE;
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
502
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
503 return FALSE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
504 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
505
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
506 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
507 eval(const GMatchInfo *match_info, GString *result, gpointer user_data)
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
508 {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
509 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
510 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
511 gint service = data->service;
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
512 gchar sub[128];
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
513
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
514 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
515
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
516 if(which == RECIPIENT) {
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
517 gchar *match = g_match_info_fetch(match_info, 1);
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
518
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
519 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
520 case twitter_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
521 snprintf(sub, 128, RECIPIENT_FORMAT, match, match);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
522 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
523 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
524 snprintf(sub, 128, RECIPIENT_FORMAT_WASSR, match, match);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
525 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
526 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
527 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
528 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
529 }
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
530
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
531 g_free(match);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
532 }
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
533 else if(which == SENDER) {
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
534 gchar *match1 = g_match_info_fetch(match_info, 1); //preceding CR|LF
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
535 gchar *match2 = g_match_info_fetch(match_info, 2); //sender
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
536
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
537 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
538 case twitter_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
539 snprintf(sub, 128, SENDER_FORMAT, match1 ? match1: "",
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
540 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
541 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
542 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
543 snprintf(sub, 128, SENDER_FORMAT_WASSR, match1 ? match1: "",
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
544 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
545 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
546 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
547 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
548 break;
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
549 }
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
550
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
551 g_free(match1);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
552 g_free(match2);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
553 }
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
554
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
555 g_string_append(result, sub);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
556 twitter_debug("sub = %s\n", sub);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
557
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
558 return FALSE;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
559 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
560
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
561 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
562 translate(gchar **str, gint which, gint service)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
563 {
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
564 gchar *newstr;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
565
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
566 eval_data *data = g_new0(eval_data, 1);
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
567
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
568 data->which = which;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
569 data->service = service;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
570
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
571 newstr = g_regex_replace_eval(regp[which], // compiled regex
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
572 *str, // subject string
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
573 -1, // length of the subject string
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
574 0, // start position
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
575 0, // match options
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
576 eval, // function to be called for each match
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
577 data, // user data
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
578 NULL); // error handler
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
579
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
580 g_free(data); data = NULL;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
581
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
582 twitter_debug("which = %d *str = %s newstr = %s\n", which, *str, newstr);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
583
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
584 g_free(*str);
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
585 *str = newstr;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
586 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
587
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
588 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
589 playsound(gchar **str, gint which)
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
590 {
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
591 GMatchInfo *match_info;
7
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
592 const gchar *list;
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
593 gchar **candidates = NULL, **candidate = NULL;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
594
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
595 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER :
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
596 OPT_USERLIST_RECIPIENT);
5
6ac1867d7e8e string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2
diff changeset
597 g_return_if_fail(list != NULL);
7
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
598 if(!strcmp(list, DEFAULT_LIST))
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
599 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
600
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
601 candidates = g_strsplit_set(list, " ,:;", 0);
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
602 g_return_if_fail(candidates != NULL);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
603
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
604 g_regex_match(regp[which], *str, 0, &match_info);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
605 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
606 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
607 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
608 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
609 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
610 user = g_match_info_fetch(match_info, 2);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
611 twitter_debug("user = %s\n", user);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
612
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
613 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
614 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
615 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
616 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
617 if(!strcmp(user, *candidate)) {
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
618 twitter_debug("match. play sound\n");
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
619 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
620 (which ? OPT_SOUNDID_SENDER :
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
621 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
622 break;
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
623 }
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
624 }
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
625 g_free(user);
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
626 g_match_info_next(match_info, NULL);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
627 }
7
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
628 g_strfreev(candidates);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
629 g_match_info_free(match_info);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
630 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
631
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
632 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
633 writing_im_cb(PurpleAccount *account, char *sender, char **buffer,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
634 PurpleConversation *conv, int *flags, void *data)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
635 {
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
636 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
637
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
638 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
639
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
640 /* 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
641 if(service == unknown_service)
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
642 return FALSE;
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
643
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
644 /* strip all markups */
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
645 strip_markup(buffer);
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
646
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
647 /* playsound */
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
648 if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
649 playsound(buffer, SENDER);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
650 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
651 if(purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
652 playsound(buffer, RECIPIENT);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
653 }
41
0a81ccfa1941 strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 40
diff changeset
654
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
655 /* translate */
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
656 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
657 translate(buffer, SENDER, service);
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
658 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
659 if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
660 translate(buffer, RECIPIENT, service);
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
661 }
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
662
46
e4f8e5708afd due to application of strip_markup() in writing_im_cb(), translation for sender had not worked. changed P_SENDER so that it matches striped representation of sender.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 45
diff changeset
663 /* escape pseudo command (to show same result to sending message) */
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
664 if(is_twitter_conv(conv) && purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
665 escape(buffer);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
666 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
667
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
668 return FALSE;
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
669 }
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
670
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
671 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
672 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
673 gchar *new_text, gint new_text_length, gpointer user_data)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
674 {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
675 PurpleConversation *conv = (PurpleConversation *)user_data;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
676 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
677
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
678 GtkWidget *box, *counter = NULL;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
679 gchar *markup = NULL;
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
680 guint count;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
681
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
682 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
683
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
684 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
685
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
686 count = gtk_text_buffer_get_char_count(textbuffer) +
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
687 (unsigned int)g_utf8_strlen(new_text, -1);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
688
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
689 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
690 case twitter_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
691 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
692 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
693 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
694 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
695 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
696 count <= 255 ? "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
697 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
698 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
699 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
700 break;
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
701 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
702
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
703 box = gtkconv->toolbar;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
704 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
705 if(counter)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
706 gtk_label_set_markup(GTK_LABEL(counter), markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
707
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
708 g_free(markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
709 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
710
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
711 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
712 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos,
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
713 GtkTextIter *end_pos, gpointer user_data)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
714 {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
715 PurpleConversation *conv = (PurpleConversation *)user_data;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
716 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
717 GtkWidget *box, *counter = NULL;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
718 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
719 gint service = get_service_type(conv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
720
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
721 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
722
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
723 guint count = gtk_text_buffer_get_char_count(textbuffer) -
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
724 (gtk_text_iter_get_offset(end_pos) -
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
725 gtk_text_iter_get_offset(start_pos));
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
726
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
727 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
728 case twitter_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
729 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
730 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
731 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
732 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
733 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
734 count <= 255 ? "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
735 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
736 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
737 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
738 break;
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
739 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
740
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
741 box = gtkconv->toolbar;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
742 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
743 if(counter)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
744 gtk_label_set_markup(GTK_LABEL(counter), markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
745
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
746 g_free(markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
747 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
748
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
749 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
750 detach_from_window(void)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
751 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
752 GList *list;
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
753
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
754 /* 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
755 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
756 PidginWindow *win = list->data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
757 PurpleConversation *conv =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
758 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
759 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
760 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
761 case twitter_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
762 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
763 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
764 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
765 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
766 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
767 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
768 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
769 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
770 }
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
771 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
772 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
773
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
774 static void
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
775 detach_from_conv(PurpleConversation *conv, gpointer null)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
776 {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
777 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
778 GtkWidget *box, *counter = NULL, *sep = NULL;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
779
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
780 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
781 (GFunc) insert_text_cb, conv);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
782 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
783 (GFunc) delete_text_cb, conv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
784
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
785 box = gtkconv->toolbar;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
786
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
787 /* remove counter */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
788 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
789 if(counter) {
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
790 gtk_container_remove(GTK_CONTAINER(box), counter);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
791 g_object_unref(counter);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
792 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
793 }
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
794
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
795 /* remove separator */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
796 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
797 if(sep) {
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
798 gtk_container_remove(GTK_CONTAINER(box), sep);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
799 g_object_unref(sep);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
800 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
801 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
802
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
803 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
804 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
805
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
806 static void
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
807 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
808 {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
809 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
810 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
811 GList *mark_list = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
812 GList *current;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
813
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
814 if(data && data->request_list)
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
815 mark_list = data->request_list;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
816
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
817 /* remove the marks in its GtkTextBuffers */
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
818 for(current = g_list_first(mark_list); current;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
819 current = g_list_next(current)) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
820 GtkTextMark *current_mark = current->data;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
821 GtkTextBuffer *current_text_buffer = gtk_text_mark_get_buffer(
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
822 current_mark);
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
823
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
824 if(!current_text_buffer)
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
825 continue;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
826
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
827 if(text_buffer) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
828 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
829 /* 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
830 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
831 current_mark);
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
832 current->data = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
833 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
834 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
835 else {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
836 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
837 current->data = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
838 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
839 } /* end of for */
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
840
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
841 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
842 data->request_list = mark_list;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
843 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
844
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
845 static void
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
846 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
847 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
848 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
849
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
850 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
851 (GHFunc)remove_marks_func,
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
852 (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
853 }
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
854
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
855 static void
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
856 attach_to_window(void)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
857 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
858 GList *list;
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
859
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
860 /* 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
861 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
862 PidginWindow *win = list->data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
863 PurpleConversation *conv =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
864 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
865 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
866 /* 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
867 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
868 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
869 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
870 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
871 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
872 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
873 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
874 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
875 }
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
876 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
877 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
878
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
879 static void
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
880 attach_to_conv(PurpleConversation *conv, gpointer null)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
881 {
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
882 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
883 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
884 GtkIMHtml *imhtml;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
885
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
886 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
887 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
888
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
889 /* Disable widgets that decorate or add link to composing text
53
872f418ba45d - revised README
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 52
diff changeset
890 * 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
891 * 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
892 */
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
893 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
894 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
895 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
896 }
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
897 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
898 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
899 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
900 }
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
901
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
902 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
903 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
904 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
905 ~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
906
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
907 /* 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
908 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
909 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
910
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
911 /* get counter object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
912 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
913 g_return_if_fail(counter == NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
914
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
915 /* make counter object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
916 counter = gtk_label_new(NULL);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
917 gtk_widget_set_name(counter, "counter_label");
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
918 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
919 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
920 gtk_widget_show_all(counter);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
921 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", counter);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
922
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
923 /* make separator object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
924 sep = gtk_vseparator_new();
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
925 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
926 gtk_widget_show_all(sep);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
927 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
928
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
929 /* connect to signals */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
930 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
931 G_CALLBACK(insert_text_cb), conv);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
932 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
933 G_CALLBACK(delete_text_cb), conv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
934
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
935 /* redraw window */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
936 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
937 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
938
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
939 static gboolean
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
940 is_twitter_account(PurpleAccount *account, const char *name)
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
941 {
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
942 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
943
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
944 twitter_debug("name = %s proto = %s\n", name, proto);
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
945
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
946 if(!strcmp(name, "twitter@twitter.com") &&
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
947 !strcmp(proto, "prpl-jabber")) {
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
948 return TRUE;
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
949 }
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
950
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
951 return FALSE;
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
952 }
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
953
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
954 static gboolean
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
955 is_twitter_conv(PurpleConversation *conv)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
956 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
957 const char *name = purple_conversation_get_name(conv);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
958 PurpleAccount *account = purple_conversation_get_account(conv);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
959
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
960 return is_twitter_account(account, name);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
961 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
962
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
963 static gboolean
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
964 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
965 {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
966 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
967
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
968 twitter_debug("name = %s proto = %s\n", name, proto);
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
969
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
970 if(strstr(name, "wassr-bot@wassr.jp") &&
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
971 !strcmp(proto, "prpl-jabber")) {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
972 return TRUE;
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
973 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
974
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
975 return FALSE;
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
976 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
977
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
978 static gboolean
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
979 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
980 {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
981 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
982 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
983
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
984 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
985 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
986
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
987 static gint
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
988 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
989 {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
990 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
991
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
992 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
993
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
994 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
995 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
996 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
997 service = wassr_service;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
998
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
999 return service;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1000 }
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1001
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1002 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1003 conv_created_cb(PurpleConversation *conv, gpointer null)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1004 {
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1005 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1006 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1007
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1008 gint service = get_service_type(conv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1009 /* 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
1010 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1011 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
1012 case wassr_service:
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1013 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
1014 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1015 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1016 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
1017 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1018 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1019 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1020
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
1021 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
1022 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
1023 {
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
1024 PidginConversation *gtkconv = PIDGIN_CONVERSATION(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
1025 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
1026
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1027 gint service = get_service_type(conv);
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
1028 /* 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
1029 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1030 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1031 delete_requested_icon_marks(gtkconv, icon_data_by_user);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1032 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1033 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1034 delete_requested_icon_marks(gtkconv, icon_data_by_user2);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1035 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1036 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1037 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
1038 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1039 }
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
1040 }
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
1041
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1042 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
1043 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
1044 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
1045 {
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
1046 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
1047 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
1048
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
1049 /* Check if the conv is not NULL to avoid a clash.
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
1050 * conv is null when the conversation window has not opened yet.
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
1051 * And if check is a twitter conv. */
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1052
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1053 /* quick hack to suppress annoying completion message from wassr */
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1054 if(conv && is_wassr_conv(conv)) {
81
f1163f2e4920 add suppression of annoying completion message for posts to the wasser-channel.
"mojin <truffechampagne@gmail.com>"
parents: 80
diff changeset
1055 if(strstr(*buffer, "<body>投稿完了:") ||
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1056 strstr(*buffer, "<body>チャンネル投稿完了:")) {
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1057 twitter_debug("clearing sender and buffer\n");
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1058 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
1059 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
1060 }
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1061 /* fix for parrot problem during post to a channel */
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1062 else if(strlen(wassr_post) && strstr(*buffer, wassr_post)) {
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1063 twitter_debug("parrot clearing: buf = %s post = %s\n", *buffer, wassr_post);
82
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1064 g_free(*sender); *sender = NULL;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1065 g_free(*buffer); *buffer = NULL;
c9600d64781a work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 81
diff changeset
1066 }
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1067 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
1068
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
1069 if(!(conv && is_twitter_conv(conv))) {
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
1070 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
1071 }
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
1072
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1073 /* suppress notification of incoming messages. */
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
1074 if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1075 *flags |= PURPLE_MESSAGE_SYSTEM;
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1076 }
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1077
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1078 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
1079 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
1080
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
1081 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
1082 twitter_debug("clearing sender and buffer\n");
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1083 g_free(*sender); *sender = NULL;
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1084 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
1085 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
1086 }
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
1087 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
1088 }
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
1089
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
1090 static void
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1091 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
1092 {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1093 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
1094
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1095 gchar *user_name = gotdata->user_name;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1096 int service = gotdata->service;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1097
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
1098 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
1099 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
1100 GtkTextBuffer *target_buffer = 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
1101 GtkTextIter inserting_point;
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
1102 int icon_id;
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1103 icon_data *data = 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
1104
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1105 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
1106
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
1107 /* 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
1108 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
1109 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
1110 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
1111 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
1112
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
1113 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
1114 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
1115 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
1116 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
1117
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1118 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
1119
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1120 if(service != unknown_service) {
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1121 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
1122 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
1123 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
1124
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
1125 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
1126 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
1127 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
1128 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
1129 }
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
1130 }
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
1131 }
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
1132 }
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
1133 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
1134 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
1135 }
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
1136
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
1137 /* 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
1138
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
1139 gtk_text_buffer_get_iter_at_mark(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
1140 &inserting_point, 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
1141
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
1142 /* 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
1143 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1144 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1145 data = (icon_data *)g_hash_table_lookup(icon_data_by_user, 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
1146 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1147 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1148 data = (icon_data *)g_hash_table_lookup(icon_data_by_user2, 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
1149 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1150 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1151 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
1152 }
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1153
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1154 if(data)
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1155 icon_id = data->icon_id;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1156 else
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1157 icon_id = 0;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1158
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
1159 if(!icon_id) {
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
1160 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
1161 }
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
1162
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1163 /* insert icon actually */
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
1164 gtk_imhtml_insert_image_at_iter(target_imhtml, icon_id, &inserting_point);
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1165 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
1166 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
1167 }
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
1168
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1169 static void
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1170 insert_requested_icon(const gchar *user_name, int 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
1171 {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1172 icon_data *data = NULL;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1173 GList *mark_list = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
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:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1177 data = (icon_data *)g_hash_table_lookup(icon_data_by_user, 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
1178 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1179 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1180 data = (icon_data *)g_hash_table_lookup(icon_data_by_user2, 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
1181 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1182 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1183 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
1184 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1185 }
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1186
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1187 if(!data)
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1188 return;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1189
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1190 mark_list = data->request_list;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1191
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1192 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
1193 gotdata->user_name = g_strdup(user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1194 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
1195
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1196 if(mark_list) {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1197 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
1198 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
1199 g_list_free(mark_list);
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1200 data->request_list = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1201 }
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1202 g_free(gotdata->user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1203 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
1204 }
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
1205
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
1206 static void
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1207 got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1208 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
1209 {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1210 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
1211 gchar *user_name = gotdata->user_name;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1212 int service = gotdata->service;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1213
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
1214 int icon_id;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1215 icon_data *data = 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
1216
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1217 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
1218
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1219 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1220 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1221 data = (icon_data *)g_hash_table_lookup(icon_data_by_user, 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
1222 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1223 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1224 data = (icon_data *)g_hash_table_lookup(icon_data_by_user2, 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
1225 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1226 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1227 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
1228 }
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1229
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1230 if(data && data->fetch_data) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1231 data->fetch_data = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1232 }
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
1233
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
1234 /* Return if user's icon had already been downloaded or
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
1235 * the download is failure. */
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1236 if((data && data->icon_id) || !url_text) { //xxx
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
1237 if(!url_text) {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1238 twitter_debug("downloading %s's icon failed : %s\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
1239 user_name, error_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
1240 }
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
1241 else {
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
1242 twitter_debug("%s's icon has already been downloaded\n", user_name);
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
1243 }
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
1244
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1245 data->requested = FALSE;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1246
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
1247 g_free(user_name);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1248 g_free(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
1249 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
1250 }
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
1251
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
1252 icon_id = purple_imgstore_add_with_id(g_memdup(url_text, len), len,
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
1253 user_name);
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1254 if(!data) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1255 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
1256 }
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1257
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1258 data->icon_id = icon_id;
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1259
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1260 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1261 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1262 g_hash_table_insert(icon_data_by_user,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1263 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1264 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1265 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1266 g_hash_table_insert(icon_data_by_user2,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1267 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1268 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1269 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1270 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
1271 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1272 }
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
1273
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1274 const gchar *dirname = purple_prefs_get_string(OPT_ICON_DIR);
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1275
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1276 /* 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
1277 if(ensure_path_exists(dirname)) {
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1278 gchar *filename = NULL;
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1279 gchar *path = NULL;
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1280 FILE *fp = NULL;
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1281
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1282 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1283 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1284 filename = g_strdup_printf("%s.gif", 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
1285 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1286 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1287 filename = g_strdup_printf("%s_wassr.png", 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
1288 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1289 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1290 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
1291 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1292 }
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1293
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1294 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
1295 g_free(filename); filename = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1296
71
76fc004cd327 windows requires "wb" instead of "w".
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 70
diff changeset
1297 fp = fopen(path, "wb");
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1298 g_free(path); path = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1299
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1300 if(fp) {
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1301 int wrotelen;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1302 wrotelen = fwrite(url_text, 1, len, fp);
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1303 }
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1304
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1305 fclose(fp); fp = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1306 }
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1307
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
1308 twitter_debug("Downloading %s's icon has been complete.(icon_id = %d)\n",
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
1309 user_name, icon_id);
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
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 /* 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
1312 insert_requested_icon(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
1313 g_free(user_name);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1314 g_free(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
1315 }
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 static void
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1318 request_icon(const char *user_name, int service)
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
1319 {
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
1320 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
1321
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1322 /* 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
1323 gchar *filename = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1324 gchar *path = NULL;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1325 icon_data *data = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1326
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1327 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1328 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1329 data = (icon_data *)g_hash_table_lookup(icon_data_by_user, 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
1330 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1331 case wassr_service:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1332 data = (icon_data *)g_hash_table_lookup(icon_data_by_user2, user_name);
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1333 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1334 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1335 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
1336 return;
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 }
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1339
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1340 if(!data) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1341 data = g_new0(icon_data, 1);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1342 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1343 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1344 g_hash_table_insert(icon_data_by_user,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1345 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1346 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1347 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1348 g_hash_table_insert(icon_data_by_user2,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1349 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1350 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1351 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1352 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
1353 return;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1354 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1355 }
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1356 }
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1357
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1358 /* if img has been registerd, just return */
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1359 if(data->icon_id)
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1360 return;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1361
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1362 /* check if saved file exists */
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1363 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1364 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1365 filename = g_strdup_printf("%s.gif", user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1366 path = g_build_filename(
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1367 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1368
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1369 if(!g_file_test(path, G_FILE_TEST_EXISTS)) {
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1370 g_free(path);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1371 filename = g_strdup_printf("%s.png", user_name);
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1372 path = g_build_filename(
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1373 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1374 }
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1375 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1376 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1377 filename = g_strdup_printf("%s_wassr.gif", user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1378 path = g_build_filename(
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1379 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1380
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1381 if(!g_file_test(path, G_FILE_TEST_EXISTS)) {
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1382 g_free(path);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1383 filename = g_strdup_printf("%s_wassr.png", user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1384 path = g_build_filename(
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1385 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1386 }
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1387 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1388 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1389 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
1390 break;
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1391 }
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1392
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1393 /* build image from file, if file exists */
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1394 if(g_file_test(path, G_FILE_TEST_EXISTS)) {
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1395 gchar *imgdata = NULL;
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1396 size_t len;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1397 GError *err = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1398
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1399 if (!g_file_get_contents(path, &imgdata, &len, &err)) {
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1400 twitter_debug("Error reading %s: %s\n",
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1401 path, err->message);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1402 g_error_free(err);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1403 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1404
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1405 data->icon_id = purple_imgstore_add_with_id(imgdata, len, path);
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1406 g_free(filename);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1407 g_free(path);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1408
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1409 twitter_debug("icon data has been loaded from file\n");
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1410
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1411 insert_requested_icon(user_name, service);
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1412 return;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1413 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1414
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1415 /* 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
1416 if(data->requested)
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1417 return;
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1418 else
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1419 data->requested = TRUE;
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1420
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1421
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
1422 /* Create the URL of the user's icon.
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
1423 * See http://twitter.g.hatena.ne.jp/ikko615/20080107/1199703400
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
1424 */
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1425 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1426 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1427 url = g_strdup_printf("http://img.twitty.jp/twitter/user/%s/m.gif",
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1428 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
1429 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1430 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1431 url = g_strdup_printf("http://wassr.jp/user/%s/profile_img.png.64",
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1432 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
1433 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1434 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1435 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
1436 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1437 }
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
1438
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1439 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
1440 gotdata->user_name = g_strdup(user_name);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1441 gotdata->service = service;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1442
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1443 /* gotdata will be released in got_icon_cb */
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1444 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE,
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1445 got_icon_cb, gotdata);
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1446 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
1447
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
1448 twitter_debug("request %s's icon\n", user_name);
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
1449 }
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
1450
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
1451 static void
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1452 mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, int 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
1453 {
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1454 icon_data *data = NULL;
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1455
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1456 twitter_debug("called\n");
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1457
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1458 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1459 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1460 data = (icon_data *)g_hash_table_lookup(icon_data_by_user, 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
1461 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1462 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1463 data = (icon_data *)g_hash_table_lookup(icon_data_by_user2, 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
1464 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1465 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1466 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
1467 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1468 }
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1469
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1470 if(!data) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1471 data = g_new0(icon_data, 1);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1472 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1473 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1474 g_hash_table_insert(icon_data_by_user,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1475 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1476 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1477 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1478 g_hash_table_insert(icon_data_by_user2,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1479 g_strdup(user_name), data);
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1480 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1481 default:
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1482 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
1483 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1484 }
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1485 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1486
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1487 data->request_list = g_list_append(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
1488 }
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1489
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1490 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
1491 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
1492 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
1493 {
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
1494 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
1495 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
1496 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
1497 GtkTextBuffer *text_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
1498 GtkTextIter inserting_point;
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
1499 int icon_id;
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1500 int 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
1501 icon_data *data = 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
1502
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1503 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
1504
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1505 if(service == unknown_service) {
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1506 twitter_debug("neither twitter or wassr conv\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
1507 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
1508 }
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
1509
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
1510 /* get user's name */
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
1511 g_regex_match(regp[USER_FORMATTED], message, 0, &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
1512 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
1513 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
1514 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
1515 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
1516 }
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
1517
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
1518 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
1519 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
1520
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
1521 /* 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
1522 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
1523 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
1524
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
1525 /* get GtkTextIter of the last line */
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
1526 gtk_text_buffer_get_iter_at_line(text_buffer, &inserting_point,
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
1527 gtk_text_buffer_get_line_count(text_buffer) - 1);
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
1528
85
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1529 switch(service) {
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1530 case twitter_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1531 data = g_hash_table_lookup(icon_data_by_user, 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
1532 break;
fb9831fae969 - fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 84
diff changeset
1533 case wassr_service:
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1534 data = g_hash_table_lookup(icon_data_by_user2, 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
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 }
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1537
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1538 if(data)
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1539 icon_id = data->icon_id;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1540 else
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1541 icon_id = 0;
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
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1543 /* If the user's icon has not been downloaded,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1544 * mark the message and request the icon. */
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
1545 if(!icon_id) {
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1546 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
1547 mark_icon_for_user(gtk_text_buffer_create_mark(
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1548 text_buffer, NULL, &inserting_point, FALSE),
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1549 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
1550 /* request to attach icon to the buffer */
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1551 request_icon(user_name, 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
1552 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
1553 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
1554 }
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
1555
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
1556 gtk_imhtml_insert_image_at_iter(imhtml, icon_id, &inserting_point);
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
1557 g_free(user_name); user_name = NULL;
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1558
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1559 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
1560 }
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
1561
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
1562 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1563 load_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1564 {
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1565 /* connect to signal */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1566 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
1567 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
1568 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
1569 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
1570 purple_signal_connect(purple_conversations_get_handle(),
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1571 "conversation-created",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1572 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
1573 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
1574 plugin, PURPLE_CALLBACK(receiving_im_cb), 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
1575 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
1576 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
1577 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
1578 "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
1579 plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1580
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
1581 /* 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
1582 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
1583 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
1584 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
1585 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
1586 regp[USER] = g_regex_new(P_USER, 0, 0, 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
1587 regp[USER_FIRST_LINE] = g_regex_new(P_USER_FIRST_LINE, 0, 0, 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
1588 regp[USER_FORMATTED] = g_regex_new(P_USER_FORMATTED, G_REGEX_RAW, 0, 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
1589
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1590 icon_data_by_user = g_hash_table_new_full(g_str_hash, g_str_equal,
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1591 g_free, NULL);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1592 icon_data_by_user2 = g_hash_table_new_full(g_str_hash, g_str_equal,
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1593 g_free, 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
1594
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1595 /* 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
1596 if(purple_prefs_get_bool(OPT_COUNTER)) {
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1597 attach_to_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1598 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1599
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1600 /* allocate wassr_post */
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1601 wassr_post = g_new0(gchar, WASSR_POST_LEN + 1);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1602
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1603 return TRUE;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1604 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1605
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1606 static void
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1607 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
1608 {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1609 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
1610
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1611 if(!data)
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1612 return;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1613
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1614 if(data->fetch_data) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1615 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
1616 data->fetch_data = NULL;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1617 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1618
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1619 if(data->request_list) {
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1620 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
1621 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1622
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1623 return;
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1624 }
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1625
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1626 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1627 unload_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1628 {
39
2ac81c0afb53 - new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 38
diff changeset
1629 twitter_debug("called\n");
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1630
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1631 /* disconnect from signal */
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1632 purple_signal_disconnect(purple_conversations_get_handle(),
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1633 "writing-im-msg",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1634 plugin, PURPLE_CALLBACK(writing_im_cb));
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1635 purple_signal_disconnect(purple_conversations_get_handle(),
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1636 "sending-im-msg",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1637 plugin, PURPLE_CALLBACK(sending_im_cb));
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1638 purple_signal_disconnect(purple_conversations_get_handle(),
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1639 "conversation-created",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1640 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
1641 purple_signal_disconnect(pidgin_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
1642 "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
1643 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
1644 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
1645 "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
1646 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
1647 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
1648 "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
1649 plugin, PURPLE_CALLBACK(deleting_conv_cb));
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1650
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1651 /* unreference regp */
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1652 g_regex_unref(regp[RECIPIENT]);
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1653 g_regex_unref(regp[SENDER]);
21
38fe566b5ee1 unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 20
diff changeset
1654 g_regex_unref(regp[COMMAND]);
38fe566b5ee1 unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 20
diff changeset
1655 g_regex_unref(regp[PSEUDO]);
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
1656 g_regex_unref(regp[USER]);
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
1657 g_regex_unref(regp[USER_FIRST_LINE]);
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
1658 g_regex_unref(regp[USER_FORMATTED]);
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
1659
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1660 /* remove mark list in each hash entry */
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1661 g_hash_table_foreach(icon_data_by_user, (GHFunc)remove_marks_func, NULL);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1662 g_hash_table_foreach(icon_data_by_user2, (GHFunc)remove_marks_func, 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
1663
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
1664 /* cancel request that has not been finished yet */
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1665 g_hash_table_foreach(icon_data_by_user, (GHFunc)cancel_fetch_func, NULL);
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1666 g_hash_table_foreach(icon_data_by_user2, (GHFunc)cancel_fetch_func, 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
1667
80
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1668 /* destroy hash table for icon_data */
e0bf37c105eb work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 79
diff changeset
1669 g_hash_table_destroy(icon_data_by_user); //XXX all memory freed? --yaz
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1670 g_hash_table_destroy(icon_data_by_user2); //XXX all memory freed? --yaz
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1671
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1672 /* detach from twitter window */
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1673 detach_from_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1674
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1675 /* free wassr_post */
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1676 g_free(wassr_post);
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1677 wassr_post = NULL;
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1678
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1679 return TRUE;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1680 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1681
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1682 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1683 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
1684 gconstpointer val, gpointer data)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1685 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1686 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
1687
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1688 if(enabled) {
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
1689 attach_to_window();
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1690 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1691 else {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1692 detach_from_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1693 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1694 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1695
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1696 static PurplePluginPrefFrame *
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1697 get_plugin_pref_frame(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1698 {
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
1699 /* create gtk elements for the plugin preferences */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1700 PurplePluginPref *pref;
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1701 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new();
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1702
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
1703 /************************/
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
1704 /* translatione heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1705 /************************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1706 pref = purple_plugin_pref_new_with_label("Translation Configurations");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1707 purple_plugin_pref_frame_add(frame, pref);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1708
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
1709 /* translation settings */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1710 pref = purple_plugin_pref_new_with_name_and_label(OPT_TRANSLATE_RECIPIENT,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1711 "Translate @username to link");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1712 purple_plugin_pref_frame_add(frame, pref);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1713
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1714 pref = purple_plugin_pref_new_with_name_and_label(OPT_TRANSLATE_SENDER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1715 "Translate sender name to link");
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1716 purple_plugin_pref_frame_add(frame, pref);
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1717
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1718
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
1719 /*************************/
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
1720 /* miscellaneous heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1721 /*************************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1722 pref = purple_plugin_pref_new_with_label("Miscellaneous Configurations");
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1723 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1724
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1725 /* escape pseudo command setting */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1726 pref = purple_plugin_pref_new_with_name_and_label(OPT_ESCAPE_PSEUDO,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1727 "Escape pseudo command string");
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1728 purple_plugin_pref_frame_add(frame, pref);
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1729
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1730 /* show text counter */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1731 pref = purple_plugin_pref_new_with_name_and_label(OPT_COUNTER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1732 "Show text counter");
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1733 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1734
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1735 purple_prefs_connect_callback(plugin, OPT_COUNTER, counter_prefs_cb, NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1736
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1737 /* suppress oops message */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1738 pref = purple_plugin_pref_new_with_name_and_label(OPT_SUPPRESS_OOPS,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1739 "Suppress oops message");
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1740 purple_plugin_pref_frame_add(frame, pref);
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1741
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1742
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
1743 /*****************/
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
1744 /* sound heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1745 /*****************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1746 pref = purple_plugin_pref_new_with_label("Sound Configurations");
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1747 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1748
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
1749 /* sound settings for recipient */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1750 pref = purple_plugin_pref_new_with_name_and_label(OPT_PLAYSOUND_RECIPIENT,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1751 "Play sound on a reply to the user in the recipient list");
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1752 purple_plugin_pref_frame_add(frame, pref);
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1753
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
1754 /* recipient list */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1755 pref = purple_plugin_pref_new_with_name_and_label(OPT_USERLIST_RECIPIENT,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1756 "Recipient List");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1757 purple_plugin_pref_frame_add(frame, pref);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
1758
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1759 /* sound id selector */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1760 pref =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1761 purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_RECIPIENT,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1762 "Recipient Sound");
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1763
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1764 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1765 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1766 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1767 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1768 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1769 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1770 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1771 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1772 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1773 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1774 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1775 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10));
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1776
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1777 purple_plugin_pref_frame_add(frame, pref);
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1778
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1779 /* sound setting for sender */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1780 pref = purple_plugin_pref_new_with_name_and_label(OPT_PLAYSOUND_SENDER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1781 "Play sound if sender of a message is in the sender list");
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1782 purple_plugin_pref_frame_add(frame, pref);
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1783
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
1784 /* sender list */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1785 pref = purple_plugin_pref_new_with_name_and_label(OPT_USERLIST_SENDER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1786 "Sender List");
7
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
1787 purple_plugin_pref_frame_add(frame, pref);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
1788
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
1789 /* sound id selector */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1790 pref =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1791 purple_plugin_pref_new_with_name_and_label(OPT_SOUNDID_SENDER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1792 "Sender Sound");
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1793
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1794 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1795 purple_plugin_pref_add_choice(pref, "Arrive", GINT_TO_POINTER(0));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1796 purple_plugin_pref_add_choice(pref, "Leave", GINT_TO_POINTER(1));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1797 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1798 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1799 purple_plugin_pref_add_choice(pref, "Send", GINT_TO_POINTER(4));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1800 purple_plugin_pref_add_choice(pref, "Chat Join", GINT_TO_POINTER(5));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1801 purple_plugin_pref_add_choice(pref, "Chat Leave", GINT_TO_POINTER(6));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1802 purple_plugin_pref_add_choice(pref, "Chat You Say", GINT_TO_POINTER(7));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1803 purple_plugin_pref_add_choice(pref, "Chat Someone Say", GINT_TO_POINTER(8));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1804 purple_plugin_pref_add_choice(pref, "Pounce Default", GINT_TO_POINTER(9));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1805 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10));
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1806
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1807 purple_plugin_pref_frame_add(frame, pref);
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1808
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1809 /************************/
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1810 /* notification heading */
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1811 /************************/
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1812 pref = purple_plugin_pref_new_with_label("Notification Configuration");
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1813 purple_plugin_pref_frame_add(frame, pref);
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1814
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1815 /* notification setting */
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1816 pref = purple_plugin_pref_new_with_name_and_label(OPT_PREVENT_NOTIFICATION,
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1817 "Prevent notifications of incoming messages");
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1818 purple_plugin_pref_frame_add(frame, pref);
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1819
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1820
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1821 /* API based post */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1822
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1823 pref = purple_plugin_pref_new_with_label("API Based Post");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1824 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1825
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1826 pref = purple_plugin_pref_new_with_name_and_label(OPT_API_BASE_POST,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1827 "Post Status with API");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1828 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1829
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1830 pref = purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1831 "Screen Name");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1832 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1833
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1834 pref = purple_plugin_pref_new_with_name_and_label(OPT_PASSWORD,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1835 "Password");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1836 purple_plugin_pref_set_masked(pref, TRUE);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1837
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1838 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1839
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1840 return frame;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1841 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1842
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1843 static PurplePluginUiInfo pref_info = {
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1844 get_plugin_pref_frame
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1845 };
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1846
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1847 static PurplePluginInfo info = {
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1848 PURPLE_PLUGIN_MAGIC,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1849 PURPLE_MAJOR_VERSION,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1850 PURPLE_MINOR_VERSION,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1851 PURPLE_PLUGIN_STANDARD, /**< type */
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1852 NULL, /**< ui_req */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1853 0, /**< flags */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1854 NULL, /**< deps */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1855 PURPLE_PRIORITY_DEFAULT, /**< priority */
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1856 PLUGIN_ID, /**< id */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1857 "Pidgin-Twitter", /**< name */
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1858 "0.7.0 alpha2d1", /**< version */
76
63bd9ca28be0 - added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 74
diff changeset
1859 "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
1860 "provides useful features for twitter", /** desc */
84
0c1f63882b8a preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents: 83
diff changeset
1861 "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, mojin, \nthe pidging-twitter team", /**< author */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1862 "http://www.honeyplanet.jp/", /**< homepage */
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1863 load_plugin, /**< load */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1864 unload_plugin, /**< unload */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1865 NULL, /**< destroy */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1866 NULL, /**< ui_info */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1867 NULL, /**< extra_info */
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1868 &pref_info, /**< pref info */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1869 NULL
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1870 };
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1871
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1872 static void
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1873 init_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1874 {
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1875 char *dirname = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1876
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1877 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
1878 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
1879 if(dirname)
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1880 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
1881 g_free(dirname);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1882
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1883 /* add plugin preferences */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1884 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
1885 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
1886 purple_prefs_add_bool(OPT_TRANSLATE_SENDER, TRUE);
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1887 purple_prefs_add_bool(OPT_ESCAPE_PSEUDO, TRUE);
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1888
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
1889 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
1890 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
1891 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
1892 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
1893 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
1894 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1895
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1896 purple_prefs_add_bool(OPT_COUNTER, TRUE);
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1897 purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE);
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1898
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1899 purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE);
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1900
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1901 purple_prefs_add_bool(OPT_API_BASE_POST, FALSE);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1902 purple_prefs_add_string(OPT_SCREEN_NAME, EMPTY);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1903 purple_prefs_add_string(OPT_PASSWORD, EMPTY);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1904 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1905
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1906 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)