Mercurial > pidgin-twitter
annotate pidgin-twitter.c @ 128:249174fdd63d
minor fixes.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 21 Jul 2008 11:42:06 +0900 |
parents | bac987852e66 |
children | 686498cc1e7a |
rev | line source |
---|---|
0 | 1 /* |
2 * Pidgin-Twitter plugin. | |
3 * | |
4 * This program is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU General Public License as | |
6 * published by the Free Software Foundation; either version 2 of the | |
7 * License, or (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, but | |
10 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
17 * 02111-1307, USA. | |
18 */ | |
19 #define PURPLE_PLUGINS 1 | |
20 | |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
21 #include "pidgin-twitter.h" |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
22 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
23 /***********/ |
0 | 24 /* globals */ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
25 /***********/ |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
26 #define NUM_REGP 9 |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
27 static GRegex *regp[NUM_REGP]; |
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
|
28 static gboolean suppress_oops = FALSE; |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
29 static GHashTable *icon_data_by_user = NULL; // twitter |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
30 static GHashTable *icon_data_by_user2 = NULL; // wassr |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
31 static GHashTable *icon_data_by_user3 = NULL; // identi.ca |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
32 static GHashTable *conv_hash = NULL; |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
33 static GList *statuseslist = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
34 static GList *postedlist = NULL; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
35 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
|
36 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
37 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
38 /*************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
39 /* functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
40 /*************/ |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
41 |
49
82b2b3767311
fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
48
diff
changeset
|
42 /* 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
|
43 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
|
44 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
|
45 { |
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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |
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
|
54 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
|
55 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
|
56 |
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 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
|
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 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
|
60 { |
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 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
|
62 { |
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 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
|
64 { |
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 /* 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
|
66 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
|
67 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
|
68 { |
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 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
|
70 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
|
71 } |
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 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
|
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 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
|
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 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
|
77 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
|
78 } |
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 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
|
80 { |
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 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
|
82 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
|
83 } |
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 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
|
85 { |
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 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
|
87 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
|
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 |
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 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
|
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 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
|
93 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
|
94 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
|
95 { |
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 /* 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
|
97 * 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
|
98 * 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
|
99 */ |
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 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
|
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 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
|
103 } |
42
68db38b5b401
fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents:
41
diff
changeset
|
104 |
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
|
105 /* 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
|
106 * 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
|
107 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
|
108 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
|
109 { |
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 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
|
111 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
|
112 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
|
113 /* 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
|
114 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
|
115 { |
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 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
|
117 { |
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 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
|
119 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
|
120 { |
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 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
|
122 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
|
123 } |
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 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
|
125 } |
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 } |
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 /* 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
|
128 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
|
129 { |
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 /* 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
|
131 } |
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 |
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 /* 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
|
134 * 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
|
135 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
|
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 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 } |
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 } |
42
68db38b5b401
fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents:
41
diff
changeset
|
145 |
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
|
146 /* 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
|
147 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
|
148 || 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
|
149 || 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
|
150 || 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
|
151 || 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
|
152 || 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
|
153 || 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
|
154 { |
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 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
|
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 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
|
158 { |
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 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
|
160 } |
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
|
161 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
|
162 { |
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
|
163 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
|
164 } |
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
|
165 /* 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
|
166 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
|
167 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
|
168 } |
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 (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
|
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 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
|
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_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
|
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 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
|
177 } |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
178 |
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
|
179 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
|
180 (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
|
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 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
|
183 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
|
184 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
|
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 } |
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
|
187 |
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
|
188 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
|
189 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
|
190 } |
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
|
191 |
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 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
|
193 |
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 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
|
195 |
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 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
|
197 } |
0 | 198 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
199 /* 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
|
200 static gboolean |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
201 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
|
202 { |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
203 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
|
204 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
|
205 return FALSE; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
206 } |
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
|
207 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
208 return TRUE; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
209 } |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
210 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
211 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
212 /**********************/ |
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
|
213 /* our implementation */ |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
214 /**********************/ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
215 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
216 /* string utilities */ |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
217 static void |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
218 escape(gchar **str) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
219 { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
220 GMatchInfo *match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
221 gchar *newstr = NULL, *match = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
222 gboolean flag = FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
223 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
224 /* search genuine command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
225 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
|
226 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
227 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
228 twitter_debug("command = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
229 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
230 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
231 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
232 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
233 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
234 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
235 |
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
|
236 if(flag) |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
237 return; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
238 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
239 /* if not found, check pseudo command */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
240 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
|
241 while(g_match_info_matches(match_info)) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
242 match = g_match_info_fetch(match_info, 1); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
243 twitter_debug("pseudo = %s\n", match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
244 g_free(match); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
245 g_match_info_next(match_info, NULL); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
246 flag = TRUE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
247 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
248 g_match_info_free(match_info); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
249 match_info = NULL; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
250 |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
251 /* if there is pseudo one, escape it */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
252 if(flag) { |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
253 /* put ". " to the beginning of buffer */ |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
254 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
|
255 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
|
256 g_free(*str); |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
257 *str = newstr; |
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 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
260 |
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
|
261 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
|
262 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
|
263 { |
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
|
264 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
|
265 |
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
|
266 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
|
267 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
|
268 *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
|
269 } |
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
|
270 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
271 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
272 /**************************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
273 /* API base get functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
274 /**************************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
275 /* xml parser */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
276 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
277 parse_user(xmlNode *user, status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
278 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
279 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
280 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
281 for(nptr = user->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
282 if(nptr->type == XML_ELEMENT_NODE) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
283 if(!xmlStrcmp(nptr->name, (xmlChar *)"screen_name")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
284 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
285 st->screen_name = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
286 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
287 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
288 else if(!xmlStrcmp(nptr->name, (xmlChar *)"profile_image_url")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
289 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
290 st->profile_image_url = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
291 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
292 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
293 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
294 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
295 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
296 |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
297 static char *day_of_week_name[] = { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
298 "Sun", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
299 "Mon", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
300 "Tue", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
301 "Wed", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
302 "Thu", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
303 "Fri", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
304 "Sat", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
305 "Sun", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
306 NULL |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
307 }; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
308 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
309 static char *month_name[] = { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
310 "Jan", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
311 "Feb", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
312 "Mar", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
313 "Apr", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
314 "May", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
315 "Jun", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
316 "Jul", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
317 "Aug", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
318 "Sep", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
319 "Oct", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
320 "Nov", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
321 "Dec", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
322 NULL |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
323 }; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
324 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
325 static void |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
326 read_timestamp(const char *str, struct tm *res) |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
327 { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
328 char day_of_week[4]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
329 char month[4]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
330 char time_offset[6]; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
331 int day, hour, minute, second, year; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
332 int i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
333 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
334 if(str == NULL || res == NULL) |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
335 return; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
336 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
337 sscanf(str, "%s %s %d %d:%d:%d %s %d", |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
338 day_of_week, month, &day, |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
339 &hour, &minute, &second, |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
340 time_offset, &year); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
341 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
342 for(i=0; i<7; i++) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
343 if(!strcmp(day_of_week_name[i], day_of_week)) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
344 res->tm_wday = i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
345 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
346 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
347 for(i=0; i<12; i++) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
348 if(!strcmp(month_name[i], month)) { |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
349 res->tm_mon = i; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
350 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
351 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
352 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
353 res->tm_mday = day; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
354 res->tm_hour = hour; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
355 res->tm_min = minute; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
356 res->tm_sec = second; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
357 res->tm_year = year - 1900; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
358 #ifndef _WIN32 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
359 int offset = atoi(time_offset); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
360 res->tm_gmtoff = -1 * (60 * 60 * offset / 100); |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
361 #endif |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
362 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
363 } |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
364 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
365 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
366 parse_status(xmlNode *status, status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
367 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
368 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
369 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
370 for(nptr = status->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
371 if(nptr->type == XML_ELEMENT_NODE) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
372 if(!xmlStrcmp(nptr->name, (xmlChar *)"created_at")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
373 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
374 st->created_at = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
375 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
376 /* read time stamp */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
377 struct tm res; |
121
8b58990f5ee9
ensure struct tm cleared before use.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
120
diff
changeset
|
378 memset(&res, 0x00, sizeof(struct tm)); |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
379 read_timestamp(str, &res); |
120
b47bc7b89de6
a better way to keep time sane.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
119
diff
changeset
|
380 tzset(); |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
381 #ifdef _WIN32 |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
382 st->time = mktime(&res) - timezone; |
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
383 #else |
123
76012df4e194
time offset in BSD extension has opposite sign
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
384 st->time = mktime(&res) + res.tm_gmtoff; |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
385 #endif |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
386 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
387 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
388 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
389 else if(!xmlStrcmp(nptr->name, (xmlChar *)"id")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
390 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
391 st->id = atoi(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
392 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
393 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
394 else if(!xmlStrcmp(nptr->name, (xmlChar *)"text")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
395 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
396 st->text = g_strdup(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
397 xmlFree(str); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
398 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
399 else if(!xmlStrcmp(nptr->name, (xmlChar *)"user")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
400 parse_user(nptr, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
401 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
402 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
403 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
404 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
405 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
406 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
407 free_status(status_t *st) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
408 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
409 g_free(st->created_at); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
410 g_free(st->text); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
411 g_free(st->screen_name); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
412 g_free(st->profile_image_url); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
413 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
414 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
415 static gboolean |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
416 is_posted_message(status_t *status) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
417 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
418 GList *pp; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
419 gboolean rv = FALSE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
420 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
421 for(pp = postedlist; pp; pp=pp->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
422 status_t *posted = (status_t *)pp->data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
423 if(posted->id == status->id) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
424 rv = TRUE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
425 free_status(posted); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
426 g_free(pp->data); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
427 pp->data = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
428 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
429 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
430 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
431 postedlist = g_list_remove_all(postedlist, NULL); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
432 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
433 return rv; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
434 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
435 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
436 static void |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
437 get_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
438 const gchar *url_text, size_t len, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
439 const gchar *error_message) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
440 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
441 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
442 xmlDocPtr doc; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
443 xmlNode *nptr, *nptr2; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
444 static guint lastid = 0; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
445 PurpleConversation *conv; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
446 GList *stp; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
447 const gchar *start; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
448 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
449 g_return_if_fail(url_text != NULL); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
450 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
451 conv = (PurpleConversation *)user_data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
452 if(!conv) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
453 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
454 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
455 /* skip to the beginning of xml */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
456 start = strstr(url_text, "<?xml"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
457 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
458 doc = xmlRecoverMemory(start, len - (start - url_text)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
459 if(doc == NULL) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
460 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
461 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
462 for(nptr = doc->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
463 if(nptr->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
464 !xmlStrcmp(nptr->name, (xmlChar *)"statuses")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
465 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
466 for(nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
467 if(nptr2->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
468 !xmlStrcmp(nptr2->name, (xmlChar *)"status")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
469 status_t *st = g_new0(status_t, 1); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
470 statuseslist = g_list_prepend(statuseslist, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
471 parse_status(nptr2, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
472 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
473 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
474 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
475 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
476 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
477 /* process statuseslist */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
478 for(stp = statuseslist; stp; stp=stp->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
479 status_t *st = (status_t *)stp->data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
480 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
481 if(st->id > lastid && !is_posted_message(st)) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
482 gchar *msg = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
483 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
484 msg = g_strdup_printf("%s: %s\n", st->screen_name, st->text); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
485 purple_conv_im_write(conv->u.im, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
486 "twitter@twitter.com", |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
487 msg, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
488 PURPLE_MESSAGE_RECV, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
489 st->time); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
490 lastid = st->id; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
491 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
492 g_free(msg); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
493 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
494 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
495 free_status(st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
496 g_free(stp->data); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
497 stp->data = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
498 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
499 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
500 statuseslist = g_list_remove_all(statuseslist, NULL); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
501 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
502 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
503 /* status fetching function. it will be called periodically. */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
504 static gboolean |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
505 get_status_with_api(gpointer data) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
506 { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
507 /* fetch friends time line */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
508 char *request, *header; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
509 char *basic_auth, *basic_auth_encoded; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
510 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
511 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
512 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
513 PurpleConversation *conv = (PurpleConversation *)data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
514 if(!conv) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
515 return FALSE; //cease fetch |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
516 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
517 const char *screen_name = |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
518 purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
519 const char *password = |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
520 purple_prefs_get_string(OPT_PASSWORD_TWITTER); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
521 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
522 if (!screen_name || !password || !screen_name[0] || !password[0]) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
523 twitter_debug("screen_name or password is empty\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
524 return TRUE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
525 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
526 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
527 /* auth */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
528 basic_auth = g_strdup_printf("%s:%s", screen_name, password); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
529 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
530 strlen(basic_auth)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
531 g_free(basic_auth); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
532 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
533 /* header */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
534 header = g_strdup_printf(TWITTER_STATUS_GET, basic_auth_encoded); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
535 request = g_strconcat(header, TWITTER_STATUS_TERMINATOR, NULL); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
536 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
537 /* invoke fetch */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
538 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
539 NULL, TRUE, request, TRUE, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
540 get_status_with_api_cb, data); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
541 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
542 g_free(header); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
543 g_free(basic_auth_encoded); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
544 g_free(request); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
545 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
546 return TRUE; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
547 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
548 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
549 /***************************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
550 /* API base post functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
551 /***************************/ |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
552 static void |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
553 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
|
554 const gchar *url_text, size_t len, |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
555 const gchar *error_message) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
556 { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
557 twitter_message_t *tm = (twitter_message_t *)user_data; |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
558 gchar *msg = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
559 char *p1 = NULL, *p2 = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
560 int error = 1; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
561 PurpleConversation *conv; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
562 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
563 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
|
564 "twitter@twitter.com", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
565 tm->account); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
566 if (!conv) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
567 twitter_debug("failed to get conversation\n"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
568 goto fin; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
569 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
570 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
571 if (error_message) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
572 /* connection failed or something */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
573 msg = g_strdup_printf("Local error: %s", error_message); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
574 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
575 int code = -1; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
576 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
577 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
|
578 || 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
|
579 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
580 p1 = strchr(url_text, ' '); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
581 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
582 if (p1) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
583 p1++; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
584 p2 = strchr(p1, ' '); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
585 if (p2) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
586 p2++; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
587 else |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
588 p2 = NULL; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
589 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
590 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
591 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
592 code = atoi(p1); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
593 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
594 if (code == 200) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
595 error = 0; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
596 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
597 switch (code) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
598 case 400: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
599 msg = g_strdup("Invalid request. Too many updates?"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
600 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
601 case 401: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
602 msg = g_strdup("Authorization failed."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
603 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
604 case 403: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
605 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
|
606 "for some reason."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
607 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
608 case 404: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
609 msg = g_strdup("Requested URI is not found."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
610 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
611 case 500: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
612 msg = g_strdup("Server error."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
613 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
614 case 502: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
615 msg = g_strdup("Twitter is down or under maintenance."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
616 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
617 case 503: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
618 msg = g_strdup("Twitter is extremely crowded. " |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
619 "Try again later."); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
620 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
621 default: |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
622 msg = g_strdup_printf("Unknown error. (%d %s)", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
623 code, p2 ? p2 : ""); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
624 break; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
625 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
626 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
627 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
628 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
629 if (!error) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
630 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
|
631 purple_account_get_username(tm->account), |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
632 tm->status, PURPLE_MESSAGE_SEND, tm->time); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
633 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
634 /* cache message ID that posted via API */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
635 gchar *start = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
636 xmlDocPtr doc; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
637 xmlNode *nptr; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
638 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
639 start = strstr(url_text, "<?xml"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
640 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
641 if(!start) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
642 goto fin; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
643 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
644 doc = xmlRecoverMemory(start, len - (start - url_text)); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
645 if(doc == NULL) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
646 return; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
647 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
648 /* enqueue posted message to postedlist */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
649 for(nptr = doc->children; nptr != NULL; nptr = nptr->next) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
650 if(nptr->type == XML_ELEMENT_NODE && |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
651 !xmlStrcmp(nptr->name, (xmlChar *)"status")) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
652 status_t *st = g_new0(status_t, 1); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
653 postedlist = g_list_prepend(postedlist, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
654 parse_status(nptr, st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
655 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
656 } |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
657 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
658 } else { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
659 gchar *m; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
660 m = g_strdup_printf("%s<BR>%s", |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
661 msg, tm->status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
662 /* FIXME: too strong. it should be more smart */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
663 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
|
664 purple_account_get_username(tm->account), |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
665 m, PURPLE_MESSAGE_ERROR, time(NULL)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
666 g_free(m); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
667 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
668 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
669 fin: |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
670 if (msg) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
671 g_free(msg); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
672 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
673 if (tm) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
674 if (tm->status) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
675 g_free(tm->status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
676 g_free(tm); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
677 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
678 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
679 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
680 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
681 static void |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
682 post_status_with_api(PurpleAccount *account, char **buffer) |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
683 { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
684 char *request, *status, *header; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
685 const char *url_encoded = purple_url_encode(*buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
686 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
|
687 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
688 twitter_message_t *tm; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
689 |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
690 const char *screen_name = |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
691 purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
692 const char *password = purple_prefs_get_string(OPT_PASSWORD_TWITTER); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
693 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
694 twitter_debug("tm.account: %s\n", |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
695 purple_account_get_username(account)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
696 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
697 if (!screen_name || !password || !screen_name[0] || !password[0]) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
698 twitter_debug("screen_name or password is empty\n"); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
699 return; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
700 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
701 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
702 tm = g_new(twitter_message_t, 1); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
703 tm->account = account; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
704 tm->status = g_strdup(*buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
705 tm->time = time(NULL); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
706 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
707 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
|
708 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
|
709 strlen(basic_auth)); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
710 g_free(basic_auth); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
711 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
712 status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
713 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
714 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
|
715 (int)strlen(status)); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
716 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
717 request = g_strconcat(header, status, TWITTER_STATUS_TERMINATOR, NULL); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
718 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
719 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE, |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
720 NULL, TRUE, request, TRUE, |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
721 post_status_with_api_cb, tm); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
722 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
723 g_free(header); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
724 g_free(basic_auth_encoded); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
725 g_free(status); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
726 g_free(request); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
727 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
728 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
729 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
730 /***********************/ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
731 /* intrinsic functions */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
732 /***********************/ |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
733 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
734 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
|
735 void *data) |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
736 { |
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
|
737 int utflen, bytes; |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
738 gboolean twitter_ac = FALSE, wassr_ac = FALSE; |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
739 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
|
740 |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
741 twitter_ac = is_twitter_account(account, recipient); |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
742 wassr_ac = is_wassr_account(account, recipient); |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
743 |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
744 if(wassr_ac) { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
745 /* 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
|
746 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
|
747 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
|
748 } |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
749 |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
750 /* strip all markups */ |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
751 if(twitter_ac || wassr_ac) |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
752 strip_markup(buffer); |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
753 |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
754 /* return here if the message is not to twitter */ |
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
755 if(!twitter_ac) |
44 | 756 return FALSE; |
757 | |
758 /* escape pseudo command */ | |
88
090e28908f09
apply strip_markup() to wassr too.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
87
diff
changeset
|
759 if(twitter_ac && |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
760 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
44 | 761 escape(buffer); |
762 } | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
763 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
764 /* update status with Twitter API instead of IM protocol */ |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
765 if (purple_prefs_get_bool(OPT_API_BASE_POST)) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
766 if (buffer && *buffer) { |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
767 post_status_with_api(account, buffer); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
768 (*buffer)[0] = '\0'; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
769 } |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
770 return FALSE; |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
771 } |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
772 |
44 | 773 /* 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
|
774 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
|
775 bytes = strlen(*buffer); |
44 | 776 twitter_debug("utflen = %d bytes = %d\n", utflen, bytes); |
777 if(bytes > 140 && utflen <= 140) | |
778 suppress_oops = TRUE; | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
779 |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
780 return FALSE; |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
781 } |
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
782 |
1 | 783 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
784 eval(const GMatchInfo *match_info, GString *result, gpointer user_data) |
1 | 785 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
786 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
|
787 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
|
788 gint service = data->service; |
1 | 789 gchar sub[128]; |
790 | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
791 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
|
792 |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
793 if(which == RECIPIENT) { |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
794 gchar *match = g_match_info_fetch(match_info, 1); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
795 const gchar *format = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
796 switch(service) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
797 case twitter_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
798 format = RECIPIENT_FORMAT_TWITTER; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
799 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
800 case wassr_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
801 format = RECIPIENT_FORMAT_WASSR; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
802 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
803 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
804 format = RECIPIENT_FORMAT_IDENTICA; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
805 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
806 default: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
807 twitter_debug("unknown service\n"); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
808 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
809 } |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
810 g_snprintf(sub, 128, format, match, match); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
811 g_free(match); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
812 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
813 else if(which == SENDER) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
814 gchar *match1 = g_match_info_fetch(match_info, 1); //preceding CR|LF |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
815 gchar *match2 = g_match_info_fetch(match_info, 2); //sender |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
816 const gchar *format = NULL; |
10
4bd8c89b4749
now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
9
diff
changeset
|
817 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
818 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
819 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
820 format = SENDER_FORMAT_TWITTER; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
821 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
822 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
823 format = SENDER_FORMAT_WASSR; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
824 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
825 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
826 format = SENDER_FORMAT_IDENTICA; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
827 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
828 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
829 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
|
830 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
831 } |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
832 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
833 g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
834 |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
835 g_free(match1); |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
836 g_free(match2); |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
837 } |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
838 else if(service == wassr_service && which == CHANNEL) { |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
839 gchar *match1 = g_match_info_fetch(match_info, 1); //before channel |
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
840 gchar *match2 = g_match_info_fetch(match_info, 2); //channel |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
841 const gchar *format = CHANNEL_FORMAT_WASSR; |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
842 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
843 g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
844 |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
845 g_free(match1); |
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
846 g_free(match2); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
847 } |
48
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
848 |
42869098eda3
adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
46
diff
changeset
|
849 g_string_append(result, sub); |
6 | 850 twitter_debug("sub = %s\n", sub); |
1 | 851 |
852 return FALSE; | |
853 } | |
0 | 854 |
8 | 855 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
|
856 translate(gchar **str, gint which, gint service) |
0 | 857 { |
1 | 858 gchar *newstr; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
859 eval_data *data = g_new0(eval_data, 1); |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
860 gint regp_id; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
861 |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
862 data->which = which; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
863 data->service = service; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
864 |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
865 regp_id = which; /* for future use --yaz */ |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
866 newstr = g_regex_replace_eval(regp[regp_id], // compiled regex |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
867 *str, // subject string |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
868 -1, // length of the subject string |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
869 0, // start position |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
870 0, // match options |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
871 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
|
872 data, // user data |
6 | 873 NULL); // error handler |
1 | 874 |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
875 g_free(data); data = NULL; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
876 |
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
|
877 twitter_debug("which = %d *str = %s newstr = %s\n", which, *str, newstr); |
1 | 878 |
879 g_free(*str); | |
880 *str = newstr; | |
881 } | |
0 | 882 |
8 | 883 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
|
884 playsound(gchar **str, gint which) |
1 | 885 { |
886 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
|
887 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
|
888 gchar **candidates = NULL, **candidate = NULL; |
0 | 889 |
31 | 890 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : |
891 OPT_USERLIST_RECIPIENT); | |
5
6ac1867d7e8e
string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2
diff
changeset
|
892 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
|
893 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
|
894 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
|
895 |
44a66c52b190
- userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
6
diff
changeset
|
896 candidates = g_strsplit_set(list, " ,:;", 0); |
20
4c236a7a128f
- now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
19
diff
changeset
|
897 g_return_if_fail(candidates != NULL); |
1 | 898 |
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
|
899 g_regex_match(regp[which], *str, 0, &match_info); |
6 | 900 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
|
901 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
|
902 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
|
903 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
|
904 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
|
905 user = g_match_info_fetch(match_info, 2); |
1 | 906 twitter_debug("user = %s\n", user); |
0 | 907 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
908 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
|
909 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
|
910 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
|
911 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
|
912 if(!strcmp(user, *candidate)) { |
1 | 913 twitter_debug("match. play sound\n"); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
914 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
|
915 (which ? OPT_SOUNDID_SENDER : |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
916 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
|
917 break; |
1 | 918 } |
919 } | |
6 | 920 g_free(user); |
921 g_match_info_next(match_info, NULL); | |
1 | 922 } |
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
|
923 g_strfreev(candidates); |
6 | 924 g_match_info_free(match_info); |
0 | 925 } |
926 | |
1 | 927 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
928 writing_im_cb(PurpleAccount *account, char *sender, char **buffer, |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
929 PurpleConversation *conv, int flags, void *data) |
0 | 930 { |
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
|
931 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
|
932 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
933 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
|
934 |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
935 /* 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
|
936 if(service == unknown_service) |
44 | 937 return FALSE; |
938 | |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
939 /* Add screen_name if the current message is posted by owner */ |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
940 if (flags & PURPLE_MESSAGE_SEND) { |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
941 gchar *m = NULL; |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
942 const char *screen_name; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
943 |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
944 switch(service) { |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
945 case twitter_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
946 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
947 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
948 case wassr_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
949 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
950 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
951 case identica_service: |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
952 screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
953 break; |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
954 } |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
955 |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
956 if (screen_name) { |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
957 m = g_strdup_printf("%s: %s", screen_name, *buffer); |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
958 g_free(*buffer); |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
959 *buffer = m; |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
960 } |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
961 } |
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
962 |
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
|
963 /* strip all markups */ |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
964 strip_markup(buffer); //it causes missing of strings surrounded by <> |
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
|
965 |
44 | 966 /* playsound */ |
967 if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) { | |
968 playsound(buffer, SENDER); | |
969 } | |
970 if(purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)) { | |
971 playsound(buffer, RECIPIENT); | |
972 } | |
41
0a81ccfa1941
strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
40
diff
changeset
|
973 |
44 | 974 /* translate */ |
975 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
|
976 translate(buffer, SENDER, service); |
44 | 977 } |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
978 if(service == wassr_service && |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
979 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) { |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
980 translate(buffer, CHANNEL, service); |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
981 } |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
982 if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) { |
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
983 translate(buffer, RECIPIENT, service); |
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
984 } |
44 | 985 |
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
|
986 /* 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
|
987 if(is_twitter_conv(conv) && purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
44 | 988 escape(buffer); |
989 } | |
990 | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
991 return FALSE; |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
992 } |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
993 |
31 | 994 static void |
995 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
996 gchar *new_text, gint new_text_length, gpointer user_data) | |
997 { | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
998 PurpleConversation *conv = (PurpleConversation *)user_data; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
999 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1000 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1001 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1002 gchar *markup = NULL; |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1003 gint service = get_service_type(conv); |
45
746ff3b54c10
trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
44
diff
changeset
|
1004 guint count; |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1005 gchar *text = NULL; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1006 GtkTextIter head, tail; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1007 guint bytes = 0; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1008 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1009 g_return_if_fail(gtkconv != NULL); |
31 | 1010 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1011 switch(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 twitter_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1013 count = gtk_text_buffer_get_char_count(textbuffer) + |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1014 (unsigned int)g_utf8_strlen(new_text, -1); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1015 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
|
1016 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
|
1017 break; |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1018 case identica_service: |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1019 gtk_text_buffer_get_start_iter(textbuffer, &head); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1020 gtk_text_buffer_get_end_iter(textbuffer, &tail); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1021 |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1022 text = gtk_text_buffer_get_text(textbuffer, &head, &tail, TRUE); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1023 if(text) |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1024 bytes = strlen(text) + new_text_length; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1025 g_free(text); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1026 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1027 bytes <= 140 ? "black" : "red", bytes); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1028 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1029 case wassr_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1030 count = gtk_text_buffer_get_char_count(textbuffer) + |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1031 (unsigned int)g_utf8_strlen(new_text, -1); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1032 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
|
1033 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
|
1034 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1035 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1036 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
|
1037 break; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1038 } |
31 | 1039 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1040 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1041 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
|
1042 if(counter) |
31 | 1043 gtk_label_set_markup(GTK_LABEL(counter), markup); |
1044 | |
1045 g_free(markup); | |
1046 } | |
1047 | |
1048 static void | |
1049 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1050 GtkTextIter *end_pos, gpointer user_data) | |
1051 { | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1052 PurpleConversation *conv = (PurpleConversation *)user_data; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1053 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1054 GtkWidget *box, *counter = NULL; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1055 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
|
1056 gint service = get_service_type(conv); |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1057 guint count = 0; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1058 gchar *text = NULL; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1059 GtkTextIter head, tail; |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1060 guint bytes = 0; |
31 | 1061 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1062 g_return_if_fail(gtkconv != NULL); |
31 | 1063 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1064 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1065 case twitter_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1066 count= gtk_text_buffer_get_char_count(textbuffer) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1067 (gtk_text_iter_get_offset(end_pos) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1068 gtk_text_iter_get_offset(start_pos)); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1069 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
|
1070 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
|
1071 break; |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1072 case identica_service: |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1073 gtk_text_buffer_get_start_iter(textbuffer, &head); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1074 gtk_text_buffer_get_end_iter(textbuffer, &tail); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1075 |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1076 text = gtk_text_buffer_get_text(textbuffer, |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1077 &head, &tail, TRUE); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1078 if(text) |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1079 bytes = strlen(text); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1080 g_free(text); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1081 |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1082 text = gtk_text_buffer_get_text(textbuffer, |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1083 start_pos, end_pos, TRUE); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1084 if(text) |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1085 bytes -= strlen(text); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1086 g_free(text); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1087 |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1088 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1089 bytes <= 140 ? "black" : "red", bytes); |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1090 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1091 case wassr_service: |
102
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1092 count= gtk_text_buffer_get_char_count(textbuffer) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1093 (gtk_text_iter_get_offset(end_pos) - |
55c466028d48
changed letter counter for identi.ca to count in byte.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
101
diff
changeset
|
1094 gtk_text_iter_get_offset(start_pos)); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1095 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
|
1096 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
|
1097 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1098 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1099 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
|
1100 break; |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1101 } |
31 | 1102 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1103 box = gtkconv->toolbar; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1104 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
|
1105 if(counter) |
31 | 1106 gtk_label_set_markup(GTK_LABEL(counter), markup); |
1107 | |
1108 g_free(markup); | |
1109 } | |
1110 | |
1111 static void | |
1112 detach_from_window(void) | |
1113 { | |
1114 GList *list; | |
1115 | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1116 /* 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
|
1117 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
|
1118 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1119 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1120 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
|
1121 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
|
1122 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1123 case twitter_service: |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1124 #if 0 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1125 if(purple_prefs_get_bool(OPT_API_BASE_POST)) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1126 g_source_remove_by_user_data((gpointer)conv); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1127 #endif |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1128 detach_from_conv(conv, NULL); |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1129 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1130 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1131 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1132 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
|
1133 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1134 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1135 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
|
1136 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1137 } |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1138 } |
31 | 1139 } |
1140 | |
1141 static void | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1142 detach_from_conv(PurpleConversation *conv, gpointer null) |
31 | 1143 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1144 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1145 GtkWidget *box, *counter = NULL, *sep = NULL; |
31 | 1146 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1147 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
|
1148 (GFunc) insert_text_cb, conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1149 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
|
1150 (GFunc) delete_text_cb, conv); |
31 | 1151 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1152 box = gtkconv->toolbar; |
31 | 1153 |
1154 /* remove counter */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1155 counter = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-counter"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1156 if(counter) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1157 gtk_container_remove(GTK_CONTAINER(box), counter); |
31 | 1158 g_object_unref(counter); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1159 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL); |
31 | 1160 } |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
1161 |
31 | 1162 /* remove separator */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1163 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
|
1164 if(sep) { |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1165 gtk_container_remove(GTK_CONTAINER(box), sep); |
31 | 1166 g_object_unref(sep); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1167 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", NULL); |
31 | 1168 } |
1169 | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1170 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 1171 } |
1172 | |
1173 static void | |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1174 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
|
1175 { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1176 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
|
1177 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
|
1178 GList *mark_list = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1179 GList *current; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1180 |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1181 if(!data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1182 return; |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1183 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
1184 if(data->request_list) |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1185 mark_list = data->request_list; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1186 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1187 /* 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
|
1188 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
|
1189 current = g_list_next(current)) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1190 GtkTextMark *current_mark = current->data; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1191 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
|
1192 current_mark); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1193 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1194 if(!current_text_buffer) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1195 continue; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1196 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1197 if(text_buffer) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1198 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
|
1199 /* 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
|
1200 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
|
1201 current_mark); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1202 current->data = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1203 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1204 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1205 else { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1206 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
|
1207 current->data = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1208 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1209 } /* end of for */ |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1210 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1211 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
|
1212 data->request_list = mark_list; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1213 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1214 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1215 static void |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1216 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
|
1217 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
|
1218 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
|
1219 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1220 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
|
1221 (GHFunc)remove_marks_func, |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1222 (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
|
1223 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1224 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1225 static void |
31 | 1226 attach_to_window(void) |
1227 { | |
1228 GList *list; | |
1229 | |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1230 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1231 |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1232 /* 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
|
1233 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
|
1234 PidginWindow *win = list->data; |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1235 PurpleConversation *conv = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1236 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
|
1237 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
|
1238 /* 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
|
1239 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1240 case twitter_service: |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1241 attach_to_conv(conv, NULL); |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1242 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1243 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1244 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1245 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
|
1246 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1247 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1248 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
|
1249 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1250 } |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1251 } |
31 | 1252 } |
1253 | |
1254 static void | |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1255 attach_to_conv(PurpleConversation *conv, gpointer null) |
31 | 1256 { |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1257 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
|
1258 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
|
1259 GtkIMHtml *imhtml; |
31 | 1260 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1261 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
|
1262 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
|
1263 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1264 /* Disable widgets that decorate or add link to composing text |
53 | 1265 * 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
|
1266 * 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
|
1267 */ |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1268 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
|
1269 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
|
1270 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
|
1271 } |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1272 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
|
1273 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
|
1274 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
|
1275 } |
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
|
1276 |
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
|
1277 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
|
1278 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
|
1279 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
|
1280 ~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
|
1281 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1282 /* 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
|
1283 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
|
1284 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
|
1285 |
d5f251b37f6b
- make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
50
diff
changeset
|
1286 /* get counter object */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1287 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
|
1288 g_return_if_fail(counter == NULL); |
31 | 1289 |
1290 /* make counter object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1291 counter = gtk_label_new(NULL); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1292 gtk_widget_set_name(counter, "counter_label"); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1293 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
|
1294 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
|
1295 gtk_widget_show_all(counter); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1296 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", counter); |
31 | 1297 |
1298 /* make separator object */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1299 sep = gtk_vseparator_new(); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1300 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
|
1301 gtk_widget_show_all(sep); |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1302 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep); |
31 | 1303 |
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
|
1304 /* connect to signals */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1305 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
|
1306 G_CALLBACK(insert_text_cb), conv); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1307 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
|
1308 G_CALLBACK(delete_text_cb), conv); |
31 | 1309 |
1310 /* redraw window */ | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1311 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); |
31 | 1312 } |
1313 | |
1314 static gboolean | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1315 is_twitter_account(PurpleAccount *account, const char *name) |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1316 { |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1317 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
|
1318 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1319 if(g_strstr_len(name, 19, "twitter@twitter.com") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1320 g_strstr_len(proto, 11, "prpl-jabber")) { |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1321 return TRUE; |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1322 } |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1323 |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1324 return FALSE; |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1325 } |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1326 |
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1327 static gboolean |
31 | 1328 is_twitter_conv(PurpleConversation *conv) |
1329 { | |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1330 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1331 |
31 | 1332 const char *name = purple_conversation_get_name(conv); |
1333 PurpleAccount *account = purple_conversation_get_account(conv); | |
1334 | |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
1335 return is_twitter_account(account, name); |
31 | 1336 } |
1337 | |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1338 static gboolean |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1339 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
|
1340 { |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1341 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
|
1342 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1343 if(g_strstr_len(name, 18, "wassr-bot@wassr.jp") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1344 g_strstr_len(proto, 11, "prpl-jabber")) { |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1345 return TRUE; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1346 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1347 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1348 return FALSE; |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1349 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1350 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1351 static gboolean |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1352 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
|
1353 { |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1354 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1355 |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1356 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
|
1357 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
|
1358 |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1359 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
|
1360 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1361 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1362 static gboolean |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1363 is_identica_account(PurpleAccount *account, const char *name) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1364 { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1365 const gchar *proto = purple_account_get_protocol_id(account); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1366 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1367 if(g_strstr_len(name, 16, "update@identi.ca") && |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1368 g_strstr_len(proto, 11, "prpl-jabber")) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1369 return TRUE; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1370 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1371 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1372 return FALSE; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1373 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1374 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1375 static gboolean |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1376 is_identica_conv(PurpleConversation *conv) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1377 { |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1378 g_return_val_if_fail(conv != NULL, FALSE); |
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1379 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1380 const char *name = purple_conversation_get_name(conv); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1381 PurpleAccount *account = purple_conversation_get_account(conv); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1382 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1383 return is_identica_account(account, name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1384 } |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1385 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1386 static gint |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1387 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
|
1388 { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1389 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
|
1390 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1391 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
|
1392 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1393 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
|
1394 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
|
1395 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
|
1396 service = wassr_service; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1397 else if(is_identica_conv(conv)) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1398 service = identica_service; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1399 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1400 return service; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1401 } |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1402 |
31 | 1403 static void |
1404 conv_created_cb(PurpleConversation *conv, gpointer null) | |
1405 { | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1406 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1407 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1408 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1409 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
1410 g_return_if_fail(gtkconv != NULL); |
31 | 1411 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1412 gint service = get_service_type(conv); |
31 | 1413 /* 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
|
1414 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1415 case twitter_service: |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1416 /* api based retrieve */ //xxx should configurable |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1417 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1418 get_status_with_api((gpointer)conv); |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
123
diff
changeset
|
1419 g_timeout_add_seconds( |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
123
diff
changeset
|
1420 purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL), |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
123
diff
changeset
|
1421 get_status_with_api, (gpointer)conv); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1422 } |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1423 attach_to_conv(conv, NULL); |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1424 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1425 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1426 case identica_service: |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1427 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
|
1428 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1429 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1430 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
|
1431 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1432 } |
31 | 1433 } |
1434 | |
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
|
1435 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
|
1436 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
|
1437 { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1438 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1439 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1440 twitter_debug("called\n"); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1441 |
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
|
1442 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
|
1443 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1444 gint service = get_service_type(conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1445 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1446 |
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 /* 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
|
1448 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1449 case twitter_service: |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1450 if(purple_prefs_get_bool(OPT_API_BASE_POST)) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1451 g_source_remove_by_user_data((gpointer)conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1452 hash = 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
|
1453 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1454 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1455 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1456 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1457 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1458 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1459 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1460 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1461 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
|
1462 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1463 } |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1464 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1465 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1466 delete_requested_icon_marks(gtkconv, hash); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1467 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1468 |
8 | 1469 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
|
1470 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
|
1471 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
|
1472 { |
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
|
1473 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
|
1474 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
|
1475 |
100
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1476 if(is_twitter_conv(conv) || is_wassr_conv(conv) || is_identica_conv(conv)) { |
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1477 /* suppress notification of incoming messages. */ |
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1478 if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) |
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1479 *flags |= PURPLE_MESSAGE_SYSTEM; |
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1480 } |
86772af940ce
fixed the notification of incoming messages for wasser and identica
mikanbako <maoutwo@gmail.com>
parents:
98
diff
changeset
|
1481 |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1482 /* quick hack to suppress annoying completion message from wassr */ |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1483 if(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
|
1484 if(strstr(*buffer, "<body>投稿完了:") || |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1485 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
|
1486 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
|
1487 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
|
1488 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
|
1489 } |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1490 /* 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
|
1491 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
|
1492 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
|
1493 g_free(*sender); *sender = NULL; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1494 g_free(*buffer); *buffer = NULL; |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
81
diff
changeset
|
1495 } |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1496 } |
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
73
diff
changeset
|
1497 |
96
987607b5ba32
made is_*_conv(conv) return FALSE if conv is NULL.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
1498 if(!is_twitter_conv(conv)) { |
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
|
1499 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
|
1500 } |
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
|
1501 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1502 /* if we use api, discard incoming IM message. XXX too wild? */ |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1503 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1504 g_free(*sender); *sender = NULL; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1505 g_free(*buffer); *buffer = NULL; |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1506 } |
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
1507 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
1508 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
|
1509 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
|
1510 |
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
|
1511 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
|
1512 twitter_debug("clearing sender and buffer\n"); |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1513 g_free(*sender); *sender = NULL; |
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1514 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
|
1515 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
|
1516 } |
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
|
1517 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
|
1518 } |
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
|
1519 |
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
|
1520 static void |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1521 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
|
1522 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1523 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
|
1524 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1525 gchar *user_name = gotdata->user_name; |
86 | 1526 gint service = gotdata->service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1527 |
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
|
1528 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
|
1529 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
|
1530 GtkTextBuffer *target_buffer = NULL; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
1531 GtkTextIter insertion_point; |
86 | 1532 gint 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
|
1533 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1534 GHashTable *hash = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1535 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1536 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
|
1537 |
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
|
1538 /* 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
|
1539 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
|
1540 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
|
1541 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
|
1542 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
|
1543 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1544 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
|
1545 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
|
1546 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
|
1547 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
|
1548 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1549 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
|
1550 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1551 if(service != unknown_service) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1552 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
|
1553 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
|
1554 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
|
1555 |
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
|
1556 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
|
1557 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
|
1558 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
|
1559 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
|
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 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1562 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1563 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1564 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
|
1565 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
|
1566 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1567 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1568 /* 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
|
1569 gtk_text_buffer_get_iter_at_mark(target_buffer, |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
1570 &insertion_point, requested_mark); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1571 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1572 /* 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
|
1573 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1574 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1575 hash = 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
|
1576 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1577 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1578 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1579 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1580 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1581 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1582 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1583 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1584 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
|
1585 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1586 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1587 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1588 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1589 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1590 if(data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1591 icon_id = data->icon_id; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1592 else |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1593 icon_id = 0; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1594 |
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
|
1595 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
|
1596 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
|
1597 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1598 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1599 /* insert icon actually */ |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1600 if(purple_prefs_get_bool(OPT_SHOW_ICON)) { |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1601 PurpleStoredImage *img = purple_imgstore_find_by_id(icon_id); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1602 const GdkPixbuf *pixbuf = purple_imgstore_get_data(img); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1603 gtk_text_buffer_insert_pixbuf(target_buffer, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1604 &insertion_point, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1605 (GdkPixbuf *)pixbuf); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1606 } |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1607 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
|
1608 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
|
1609 } |
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
|
1610 |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1611 static void |
86 | 1612 insert_requested_icon(const gchar *user_name, gint service) |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1613 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1614 icon_data *data = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1615 GList *mark_list = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1616 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1617 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1618 twitter_debug("called\n"); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1619 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1620 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1621 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1622 hash = 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
|
1623 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1624 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1625 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1626 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1627 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1628 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1629 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1630 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1631 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
|
1632 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1633 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1634 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1635 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1636 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1637 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1638 if(!data) |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1639 return; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1640 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1641 mark_list = data->request_list; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1642 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1643 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
|
1644 gotdata->user_name = g_strdup(user_name); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1645 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
|
1646 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1647 twitter_debug("about to insert icon\n"); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1648 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1649 if(mark_list) { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1650 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
|
1651 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
|
1652 g_list_free(mark_list); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1653 data->request_list = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1654 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1655 g_free(gotdata->user_name); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1656 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
|
1657 } |
ddd164e74312
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 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1659 /* this function will be called when profile page has been retrieved */ |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1660 static void |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1661 got_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1662 const gchar *url_text, gsize len, const gchar *error_message) |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1663 { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1664 got_icon_data *gotdata = (got_icon_data *)user_data; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1665 gchar *user_name = gotdata->user_name; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1666 // gint service = gotdata->service; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1667 GMatchInfo *match_info = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1668 icon_data *data = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1669 gchar *url = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1670 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1671 data = (icon_data *)g_hash_table_lookup(icon_data_by_user3, user_name); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1672 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1673 if(!url_text) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1674 if(data) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1675 data->requested = FALSE; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1676 data->fetch_data = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1677 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1678 g_free(gotdata->user_name); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1679 g_free(gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1680 return; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1681 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1682 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1683 /* setup image url */ |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1684 g_regex_match(regp[IMAGE_IDENTICA], url_text, 0, &match_info); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1685 if(!g_match_info_matches(match_info)) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1686 twitter_debug("no image found\n"); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1687 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1688 g_match_info_free(match_info); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1689 if(data) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1690 data->requested = FALSE; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1691 data->fetch_data = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1692 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1693 g_free(gotdata->user_name); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1694 g_free(gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1695 return; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1696 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1697 url = g_match_info_fetch(match_info, 1); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1698 g_match_info_free(match_info); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1699 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1700 /* request fetch image */ |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1701 if(url) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1702 /* reuse gotdata. just pass given one */ |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1703 /* gotdata will be released in got_icon_cb */ |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1704 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1705 got_icon_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1706 g_free(url); url = NULL; |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1707 |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1708 twitter_debug("request %s's icon\n", user_name); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1709 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1710 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1711 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1712 static GdkPixbuf * |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1713 make_scaled_pixbuf(const gchar *url_text, gsize len) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1714 { |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1715 /* make pixbuf */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1716 GdkPixbufLoader *loader; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1717 GdkPixbuf *src = NULL, *dest = NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1718 gint size; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1719 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1720 g_return_val_if_fail(url_text != NULL, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1721 g_return_val_if_fail(len > 0, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1722 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1723 loader = gdk_pixbuf_loader_new(); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1724 gdk_pixbuf_loader_write(loader, (guchar *)url_text, len, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1725 gdk_pixbuf_loader_close(loader, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1726 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1727 src = gdk_pixbuf_loader_get_pixbuf(loader); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1728 if(!src) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1729 return NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1730 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1731 size = purple_prefs_get_int(OPT_ICON_SIZE); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1732 if(size == 0) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1733 size = 48; /* twitter icon size */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1734 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1735 dest = gdk_pixbuf_scale_simple(src, size, size, GDK_INTERP_HYPER); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1736 gdk_pixbuf_unref (src); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1737 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1738 return dest; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1739 } |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1740 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
1741 /* this function will be called when requested icon has been retrieved */ |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1742 static void |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1743 got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1744 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
|
1745 { |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1746 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
|
1747 gchar *user_name = gotdata->user_name; |
86 | 1748 gint service = gotdata->service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1749 |
86 | 1750 gint icon_id; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1751 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1752 GHashTable *hash = NULL; |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1753 GdkPixbuf *pixbuf = NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1754 const gchar *dirname = NULL; |
61
a44d15cfd8a2
trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents:
60
diff
changeset
|
1755 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1756 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
|
1757 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1758 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1759 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1760 hash = 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
|
1761 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1762 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1763 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1764 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1765 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1766 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1767 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1768 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1769 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
|
1770 } |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1771 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1772 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1773 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1774 |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1775 /* return if download failed */ |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1776 if(!url_text) { |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1777 twitter_debug("downloading %s's icon failed : %s\n", |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1778 user_name, error_message); |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1779 if(data) |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1780 data->requested = FALSE; |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1781 goto fin_got_icon_cb; |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1782 return; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1783 } |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1784 |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1785 if(data) { |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1786 /* remove download request */ |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1787 data->requested = FALSE; |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1788 data->fetch_data = NULL; |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1789 |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1790 /* return if user's icon had been downloaded */ |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1791 if(data->icon_id > 0) { |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1792 twitter_debug("%s's icon has already been downloaded\n", |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1793 user_name); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1794 goto fin_got_icon_cb; |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1795 return; |
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
|
1796 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1797 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1798 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1799 pixbuf = make_scaled_pixbuf(url_text, len); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1800 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1801 if(!pixbuf) |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1802 goto fin_got_icon_cb; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1803 |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1804 icon_id = |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1805 purple_imgstore_add_with_id(pixbuf, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1806 gdk_pixbuf_get_rowstride(pixbuf) * |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1807 gdk_pixbuf_get_height(pixbuf), |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1808 user_name); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1809 if(!data) { |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1810 twitter_debug("allocate icon_data (shouldn't be called)\n"); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1811 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
|
1812 } |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1813 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1814 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
|
1815 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1816 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1817 g_hash_table_insert(hash, g_strdup(user_name), data); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1818 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1819 dirname = purple_prefs_get_string(OPT_ICON_DIR); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1820 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1821 /* 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
|
1822 if(ensure_path_exists(dirname)) { |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1823 gchar *filename = NULL; |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1824 gchar *path = NULL; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1825 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1826 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1827 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1828 filename = g_strdup_printf("%s_twitter.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
|
1829 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1830 case wassr_service: |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1831 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
|
1832 break; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1833 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1834 filename = g_strdup_printf("%s_identica.png", user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1835 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1836 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1837 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
|
1838 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1839 } |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1840 |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1841 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
|
1842 g_free(filename); filename = NULL; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1843 |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1844 g_file_set_contents(path, url_text, len, NULL); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1845 } |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
1846 |
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
|
1847 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
|
1848 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
|
1849 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1850 /* 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
|
1851 insert_requested_icon(user_name, service); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1852 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1853 fin_got_icon_cb: |
93
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1854 g_free(gotdata->user_name); |
7219f7dee52f
revised got_icon_cb() and fixed unexpected free hash table data.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
1855 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
|
1856 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1857 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1858 static void |
86 | 1859 request_icon(const char *user_name, gint 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
|
1860 { |
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
|
1861 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
|
1862 |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1863 /* 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
|
1864 gchar *path = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1865 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1866 GHashTable *hash = NULL; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1867 const gchar *suffix = NULL; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1868 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1869 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1870 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1871 hash = icon_data_by_user; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1872 suffix = "twitter"; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1873 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1874 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1875 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1876 suffix = "wassr"; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1877 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1878 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1879 suffix = "identica"; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1880 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1881 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1882 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1883 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
|
1884 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1885 } |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1886 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1887 if(!hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1888 return; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1889 |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1890 /* since this function is called after mark_icon_for_user(), data |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1891 * must exist here. */ |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1892 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1893 g_hash_table_insert(hash, g_strdup(user_name), data); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1894 |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1895 /* if img has been registerd, just return */ |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1896 if(data->icon_id > 0) |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1897 return; |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1898 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1899 /* check if saved file exists */ |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1900 if(suffix) { |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1901 gchar *filename = NULL; |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1902 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1903 filename = g_strdup_printf("%s_%s.gif", user_name, suffix); |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1904 path = g_build_filename( |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1905 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
|
1906 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1907 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
|
1908 g_free(path); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1909 filename = g_strdup_printf("%s_%s.png", user_name, suffix); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1910 path = g_build_filename( |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1911 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
|
1912 } |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1913 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1914 g_free(filename); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1915 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1916 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1917 twitter_debug("path = %s\n", path); |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1918 |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1919 /* build image from file, if file exists */ |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1920 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
|
1921 gchar *imgdata = NULL; |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1922 size_t len; |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1923 GError *err = NULL; |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1924 GdkPixbuf *pixbuf = NULL; |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1925 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1926 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
|
1927 twitter_debug("Error reading %s: %s\n", |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1928 path, err->message); |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1929 g_error_free(err); |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1930 } |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1931 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1932 pixbuf = make_scaled_pixbuf(imgdata, len); |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
1933 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1934 if(pixbuf) { |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1935 data->icon_id = |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1936 purple_imgstore_add_with_id(pixbuf, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1937 gdk_pixbuf_get_rowstride(pixbuf) * |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1938 gdk_pixbuf_get_height(pixbuf), |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1939 user_name); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1940 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1941 twitter_debug("icon data has been loaded from file\n"); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1942 insert_requested_icon(user_name, service); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1943 } |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1944 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
1945 g_free(path); |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1946 return; |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1947 } |
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
1948 |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1949 /* 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
|
1950 if(data->requested) |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1951 return; |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1952 else |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1953 data->requested = TRUE; |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
1954 |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1955 |
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
|
1956 /* 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
|
1957 * 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
|
1958 */ |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1959 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1960 case twitter_service: |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1961 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
|
1962 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
|
1963 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1964 case wassr_service: |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1965 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
|
1966 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
|
1967 break; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1968 case identica_service: |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1969 url = g_strdup_printf("http://identi.ca/%s", user_name); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1970 break; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1971 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1972 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
|
1973 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
1974 } |
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
|
1975 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1976 if(url) { |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1977 got_icon_data *gotdata = g_new0(got_icon_data, 1); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1978 gotdata->user_name = g_strdup(user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1979 gotdata->service = service; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
1980 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1981 /* gotdata will be released in got_icon_cb */ |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1982 if(service == identica_service) { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1983 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1984 got_page_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1985 } |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1986 else { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1987 data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1988 got_icon_cb, gotdata); |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
1989 } |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1990 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
|
1991 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1992 twitter_debug("request %s's icon\n", user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
1993 } |
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
|
1994 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1995 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
1996 static void |
86 | 1997 mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service) |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
1998 { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
1999 icon_data *data = NULL; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2000 GHashTable *hash = NULL; |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2001 |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2002 twitter_debug("called\n"); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2003 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2004 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2005 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2006 hash = 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
|
2007 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2008 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2009 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2010 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2011 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2012 hash = icon_data_by_user3; |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2013 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2014 default: |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2015 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
|
2016 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2017 } |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2018 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2019 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2020 data = (icon_data *)g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2021 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2022 if(!data) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2023 data = g_new0(icon_data, 1); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2024 g_hash_table_insert(hash, g_strdup(user_name), data); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2025 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2026 |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2027 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
|
2028 } |
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2029 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2030 static gboolean |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2031 displaying_im_cb(PurpleAccount *account, const char *who, char **message, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2032 PurpleConversation *conv, PurpleMessageFlags flags, void *unused) |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2033 { |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2034 GtkIMHtml *imhtml; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2035 GtkTextBuffer *text_buffer; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2036 gint service = get_service_type(conv); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2037 gint linenumber = 0; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2038 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2039 twitter_debug("called\n"); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2040 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2041 if(service == unknown_service) { |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2042 twitter_debug("neither twitter or wassr conv\n"); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2043 return FALSE; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2044 } |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2045 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2046 /* get text buffer */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2047 imhtml = GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2048 text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2049 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2050 /* store number of lines */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2051 linenumber = gtk_text_buffer_get_line_count(text_buffer); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2052 g_hash_table_insert(conv_hash, conv, GINT_TO_POINTER(linenumber)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2053 twitter_debug("conv = %p linenumber = %d\n", conv, linenumber); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2054 |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2055 return FALSE; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2056 } |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2057 |
78
0b93dd0e0de1
fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents:
76
diff
changeset
|
2058 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
|
2059 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
|
2060 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
|
2061 { |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2062 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
|
2063 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
|
2064 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
|
2065 GtkTextBuffer *text_buffer; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2066 GtkTextIter insertion_point; |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2067 gint icon_id = 0; |
86 | 2068 gint service = get_service_type(conv); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2069 icon_data *data = NULL; |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2070 gint linenumber; |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2071 GHashTable *hash = NULL; |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2072 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2073 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
|
2074 |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2075 if(service == unknown_service) { |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2076 twitter_debug("unknown service\n"); |
60
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2077 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
|
2078 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2079 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2080 /* 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
|
2081 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
|
2082 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
|
2083 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
|
2084 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
|
2085 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
|
2086 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2087 |
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
|
2088 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
|
2089 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
|
2090 |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2091 /* 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
|
2092 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
|
2093 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
|
2094 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2095 /* get GtkTextIter in the target line */ |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2096 linenumber = GPOINTER_TO_INT(g_hash_table_lookup(conv_hash, conv)); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2097 gtk_text_buffer_get_iter_at_line(text_buffer, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2098 &insertion_point, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2099 linenumber); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2100 |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2101 switch(service) { |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2102 case twitter_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2103 hash = 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
|
2104 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2105 case wassr_service: |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2106 hash = icon_data_by_user2; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2107 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2108 case identica_service: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2109 hash = icon_data_by_user3; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2110 break; |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2111 default: |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2112 twitter_debug("unknown service\n"); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2113 break; |
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
2114 } |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2115 |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2116 if(hash) |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2117 data = g_hash_table_lookup(hash, user_name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2118 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2119 if(data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2120 icon_id = data->icon_id; |
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
|
2121 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2122 /* if we don't have the icon for this user, put a mark instead and |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2123 * 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
|
2124 if(!icon_id) { |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2125 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
|
2126 mark_icon_for_user(gtk_text_buffer_create_mark( |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2127 text_buffer, NULL, &insertion_point, FALSE), |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2128 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
|
2129 /* 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
|
2130 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
|
2131 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
|
2132 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
|
2133 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2134 |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2135 /* if we have icon for this user, insert icon immediately */ |
104
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2136 if(purple_prefs_get_bool(OPT_SHOW_ICON)) { |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2137 PurpleStoredImage *img = purple_imgstore_find_by_id(icon_id); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2138 const GdkPixbuf *pixbuf = purple_imgstore_get_data(img); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2139 gtk_text_buffer_insert_pixbuf(text_buffer, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2140 &insertion_point, |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2141 (GdkPixbuf *)pixbuf); |
084e1c6de8ca
icon scaling feature has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
2142 } |
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
|
2143 g_free(user_name); user_name = NULL; |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2144 |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2145 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
|
2146 } |
ddd164e74312
trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents:
59
diff
changeset
|
2147 |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2148 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2149 static void |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2150 signed_on_cb(PurpleConnection *gc) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2151 { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2152 PurpleBuddyList *list = purple_get_blist(); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2153 PurpleBlistNode *gnode, *cnode, *bnode; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2154 PurpleBuddy *b; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2155 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2156 twitter_debug("called\n"); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2157 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2158 if(!purple_prefs_get_bool(OPT_API_BASE_POST)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2159 return; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2160 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2161 if (!list) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2162 return; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2163 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2164 twitter_debug("scan list\n"); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2165 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2166 for (gnode = list->root; gnode; gnode = gnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2167 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2168 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2169 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2170 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2171 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2172 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2173 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2174 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2175 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2176 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2177 continue; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2178 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2179 b = (PurpleBuddy *)bnode; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2180 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2181 if(!PURPLE_BUDDY_IS_ONLINE(b)) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2182 const char *name; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2183 PurpleAccount *account; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2184 name = purple_buddy_get_name(b); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2185 account = purple_buddy_get_account(b); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2186 if (is_twitter_account(account, name)) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2187 PurpleConversation *gconv; |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2188 gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2189 if (!gconv) { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2190 gconv = purple_conversation_new(PURPLE_CONV_TYPE_IM, |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2191 account, name); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2192 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2193 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2194 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2195 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2196 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2197 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2198 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2199 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2200 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2201 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2202 static void |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2203 api_base_post_cb(const char *name, PurplePrefType type, gconstpointer value, |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2204 gpointer data) |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2205 { |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2206 signed_on_cb(NULL); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2207 } |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2208 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2209 |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2210 |
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
|
2211 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2212 load_plugin(PurplePlugin *plugin) |
0 | 2213 { |
6 | 2214 /* connect to signal */ |
2215 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
|
2216 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
|
2217 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
|
2218 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
|
2219 purple_signal_connect(purple_conversations_get_handle(), |
31 | 2220 "conversation-created", |
2221 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
|
2222 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
|
2223 plugin, PURPLE_CALLBACK(receiving_im_cb), NULL); |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2224 purple_signal_connect(pidgin_conversations_get_handle(), "displaying-im-msg", |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2225 plugin, PURPLE_CALLBACK(displaying_im_cb), NULL); |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2226 |
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
|
2227 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
|
2228 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
|
2229 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
|
2230 "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
|
2231 plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2232 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2233 plugin, PURPLE_CALLBACK(signed_on_cb), NULL); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2234 |
0 | 2235 |
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
|
2236 /* 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
|
2237 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
|
2238 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
|
2239 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
|
2240 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
|
2241 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
|
2242 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
|
2243 regp[USER_FORMATTED] = g_regex_new(P_USER_FORMATTED, G_REGEX_RAW, 0, NULL); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2244 regp[CHANNEL] = g_regex_new(P_CHANNEL, 0, 0, NULL); |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
102
diff
changeset
|
2245 regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2246 |
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
|
2247 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2248 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
|
2249 g_free, NULL); |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2250 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
|
2251 g_free, NULL); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2252 icon_data_by_user3 = g_hash_table_new_full(g_str_hash, g_str_equal, |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2253 g_free, NULL); |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2254 conv_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, |
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2255 NULL, NULL); |
28
73e817be3267
- Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
25
diff
changeset
|
2256 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2257 /* 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
|
2258 if(purple_prefs_get_bool(OPT_COUNTER)) { |
31 | 2259 attach_to_window(); |
2260 } | |
2261 | |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2262 /* allocate wassr_post */ |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2263 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
|
2264 |
6 | 2265 return TRUE; |
0 | 2266 } |
2267 | |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2268 static void |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2269 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
|
2270 { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2271 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
|
2272 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2273 if(!data) |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2274 return; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2275 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2276 if(data->fetch_data) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2277 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
|
2278 data->fetch_data = NULL; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2279 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2280 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2281 if(data->request_list) { |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2282 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
|
2283 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2284 |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2285 return; |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2286 } |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2287 |
8 | 2288 static gboolean |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2289 unload_plugin(PurplePlugin *plugin) |
0 | 2290 { |
39
2ac81c0afb53
- new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
38
diff
changeset
|
2291 twitter_debug("called\n"); |
0 | 2292 |
31 | 2293 /* disconnect from signal */ |
2294 purple_signal_disconnect(purple_conversations_get_handle(), | |
2295 "writing-im-msg", | |
2296 plugin, PURPLE_CALLBACK(writing_im_cb)); | |
2297 purple_signal_disconnect(purple_conversations_get_handle(), | |
2298 "sending-im-msg", | |
2299 plugin, PURPLE_CALLBACK(sending_im_cb)); | |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2300 purple_signal_disconnect(purple_conversations_get_handle(), |
31 | 2301 "conversation-created", |
2302 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
|
2303 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
|
2304 "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
|
2305 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
|
2306 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
|
2307 "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
|
2308 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
|
2309 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
|
2310 "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
|
2311 plugin, PURPLE_CALLBACK(deleting_conv_cb)); |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2312 purple_signal_disconnect(purple_connections_get_handle(), |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2313 "signed-on", |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2314 plugin, PURPLE_CALLBACK(signed_on_cb)); |
31 | 2315 |
2316 /* unreference regp */ | |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2317 int i; |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2318 for(i = 0; i < NUM_REGP; i++) { |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2319 g_regex_unref(regp[i]); |
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
121
diff
changeset
|
2320 } |
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
|
2321 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2322 /* 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
|
2323 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
|
2324 g_hash_table_foreach(icon_data_by_user2, (GHFunc)remove_marks_func, NULL); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2325 g_hash_table_foreach(icon_data_by_user3, (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
|
2326 |
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
|
2327 /* 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
|
2328 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
|
2329 g_hash_table_foreach(icon_data_by_user2, (GHFunc)cancel_fetch_func, NULL); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2330 g_hash_table_foreach(icon_data_by_user3, (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
|
2331 |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
79
diff
changeset
|
2332 /* 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
|
2333 g_hash_table_destroy(icon_data_by_user); //XXX all memory freed? --yaz |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2334 g_hash_table_destroy(icon_data_by_user2); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
2335 g_hash_table_destroy(icon_data_by_user3); |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
93
diff
changeset
|
2336 g_hash_table_destroy(conv_hash); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
2337 |
31 | 2338 /* detach from twitter window */ |
2339 detach_from_window(); | |
2340 | |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2341 /* free wassr_post */ |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2342 g_free(wassr_post); |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2343 wassr_post = NULL; |
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2344 |
6 | 2345 return TRUE; |
0 | 2346 } |
2347 | |
31 | 2348 static void |
2349 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
|
2350 gconstpointer val, gpointer data) |
31 | 2351 { |
2352 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
|
2353 |
31 | 2354 if(enabled) { |
40
e60e6cbdc4c4
- added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
39
diff
changeset
|
2355 attach_to_window(); |
31 | 2356 } |
2357 else { | |
2358 detach_from_window(); | |
2359 } | |
2360 } | |
2361 | |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2362 static void |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2363 invalidate_icon_data_func(gpointer key, gpointer value, gpointer user_data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2364 { |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2365 icon_data *data = (icon_data *)value; |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2366 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2367 g_return_if_fail(data != NULL); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2368 g_return_if_fail(data->icon_id >0); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2369 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2370 /* img->data is managed by gdkpixbuf, so we should not free here. */ |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2371 #if 0 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2372 PurpleStoredImage *img = purple_imgstore_find_by_id(data->icon_id); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2373 if(img) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2374 purple_imgstore_unref_by_id(data->icon_id); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2375 #endif |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2376 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2377 data->icon_id = 0; |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2378 } |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2379 |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2380 static void |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2381 icon_size_prefs_cb(const char *name, PurplePrefType type, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2382 gconstpointer val, gpointer data) |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2383 { |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2384 /* invalidate icon cache */ |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2385 g_hash_table_foreach(icon_data_by_user, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2386 (GHFunc)invalidate_icon_data_func, NULL); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2387 g_hash_table_foreach(icon_data_by_user2, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2388 (GHFunc)invalidate_icon_data_func, NULL); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2389 g_hash_table_foreach(icon_data_by_user3, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2390 (GHFunc)invalidate_icon_data_func, NULL); |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2391 } |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2392 |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2393 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2394 text_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2395 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2396 const gchar *text; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2397 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2398 text = gtk_entry_get_text(GTK_ENTRY(data)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2399 purple_prefs_set_string(pref, text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2400 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2401 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2402 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2403 bool_toggled_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2404 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2405 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2406 gboolean value = purple_prefs_get_bool(pref); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2407 purple_prefs_set_bool(pref, !value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2408 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2409 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2410 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2411 spin_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2412 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2413 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2414 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2415 twitter_debug("called\n"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2416 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2417 purple_prefs_set_int( |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2418 pref, |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2419 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data))); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2420 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2421 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2422 static void |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2423 combo_changed_cb(gpointer *data) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2424 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2425 gint position; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2426 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2427 position = gtk_combo_box_get_active(GTK_COMBO_BOX(data)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2428 purple_prefs_set_int(pref, position); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2429 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2430 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2431 static GtkWidget * |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2432 prefs_get_frame(PurplePlugin *plugin) |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2433 { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2434 GtkBuilder *builder; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2435 GError *err = NULL; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2436 gchar *filename; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2437 GtkWidget *window, *notebook, *e; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2438 const gchar *text; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2439 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2440 builder = gtk_builder_new(); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2441 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2442 filename = g_build_filename(DATADIR, "pidgin-twitter", "prefs.ui", NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2443 gtk_builder_add_from_file(builder, filename, &err); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2444 if(err) { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2445 twitter_debug("%s\n", err->message); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2446 return NULL; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2447 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2448 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2449 g_free(filename); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2450 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2451 gtk_builder_connect_signals(builder, NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2452 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2453 window = GTK_WIDGET(gtk_builder_get_object(builder, "prefswindow")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2454 notebook = GTK_WIDGET(gtk_builder_get_object(builder, "prefsnotebook")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2455 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2456 gtk_container_remove(GTK_CONTAINER(window), notebook); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2457 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2458 g_signal_connect(notebook, "destroy", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2459 G_CALLBACK(gtk_widget_destroyed), ¬ebook); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2460 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2461 /* connect to signals */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2462 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2463 /* account page */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2464 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_twitter")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2465 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_TWITTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2466 text = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2467 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2468 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2469 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2470 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2471 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_wassr")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2472 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_WASSR); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2473 text = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2474 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2475 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2476 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2477 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2478 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_identica")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2479 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_IDENTICA); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2480 text = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2481 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2482 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2483 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2484 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2485 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2486 g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_POST); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2487 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2488 purple_prefs_get_bool(OPT_API_BASE_POST)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2489 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2490 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2491 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2492 purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, // xxx devide? |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2493 api_base_post_cb, NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2494 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2495 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api_password")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2496 g_object_set_data(G_OBJECT(e), "pref", OPT_PASSWORD_TWITTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2497 text = purple_prefs_get_string(OPT_PASSWORD_TWITTER); //xxx should be masked |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2498 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2499 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2500 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2501 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2502 /* translation page */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2503 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_recipient")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2504 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2505 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2506 purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2507 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2508 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2509 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2510 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_sender")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2511 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2512 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2513 purple_prefs_get_bool(OPT_TRANSLATE_SENDER)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2514 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2515 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2516 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2517 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_channel")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2518 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_CHANNEL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2519 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2520 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2521 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2522 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2523 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2524 /* utility page */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2525 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_show_icon")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2526 g_object_set_data(G_OBJECT(e), "pref", OPT_SHOW_ICON); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2527 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2528 purple_prefs_get_bool(OPT_SHOW_ICON)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2529 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2530 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2531 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2532 /* setup spin */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2533 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_icon_size_spin")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2534 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_SIZE); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2535 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2536 GtkSpinButton *spin = GTK_SPIN_BUTTON(e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2537 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2538 int value = purple_prefs_get_int(OPT_ICON_SIZE); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2539 twitter_debug("spin value = %d\n", value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2540 |
128 | 2541 GtkObject *adjust = gtk_adjustment_new(value, 16, 128, 4, 1, 1); |
2542 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); | |
2543 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2544 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2545 if(value == 0) { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2546 value = DEFAULT_ICON_SIZE; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2547 purple_prefs_set_int(OPT_ICON_SIZE, value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2548 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2549 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2550 g_signal_connect(e, "value-changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2551 G_CALLBACK(spin_changed_cb), &e); |
128 | 2552 purple_prefs_connect_callback(plugin, OPT_ICON_SIZE, |
2553 icon_size_prefs_cb, NULL); | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2554 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2555 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2556 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2557 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_counter")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2558 g_object_set_data(G_OBJECT(e), "pref", OPT_COUNTER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2559 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2560 purple_prefs_get_bool(OPT_COUNTER)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2561 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2562 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2563 purple_prefs_connect_callback(plugin, OPT_COUNTER, //xxx |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2564 counter_prefs_cb, NULL); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2565 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2566 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_pseudo")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2567 g_object_set_data(G_OBJECT(e), "pref", OPT_ESCAPE_PSEUDO); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2568 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2569 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2570 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2571 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2572 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2573 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_oops")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2574 g_object_set_data(G_OBJECT(e), "pref", OPT_SUPPRESS_OOPS); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2575 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2576 purple_prefs_get_bool(OPT_SUPPRESS_OOPS)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2577 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2578 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2579 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2580 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_notify")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2581 g_object_set_data(G_OBJECT(e), "pref", OPT_PREVENT_NOTIFICATION); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2582 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2583 purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2584 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2585 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2586 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2587 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2588 /* sound page */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2589 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_check")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2590 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2591 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2592 purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2593 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2594 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2595 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2596 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_list")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2597 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2598 text = purple_prefs_get_string(OPT_USERLIST_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2599 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2600 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2601 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2602 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2603 /* setup combobox */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2604 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_combo")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2605 gtk_combo_box_set_active(GTK_COMBO_BOX(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2606 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2607 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_RECIPIENT); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2608 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2609 G_CALLBACK(combo_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2610 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2611 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2612 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2613 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_check")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2614 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2615 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2616 purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2617 g_signal_connect(e, "toggled", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2618 G_CALLBACK(bool_toggled_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2619 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2620 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_list")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2621 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2622 text = purple_prefs_get_string(OPT_USERLIST_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2623 gtk_entry_set_text(GTK_ENTRY(e), text); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2624 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2625 G_CALLBACK(text_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2626 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2627 /* setup combobox */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2628 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_combo")); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2629 gtk_combo_box_set_active(GTK_COMBO_BOX(e), |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2630 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2631 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_SENDER); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2632 g_signal_connect(e, "changed", |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2633 G_CALLBACK(combo_changed_cb), &e); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2634 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2635 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2636 gtk_widget_show_all(notebook); |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2637 return notebook; |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2638 } |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2639 |
128 | 2640 #if 0 |
8 | 2641 static PurplePluginPrefFrame * |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2642 get_plugin_pref_frame(PurplePlugin *plugin) |
0 | 2643 { |
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
|
2644 /* create gtk elements for the plugin preferences */ |
6 | 2645 PurplePluginPref *pref; |
2646 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); | |
0 | 2647 |
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
|
2648 /************************/ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2649 /* screen name heading */ |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2650 /************************/ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2651 pref = purple_plugin_pref_new_with_label("Screen Name"); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2652 purple_plugin_pref_frame_add(frame, pref); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2653 |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2654 /* twitter */ |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2655 pref = |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2656 purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_TWITTER, |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2657 "twitter"); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2658 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2659 |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2660 /* wassr */ |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2661 pref = |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2662 purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_WASSR, |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2663 "wassr"); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2664 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2665 |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2666 /* identica */ |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2667 pref = |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2668 purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_IDENTICA, |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2669 "identi.ca"); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2670 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2671 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2672 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2673 /************************/ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2674 /* translation heading */ |
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
|
2675 /************************/ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2676 pref = purple_plugin_pref_new_with_label("Translation"); |
6 | 2677 purple_plugin_pref_frame_add(frame, pref); |
0 | 2678 |
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
|
2679 /* translation settings */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2680 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
|
2681 "Translate @username to link"); |
6 | 2682 purple_plugin_pref_frame_add(frame, pref); |
0 | 2683 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2684 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
|
2685 "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
|
2686 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
|
2687 |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2688 pref = purple_plugin_pref_new_with_name_and_label(OPT_TRANSLATE_CHANNEL, |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2689 "Translate channel name to link (wassr only)"); |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2690 purple_plugin_pref_frame_add(frame, pref); |
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2691 |
31 | 2692 |
113
388a8ca50817
tweaked configure dialog.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
112
diff
changeset
|
2693 /*******************/ |
388a8ca50817
tweaked configure dialog.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
112
diff
changeset
|
2694 /* Utility heading */ |
388a8ca50817
tweaked configure dialog.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
112
diff
changeset
|
2695 /*******************/ |
388a8ca50817
tweaked configure dialog.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
112
diff
changeset
|
2696 pref = purple_plugin_pref_new_with_label("Utility"); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2697 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2698 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2699 /* show icon */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2700 pref = purple_plugin_pref_new_with_name_and_label(OPT_SHOW_ICON, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2701 "Show icons in conversation"); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2702 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2703 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2704 /* icon size */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2705 pref = purple_plugin_pref_new_with_name_and_label(OPT_ICON_SIZE, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2706 "Icon size in pixel"); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2707 purple_plugin_pref_set_bounds(pref, 16, 128); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2708 purple_plugin_pref_frame_add(frame, pref); |
111
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2709 purple_prefs_connect_callback(plugin, OPT_ICON_SIZE, |
799b28f181f8
added UI for icon size.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
110
diff
changeset
|
2710 icon_size_prefs_cb, NULL); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2711 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2712 /* show text counter */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2713 pref = purple_plugin_pref_new_with_name_and_label(OPT_COUNTER, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2714 "Show text counter widget"); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2715 purple_plugin_pref_frame_add(frame, pref); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2716 purple_prefs_connect_callback(plugin, OPT_COUNTER, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2717 counter_prefs_cb, NULL); |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2718 |
31 | 2719 /* escape pseudo command setting */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2720 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
|
2721 "Escape pseudo command string"); |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2722 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
|
2723 |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2724 /* suppress oops message */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2725 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
|
2726 "Suppress oops message"); |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2727 purple_plugin_pref_frame_add(frame, pref); |
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2728 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2729 |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2730 /* notification setting */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2731 pref = |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2732 purple_plugin_pref_new_with_name_and_label(OPT_PREVENT_NOTIFICATION, |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2733 "Do not notify incoming message"); |
99
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
2734 purple_plugin_pref_frame_add(frame, pref); |
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
2735 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2736 /******************/ |
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
|
2737 /* sound heading */ |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2738 /******************/ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2739 pref = purple_plugin_pref_new_with_label("Sound"); |
31 | 2740 purple_plugin_pref_frame_add(frame, pref); |
2741 | |
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
|
2742 /* sound settings for recipient */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2743 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
|
2744 "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
|
2745 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
|
2746 |
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
|
2747 /* recipient list */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2748 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
|
2749 "Recipient List"); |
6 | 2750 purple_plugin_pref_frame_add(frame, pref); |
1 | 2751 |
8 | 2752 /* sound id selector */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2753 pref = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2754 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
|
2755 "Recipient Sound"); |
9
c6b80f47d4df
added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
8
diff
changeset
|
2756 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2757 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
|
2758 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
|
2759 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
|
2760 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2761 purple_plugin_pref_add_choice(pref, "First Receive", GINT_TO_POINTER(3)); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2762 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
|
2763 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
|
2764 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
|
2765 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
|
2766 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
|
2767 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
|
2768 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
|
2769 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2770 purple_plugin_pref_frame_add(frame, pref); |
8 | 2771 |
31 | 2772 /* sound setting for sender */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2773 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
|
2774 "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
|
2775 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
|
2776 |
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
|
2777 /* sender list */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2778 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
|
2779 "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
|
2780 purple_plugin_pref_frame_add(frame, pref); |
1 | 2781 |
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
|
2782 /* sound id selector */ |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2783 pref = |
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2784 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
|
2785 "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
|
2786 |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2787 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
|
2788 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
|
2789 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
|
2790 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2)); |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2791 purple_plugin_pref_add_choice(pref, "First Receive", GINT_TO_POINTER(3)); |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2792 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
|
2793 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
|
2794 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
|
2795 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
|
2796 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
|
2797 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
|
2798 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); |
59
3f9148c1dc60
added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents:
56
diff
changeset
|
2799 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
|
2800 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2801 /****************/ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2802 /* API heading */ |
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2803 /****************/ |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
2804 pref = purple_plugin_pref_new_with_label("API Based Twitter Access"); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2805 purple_plugin_pref_frame_add(frame, pref); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2806 |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2807 /* post configuration */ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2808 pref = purple_plugin_pref_new_with_name_and_label(OPT_API_BASE_POST, |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
118
diff
changeset
|
2809 "Post/get statuses via API"); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2810 purple_plugin_pref_frame_add(frame, pref); |
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2811 |
118
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2812 purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2813 api_base_post_cb, NULL); |
8b097fcb9243
Add function that opens twitter's conversation window automatically when the
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
117
diff
changeset
|
2814 |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2815 /* password */ |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2816 pref = purple_plugin_pref_new_with_name_and_label(OPT_PASSWORD_TWITTER, |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2817 "Password"); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2818 purple_plugin_pref_set_masked(pref, TRUE); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2819 purple_plugin_pref_frame_add(frame, pref); |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2820 |
6 | 2821 return frame; |
0 | 2822 } |
2823 | |
6 | 2824 static PurplePluginUiInfo pref_info = { |
2825 get_plugin_pref_frame | |
0 | 2826 }; |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2827 #endif |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2828 |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2829 static PidginPluginUiInfo ui_info = { |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2830 prefs_get_frame, |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2831 0, /* page number - reserved */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2832 NULL, /* reserved 1 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2833 NULL, /* reserved 2 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2834 NULL, /* reserved 3 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2835 NULL /* reserved 4 */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2836 }; |
0 | 2837 |
6 | 2838 static PurplePluginInfo info = { |
2839 PURPLE_PLUGIN_MAGIC, | |
2840 PURPLE_MAJOR_VERSION, | |
2841 PURPLE_MINOR_VERSION, | |
2842 PURPLE_PLUGIN_STANDARD, /**< type */ | |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2843 // NULL, /**< ui_req */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2844 PIDGIN_PLUGIN_TYPE, /**< ui_req */ |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2845 0, /**< flags */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2846 NULL, /**< deps */ |
6 | 2847 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
31 | 2848 PLUGIN_ID, /**< id */ |
6 | 2849 "Pidgin-Twitter", /**< name */ |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2850 "0.7.0", /**< version */ |
76
63bd9ca28be0
- added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
74
diff
changeset
|
2851 "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
|
2852 "provides useful features for twitter", /** desc */ |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
83
diff
changeset
|
2853 "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, mojin, \nthe pidging-twitter team", /**< author */ |
6 | 2854 "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
|
2855 load_plugin, /**< load */ |
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2856 unload_plugin, /**< unload */ |
6 | 2857 NULL, /**< destroy */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2858 #if 0 |
6 | 2859 NULL, /**< ui_info */ |
2860 NULL, /**< extra_info */ | |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2861 &pref_info, /**< pref info */ |
126
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2862 #else |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2863 &ui_info, /**< ui_info */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2864 NULL, /**< extra_info */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2865 NULL, /**< pref info */ |
bac987852e66
switched to native gtk preferences dialog.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
125
diff
changeset
|
2866 #endif |
6 | 2867 NULL |
0 | 2868 }; |
2869 | |
8 | 2870 static void |
38
625e385036c3
applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
37
diff
changeset
|
2871 init_plugin(PurplePlugin *plugin) |
0 | 2872 { |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2873 char *dirname = NULL; |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2874 |
6 | 2875 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
|
2876 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
|
2877 if(dirname) |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
63
diff
changeset
|
2878 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
|
2879 g_free(dirname); |
0 | 2880 |
6 | 2881 /* add plugin preferences */ |
2882 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
|
2883 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
|
2884 purple_prefs_add_bool(OPT_TRANSLATE_SENDER, TRUE); |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
2885 purple_prefs_add_bool(OPT_TRANSLATE_CHANNEL, TRUE); |
19
0d7cbc984570
escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
16
diff
changeset
|
2886 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
|
2887 |
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
|
2888 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
|
2889 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
|
2890 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
|
2891 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
|
2892 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
|
2893 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); |
31 | 2894 |
2895 purple_prefs_add_bool(OPT_COUNTER, TRUE); | |
37
bafe2abf2d3b
- made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
36
diff
changeset
|
2896 purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); |
99
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
2897 purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE); |
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
2898 purple_prefs_add_bool(OPT_SHOW_ICON, TRUE); |
59
3f9148c1dc60
added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents:
56
diff
changeset
|
2899 |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
71
diff
changeset
|
2900 purple_prefs_add_bool(OPT_API_BASE_POST, FALSE); |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2901 purple_prefs_add_string(OPT_SCREEN_NAME_TWITTER, EMPTY); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2902 purple_prefs_add_string(OPT_PASSWORD_TWITTER, EMPTY); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
104
diff
changeset
|
2903 |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
123
diff
changeset
|
2904 purple_prefs_add_int(OPT_ICON_SIZE, DEFAULT_ICON_SIZE); |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2905 purple_prefs_add_string(OPT_SCREEN_NAME_WASSR, EMPTY); |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
109
diff
changeset
|
2906 purple_prefs_add_string(OPT_SCREEN_NAME_IDENTICA, EMPTY); |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
123
diff
changeset
|
2907 purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); |
115
7d0dd0e1dbd0
very preliminary twitter API get status feature.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
113
diff
changeset
|
2908 |
0 | 2909 } |
2910 | |
2911 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) |