Mercurial > pidgin-twitter
annotate pidgin-twitter.h @ 128:249174fdd63d
minor fixes.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 21 Jul 2008 11:42:06 +0900 |
parents | f0305c387d32 |
children | 9e80267fe566 |
rev | line source |
---|---|
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
1 #ifndef _PIDGIN_TWITTER_H_ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
2 #define _PIDGIN_TWITTER_H_ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
3 |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
119
diff
changeset
|
4 #define _BSD_SOURCE |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
5 #define _XOPEN_SOURCE 600 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
6 #include <stdio.h> |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
7 #include <stdlib.h> |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
8 #include <string.h> |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
9 #include <glib.h> |
66
0ddcba9161fd
now local icon cache works
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
65
diff
changeset
|
10 #include <sys/stat.h> |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
11 #include <time.h> |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
12 #include <locale.h> |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
13 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
14 #include <gdk-pixbuf/gdk-pixbuf.h> |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
15 #include <libxml/xmlreader.h> |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
16 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
17 #include "gtkplugin.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
18 #include "util.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
19 #include "debug.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
20 #include "connection.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
21 #include "version.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
22 #include "sound.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
23 #include "gtkconv.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
24 #include "gtkimhtml.h" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
25 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
26 /* regp id */ |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
27 enum { |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
28 RECIPIENT = 0, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
29 SENDER, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
30 COMMAND, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
31 PSEUDO, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
32 USER, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
33 USER_FIRST_LINE, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
34 USER_FORMATTED, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
35 CHANNEL, |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
36 IMAGE_IDENTICA |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
37 }; |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
38 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
39 /* service id */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
40 enum { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
41 unknown_service = 0, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
42 twitter_service, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
43 wassr_service, |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
44 identica_service |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
45 }; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
46 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
47 /* container to hold icon data */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
48 typedef struct _icon_data { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
49 gint icon_id; // image id |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
50 gboolean requested; // TRUE if download icon has been requested |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
51 GList *request_list; // marker list |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
52 PurpleUtilFetchUrlData *fetch_data; // icon fetch data |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
53 } icon_data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
54 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
55 /* used by got_icon_cb */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
56 typedef struct _got_icon_data { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
57 gchar *user_name; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
58 gint service; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
59 } got_icon_data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
60 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
61 /* used by eval */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
62 typedef struct _eval_data { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
63 gint which; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
64 gint service; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
65 } eval_data; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
66 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
67 /* container for api based retrieve */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
68 typedef struct _status { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
69 gchar *created_at; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
70 gchar *text; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
71 gchar *screen_name; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
72 gchar *profile_image_url; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
73 time_t time; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
74 guint id; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
75 } status_t; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
76 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
77 /* container for api based post */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
78 typedef struct twitter_message { |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
79 PurpleAccount *account; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
80 char *status; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
81 time_t time; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
82 } twitter_message_t; |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
83 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
84 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
85 #define PLUGIN_ID "gtk-honeyplanet-pidgin_twitter" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
86 #define PLUGIN_NAME "pidgin-twitter" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
87 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
88 /* options */ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
89 #define OPT_PIDGINTWITTER "/plugins/pidgin_twitter" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
90 #define OPT_TRANSLATE_RECIPIENT OPT_PIDGINTWITTER "/translate_recipient" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
91 #define OPT_TRANSLATE_SENDER OPT_PIDGINTWITTER "/translate_sender" |
97
24ad534e438e
linkfy #channelname per user configuration.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
95
diff
changeset
|
92 #define OPT_TRANSLATE_CHANNEL OPT_PIDGINTWITTER "/translate_channel" |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
93 #define OPT_PLAYSOUND_RECIPIENT OPT_PIDGINTWITTER "/playsound_recipient" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
94 #define OPT_PLAYSOUND_SENDER OPT_PIDGINTWITTER "/playsound_sender" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
95 #define OPT_SOUNDID_RECIPIENT OPT_PIDGINTWITTER "/soundid_recipient" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
96 #define OPT_SOUNDID_SENDER OPT_PIDGINTWITTER "/soundid_sender" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
97 #define OPT_ESCAPE_PSEUDO OPT_PIDGINTWITTER "/escape_pseudo" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
98 #define OPT_USERLIST_RECIPIENT OPT_PIDGINTWITTER "/userlist_recipient" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
99 #define OPT_USERLIST_SENDER OPT_PIDGINTWITTER "/userlist_sender" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
100 #define OPT_COUNTER OPT_PIDGINTWITTER "/counter" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
101 #define OPT_SUPPRESS_OOPS OPT_PIDGINTWITTER "/suppress_oops" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
102 #define OPT_PREVENT_NOTIFICATION OPT_PIDGINTWITTER "/prevent_notification" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
103 #define OPT_ICON_DIR OPT_PIDGINTWITTER "/icon_dir" |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
69
diff
changeset
|
104 #define OPT_API_BASE_POST OPT_PIDGINTWITTER "/api_base_post" |
110
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
107
diff
changeset
|
105 #define OPT_SCREEN_NAME_TWITTER OPT_PIDGINTWITTER "/screen_name_twitter" |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
107
diff
changeset
|
106 #define OPT_SCREEN_NAME_WASSR OPT_PIDGINTWITTER "/screen_name_wassr" |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
107
diff
changeset
|
107 #define OPT_SCREEN_NAME_IDENTICA OPT_PIDGINTWITTER "/screen_name_identica" |
8b98a26f44ce
made screen name for each service configurable.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
107
diff
changeset
|
108 #define OPT_PASSWORD_TWITTER OPT_PIDGINTWITTER "/password_twitter" |
99
f207cc8da6cd
quick hack to make show icon configurable
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
109 #define OPT_SHOW_ICON OPT_PIDGINTWITTER "/show_icon" |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
105
diff
changeset
|
110 #define OPT_ICON_SIZE OPT_PIDGINTWITTER "/icon_size" |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
111 #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval" |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
112 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
113 /* formats and templates */ |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
114 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>" |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
115 #define SENDER_FORMAT_TWITTER "%s<a href='http://twitter.com/%s'>%s</a>: " |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
80
diff
changeset
|
116 #define RECIPIENT_FORMAT_WASSR "@<a href='http://wassr.jp/user/%s'>%s</a>" |
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
80
diff
changeset
|
117 #define SENDER_FORMAT_WASSR "%s<a href='http://wassr.jp/user/%s'>%s</a>: " |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
118 #define RECIPIENT_FORMAT_IDENTICA "@<a href='http://identi.ca/%s'>%s</a>" |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
119 #define SENDER_FORMAT_IDENTICA "%s<a href='http://identi.ca/%s'>%s</a>: " |
98
e460e1978ca3
- fixed a bug introduced in r97.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
97
diff
changeset
|
120 #define CHANNEL_FORMAT_WASSR "%s<a href='http://wassr.jp/channel/%s'>%s</a> " |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
121 #define DEFAULT_LIST "(list of users: separated with ' ,:;')" |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
122 #define OOPS_MESSAGE "<body>Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).<BR></body>" |
72
af4f31bce461
Support API base message posting
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
69
diff
changeset
|
123 #define EMPTY "" |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
124 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
125 /* patterns */ |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
126 #define P_RECIPIENT "@([A-Za-z0-9_]+)" |
122
a37dd74c8355
- adapted to identi.ca changes.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
119
diff
changeset
|
127 #define P_SENDER "^(\\r?\\n?)\\s*([A-Za-z0-9_]+): " |
103
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
128 #define P_COMMAND "^(?:\\s*)([dDfFgGlLmMnNtTwW]{1}\\s+[A-Za-z0-9_]+)(?:\\s*\\Z)" |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
129 #define P_PSEUDO "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)" |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
130 #define P_USER "^\\(.+?\\)\\s*([A-Za-z0-9_]+):" |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
131 #define P_USER_FIRST_LINE "^\\(.+?\\)\\s*.+:\\s*([A-Za-z0-9_]+):" |
8de54d420328
added preliminary identi.ca icon support.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
99
diff
changeset
|
132 #define P_USER_FORMATTED "^.*?<a .+?>([A-Za-z0-9_]+)</a>:" |
114
48bfe86ff990
fix a bug that linkfy channel name does not work if msn style is turned on.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
110
diff
changeset
|
133 #define P_CHANNEL "^(.*?<a .+?>[A-Za-z0-9_]+</a>: \\r?\\n?#)([A-Za-z0-9_]+) " |
105
9147ff70d2e2
eased the pattern for identi.ca icon
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
103
diff
changeset
|
134 #define P_IMAGE_IDENTICA "<img src=\"(http://avatar.identi.ca/[A-Za-z0-9-.]+)\" class=\"avatar profile\" width=\"96\" height=\"96\" alt=\"[A-Za-z0-0_]+\"/>" |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
135 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
136 /* twitter API specific macros */ |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
137 #define TWITTER_BASE_URL "http://twitter.com" |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
138 #define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml HTTP/1.0\r\n" \ |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
139 "Host: twitter.com\r\n" \ |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
140 "User-Agent: Pidgin-Twitter\r\n" \ |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
141 "Authorization: Basic %s\r\n" |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
142 #define TWITTER_STATUS_POST "POST /statuses/update.xml HTTP/1.0\r\n" \ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
143 "Host: twitter.com\r\n" \ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
144 "User-Agent: Pidgin-Twitter\r\n" \ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
145 "Authorization: Basic %s\r\n" \ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
146 "Content-Length: %d\r\n\r\n" |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
147 #define TWITTER_STATUS_FORMAT "status=%s" |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
148 #define TWITTER_STATUS_TERMINATOR "\r\n\r\n" |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
149 #define TWITTER_DEFAULT_INTERVAL 60 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
150 |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
151 /* wassr specific macros */ |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
152 #define WASSR_POST_LEN (255 * 4) |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
153 |
124
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
154 /* misc macros */ |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
155 #define DEFAULT_ICON_SIZE 48 |
ec861f8a2268
- added new pref value for API based fetch interval.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
122
diff
changeset
|
156 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
157 /* debug macros */ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
158 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
159 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
160 |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
161 /* prototypes */ |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
162 static void escape(gchar **str); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
163 static gboolean sending_im_cb(PurpleAccount *account, char *recipient, char **buffer, void *data); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
164 static gboolean eval(const GMatchInfo *match_info, GString *result, gpointer user_data); |
86 | 165 static void translate(gchar **str, gint which, gint service); |
166 static void playsound(gchar **str, gint which); | |
91
2b7ef3538cd3
- Fix type of 'flag' of writing_im_cb
Konosuke Watanabe <sasugaanija@gmail.com>
parents:
85
diff
changeset
|
167 static gboolean writing_im_cb(PurpleAccount *account, char *sender, char **buffer, PurpleConversation *conv, int flags, void *data); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
168 static void insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, gchar *new_text, gint new_text_length, gpointer user_data); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
169 static void delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, GtkTextIter *end_pos, gpointer user_data); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
170 static void detach_from_window(void); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
80
diff
changeset
|
171 static void detach_from_conv(PurpleConversation *conv, gpointer null); |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
82
diff
changeset
|
172 static void delete_requested_icon_marks(PidginConversation *gtkconv, GHashTable *table); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
173 static void attach_to_window(void); |
82
c9600d64781a
work in progress adaptation to wassr service. cleanups required:
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
80
diff
changeset
|
174 static void attach_to_conv(PurpleConversation *conv, gpointer null); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
175 static gboolean is_twitter_account(PurpleAccount *account, const char *name); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
176 static gboolean is_twitter_conv(PurpleConversation *conv); |
74
6b9593d1ffed
quick hack to suppress annoying completion message from wassr.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
72
diff
changeset
|
177 static gboolean 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:
72
diff
changeset
|
178 static gboolean is_wassr_conv(PurpleConversation *conv); |
95
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
179 static gboolean is_identica_account(PurpleAccount *account, const char *name); |
ab612180e7d0
- added identica support. linkfy and character counter work. icon support has not implemented yet.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
94
diff
changeset
|
180 static gboolean is_identica_conv(PurpleConversation *conv); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
181 static void conv_created_cb(PurpleConversation *conv, gpointer null); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
182 static void deleting_conv_cb(PurpleConversation *conv); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
183 static gboolean receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void *data); |
84
0c1f63882b8a
preliminary wassr icon support. not yet completed.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
82
diff
changeset
|
184 static void insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data); |
86 | 185 static void insert_requested_icon(const gchar *user_name, gint service); |
65
4949d4eb34ec
- revised store icon feature
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
64
diff
changeset
|
186 static void got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); |
86 | 187 static void request_icon(const char *user_name, gint service); |
188 static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service); | |
94
31cddb2c2acc
fix icon position when the displaying message contains new line character. try 1.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
92
diff
changeset
|
189 static gboolean displaying_im_cb(PurpleAccount *account, const char *who, char **message, PurpleConversation *conv, PurpleMessageFlags flags, void *data); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
190 static void displayed_im_cb(PurpleAccount *account, const char *who, char *message, PurpleConversation *conv, PurpleMessageFlags flags); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
191 static gboolean load_plugin(PurplePlugin *plugin); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
192 static gboolean unload_plugin(PurplePlugin *plugin); |
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
193 static void counter_prefs_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data); |
128 | 194 //static PurplePluginPrefFrame *get_plugin_pref_frame(PurplePlugin *plugin); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
195 static void init_plugin(PurplePlugin *plugin); |
80
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
78
diff
changeset
|
196 static void remove_marks_func(gpointer key, gpointer value, gpointer user_data); |
e0bf37c105eb
work in progress one hash table code:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
78
diff
changeset
|
197 static void cancel_fetch_func(gpointer key, gpointer value, gpointer user_data); |
85
fb9831fae969
- fixed the bug that icons didn't appear correctly for wassr conversation.
Yoshiki Yazawa <yaz@honeyplnaet.jp>
parents:
84
diff
changeset
|
198 static gint get_service_type(PurpleConversation *conv); |
107
eb77d409c235
- do neither save nor cache icon image if pixbuf can not be obtained.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
105
diff
changeset
|
199 static GdkPixbuf *make_scaled_pixbuf(const gchar *url_text, gsize len); |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
200 |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
201 static void parse_user(xmlNode *user, status_t *st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
202 static void parse_status(xmlNode *status, status_t *st); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
203 static void get_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
204 static gboolean get_status_with_api(gpointer data); |
125
f0305c387d32
replaced troublesome strptime() with our own function read_timestamp().
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
124
diff
changeset
|
205 static void read_timestamp(const char *str, struct tm *res); |
119
0c4a83f734cd
- duplication avoidance for the posted messages has been implemented.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
114
diff
changeset
|
206 |
64
da37857f3033
- separated header things into pidgin-twitter.h
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff
changeset
|
207 #endif |