Thu, 30 Jun 2005 05:33:05 +0000
[gaim-migrate @ 12957]
Patch #1210242 from Bleeter
"Following on from patch 941731, I've updated for both head and oldstatus. I couldn't submit the patches there, so I've opened this so I can do so here.
As noted in the other tracker entry, I have some testing to do on all known locales so the FAQ can be updated accordingly. I'll submit patches once I've done this check."
committer: Richard Laager <rlaager@pidgin.im>
| 6513 | 1 | /** |
| 2 | * @file yahoo.h The Yahoo! protocol plugin | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 8046 | 6 | * Gaim is the legal property of its developers, whose names are too numerous |
| 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 | ||
| 6784 | 28 | #include "prpl.h" |
| 29 | ||
| 7883 | 30 | #define YAHOO_PAGER_HOST "scs.msg.yahoo.com" |
| 7827 | 31 | #define YAHOO_PAGER_PORT 5050 |
| 32 | #define YAHOO_PROFILE_URL "http://profiles.yahoo.com/" | |
| 9221 | 33 | #define YAHOO_MAIL_URL "http://mail.yahoo.com/" |
| 7651 | 34 | #define YAHOO_XFER_HOST "filetransfer.msg.yahoo.com" |
| 35 | #define YAHOO_XFER_PORT 80 | |
| 8113 | 36 | #define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/" |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10989
diff
changeset
|
37 | #define YAHOO_ROOMLIST_LOCALE "" |
| 9164 | 38 | /* really we should get the list of servers from |
| 39 | http://update.messenger.yahoo.co.jp/servers.html */ | |
| 40 | #define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp" | |
| 9221 | 41 | #define YAHOOJP_PROFILE_URL "http://profiles.yahoo.co.jp/" |
| 42 | #define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/" | |
| 9164 | 43 | #define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" |
| 44 | #define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" | |
| 45 | ||
| 7134 | 46 | #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" |
| 47 | ||
| 9306 | 48 | #define YAHOO_ICON_CHECKSUM_KEY "icon_checksum" |
| 49 | #define YAHOO_PICURL_SETTING "picture_url" | |
| 50 | #define YAHOO_PICCKSUM_SETTING "picture_checksum" | |
| 51 | #define YAHOO_PICEXPIRE_SETTING "picture_expire" | |
| 52 | ||
| 10392 | 53 | |
| 6513 | 54 | |
| 10373 | 55 | #define YAHOO_STATUS_TYPE_OFFLINE "offline" |
| 56 | #define YAHOO_STATUS_TYPE_ONLINE "online" | |
| 57 | #define YAHOO_STATUS_TYPE_AVAILABLE "available" | |
| 58 | #define YAHOO_STATUS_TYPE_AVAILABLE_WM "available-wm" | |
| 59 | #define YAHOO_STATUS_TYPE_BRB "brb" | |
| 60 | #define YAHOO_STATUS_TYPE_BUSY "busy" | |
| 61 | #define YAHOO_STATUS_TYPE_NOTATHOME "notathome" | |
| 62 | #define YAHOO_STATUS_TYPE_NOTATDESK "notatdesk" | |
| 63 | #define YAHOO_STATUS_TYPE_NOTINOFFICE "notinoffice" | |
| 64 | #define YAHOO_STATUS_TYPE_ONPHONE "onphone" | |
| 65 | #define YAHOO_STATUS_TYPE_ONVACATION "onvacation" | |
| 66 | #define YAHOO_STATUS_TYPE_OUTTOLUNCH "outtolunch" | |
| 67 | #define YAHOO_STATUS_TYPE_STEPPEDOUT "steppedout" | |
| 68 | #define YAHOO_STATUS_TYPE_AWAY "away" | |
| 69 | #define YAHOO_STATUS_TYPE_INVISIBLE "invisible" | |
| 70 | ||
| 6729 | 71 | enum yahoo_status { |
| 72 | YAHOO_STATUS_AVAILABLE = 0, | |
| 73 | YAHOO_STATUS_BRB, | |
| 74 | YAHOO_STATUS_BUSY, | |
| 75 | YAHOO_STATUS_NOTATHOME, | |
| 76 | YAHOO_STATUS_NOTATDESK, | |
| 77 | YAHOO_STATUS_NOTINOFFICE, | |
| 78 | YAHOO_STATUS_ONPHONE, | |
| 79 | YAHOO_STATUS_ONVACATION, | |
| 80 | YAHOO_STATUS_OUTTOLUNCH, | |
| 81 | YAHOO_STATUS_STEPPEDOUT, | |
| 82 | YAHOO_STATUS_INVISIBLE = 12, | |
| 83 | YAHOO_STATUS_CUSTOM = 99, | |
| 84 | YAHOO_STATUS_IDLE = 999, | |
| 7134 | 85 | YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, |
| 6729 | 86 | YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ |
| 87 | YAHOO_STATUS_TYPING = 0x16 | |
| 88 | }; | |
| 89 | ||
| 9306 | 90 | struct yahoo_buddy_icon_upload_data { |
| 91 | GaimConnection *gc; | |
| 92 | GString *str; | |
| 93 | char *filename; | |
| 94 | int pos; | |
| 95 | int fd; | |
| 96 | guint watcher; | |
| 97 | }; | |
| 98 | ||
| 9376 | 99 | struct _YchtConn; |
| 100 | ||
| 6729 | 101 | struct yahoo_data { |
| 102 | int fd; | |
| 103 | guchar *rxqueue; | |
| 104 | int rxlen; | |
| 6784 | 105 | GHashTable *friends; |
| 6729 | 106 | int current_status; |
| 107 | gboolean logged_in; | |
| 6784 | 108 | GString *tmp_serv_blist, *tmp_serv_ilist; |
| 6729 | 109 | GSList *confs; |
| 110 | unsigned int conf_id; /* just a counter */ | |
| 111 | gboolean chat_online; | |
| 112 | gboolean in_chat; | |
| 113 | char *chat_name; | |
| 7134 | 114 | char *auth; |
| 7651 | 115 | char *cookie_y; |
| 116 | char *cookie_t; | |
| 117 | int session_id; | |
| 9164 | 118 | gboolean jp; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10937
diff
changeset
|
119 | gboolean wm; /* connected w/ web messenger method */ |
| 9306 | 120 | /* picture aka buddy icon stuff */ |
| 121 | char *picture_url; | |
| 122 | int picture_checksum; | |
| 123 | ||
| 124 | /* ew. we have to check the icon before we connect, | |
| 125 | * but can't upload it til we're connected. */ | |
| 126 | struct yahoo_buddy_icon_upload_data *picture_upload_todo; | |
| 9376 | 127 | |
| 128 | struct _YchtConn *ycht; | |
| 6729 | 129 | }; |
| 130 | ||
| 6784 | 131 | |
| 9603 | 132 | #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) |
| 6847 | 133 | |
| 9371 | 134 | |
| 7651 | 135 | /* sometimes i wish prpls could #include things from other prpls. then i could just |
| 136 | * use the routines from libfaim and not have to admit to knowing how they work. */ | |
| 137 | #define yahoo_put16(buf, data) ( \ | |
| 138 | (*(buf) = (unsigned char)((data)>>8)&0xff), \ | |
| 139 | (*((buf)+1) = (unsigned char)(data)&0xff), \ | |
| 140 | 2) | |
| 141 | #define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) | |
| 142 | #define yahoo_put32(buf, data) ( \ | |
| 143 | (*((buf)) = (unsigned char)((data)>>24)&0xff), \ | |
| 144 | (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ | |
| 145 | (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ | |
| 146 | (*((buf)+3) = (unsigned char)(data)&0xff), \ | |
| 147 | 4) | |
| 148 | #define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \ | |
| 149 | (((*((buf)+1))<<16)&0x00ff0000) + \ | |
| 150 | (((*((buf)+2))<< 8)&0x0000ff00) + \ | |
| 151 | (((*((buf)+3) )&0x000000ff))) | |
| 152 | ||
| 153 | ||
| 6729 | 154 | |
| 155 | /* util.c */ | |
| 6513 | 156 | void yahoo_init_colorht(); |
| 157 | void yahoo_dest_colorht(); | |
| 6629 | 158 | char *yahoo_codes_to_html(const char *x); |
| 159 | char *yahoo_html_to_codes(const char *src); | |
| 6513 | 160 | |
| 7827 | 161 | /** |
| 162 | * Encode some text to send to the yahoo server. | |
| 163 | * | |
| 164 | * @param gc The connection handle. | |
| 165 | * @param str The null terminated utf8 string to encode. | |
| 166 | * @param utf8 If not @c NULL, whether utf8 is okay or not. | |
| 167 | * Even if it is okay, we may not use it. If we | |
| 168 | * used it, we set this to @c TRUE, else to | |
| 169 | * @c FALSE. If @c NULL, false is assumed, and | |
| 170 | * it is not dereferenced. | |
| 171 | * @return The g_malloced string in the appropriate encoding. | |
| 172 | */ | |
| 173 | char *yahoo_string_encode(GaimConnection *gc, const char *str, gboolean *utf8); | |
| 174 | ||
| 175 | /** | |
| 176 | * Decode some text received from the server. | |
| 177 | * | |
| 178 | * @param gc The gc handle. | |
| 179 | * @param str The null terminated string to decode. | |
| 180 | * @param utf8 Did the server tell us it was supposed to be utf8? | |
| 181 | * @return The decoded, utf-8 string, which must be g_free()'d. | |
| 182 | */ | |
| 183 | char *yahoo_string_decode(GaimConnection *gc, const char *str, gboolean utf8); | |
| 184 | ||
| 9220 | 185 | /* previously-static functions, now needed for yahoo_profile.c */ |
| 186 | char *yahoo_tooltip_text(GaimBuddy *b); | |
| 187 | ||
| 9161 | 188 | /* yahoo_profile.c */ |
| 189 | void yahoo_get_info(GaimConnection *gc, const char *name); | |
| 190 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
191 | /** |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
192 | * Check to see whether the sender is permitted to send |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
193 | * |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
194 | * @param gc The gc handle. |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
195 | * @param who The sender of the packet to check |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
196 | */ |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
197 | gboolean yahoo_privacy_check |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
198 | (GaimConnection *gc, const char *who); |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10392
diff
changeset
|
199 | |
| 6513 | 200 | #endif /* _YAHOO_H_ */ |