Tue, 25 Nov 2003 23:21:31 +0000
[gaim-migrate @ 8259]
T.M.Thanh requests these updates
| 6513 | 1 | /** |
| 2 | * @file yahoo.h The Yahoo! protocol plugin | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2003 | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | */ | |
| 22 | ||
| 23 | #ifndef _YAHOO_H_ | |
| 24 | #define _YAHOO_H_ | |
| 25 | ||
| 6784 | 26 | #include "prpl.h" |
| 27 | ||
| 7134 | 28 | #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" |
| 29 | ||
| 6729 | 30 | enum yahoo_service { /* these are easier to see in hex */ |
| 31 | YAHOO_SERVICE_LOGON = 1, | |
| 32 | YAHOO_SERVICE_LOGOFF, | |
| 33 | YAHOO_SERVICE_ISAWAY, | |
| 34 | YAHOO_SERVICE_ISBACK, | |
| 35 | YAHOO_SERVICE_IDLE, /* 5 (placemarker) */ | |
| 36 | YAHOO_SERVICE_MESSAGE, | |
| 37 | YAHOO_SERVICE_IDACT, | |
| 38 | YAHOO_SERVICE_IDDEACT, | |
| 39 | YAHOO_SERVICE_MAILSTAT, | |
| 40 | YAHOO_SERVICE_USERSTAT, /* 0xa */ | |
| 41 | YAHOO_SERVICE_NEWMAIL, | |
| 42 | YAHOO_SERVICE_CHATINVITE, | |
| 43 | YAHOO_SERVICE_CALENDAR, | |
| 44 | YAHOO_SERVICE_NEWPERSONALMAIL, | |
| 45 | YAHOO_SERVICE_NEWCONTACT, | |
| 46 | YAHOO_SERVICE_ADDIDENT, /* 0x10 */ | |
| 47 | YAHOO_SERVICE_ADDIGNORE, | |
| 48 | YAHOO_SERVICE_PING, | |
| 49 | YAHOO_SERVICE_GOTGROUPRENAME, | |
| 50 | YAHOO_SERVICE_SYSMESSAGE = 0x14, | |
| 51 | YAHOO_SERVICE_PASSTHROUGH2 = 0x16, | |
| 52 | YAHOO_SERVICE_CONFINVITE = 0x18, | |
| 53 | YAHOO_SERVICE_CONFLOGON, | |
| 54 | YAHOO_SERVICE_CONFDECLINE, | |
| 55 | YAHOO_SERVICE_CONFLOGOFF, | |
| 56 | YAHOO_SERVICE_CONFADDINVITE, | |
| 57 | YAHOO_SERVICE_CONFMSG, | |
| 58 | YAHOO_SERVICE_CHATLOGON, | |
| 59 | YAHOO_SERVICE_CHATLOGOFF, | |
| 60 | YAHOO_SERVICE_CHATMSG = 0x20, | |
| 61 | YAHOO_SERVICE_GAMELOGON = 0x28, | |
| 62 | YAHOO_SERVICE_GAMELOGOFF, | |
| 63 | YAHOO_SERVICE_GAMEMSG = 0x2a, | |
| 64 | YAHOO_SERVICE_FILETRANSFER = 0x46, | |
| 65 | YAHOO_SERVICE_VOICECHAT = 0x4A, | |
| 66 | YAHOO_SERVICE_NOTIFY = 0x4B, | |
| 67 | YAHOO_SERVICE_VERIFY, | |
| 68 | YAHOO_SERVICE_P2PFILEXFER, | |
| 69 | YAHOO_SERVICE_PEEPTOPEER = 0x4F, | |
| 70 | YAHOO_SERVICE_WEBCAM, | |
| 71 | YAHOO_SERVICE_AUTHRESP = 0x54, | |
| 72 | YAHOO_SERVICE_LIST = 0x55, | |
| 73 | YAHOO_SERVICE_AUTH = 0x57, | |
| 74 | YAHOO_SERVICE_ADDBUDDY = 0x83, | |
| 75 | YAHOO_SERVICE_REMBUDDY = 0x84, | |
| 76 | YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/ | |
| 77 | YAHOO_SERVICE_REJECTCONTACT, | |
| 78 | YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ | |
| 6847 | 79 | /* YAHOO_SERVICE_??? = 0x8A, */ |
| 6729 | 80 | YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ |
| 81 | YAHOO_SERVICE_CHATGOTO, | |
| 82 | YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */ | |
| 83 | YAHOO_SERVICE_CHATLEAVE, | |
| 84 | YAHOO_SERVICE_CHATEXIT = 0x9b, | |
| 85 | YAHOO_SERVICE_CHATADDINVITE = 0x9d, | |
| 86 | YAHOO_SERVICE_CHATLOGOUT = 0xa0, | |
| 87 | YAHOO_SERVICE_CHATPING, | |
| 7134 | 88 | YAHOO_SERVICE_COMMENT = 0xa8, |
| 89 | YAHOO_SERVICE_WEBLOGIN = 0x0226 | |
| 6729 | 90 | }; |
| 6513 | 91 | |
| 6729 | 92 | enum yahoo_status { |
| 93 | YAHOO_STATUS_AVAILABLE = 0, | |
| 94 | YAHOO_STATUS_BRB, | |
| 95 | YAHOO_STATUS_BUSY, | |
| 96 | YAHOO_STATUS_NOTATHOME, | |
| 97 | YAHOO_STATUS_NOTATDESK, | |
| 98 | YAHOO_STATUS_NOTINOFFICE, | |
| 99 | YAHOO_STATUS_ONPHONE, | |
| 100 | YAHOO_STATUS_ONVACATION, | |
| 101 | YAHOO_STATUS_OUTTOLUNCH, | |
| 102 | YAHOO_STATUS_STEPPEDOUT, | |
| 103 | YAHOO_STATUS_INVISIBLE = 12, | |
| 104 | YAHOO_STATUS_CUSTOM = 99, | |
| 105 | YAHOO_STATUS_IDLE = 999, | |
| 7134 | 106 | YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, |
| 6729 | 107 | YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ |
| 108 | YAHOO_STATUS_TYPING = 0x16 | |
| 109 | }; | |
| 110 | ||
| 111 | struct yahoo_data { | |
| 112 | int fd; | |
| 113 | guchar *rxqueue; | |
| 114 | int rxlen; | |
| 6784 | 115 | GHashTable *friends; |
| 6729 | 116 | int current_status; |
| 117 | gboolean logged_in; | |
| 6784 | 118 | GString *tmp_serv_blist, *tmp_serv_ilist; |
| 6729 | 119 | GSList *confs; |
| 120 | unsigned int conf_id; /* just a counter */ | |
| 121 | gboolean chat_online; | |
| 122 | gboolean in_chat; | |
| 123 | char *chat_name; | |
| 7134 | 124 | char *auth; |
| 6729 | 125 | }; |
| 126 | ||
| 127 | struct yahoo_pair { | |
| 128 | int key; | |
| 129 | char *value; | |
| 130 | }; | |
| 131 | ||
| 132 | struct yahoo_packet { | |
| 133 | guint16 service; | |
| 134 | guint32 status; | |
| 135 | guint32 id; | |
| 136 | GSList *hash; | |
| 137 | }; | |
| 138 | ||
| 6784 | 139 | struct yahoo_friend { /* we'll call them friends, so we don't confuse them with GaimBuddy */ |
| 140 | enum yahoo_status status; | |
| 141 | char *msg; | |
| 142 | char *game; | |
| 143 | int idle; | |
| 144 | int away; | |
| 145 | gboolean sms; | |
| 146 | }; | |
| 147 | ||
| 6895 | 148 | #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (48) |
| 6847 | 149 | |
| 6729 | 150 | struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id); |
| 151 | void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value); | |
| 152 | int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt); | |
| 153 | void yahoo_packet_free(struct yahoo_packet *pkt); | |
| 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 | |
| 161 | #endif /* _YAHOO_H_ */ |