1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/libymsg.h Fri Aug 21 13:25:11 2009 -0700
1.3 @@ -0,0 +1,359 @@
1.4 +/**
1.5 + * @file libymsg.h The Yahoo! and Yahoo! JAPAN Protocol Plugins
1.6 + *
1.7 + * purple
1.8 + *
1.9 + * Purple is the legal property of its developers, whose names are too numerous
1.10 + * to list here. Please refer to the COPYRIGHT file distributed with this
1.11 + * source distribution.
1.12 + *
1.13 + * This program is free software; you can redistribute it and/or modify
1.14 + * it under the terms of the GNU General Public License as published by
1.15 + * the Free Software Foundation; either version 2 of the License, or
1.16 + * (at your option) any later version.
1.17 + *
1.18 + * This program is distributed in the hope that it will be useful,
1.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.21 + * GNU General Public License for more details.
1.22 + *
1.23 + * You should have received a copy of the GNU General Public License
1.24 + * along with this program; if not, write to the Free Software
1.25 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.26 + */
1.27 +
1.28 +#ifndef _LIBYMSG_H_
1.29 +#define _LIBYMSG_H_
1.30 +
1.31 +#include "circbuffer.h"
1.32 +#include "cmds.h"
1.33 +#include "prpl.h"
1.34 +
1.35 +#define YAHOO_PAGER_HOST "scsa.msg.yahoo.com"
1.36 +#define YAHOO_PAGER_PORT 5050
1.37 +#define YAHOO_PAGER_PORT_P2P 5101
1.38 +#define YAHOO_LOGIN_URL "https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=%s"
1.39 +#define YAHOO_TOKEN_URL "https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s"
1.40 +#define YAHOO_P2P_KEEPALIVE_SECS 300
1.41 +#define YAHOO_P2P_SERVER_TIMEOUT 10
1.42 +#define YAHOO_PROFILE_URL "http://profiles.yahoo.com/"
1.43 +#define YAHOO_MAIL_URL "http://rd.yahoo.com/messenger/client/?http://mail.yahoo.com/"
1.44 +#define YAHOO_XFER_HOST "filetransfer.msg.yahoo.com"
1.45 +#define YAHOO_XFER_PORT 80
1.46 +#define YAHOO_XFER_RELAY_HOST "relay.msg.yahoo.com"
1.47 +#define YAHOO_XFER_RELAY_PORT 80
1.48 +#define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/"
1.49 +#define YAHOO_ROOMLIST_LOCALE "us"
1.50 +/* really we should get the list of servers from
1.51 + http://update.messenger.yahoo.co.jp/servers.html */
1.52 +#define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp"
1.53 +#define YAHOOJP_TOKEN_URL "https://login.yahoo.co.jp/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s"
1.54 +#define YAHOOJP_LOGIN_URL "https://login.yahoo.co.jp/config/pwtoken_login?src=ymsgr&ts=&token=%s"
1.55 +#define YAHOOJP_PROFILE_URL "http://profiles.yahoo.co.jp/"
1.56 +#define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/"
1.57 +#define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp"
1.58 +#define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp"
1.59 +/* not sure, must test: */
1.60 +#define YAHOOJP_XFER_RELAY_HOST "relay.msg.yahoo.co.jp"
1.61 +#define YAHOOJP_XFER_RELAY_PORT 80
1.62 +#define YAHOOJP_ROOMLIST_URL "http://insider.msg.yahoo.co.jp/ycontent/"
1.63 +#define YAHOOJP_ROOMLIST_LOCALE "ja"
1.64 +
1.65 +#define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud"
1.66 +
1.67 +#define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg"
1.68 +
1.69 +#define YAHOO_SMS_CARRIER_URL "http://lookup.msg.vip.mud.yahoo.com"
1.70 +
1.71 +#define YAHOO_USERINFO_URL "http://address.yahoo.com/yab/us?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252"
1.72 +#define YAHOOJP_USERINFO_URL "http://address.yahoo.co.jp/yab/jp?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252"
1.73 +
1.74 +#define YAHOO_PICURL_SETTING "picture_url"
1.75 +#define YAHOO_PICCKSUM_SETTING "picture_checksum"
1.76 +#define YAHOO_PICEXPIRE_SETTING "picture_expire"
1.77 +
1.78 +#define YAHOO_STATUS_TYPE_OFFLINE "offline"
1.79 +#define YAHOO_STATUS_TYPE_AVAILABLE "available"
1.80 +#define YAHOO_STATUS_TYPE_BRB "brb"
1.81 +#define YAHOO_STATUS_TYPE_BUSY "busy"
1.82 +#define YAHOO_STATUS_TYPE_NOTATHOME "notathome"
1.83 +#define YAHOO_STATUS_TYPE_NOTATDESK "notatdesk"
1.84 +#define YAHOO_STATUS_TYPE_NOTINOFFICE "notinoffice"
1.85 +#define YAHOO_STATUS_TYPE_ONPHONE "onphone"
1.86 +#define YAHOO_STATUS_TYPE_ONVACATION "onvacation"
1.87 +#define YAHOO_STATUS_TYPE_OUTTOLUNCH "outtolunch"
1.88 +#define YAHOO_STATUS_TYPE_STEPPEDOUT "steppedout"
1.89 +#define YAHOO_STATUS_TYPE_AWAY "away"
1.90 +#define YAHOO_STATUS_TYPE_INVISIBLE "invisible"
1.91 +#define YAHOO_STATUS_TYPE_MOBILE "mobile"
1.92 +
1.93 +#define YAHOO_CLIENT_VERSION_ID "4194239"
1.94 +#define YAHOO_CLIENT_VERSION "9.0.0.2162"
1.95 +
1.96 +#define YAHOOJP_CLIENT_VERSION_ID "4194239"
1.97 +#define YAHOOJP_CLIENT_VERSION "9.0.0.2162"
1.98 +
1.99 +#define YAHOO_CLIENT_USERAGENT "Mozilla/5.0"
1.100 +
1.101 +/* Index into attention types list. */
1.102 +#define YAHOO_BUZZ 0
1.103 +
1.104 +typedef enum {
1.105 + YAHOO_PKT_TYPE_SERVER = 0,
1.106 + YAHOO_PKT_TYPE_P2P
1.107 +} yahoo_pkt_type;
1.108 +
1.109 +typedef enum {
1.110 + YAHOO_P2P_WE_ARE_CLIENT =0,
1.111 + YAHOO_P2P_WE_ARE_SERVER
1.112 +} yahoo_p2p_connection_type;
1.113 +
1.114 +enum yahoo_status {
1.115 + YAHOO_STATUS_AVAILABLE = 0,
1.116 + YAHOO_STATUS_BRB,
1.117 + YAHOO_STATUS_BUSY,
1.118 + YAHOO_STATUS_NOTATHOME,
1.119 + YAHOO_STATUS_NOTATDESK,
1.120 + YAHOO_STATUS_NOTINOFFICE,
1.121 + YAHOO_STATUS_ONPHONE,
1.122 + YAHOO_STATUS_ONVACATION,
1.123 + YAHOO_STATUS_OUTTOLUNCH,
1.124 + YAHOO_STATUS_STEPPEDOUT,
1.125 + YAHOO_STATUS_INVISIBLE = 12,
1.126 + YAHOO_STATUS_CUSTOM = 99,
1.127 + YAHOO_STATUS_IDLE = 999,
1.128 + YAHOO_STATUS_WEBLOGIN = 0x5a55aa55,
1.129 + YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */
1.130 + YAHOO_STATUS_TYPING = 0x16,
1.131 + YAHOO_STATUS_DISCONNECTED = 0xffffffff /* in ymsg 15. doesnt mean the normal sense of 'disconnected' */
1.132 +};
1.133 +
1.134 +struct yahoo_buddy_icon_upload_data {
1.135 + PurpleConnection *gc;
1.136 + GString *str;
1.137 + char *filename;
1.138 + int pos;
1.139 + int fd;
1.140 + guint watcher;
1.141 +};
1.142 +
1.143 +struct yahoo_p2p_data {
1.144 + PurpleConnection *gc;
1.145 + char *host_ip;
1.146 + char *host_username;
1.147 + int val_13;
1.148 + guint input_event;
1.149 + gint source;
1.150 + int session_id;
1.151 + yahoo_p2p_connection_type connection_type;
1.152 +};
1.153 +
1.154 +struct _YchtConn;
1.155 +
1.156 +typedef struct _YahooPersonalDetails {
1.157 + char *id;
1.158 +
1.159 + struct {
1.160 + char *first;
1.161 + char *last;
1.162 + char *middle;
1.163 + char *nick;
1.164 + } names;
1.165 +
1.166 + struct {
1.167 + char *work;
1.168 + char *home;
1.169 + char *mobile;
1.170 + } phone;
1.171 +} YahooPersonalDetails;
1.172 +
1.173 +typedef struct {
1.174 + PurpleConnection *gc;
1.175 + int fd;
1.176 + guchar *rxqueue;
1.177 + int rxlen;
1.178 + PurpleCircBuffer *txbuf;
1.179 + guint txhandler;
1.180 + GHashTable *friends;
1.181 +
1.182 + char **profiles; /* Multiple profiles can be associated with an account */
1.183 + YahooPersonalDetails ypd;
1.184 +
1.185 + /**
1.186 + * This is used to keep track of the IMVironment chosen
1.187 + * by people you talk to. We don't do very much with
1.188 + * this right now... but at least now if the remote user
1.189 + * selects an IMVironment we won't reset it back to the
1.190 + * default of nothing.
1.191 + */
1.192 + GHashTable *imvironments;
1.193 +
1.194 + int current_status;
1.195 + gboolean logged_in;
1.196 + GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist;
1.197 + GSList *confs;
1.198 + unsigned int conf_id; /* just a counter */
1.199 + gboolean chat_online;
1.200 + gboolean in_chat;
1.201 + char *chat_name;
1.202 + char *pending_chat_room;
1.203 + char *pending_chat_id;
1.204 + char *pending_chat_topic;
1.205 + char *pending_chat_goto;
1.206 + char *auth;
1.207 + gsize auth_written;
1.208 + char *cookie_y;
1.209 + char *cookie_t;
1.210 + int session_id;
1.211 + gboolean jp;
1.212 + gboolean wm; /* connected w/ web messenger method */
1.213 + /* picture aka buddy icon stuff */
1.214 + char *picture_url;
1.215 + int picture_checksum;
1.216 +
1.217 + /* ew. we have to check the icon before we connect,
1.218 + * but can't upload it til we're connected. */
1.219 + struct yahoo_buddy_icon_upload_data *picture_upload_todo;
1.220 + PurpleProxyConnectData *buddy_icon_connect_data;
1.221 +
1.222 + struct _YchtConn *ycht;
1.223 +
1.224 + /**
1.225 + * This linked list contains PurpleUtilFetchUrlData structs
1.226 + * for when we lookup people profile or photo information.
1.227 + */
1.228 + GSList *url_datas;
1.229 + GHashTable *xfer_peer_idstring_map;/* Hey, i dont know, but putting this HashTable next to friends gives a run time fault... */
1.230 + GSList *cookies;/* contains all cookies, including _y and _t */
1.231 +
1.232 + /**
1.233 + * We may receive a list15 in multiple packets with no prior warning as to how many we'll be getting;
1.234 + * the server expects us to keep track of the group for which it is sending us contact names.
1.235 + */
1.236 + char *current_list15_grp;
1.237 + time_t last_ping;
1.238 + time_t last_keepalive;
1.239 + GHashTable *peers; /* information about p2p data */
1.240 + int yahoo_p2p_timer;
1.241 + int yahoo_local_p2p_server_fd;
1.242 + int yahoo_p2p_server_watcher;
1.243 + GHashTable *sms_carrier; /* sms carrier data */
1.244 + guint yahoo_p2p_server_timeout_handle;
1.245 +} YahooData;
1.246 +
1.247 +#define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255)
1.248 +
1.249 +/*
1.250 + * Current Maximum Length for Instant Messages
1.251 + *
1.252 + * This was found by experiment.
1.253 + *
1.254 + * The YMSG protocol allows a message of up to 948 bytes, but the official client
1.255 + * limits to 800 characters. According to experiments I conducted, it seems that
1.256 + * the discrepancy is to allow some leeway for messages with mixed single- and
1.257 + * multi-byte characters, as I was able to send messages of 840 and 932 bytes
1.258 + * by using some multibyte characters (some random Chinese or Japanese characters,
1.259 + * to be precise). - rekkanoryo
1.260 + */
1.261 +#define YAHOO_MAX_MESSAGE_LENGTH_BYTES 948
1.262 +#define YAHOO_MAX_MESSAGE_LENGTH_CHARS 800
1.263 +
1.264 +/* sometimes i wish prpls could #include things from other prpls. then i could just
1.265 + * use the routines from libfaim and not have to admit to knowing how they work. */
1.266 +#define yahoo_put16(buf, data) ( \
1.267 + (*(buf) = (unsigned char)((data)>>8)&0xff), \
1.268 + (*((buf)+1) = (unsigned char)(data)&0xff), \
1.269 + 2)
1.270 +#define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
1.271 +#define yahoo_put32(buf, data) ( \
1.272 + (*((buf)) = (unsigned char)((data)>>24)&0xff), \
1.273 + (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \
1.274 + (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \
1.275 + (*((buf)+3) = (unsigned char)(data)&0xff), \
1.276 + 4)
1.277 +#define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \
1.278 + (((*((buf)+1))<<16)&0x00ff0000) + \
1.279 + (((*((buf)+2))<< 8)&0x0000ff00) + \
1.280 + (((*((buf)+3) )&0x000000ff)))
1.281 +
1.282 +/* util.c */
1.283 +void yahoo_init_colorht(void);
1.284 +void yahoo_dest_colorht(void);
1.285 +char *yahoo_codes_to_html(const char *x);
1.286 +char *yahoo_html_to_codes(const char *src);
1.287 +
1.288 +gboolean
1.289 +yahoo_account_use_http_proxy(PurpleConnection *conn);
1.290 +
1.291 +/**
1.292 + * Encode some text to send to the yahoo server.
1.293 + *
1.294 + * @param gc The connection handle.
1.295 + * @param str The null terminated utf8 string to encode.
1.296 + * @param utf8 If not @c NULL, whether utf8 is okay or not.
1.297 + * Even if it is okay, we may not use it. If we
1.298 + * used it, we set this to @c TRUE, else to
1.299 + * @c FALSE. If @c NULL, false is assumed, and
1.300 + * it is not dereferenced.
1.301 + * @return The g_malloced string in the appropriate encoding.
1.302 + */
1.303 +char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8);
1.304 +
1.305 +/**
1.306 + * Decode some text received from the server.
1.307 + *
1.308 + * @param gc The gc handle.
1.309 + * @param str The null terminated string to decode.
1.310 + * @param utf8 Did the server tell us it was supposed to be utf8?
1.311 + * @return The decoded, utf-8 string, which must be g_free()'d.
1.312 + */
1.313 +char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8);
1.314 +
1.315 +char *yahoo_convert_to_numeric(const char *str);
1.316 +
1.317 +
1.318 +/* yahoo_profile.c */
1.319 +void yahoo_get_info(PurpleConnection *gc, const char *name);
1.320 +
1.321 +/* libymsg.h - these functions were formerly static but need not to be for the
1.322 + * new two-prpl model. */
1.323 +const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b);
1.324 +const char *yahoo_list_emblem(PurpleBuddy *b);
1.325 +char *yahoo_status_text(PurpleBuddy *b);
1.326 +void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
1.327 +GList *yahoo_status_types(PurpleAccount *account);
1.328 +GList *yahoo_blist_node_menu(PurpleBlistNode *node);
1.329 +void yahoo_login(PurpleAccount *account);
1.330 +void yahoo_close(PurpleConnection *gc);
1.331 +int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags);
1.332 +unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state);
1.333 +void yahoo_set_status(PurpleAccount *account, PurpleStatus *status);
1.334 +void yahoo_set_idle(PurpleConnection *gc, int idle);
1.335 +void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g);
1.336 +void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
1.337 +void yahoo_add_deny(PurpleConnection *gc, const char *who);
1.338 +void yahoo_rem_deny(PurpleConnection *gc, const char *who);
1.339 +void yahoo_set_permit_deny(PurpleConnection *gc);
1.340 +void yahoo_keepalive(PurpleConnection *gc);
1.341 +void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group);
1.342 +void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies);
1.343 +gboolean yahoo_offline_message(const PurpleBuddy *buddy);
1.344 +gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type);
1.345 +GList *yahoo_attention_types(PurpleAccount *account);
1.346 +
1.347 +GList *yahoo_actions(PurplePlugin *plugin, gpointer context);
1.348 +void yahoopurple_register_commands(void);
1.349 +
1.350 +PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data);
1.351 +PurpleCmdRet yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data);
1.352 +PurpleCmdRet yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data);
1.353 +/* needed for xfer, thought theyd be useful for other enhancements later on
1.354 + Returns list of cookies stored in yahoo_data formatted as a single null terminated string
1.355 + returned value must be g_freed
1.356 +*/
1.357 +gchar* yahoo_get_cookies(PurpleConnection *gc);
1.358 +
1.359 +/* send p2p pkt containing our encoded ip, asking peer to connect to us */
1.360 +void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13);
1.361 +
1.362 +#endif /* _LIBYMSG_H_ */