Wed, 25 Apr 2007 00:56:13 +0000
Move the prpl icon checksum code into the core, so we can delete the
checksum if the cache file disappears.
See ticket #223
| 6513 | 1 | /** |
| 2 | * @file yahoo.h The Yahoo! protocol plugin | |
| 3 | * | |
| 15884 | 4 | * purple |
| 6513 | 5 | * |
| 15884 | 6 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 8 | * source distribution. | |
| 6513 | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | |
| 11 | * it under the terms of the GNU General Public License as published by | |
| 12 | * the Free Software Foundation; either version 2 of the License, or | |
| 13 | * (at your option) any later version. | |
| 14 | * | |
| 15 | * This program is distributed in the hope that it will be useful, | |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | * GNU General Public License for more details. | |
| 19 | * | |
| 20 | * You should have received a copy of the GNU General Public License | |
| 21 | * along with this program; if not, write to the Free Software | |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | */ | |
| 24 | ||
| 25 | #ifndef _YAHOO_H_ | |
| 26 | #define _YAHOO_H_ | |
| 27 | ||
|
14013
86dac5633bd9
[gaim-migrate @ 16496]
Mark Doliner <markdoliner@pidgin.im>
parents:
13851
diff
changeset
|
28 | #include "circbuffer.h" |
| 6784 | 29 | #include "prpl.h" |
| 30 | ||
| 7883 | 31 | #define YAHOO_PAGER_HOST "scs.msg.yahoo.com" |
| 7827 | 32 | #define YAHOO_PAGER_PORT 5050 |
| 33 | #define YAHOO_PROFILE_URL "http://profiles.yahoo.com/" | |
|
13689
70b7618b1916
[gaim-migrate @ 16090]
Richard Laager <rlaager@pidgin.im>
parents:
13201
diff
changeset
|
34 | #define YAHOO_MAIL_URL "https://login.yahoo.com/config/login?.src=ym" |
| 7651 | 35 | #define YAHOO_XFER_HOST "filetransfer.msg.yahoo.com" |
| 36 | #define YAHOO_XFER_PORT 80 | |
| 8113 | 37 | #define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/" |
|
11160
c216000381d7
[gaim-migrate @ 13248]
Daniel Atallah <datallah@pidgin.im>
parents:
11046
diff
changeset
|
38 | #define YAHOO_ROOMLIST_LOCALE "us" |
| 9164 | 39 | /* really we should get the list of servers from |
| 40 | http://update.messenger.yahoo.co.jp/servers.html */ | |
| 41 | #define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp" | |
| 9221 | 42 | #define YAHOOJP_PROFILE_URL "http://profiles.yahoo.co.jp/" |
| 43 | #define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/" | |
| 9164 | 44 | #define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" |
| 45 | #define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" | |
| 46 | ||
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12323
diff
changeset
|
47 | #define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud" |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12323
diff
changeset
|
48 | |
| 7134 | 49 | #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" |
| 50 | ||
| 9306 | 51 | #define YAHOO_PICURL_SETTING "picture_url" |
| 52 | #define YAHOO_PICCKSUM_SETTING "picture_checksum" | |
| 53 | #define YAHOO_PICEXPIRE_SETTING "picture_expire" | |
| 54 | ||
| 10373 | 55 | #define YAHOO_STATUS_TYPE_OFFLINE "offline" |
| 56 | #define YAHOO_STATUS_TYPE_AVAILABLE "available" | |
| 57 | #define YAHOO_STATUS_TYPE_BRB "brb" | |
| 58 | #define YAHOO_STATUS_TYPE_BUSY "busy" | |
| 59 | #define YAHOO_STATUS_TYPE_NOTATHOME "notathome" | |
| 60 | #define YAHOO_STATUS_TYPE_NOTATDESK "notatdesk" | |
| 61 | #define YAHOO_STATUS_TYPE_NOTINOFFICE "notinoffice" | |
| 62 | #define YAHOO_STATUS_TYPE_ONPHONE "onphone" | |
| 63 | #define YAHOO_STATUS_TYPE_ONVACATION "onvacation" | |
| 64 | #define YAHOO_STATUS_TYPE_OUTTOLUNCH "outtolunch" | |
| 65 | #define YAHOO_STATUS_TYPE_STEPPEDOUT "steppedout" | |
| 66 | #define YAHOO_STATUS_TYPE_AWAY "away" | |
| 67 | #define YAHOO_STATUS_TYPE_INVISIBLE "invisible" | |
| 15589 | 68 | #define YAHOO_STATUS_TYPE_MOBILE "mobile" |
| 10373 | 69 | |
| 6729 | 70 | enum yahoo_status { |
| 71 | YAHOO_STATUS_AVAILABLE = 0, | |
| 72 | YAHOO_STATUS_BRB, | |
| 73 | YAHOO_STATUS_BUSY, | |
| 74 | YAHOO_STATUS_NOTATHOME, | |
| 75 | YAHOO_STATUS_NOTATDESK, | |
| 76 | YAHOO_STATUS_NOTINOFFICE, | |
| 77 | YAHOO_STATUS_ONPHONE, | |
| 78 | YAHOO_STATUS_ONVACATION, | |
| 79 | YAHOO_STATUS_OUTTOLUNCH, | |
| 80 | YAHOO_STATUS_STEPPEDOUT, | |
| 81 | YAHOO_STATUS_INVISIBLE = 12, | |
| 82 | YAHOO_STATUS_CUSTOM = 99, | |
| 83 | YAHOO_STATUS_IDLE = 999, | |
| 7134 | 84 | YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, |
| 6729 | 85 | YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ |
| 86 | YAHOO_STATUS_TYPING = 0x16 | |
| 87 | }; | |
| 88 | ||
| 9306 | 89 | struct yahoo_buddy_icon_upload_data { |
| 15884 | 90 | PurpleConnection *gc; |
| 9306 | 91 | GString *str; |
| 92 | char *filename; | |
| 93 | int pos; | |
| 94 | int fd; | |
| 95 | guint watcher; | |
| 96 | }; | |
| 97 | ||
| 9376 | 98 | struct _YchtConn; |
| 99 | ||
| 6729 | 100 | struct yahoo_data { |
| 15884 | 101 | PurpleConnection *gc; |
| 6729 | 102 | int fd; |
| 103 | guchar *rxqueue; | |
| 104 | int rxlen; | |
| 15884 | 105 | PurpleCircBuffer *txbuf; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
106 | guint txhandler; |
| 6784 | 107 | GHashTable *friends; |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
108 | |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
109 | /** |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
110 | * This is used to keep track of the IMVironment chosen |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
111 | * by people you talk to. We don't do very much with |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
112 | * this right now... but at least now if the remote user |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
113 | * selects an IMVironment we won't reset it back to the |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
114 | * default of nothing. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
115 | */ |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
116 | GHashTable *imvironments; |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13689
diff
changeset
|
117 | |
| 6729 | 118 | int current_status; |
| 119 | gboolean logged_in; | |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11970
diff
changeset
|
120 | GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; |
| 6729 | 121 | GSList *confs; |
| 122 | unsigned int conf_id; /* just a counter */ | |
| 123 | gboolean chat_online; | |
| 124 | gboolean in_chat; | |
| 125 | char *chat_name; | |
| 7134 | 126 | char *auth; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
127 | gsize auth_written; |
| 7651 | 128 | char *cookie_y; |
| 129 | char *cookie_t; | |
| 130 | int session_id; | |
| 9164 | 131 | gboolean jp; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10937
diff
changeset
|
132 | gboolean wm; /* connected w/ web messenger method */ |
| 9306 | 133 | /* picture aka buddy icon stuff */ |
| 134 | char *picture_url; | |
| 135 | int picture_checksum; | |
| 136 | ||
| 137 | /* ew. we have to check the icon before we connect, | |
| 138 | * but can't upload it til we're connected. */ | |
| 139 | struct yahoo_buddy_icon_upload_data *picture_upload_todo; | |
| 15884 | 140 | PurpleProxyConnectData *buddy_icon_connect_data; |
| 9376 | 141 | |
| 142 | struct _YchtConn *ycht; | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
143 | |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
144 | /** |
| 15884 | 145 | * This linked list contains PurpleUtilFetchUrlData structs |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
146 | * for when we lookup people profile or photo information. |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
147 | */ |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
148 | GSList *url_datas; |
| 6729 | 149 | }; |
| 150 | ||
| 9603 | 151 | #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) |
| 6847 | 152 | |
| 7651 | 153 | /* sometimes i wish prpls could #include things from other prpls. then i could just |
| 154 | * use the routines from libfaim and not have to admit to knowing how they work. */ | |
| 155 | #define yahoo_put16(buf, data) ( \ | |
| 156 | (*(buf) = (unsigned char)((data)>>8)&0xff), \ | |
| 157 | (*((buf)+1) = (unsigned char)(data)&0xff), \ | |
| 158 | 2) | |
| 159 | #define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) | |
| 160 | #define yahoo_put32(buf, data) ( \ | |
| 161 | (*((buf)) = (unsigned char)((data)>>24)&0xff), \ | |
| 162 | (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ | |
| 163 | (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ | |
| 164 | (*((buf)+3) = (unsigned char)(data)&0xff), \ | |
| 165 | 4) | |
| 166 | #define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \ | |
| 167 | (((*((buf)+1))<<16)&0x00ff0000) + \ | |
| 168 | (((*((buf)+2))<< 8)&0x0000ff00) + \ | |
| 169 | (((*((buf)+3) )&0x000000ff))) | |
| 170 | ||
| 6729 | 171 | /* util.c */ |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12203
diff
changeset
|
172 | void yahoo_init_colorht(void); |
|
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12203
diff
changeset
|
173 | void yahoo_dest_colorht(void); |
| 6629 | 174 | char *yahoo_codes_to_html(const char *x); |
| 175 | char *yahoo_html_to_codes(const char *src); | |
| 6513 | 176 | |
| 7827 | 177 | /** |
| 178 | * Encode some text to send to the yahoo server. | |
| 179 | * | |
| 180 | * @param gc The connection handle. | |
| 181 | * @param str The null terminated utf8 string to encode. | |
| 182 | * @param utf8 If not @c NULL, whether utf8 is okay or not. | |
| 183 | * Even if it is okay, we may not use it. If we | |
| 184 | * used it, we set this to @c TRUE, else to | |
| 185 | * @c FALSE. If @c NULL, false is assumed, and | |
| 186 | * it is not dereferenced. | |
| 187 | * @return The g_malloced string in the appropriate encoding. | |
| 188 | */ | |
| 15884 | 189 | char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8); |
| 7827 | 190 | |
| 191 | /** | |
| 192 | * Decode some text received from the server. | |
| 193 | * | |
| 194 | * @param gc The gc handle. | |
| 195 | * @param str The null terminated string to decode. | |
| 196 | * @param utf8 Did the server tell us it was supposed to be utf8? | |
| 197 | * @return The decoded, utf-8 string, which must be g_free()'d. | |
| 198 | */ | |
| 15884 | 199 | char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8); |
| 7827 | 200 | |
| 9220 | 201 | /* previously-static functions, now needed for yahoo_profile.c */ |
| 15884 | 202 | void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); |
| 9220 | 203 | |
| 9161 | 204 | /* yahoo_profile.c */ |
| 15884 | 205 | void yahoo_get_info(PurpleConnection *gc, const char *name); |
| 9161 | 206 | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
207 | /** |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
208 | * Check to see whether the sender is permitted to send |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
209 | * |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
210 | * @param gc The gc handle. |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
211 | * @param who The sender of the packet to check |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
212 | */ |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
213 | gboolean yahoo_privacy_check |
| 15884 | 214 | (PurpleConnection *gc, const char *who); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
215 | |
| 6513 | 216 | #endif /* _YAHOO_H_ */ |