annotate pidgin-twitter.c @ 79:a4a6c7b204c9

fixed changeset 78:0b93dd0e0de1: fixed removing the mark
author mikanbako <maoutwo@gmail.com>
date Mon, 30 Jun 2008 11:02:01 +0900
parents 0b93dd0e0de1
children e0bf37c105eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
2 /*
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
3 * Pidgin-Twitter plugin.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
4 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
6 * modify it under the terms of the GNU General Public License as
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
7 * published by the Free Software Foundation; either version 2 of the
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
8 * License, or (at your option) any later version.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
9 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
13 * General Public License for more details.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
14 *
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
18 * 02111-1307, USA.
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
19 */
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
20 #define PURPLE_PLUGINS 1
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
21
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
22 #include "pidgin-twitter.h"
45
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
23
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
24 /* globals */
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
25 static GRegex *regp[7];
36
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
26 static gboolean suppress_oops = FALSE;
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
27 static GHashTable *icon_id_by_user;
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
28 static GList *requested_users = 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
29 static GList *requestings = 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
30 static GHashTable *icon_mark_list_by_user;
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
31
49
82b2b3767311 fixed indentation of strip_html_markup()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 48
diff changeset
32 /* 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
33 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
34 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
35 {
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
36 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
37 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
38 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
39 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
40 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
41 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
42 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
43
746ff3b54c10 trying another way to strip markups. in this 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 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
45 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
46
746ff3b54c10 trying another way to strip markups. in this 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 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
48
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
49 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
50 {
746ff3b54c10 trying another way to strip markups. in this 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 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
52 {
746ff3b54c10 trying another way to strip markups. in this 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 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
54 {
746ff3b54c10 trying another way to strip markups. in this 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 /* 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
56 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
57 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
58 {
746ff3b54c10 trying another way to strip markups. in this 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 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
60 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
61 }
746ff3b54c10 trying another way to strip markups. in this 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 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
63 }
746ff3b54c10 trying another way to strip markups. in this 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 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
65 {
746ff3b54c10 trying another way to strip markups. in this 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 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
67 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
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 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
70 {
746ff3b54c10 trying another way to strip markups. in this 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 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
72 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
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
746ff3b54c10 trying another way to strip markups. in this 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 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
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
746ff3b54c10 trying another way to strip markups. in this 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 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
81
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
82 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
83 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
84 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
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 /* 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
87 * 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
88 * 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
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 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
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 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 }
42
68db38b5b401 fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents: 41
diff changeset
94
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
95 /* 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
96 * 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
97 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
98 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
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 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
101 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
102 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
103 /* 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
104 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
105 {
746ff3b54c10 trying another way to strip markups. in this 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 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
107 {
746ff3b54c10 trying another way to strip markups. in this 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 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
109 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
110 {
746ff3b54c10 trying another way to strip markups. in this 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 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
112 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
113 }
746ff3b54c10 trying another way to strip markups. in this 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 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
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 }
746ff3b54c10 trying another way to strip markups. in this 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 /* 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
118 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
119 {
746ff3b54c10 trying another way to strip markups. in this 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 /* 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
121 }
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
122
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
123 /* 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
124 * 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
125 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
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 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
128 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
129 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
130 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
131 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
132 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
133 }
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
134 }
42
68db38b5b401 fixed changeset 41:0a81ccfa1941
mikanbako <maoutwo@gmail.com>
parents: 41
diff changeset
135
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
136 /* 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
137 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
138 || 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
139 || 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
140 || 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
141 || 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
142 || 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
143 || 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
144 {
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
145 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
146 }
746ff3b54c10 trying another way to strip markups. in this 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, "<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
148 {
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
149 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
150 }
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
151 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
152 {
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
153 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
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 /* 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
156 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
157 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
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 }
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
160 else if (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
161 {
746ff3b54c10 trying another way to strip markups. in this 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 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
163 }
746ff3b54c10 trying another way to strip markups. in this 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 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
165 {
746ff3b54c10 trying another way to strip markups. in this 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 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
167 }
39
2ac81c0afb53 - new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 38
diff changeset
168
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
169 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
170 (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
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 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
173 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
174 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
175 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
176 }
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
177
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
178 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
179 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
180 }
746ff3b54c10 trying another way to strip markups. in this 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 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
183
746ff3b54c10 trying another way to strip markups. in this 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 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
185
746ff3b54c10 trying another way to strip markups. in this 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 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
187 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
188
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
189 /* 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
190 static gboolean
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
191 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
192 {
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
193 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
194 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
195 return FALSE;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
196 }
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
197
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
198 return TRUE;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
199 }
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
200
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
201
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
202 /**********************/
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
203 /* our implementation */
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
204 /**********************/
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
205 static void
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
206 escape(gchar **str)
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
207 {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
208 GMatchInfo *match_info = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
209 gchar *newstr = NULL, *match = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
210 gboolean flag = FALSE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
211
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
212 /* search genuine command */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
213 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
214 while(g_match_info_matches(match_info)) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
215 match = g_match_info_fetch(match_info, 1);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
216 twitter_debug("command = %s\n", match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
217 g_free(match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
218 g_match_info_next(match_info, NULL);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
219 flag = TRUE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
220 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
221 g_match_info_free(match_info);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
222 match_info = NULL;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
223
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
224 if(flag)
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
225 return;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
226
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
227 /* if not found, check pseudo command */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
228 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
229 while(g_match_info_matches(match_info)) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
230 match = g_match_info_fetch(match_info, 1);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
231 twitter_debug("pseudo = %s\n", match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
232 g_free(match);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
233 g_match_info_next(match_info, NULL);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
234 flag = TRUE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
235 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
236 g_match_info_free(match_info);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
237 match_info = NULL;
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 there is pseudo one, escape it */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
240 if(flag) {
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
241 /* put ". " to the beginning of buffer */
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
242 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
243 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
244 g_free(*str);
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
245 *str = newstr;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
246 }
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
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
249 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
250 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
251 {
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
252 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
253
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
254 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
255 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
256 *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
257 }
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
258
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
259 #define TWITTER_STATUS_POST "POST /statuses/update.xml HTTP/1.0\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
260 "Host: twitter.com\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
261 "User-Agent: Pidgin-Twitter\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
262 "Authorization: Basic %s\r\n" \
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
263 "Content-Length: %d\r\n\r\n"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
264
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
265 #define TWITTER_STATUS_FORMAT "status=%s"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
266 #define TWITTER_STATUS_TERMINATOR "\r\n\r\n"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
267
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
268 #define TWITTER_BASE_URL "http://twitter.com"
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
269
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
270 typedef struct twitter_message {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
271 PurpleAccount *account;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
272 char *status;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
273 time_t time;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
274 } twitter_message_t;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
275
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
276 static void
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
277 post_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
278 const gchar *url_text, size_t len,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
279 const gchar *error_message)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
280 {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
281 twitter_message_t *tm = (struct twitter_message *)user_data;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
282 gchar *msg = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
283 char *p1 = NULL, *p2 = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
284 int error = 1;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
285 PurpleConversation *conv;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
286
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
287 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
288 "twitter@twitter.com",
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
289 tm->account);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
290 if (!conv) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
291 twitter_debug("failed to get conversation\n");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
292 goto fin;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
293 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
294
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
295 if (error_message) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
296 /* connection failed or something */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
297 msg = g_strdup_printf("Local error: %s", error_message);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
298 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
299 int code = -1;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
300
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
301 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
302 || 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
303
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
304 p1 = strchr(url_text, ' ');
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
305
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
306 if (p1) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
307 p1++;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
308 p2 = strchr(p1, ' ');
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
309 if (p2)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
310 p2++;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
311 else
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
312 p2 = NULL;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
313 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
314 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
315
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
316 code = atoi(p1);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
317
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
318 if (code == 200) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
319 error = 0;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
320 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
321 switch (code) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
322 case 400:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
323 msg = g_strdup("Invalid request. Too many updates?");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
324 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
325 case 401:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
326 msg = g_strdup("Authorization failed.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
327 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
328 case 403:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
329 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
330 "for some reason.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
331 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
332 case 404:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
333 msg = g_strdup("Requested URI is not found.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
334 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
335 case 500:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
336 msg = g_strdup("Server error.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
337 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
338 case 502:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
339 msg = g_strdup("Twitter is down or under maintenance.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
340 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
341 case 503:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
342 msg = g_strdup("Twitter is extremely crowded. "
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
343 "Try again later.");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
344 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
345 default:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
346 msg = g_strdup_printf("Unknown error. (%d %s)",
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
347 code, p2 ? p2 : "");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
348 break;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
349 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
350 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
351 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
352
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
353 if (!error) {
73
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
354 gchar *m = NULL;
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
355 const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
356 if (screen_name)
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
357 m = g_strdup_printf("%s: %s", screen_name, tm->status);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
358 else
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
359 m = "";
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
360
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
361 purple_conv_im_write(conv->u.im,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
362 purple_account_get_username(tm->account),
73
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
363 m, PURPLE_MESSAGE_SEND, tm->time);
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
364
08bd4abdfd3d Now your own icon is shown on the conversation window.
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 72
diff changeset
365 g_free(m);
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
366 } else {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
367 gchar *m;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
368 m = g_strdup_printf("%s<BR>%s",
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
369 msg, tm->status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
370 /* FIXME: too strong. it should be more smart */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
371 purple_conv_im_write(conv->u.im,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
372 purple_account_get_username(tm->account),
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
373 m, PURPLE_MESSAGE_ERROR, time(NULL));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
374 g_free(m);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
375 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
376
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
377 fin:
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
378 if (msg)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
379 g_free(msg);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
380
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
381 if (tm) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
382 if (tm->status)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
383 g_free(tm->status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
384 g_free(tm);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
385 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
386
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
387 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
388
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
389 static void
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
390 post_status_with_api(PurpleAccount *account, char **buffer)
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
391 {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
392 char *request, *status, *header;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
393 const char *url_encoded = purple_url_encode(*buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
394 char *basic_auth, *basic_auth_encoded;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
395
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
396 twitter_message_t *tm;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
397
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
398 const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
399 const char *password = purple_prefs_get_string(OPT_PASSWORD);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
400
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
401 twitter_debug("tm.account: %s\n",
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
402 purple_account_get_username(account));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
403
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
404 if (!screen_name || !password || !screen_name[0] || !password[0]) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
405 twitter_debug("screen_name or password is empty\n");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
406 return;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
407 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
408
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
409 tm = g_new(twitter_message_t, 1);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
410 tm->account = account;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
411 tm->status = g_strdup(*buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
412 tm->time = time(NULL);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
413
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
414 basic_auth = g_strdup_printf("%s:%s", screen_name, password);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
415 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
416 strlen(basic_auth));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
417 g_free(basic_auth);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
418
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
419 status = g_strdup_printf(TWITTER_STATUS_FORMAT, url_encoded);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
420
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
421 header = g_strdup_printf(TWITTER_STATUS_POST, basic_auth_encoded,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
422 strlen(status));
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
423
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
424 request = g_strconcat(header, status, TWITTER_STATUS_TERMINATOR, NULL);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
425
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
426 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
427 NULL, TRUE, request, TRUE,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
428 post_status_with_api_cb, tm);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
429
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
430 g_free(header);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
431 g_free(basic_auth_encoded);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
432 g_free(status);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
433 g_free(request);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
434
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
435 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
436
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
437 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
438 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
439 void *data)
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
440 {
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
441 int utflen, bytes;
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
442
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
443 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
444
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
445 /* check if the message is from twitter */
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
446 if(!is_twitter_account(account, recipient))
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
447 return FALSE;
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
448
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
449 /* strip all markups */
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
450 strip_markup(buffer);
41
0a81ccfa1941 strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 40
diff changeset
451
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
452 /* escape pseudo command */
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
453 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
454 escape(buffer);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
455 }
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
456
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
457 /* update status with Twitter API instead of IM protocol */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
458 if (purple_prefs_get_bool(OPT_API_BASE_POST)) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
459 if (buffer && *buffer) {
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
460 post_status_with_api(account, buffer);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
461 (*buffer)[0] = '\0';
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
462 }
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
463 return FALSE;
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
464 }
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
465
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
466 /* 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
467 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
468 bytes = strlen(*buffer);
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
469 twitter_debug("utflen = %d bytes = %d\n", utflen, bytes);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
470 if(bytes > 140 && utflen <= 140)
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
471 suppress_oops = TRUE;
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
472
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
473 return FALSE;
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
474 }
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
475
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
476 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
477 eval(const GMatchInfo *match_info, GString *result, gpointer user_data)
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
478 {
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
479 int which = *(int *)user_data;
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
480 gchar sub[128];
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
481
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
482 if(which == RECIPIENT) {
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
483 gchar *match = g_match_info_fetch(match_info, 1);
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
484
48
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
485 snprintf(sub, 128, RECIPIENT_FORMAT, match, match);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
486 g_free(match);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
487 }
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
488 else if(which == SENDER) {
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
489 gchar *match1 = g_match_info_fetch(match_info, 1); //preceding CR|LF
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
490 gchar *match2 = g_match_info_fetch(match_info, 2); //sender
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
491
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
492 snprintf(sub, 128, SENDER_FORMAT, match1 ? match1: "",
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
493 match2, match2);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
494 g_free(match1);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
495 g_free(match2);
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
496 }
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
497
42869098eda3 adapted for msn style option (or new line plugin).
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 46
diff changeset
498 g_string_append(result, sub);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
499 twitter_debug("sub = %s\n", sub);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
500
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
501 return FALSE;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
502 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
503
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
504 static void
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
505 translate(gchar **str, int which)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
506 {
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
507 gchar *newstr;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
508
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
509 newstr = g_regex_replace_eval(regp[which], // compiled regex
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
510 *str, // subject string
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
511 -1, // length of the subject string
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
512 0, // start position
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
513 0, // match options
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
514 eval, // function to be called for each match
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
515 &which, // user data
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
516 NULL); // error handler
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
517
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
518 twitter_debug("which = %d *str = %s newstr = %s\n", which, *str, newstr);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
519
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
520 g_free(*str);
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
521 *str = newstr;
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
522 }
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
523
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
524 static void
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
525 playsound(gchar **str, int which)
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
526 {
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
527 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
528 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
529 gchar **candidates = NULL, **candidate = NULL;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
530
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
531 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER :
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
532 OPT_USERLIST_RECIPIENT);
5
6ac1867d7e8e string list should be initialized with NULL
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2
diff changeset
533 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
534 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
535 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
536
44a66c52b190 - userlist no longer uses string list. now ' ,:;' separated string is used instead.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 6
diff changeset
537 candidates = g_strsplit_set(list, " ,:;", 0);
20
4c236a7a128f - now escape feature works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 19
diff changeset
538 g_return_if_fail(candidates != NULL);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
539
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
540 g_regex_match(regp[which], *str, 0, &match_info);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
541 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
542 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
543 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
544 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
545 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
546 user = g_match_info_fetch(match_info, 2);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
547 twitter_debug("user = %s\n", user);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
548
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
549 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
550 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
551 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
552 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
553 if(!strcmp(user, *candidate)) {
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
554 twitter_debug("match. play sound\n");
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
555 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
556 (which ? OPT_SOUNDID_SENDER :
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
557 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
558 break;
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
559 }
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
560 }
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
561 g_free(user);
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
562 g_match_info_next(match_info, NULL);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
563 }
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
564 g_strfreev(candidates);
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
565 g_match_info_free(match_info);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
566 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
567
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
568 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
569 writing_im_cb(PurpleAccount *account, char *sender, char **buffer,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
570 PurpleConversation *conv, int *flags, void *data)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
571 {
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
572 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
573
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
574 /* check if the message is from twitter */
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
575 if(!is_twitter_conv(conv))
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
576 /* if(!is_twitter_account(account, sender)) */
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
577 return FALSE;
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
578
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
579 /* strip all markups */
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
580 strip_markup(buffer);
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
581
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
582 /* playsound */
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
583 if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
584 playsound(buffer, SENDER);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
585 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
586 if(purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
587 playsound(buffer, RECIPIENT);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
588 }
41
0a81ccfa1941 strip excessive markup where it is not needed. (work in progress)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 40
diff changeset
589
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
590 /* translate */
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
591 if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
592 translate(buffer, SENDER);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
593 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
594 if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
595 translate(buffer, RECIPIENT);
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
596 }
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
597
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
598 /* escape pseudo command (to show same result to sending message) */
44
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
599 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
600 escape(buffer);
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
601 }
4f456c7150ed cleanups
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 43
diff changeset
602
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
603 return FALSE;
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
604 }
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
605
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
606 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
607 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
608 gchar *new_text, gint new_text_length, gpointer user_data)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
609 {
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
610 PidginConversation *gtkconv = (PidginConversation *)user_data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
611 GtkWidget *box, *counter = NULL;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
612 gchar *markup = NULL;
45
746ff3b54c10 trying another way to strip markups. in this revision, all markups are striped with strip_html_markup() on sending a message.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 44
diff changeset
613 guint count;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
614
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
615 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
616
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
617 count = gtk_text_buffer_get_char_count(textbuffer) +
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
618 (unsigned int)g_utf8_strlen(new_text, -1);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
619
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
620 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
621 count <= 140 ? "black" : "red", count);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
622
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
623 box = gtkconv->toolbar;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
624 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
625 if(counter)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
626 gtk_label_set_markup(GTK_LABEL(counter), markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
627
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
628 g_free(markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
629 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
630
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
631 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
632 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos,
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
633 GtkTextIter *end_pos, gpointer user_data)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
634 {
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
635 PidginConversation *gtkconv = (PidginConversation *)user_data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
636 GtkWidget *box, *counter = NULL;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
637 gchar *markup = NULL;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
638
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
639 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
640
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
641 guint count = gtk_text_buffer_get_char_count(textbuffer) -
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
642 (gtk_text_iter_get_offset(end_pos) -
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
643 gtk_text_iter_get_offset(start_pos));
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
644
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
645 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
646 count <= 140 ? "black" : "red", count);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
647
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
648 box = gtkconv->toolbar;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
649 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
650 if(counter)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
651 gtk_label_set_markup(GTK_LABEL(counter), markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
652
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
653 g_free(markup);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
654 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
655
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
656 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
657 detach_from_window(void)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
658 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
659 GList *list;
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
660
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
661 /* 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
662 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
663 PidginWindow *win = list->data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
664 PurpleConversation *conv =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
665 pidgin_conv_window_get_active_conversation(win);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
666 if(is_twitter_conv(conv))
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
667 detach_from_gtkconv(PIDGIN_CONVERSATION(conv), NULL);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
668 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
669 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
670
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
671 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
672 detach_from_gtkconv(PidginConversation *gtkconv, gpointer null)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
673 {
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
674 GtkWidget *box, *counter = NULL, *sep = NULL;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
675
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
676 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer),
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
677 (GFunc) insert_text_cb, gtkconv);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
678 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer),
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
679 (GFunc) delete_text_cb, gtkconv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
680
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
681 box = gtkconv->toolbar;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
682
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
683 /* remove counter */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
684 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
685 if(counter) {
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
686 gtk_container_remove(GTK_CONTAINER(box), counter);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
687 g_object_unref(counter);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
688 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
689 }
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
690
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
691 /* remove separator */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
692 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
693 if(sep) {
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
694 gtk_container_remove(GTK_CONTAINER(box), sep);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
695 g_object_unref(sep);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
696 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
697 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
698
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
699 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
700 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
701
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
702 static void
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
703 delete_requested_icon_marks(PidginConversation *conv) {
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
704 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
705 GTK_TEXT_VIEW(conv->imhtml));
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
706 GList *user_name_list = g_hash_table_get_keys(icon_mark_list_by_user);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
707 GList *current_user;
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
708
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
709 for(current_user = g_list_first(user_name_list); current_user;
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
710 current_user = g_list_next(current_user)) {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
711 gchar *user_name = current_user->data;
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
712 GList *mark_list = g_hash_table_lookup(icon_mark_list_by_user,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
713 user_name);
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
714
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
715 /* delete the marks in the buffer that will be closed. */
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
716 GList *current = g_list_first(mark_list);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
717 while(current) {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
718 GtkTextMark *mark = current->data;
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
719 GList *next = g_list_next(current);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
720
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
721 if(gtk_text_mark_get_buffer(mark) == text_buffer) {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
722 /* the mark will be freed in the function */
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
723 gtk_text_buffer_delete_mark(text_buffer, mark);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
724 mark_list = g_list_delete_link(mark_list, current);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
725 }
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
726
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
727 current = next;
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
728 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
729
79
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
730 /* Does not replace the old key */
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
731 g_hash_table_insert(icon_mark_list_by_user,
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
732 g_strdup(user_name), mark_list);
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
733 }
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
734 g_list_free(user_name_list);
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
735 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
736
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
737 static void
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
738 attach_to_window(void)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
739 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
740 GList *list;
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
741
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
742 /* 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
743 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
744 PidginWindow *win = list->data;
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
745 PurpleConversation *conv =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
746 pidgin_conv_window_get_active_conversation(win);
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
747 /* only attach to twitter conversation window */
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
748 if(is_twitter_conv(conv))
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
749 attach_to_gtkconv(PIDGIN_CONVERSATION(conv), NULL);
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
750 }
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
751 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
752
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
753 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
754 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
755 {
50
3e0d4fd75b03 added that to disable widgets that decorate or link text.
mikanbako <maoutwo@gmail.com>
parents: 49
diff changeset
756 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
757 GtkIMHtml *imhtml;
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
758
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
759 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
760 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
761
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
762 /* Disable widgets that decorate or add link to composing text
53
872f418ba45d - revised README
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 52
diff changeset
763 * 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
764 * 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
765 */
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
766 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
767 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
768 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
769 }
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
770 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
771 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
772 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
773 }
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
774
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
775 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
776 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
777 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
778 ~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
779
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
780 /* 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
781 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
782 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
783
d5f251b37f6b - make sure that disabling markup widgets works even if counter is disabled.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 50
diff changeset
784 /* get counter object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
785 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
786 g_return_if_fail(counter == NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
787
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
788 /* make counter object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
789 counter = gtk_label_new(NULL);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
790 gtk_widget_set_name(counter, "counter_label");
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
791 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
792 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
793 gtk_widget_show_all(counter);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
794 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", counter);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
795
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
796 /* make separator object */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
797 sep = gtk_vseparator_new();
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
798 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
799 gtk_widget_show_all(sep);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
800 g_object_set_data(G_OBJECT(box), PLUGIN_ID "-sep", sep);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
801
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
802 /* connect to signals */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
803 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text",
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
804 G_CALLBACK(insert_text_cb), gtkconv);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
805 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range",
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
806 G_CALLBACK(delete_text_cb), gtkconv);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
807
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
808 /* redraw window */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
809 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
810 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
811
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
812 static gboolean
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
813 is_twitter_account(PurpleAccount *account, const char *name)
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
814 {
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
815 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
816
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
817 twitter_debug("name = %s proto = %s\n", name, proto);
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
818
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
819 if(!strcmp(name, "twitter@twitter.com") &&
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
820 !strcmp(proto, "prpl-jabber")) {
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
821 return TRUE;
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
822 }
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
823
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
824 return FALSE;
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
825 }
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
826
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
827 static gboolean
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
828 is_twitter_conv(PurpleConversation *conv)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
829 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
830 const char *name = purple_conversation_get_name(conv);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
831 PurpleAccount *account = purple_conversation_get_account(conv);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
832
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
833 return is_twitter_account(account, name);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
834 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
835
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
836 static gboolean
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
837 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
838 {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
839 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
840
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
841 twitter_debug("name = %s proto = %s\n", name, proto);
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
842
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
843 if(!strcmp(name, "wassr-bot@wassr.jp/bot") &&
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
844 !strcmp(proto, "prpl-jabber")) {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
845 return TRUE;
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
846 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
847
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
848 return FALSE;
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
849 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
850
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
851 static gboolean
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
852 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
853 {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
854 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
855 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
856
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
857 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
858 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
859
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
860 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
861 conv_created_cb(PurpleConversation *conv, gpointer null)
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
862 {
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
863 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
864 g_return_if_fail(gtkconv != NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
865
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
866 /* only attach to twitter conversation 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
867 if(is_twitter_conv(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
868 attach_to_gtkconv(gtkconv, NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
869 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
870
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
871 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
872 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
873 {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
874 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
875 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
876
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
877 /* only attach to twitter conversation window */
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
878 if(is_twitter_conv(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
879 delete_requested_icon_marks(gtkconv);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
880 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
881
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
882 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
883 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
884 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
885 {
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
886 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
887 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
888
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
889 /* Check if the conv is not NULL to avoid a clash.
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
890 * conv is null when the conversation window has not opened yet.
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
891 * And if check is a twitter conv. */
74
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
892
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
893 /* quick hack to suppress annoying completion message from wassr */
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
894 if(conv && is_wassr_conv(conv)) {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
895 if(strstr(*buffer, "<body>投稿完了:")) {
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
896 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
897 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
898 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
899 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
900 }
6b9593d1ffed quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 73
diff changeset
901
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
902 if(!(conv && is_twitter_conv(conv))) {
a44d15cfd8a2 trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents: 60
diff changeset
903 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
904 }
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
905
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
906 /* suppress notification of incoming messages. */
61
a44d15cfd8a2 trying to fix changeset 60:ddd164e74312: clash when a message received and this plugin loaded after unloaded
mikanbako <maoutwo@gmail.com>
parents: 60
diff changeset
907 if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
908 *flags |= PURPLE_MESSAGE_SYSTEM;
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
909 }
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
910
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
911 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
912 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
913
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
914 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
915 twitter_debug("clearing sender and buffer\n");
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
916 g_free(*sender); *sender = NULL;
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
917 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
918 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
919 }
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
920 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
921 }
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
922
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
923 static void
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
924 insert_icon_at_mark(GtkTextMark *requested_mark, const gchar *user_name)
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
925 {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
926 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
927 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
928 GtkTextBuffer *target_buffer = NULL;
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
929 GtkTextIter inserting_point;
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
930 int 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
931
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
932 twitter_debug("called\n");
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
933
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
934 /* 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
935 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
936 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
937 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
938 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
939
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
940 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
941 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
942 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
943 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
944
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
945 if(purple_conv && is_twitter_conv(purple_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
946 GtkIMHtml *current_imhtml = GTK_IMHTML(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
947 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
948 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
949
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
950 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
951 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
952 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
953 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
954 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
955 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
956 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
957 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
958 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
959 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
960 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
961
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
962 /* 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
963
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
964 gtk_text_buffer_get_iter_at_mark(target_buffer,
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
965 &inserting_point, requested_mark);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
966
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
967 /* 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
968 icon_id = GPOINTER_TO_INT(g_hash_table_lookup(icon_id_by_user, user_name));
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
969 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
970 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
971 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
972
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
973 /* insert icon actually */
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
974 gtk_imhtml_insert_image_at_iter(target_imhtml, icon_id, &inserting_point);
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
975 gtk_text_buffer_delete_mark(target_buffer, requested_mark);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
976 }
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
977
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
978 static void
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
979 insert_requested_icon(const gchar *user_name)
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
980 {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
981 GList *mark_list = g_hash_table_lookup(icon_mark_list_by_user, user_name);
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
982
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
983 g_list_foreach(mark_list, (GFunc) insert_icon_at_mark, (gchar *)user_name);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
984 g_hash_table_remove(icon_mark_list_by_user, user_name);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
985 g_list_free(mark_list);
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
986 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
987
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
988 static void
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
989 got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
990 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
991 {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
992 gchar *user_name = (gchar *)user_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
993 int icon_id;
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
994
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
995 twitter_debug("called\n");
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
996
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
997 requestings = g_list_remove(requestings, url_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
998
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
999 /* Return if user's icon had already been downloaded or
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1000 * the download is failure. */
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1001 if(g_hash_table_lookup(icon_id_by_user, user_name) || !url_text) {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1002 if(!url_text) {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1003 twitter_debug("downloading %s's icon was failure : %s\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
1004 user_name, error_message);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1005 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1006 else {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1007 twitter_debug("%s's icon has already been downloaded\n", user_name);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1008 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1009
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1010 GList *deleting = g_list_find_custom(requested_users,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1011 user_name, (GCompareFunc) strcmp);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1012 if(deleting) {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1013 g_free(deleting->data);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1014 requested_users = g_list_delete_link(requested_users, deleting);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1015 }
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
1016 g_free(user_name);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1017 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
1018 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1019
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1020 icon_id = purple_imgstore_add_with_id(g_memdup(url_text, len), len,
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1021 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
1022 g_hash_table_insert(icon_id_by_user,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1023 g_strdup(user_name),GINT_TO_POINTER(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
1024
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1025 const gchar *dirname = purple_prefs_get_string(OPT_ICON_DIR);
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1026
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1027 /* 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
1028 if(ensure_path_exists(dirname)) {
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1029 gchar *filename = NULL;
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1030 gchar *path = NULL;
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1031 FILE *fp = NULL;
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1032 filename = g_strdup_printf("%s.gif", user_name);
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1033
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1034 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
1035 g_free(filename); filename = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1036
71
76fc004cd327 windows requires "wb" instead of "w".
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 70
diff changeset
1037 fp = fopen(path, "wb");
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1038 g_free(path); path = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1039
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1040 if(fp) {
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1041 int wrotelen;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1042 wrotelen = fwrite(url_text, 1, len, fp);
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1043 }
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1044
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1045 fclose(fp); fp = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1046 }
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1047
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
1048 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
1049 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
1050
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1051 /* Insert the icon to messages that had been received. */
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1052 insert_requested_icon(user_name);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1053 g_free(user_name);
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1054 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1055
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1056 static void
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1057 request_icon(const char *user_name)
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1058 {
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
1059 gchar *url = 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
1060 PurpleUtilFetchUrlData *fetch_data = NULL;
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1061
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1062 /* 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
1063 gchar *filename = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1064 gchar *path = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1065 gint icon_id;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1066
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1067 /* if img has been registerd, just return */
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1068 icon_id = GPOINTER_TO_INT(g_hash_table_lookup(icon_id_by_user, user_name));
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1069 if(icon_id) {
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1070 return;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1071 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1072
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1073 filename = g_strdup_printf("%s.gif", user_name);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1074
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1075 path = g_build_filename(
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1076 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1077
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1078 if(!g_file_test(path, G_FILE_TEST_EXISTS)) {
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1079 g_free(path);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1080 filename = g_strdup_printf("%s.png", user_name);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1081 path = g_build_filename(
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1082 purple_prefs_get_string(OPT_ICON_DIR), filename, NULL);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1083 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1084 /* build image from file, if file exists */
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1085 if(g_file_test(path, G_FILE_TEST_EXISTS)) {
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1086 gchar *data = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1087 size_t len;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1088 GError *err = NULL;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1089
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1090 if (!g_file_get_contents(path, &data, &len, &err)) {
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1091 twitter_debug("Error reading %s: %s\n",
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1092 path, err->message);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1093 g_error_free(err);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1094 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1095
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1096 icon_id = purple_imgstore_add_with_id(data, len, path);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1097
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
1098 g_hash_table_insert(icon_id_by_user, g_strdup(user_name), GINT_TO_POINTER(icon_id));
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1099 g_free(filename);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1100 g_free(path);
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1101
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1102 insert_requested_icon(user_name);
66
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1103 return;
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1104 }
0ddcba9161fd now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 65
diff changeset
1105
65
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1106 /* Return if user's icon has been requested already. */
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1107 if(g_list_find_custom(requested_users, user_name, (GCompareFunc)strcmp)) {
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1108 return;
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1109 }
4949d4eb34ec - revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 64
diff changeset
1110
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
1111 requested_users = g_list_append(requested_users, g_strdup(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
1112
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
1113 /* 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
1114 * 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
1115 */
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
1116 url = g_strdup_printf("http://img.twitty.jp/twitter/user/%s/m.gif",
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
1117 user_name);
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
1118
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
1119 fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE,
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
1120 got_icon_cb, g_strdup(user_name));
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
1121 g_free(url);
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1122 requestings = g_list_append(requestings, fetch_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
1123
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1124 twitter_debug("request %s's icon\n", user_name);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1125 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1126
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1127 static void
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1128 mark_icon_for_user(GtkTextMark *mark, const gchar *user_name)
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1129 {
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1130 GList *mark_list = g_hash_table_lookup(icon_mark_list_by_user, user_name);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1131
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1132 mark_list = g_list_append(mark_list, mark);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1133 g_hash_table_replace(icon_mark_list_by_user,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1134 g_strdup(user_name), mark_list);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1135 }
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1136
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1137 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
1138 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
1139 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
1140 {
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1141 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
1142 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
1143 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
1144 GtkTextBuffer *text_buffer;
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1145 GtkTextIter inserting_point;
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1146 int 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
1147
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
1148 if(!is_twitter_conv(conv)) {
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1149 twitter_debug("not twitter conv\n");
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1150 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
1151 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1152
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1153 /* 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
1154 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
1155 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
1156 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
1157 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
1158 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
1159 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1160
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
1161 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
1162 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
1163
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1164 /* 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
1165
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1166 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
1167 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
1168
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1169 /* get GtkTextIter of the last line */
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1170 gtk_text_buffer_get_iter_at_line(text_buffer, &inserting_point,
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1171 gtk_text_buffer_get_line_count(text_buffer) - 1);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1172
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
1173 icon_id = GPOINTER_TO_INT(g_hash_table_lookup(icon_id_by_user, user_name));
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1174
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1175 /* If the user's icon has not been downloaded,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1176 * mark the message and request the icon. */
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1177 if(!icon_id) {
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
1178 twitter_debug("%s's icon has not been downloaded.\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
1179 mark_icon_for_user(gtk_text_buffer_create_mark(
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1180 text_buffer, NULL, &inserting_point, FALSE),
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1181 user_name);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1182 /* request to attach icon to the buffer */
69
d1f92d980f58 fixed that icon had not appeard in the first message.
mikanbako <maoutwo@gmail.com>
parents: 68
diff changeset
1183 request_icon(user_name);
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
1184 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
1185 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
1186 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1187
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1188 gtk_imhtml_insert_image_at_iter(imhtml, icon_id, &inserting_point);
70
74524f379440 trying simple search in insert_requested_icon() due to malfunction under linux environment.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 69
diff changeset
1189 g_free(user_name); user_name = NULL;
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1190
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1191 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
1192 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1193
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
1194 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1195 load_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1196 {
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1197 /* connect to signal */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1198 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
1199 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
1200 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
1201 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
1202 purple_signal_connect(purple_conversations_get_handle(),
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1203 "conversation-created",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1204 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
1205 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
1206 plugin, PURPLE_CALLBACK(receiving_im_cb), NULL);
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1207 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
1208 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
1209 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
1210 "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
1211 plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1212
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
1213 /* 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
1214 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
1215 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
1216 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
1217 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
1218 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
1219 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
1220 regp[USER_FORMATTED] = g_regex_new(P_USER_FORMATTED, G_REGEX_RAW, 0, NULL);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1221
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1222 /* hash table for user's icons */
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1223 icon_id_by_user = g_hash_table_new_full(g_str_hash, g_str_equal,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1224 g_free, NULL);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1225
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1226 /* hash table for a list of marks that are alternative icons */
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1227 icon_mark_list_by_user = g_hash_table_new_full(g_str_hash, g_str_equal,
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1228 g_free, NULL);
28
73e817be3267 - Fixed a crash bug. Each unload/reload cycle caused crash due to unrefed regp.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 25
diff changeset
1229
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1230 /* 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
1231 if(purple_prefs_get_bool(OPT_COUNTER)) {
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1232 attach_to_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1233 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1234
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1235 return TRUE;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1236 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1237
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1238 static gboolean
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1239 unload_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1240 {
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1241 GList *list, *current;
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
1242
39
2ac81c0afb53 - new debug macro. it includes function name and line number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 38
diff changeset
1243 twitter_debug("called\n");
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1244
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1245 /* disconnect from signal */
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1246 purple_signal_disconnect(purple_conversations_get_handle(),
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1247 "writing-im-msg",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1248 plugin, PURPLE_CALLBACK(writing_im_cb));
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1249 purple_signal_disconnect(purple_conversations_get_handle(),
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1250 "sending-im-msg",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1251 plugin, PURPLE_CALLBACK(sending_im_cb));
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1252 purple_signal_disconnect(purple_conversations_get_handle(),
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1253 "conversation-created",
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1254 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
1255 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
1256 "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
1257 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
1258 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
1259 "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
1260 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
1261 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
1262 "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
1263 plugin, PURPLE_CALLBACK(deleting_conv_cb));
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1264
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1265 /* unreference regp */
10
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1266 g_regex_unref(regp[RECIPIENT]);
4bd8c89b4749 now it plays sound when sender of message is in the userlist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 9
diff changeset
1267 g_regex_unref(regp[SENDER]);
21
38fe566b5ee1 unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 20
diff changeset
1268 g_regex_unref(regp[COMMAND]);
38fe566b5ee1 unref newly added regex at unload time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 20
diff changeset
1269 g_regex_unref(regp[PSEUDO]);
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1270 g_regex_unref(regp[USER]);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1271 g_regex_unref(regp[USER_FIRST_LINE]);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1272 g_regex_unref(regp[USER_FORMATTED]);
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1273
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1274 /* remove the hash table of marks that are alternative icons */
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1275 list = g_hash_table_get_values(icon_mark_list_by_user);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1276 for(current = g_list_first(list); current;
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1277 current = g_list_next(current)) {
79
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1278 GList *mark_list = current->data;
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1279 GList *current_mark_list;
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1280
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1281 /* remove the marks in its GtkTextBuffers */
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1282 for(current_mark_list = g_list_first(mark_list); current_mark_list;
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1283 current_mark_list = g_list_next(current_mark_list)) {
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1284 GtkTextMark *current_mark = current_mark_list->data;
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1285 GtkTextBuffer *text_buffer = gtk_text_mark_get_buffer(
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1286 current_mark);
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1287
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1288 if(text_buffer) {
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1289 /* the mark will be freed in this function */
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1290 gtk_text_buffer_delete_mark(text_buffer, current_mark);
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1291 }
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1292 }
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1293
a4a6c7b204c9 fixed changeset 78:0b93dd0e0de1: fixed removing the mark
mikanbako <maoutwo@gmail.com>
parents: 78
diff changeset
1294 g_list_free(mark_list);
78
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1295 }
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1296 g_list_free(list);
0b93dd0e0de1 fixed the data structure of marks that are positions of inserting user's icons.
mikanbako <maoutwo@gmail.com>
parents: 76
diff changeset
1297 g_hash_table_destroy(icon_mark_list_by_user);
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
1298
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
1299 /* cancel request that has not been finished yet */
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1300 for(list = g_list_first(requestings); list; list = g_list_next(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
1301 purple_util_fetch_url_cancel(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
1302 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1303 g_list_free(requestings);
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
1304 requestings = 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
1305
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1306 /* destroy hash table for icons */
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
1307 g_hash_table_destroy(icon_id_by_user);
60
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1308 for(list = g_list_first(requested_users); list; list = g_list_next(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
1309 g_free(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
1310 }
ddd164e74312 trying to show user's icon. in this revision, the default icon of twitter is showed.
mikanbako <maoutwo@gmail.com>
parents: 59
diff changeset
1311 g_list_free(requested_users);
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
1312 requested_users = NULL;
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1313
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1314 /* detach from twitter window */
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1315 detach_from_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1316
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1317 return TRUE;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1318 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1319
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1320 static void
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1321 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
1322 gconstpointer val, gpointer data)
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1323 {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1324 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
1325
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1326 if(enabled) {
40
e60e6cbdc4c4 - added is_twitter_account().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 39
diff changeset
1327 attach_to_window();
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1328 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1329 else {
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1330 detach_from_window();
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1331 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1332 }
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1333
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1334 static PurplePluginPrefFrame *
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1335 get_plugin_pref_frame(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1336 {
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
1337 /* create gtk elements for the plugin preferences */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1338 PurplePluginPref *pref;
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1339 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new();
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1340
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
1341 /************************/
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
1342 /* translatione heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1343 /************************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1344 pref = purple_plugin_pref_new_with_label("Translation Configurations");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1345 purple_plugin_pref_frame_add(frame, pref);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1346
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
1347 /* translation settings */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1348 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
1349 "Translate @username to link");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1350 purple_plugin_pref_frame_add(frame, pref);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1351
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1352 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
1353 "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
1354 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
1355
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1356
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
1357 /*************************/
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
1358 /* miscellaneous heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1359 /*************************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1360 pref = purple_plugin_pref_new_with_label("Miscellaneous Configurations");
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1361 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1362
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1363 /* escape pseudo command setting */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1364 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
1365 "Escape pseudo command string");
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1366 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
1367
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1368 /* show text counter */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1369 pref = purple_plugin_pref_new_with_name_and_label(OPT_COUNTER,
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1370 "Show text counter");
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1371 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1372
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1373 purple_prefs_connect_callback(plugin, OPT_COUNTER, counter_prefs_cb, NULL);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1374
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1375 /* suppress oops message */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1376 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
1377 "Suppress oops message");
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1378 purple_plugin_pref_frame_add(frame, pref);
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1379
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1380
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
1381 /*****************/
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
1382 /* sound heading */
ae1d059fa6fe added oops message suppression functionality. it discards oops message if a sent message is more than 140 bytes and less than 140 letters.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 35
diff changeset
1383 /*****************/
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1384 pref = purple_plugin_pref_new_with_label("Sound Configurations");
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1385 purple_plugin_pref_frame_add(frame, pref);
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1386
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
1387 /* sound settings for recipient */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1388 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
1389 "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
1390 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
1391
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
1392 /* recipient list */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1393 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
1394 "Recipient List");
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1395 purple_plugin_pref_frame_add(frame, pref);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
1396
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1397 /* sound id selector */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1398 pref =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1399 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
1400 "Recipient Sound");
9
c6b80f47d4df added capability to translate sender name into link
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 8
diff changeset
1401
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1402 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
1403 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
1404 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
1405 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1406 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1407 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
1408 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
1409 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
1410 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
1411 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
1412 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
1413 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
1414
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1415 purple_plugin_pref_frame_add(frame, pref);
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1416
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1417 /* sound setting for sender */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1418 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
1419 "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
1420 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
1421
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
1422 /* sender list */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1423 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
1424 "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
1425 purple_plugin_pref_frame_add(frame, pref);
1
799955af57ad alpha version
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 0
diff changeset
1426
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
1427 /* sound id selector */
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1428 pref =
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1429 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
1430 "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
1431
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1432 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
1433 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
1434 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
1435 purple_plugin_pref_add_choice(pref, "Receive", GINT_TO_POINTER(2));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1436 purple_plugin_pref_add_choice(pref, "Fist Receive", GINT_TO_POINTER(3));
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1437 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
1438 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
1439 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
1440 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
1441 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
1442 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
1443 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10));
11
7ea2a717af42 now sender list and sender sound can be set in independent of recipient settings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 10
diff changeset
1444
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1445 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
1446
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1447 /************************/
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1448 /* notification heading */
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1449 /************************/
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1450 pref = purple_plugin_pref_new_with_label("Notification Configuration");
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1451 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
1452
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1453 /* notification setting */
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1454 pref = purple_plugin_pref_new_with_name_and_label(OPT_PREVENT_NOTIFICATION,
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1455 "Prevent notifications of incoming messages");
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1456 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
1457
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1458
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1459 /* API based post */
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1460
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1461 pref = purple_plugin_pref_new_with_label("API Based Post");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1462 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1463
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1464 pref = purple_plugin_pref_new_with_name_and_label(OPT_API_BASE_POST,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1465 "Post Status with API");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1466 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1467
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1468 pref = purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1469 "Screen Name");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1470 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1471
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1472 pref = purple_plugin_pref_new_with_name_and_label(OPT_PASSWORD,
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1473 "Password");
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1474 purple_plugin_pref_set_masked(pref, TRUE);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1475
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1476 purple_plugin_pref_frame_add(frame, pref);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1477
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1478 return frame;
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1479 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1480
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1481 static PurplePluginUiInfo pref_info = {
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1482 get_plugin_pref_frame
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1483 };
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1484
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1485 static PurplePluginInfo info = {
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1486 PURPLE_PLUGIN_MAGIC,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1487 PURPLE_MAJOR_VERSION,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1488 PURPLE_MINOR_VERSION,
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1489 PURPLE_PLUGIN_STANDARD, /**< type */
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1490 NULL, /**< ui_req */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1491 0, /**< flags */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1492 NULL, /**< deps */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1493 PURPLE_PRIORITY_DEFAULT, /**< priority */
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1494 PLUGIN_ID, /**< id */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1495 "Pidgin-Twitter", /**< name */
76
63bd9ca28be0 - added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 74
diff changeset
1496 "0.7.0 alpha1", /**< version */
63bd9ca28be0 - added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 74
diff changeset
1497 "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
1498 "provides useful features for twitter", /** desc */
63bd9ca28be0 - added nosuke and iratqq to the authors.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 74
diff changeset
1499 "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, \nthe pidging-twitter team", /**< author */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1500 "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
1501 load_plugin, /**< load */
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1502 unload_plugin, /**< unload */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1503 NULL, /**< destroy */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1504 NULL, /**< ui_info */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1505 NULL, /**< extra_info */
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1506 &pref_info, /**< pref info */
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1507 NULL
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1508 };
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1509
8
2c7c9eb4cdda added soundid selector
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 7
diff changeset
1510 static void
38
625e385036c3 applied indent to fix indentations
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 37
diff changeset
1511 init_plugin(PurplePlugin *plugin)
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1512 {
64
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1513 char *dirname = NULL;
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1514
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1515 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
1516 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
1517 if(dirname)
da37857f3033 - separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 63
diff changeset
1518 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
1519 g_free(dirname);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1520
6
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1521 /* add plugin preferences */
ca8f95431962 fixed indentation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 5
diff changeset
1522 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
1523 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
1524 purple_prefs_add_bool(OPT_TRANSLATE_SENDER, TRUE);
19
0d7cbc984570 escape pseudo command feature has been added
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 16
diff changeset
1525 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
1526
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
1527 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
1528 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
1529 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
1530 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
1531 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
1532 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST);
31
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1533
312a745dece6 added letter counter
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 30
diff changeset
1534 purple_prefs_add_bool(OPT_COUNTER, TRUE);
37
bafe2abf2d3b - made suppress oops configurable
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 36
diff changeset
1535 purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE);
59
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1536
3f9148c1dc60 added that to prevent notifications of incoming messages from twitter.com.
mikanbako <maoutwo@gmail.com>
parents: 56
diff changeset
1537 purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE);
72
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1538
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1539 purple_prefs_add_bool(OPT_API_BASE_POST, FALSE);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1540 purple_prefs_add_string(OPT_SCREEN_NAME, EMPTY);
af4f31bce461 Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents: 71
diff changeset
1541 purple_prefs_add_string(OPT_PASSWORD, EMPTY);
0
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1542 }
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1543
2413369d1b01 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1544 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)