comparison src/protocols/yahoo/yahoo.h @ 10392:a8f9e5ce4f92

[gaim-migrate @ 11620] a little bit of clean up and reorganization of the yahoo prpl. I moved the packet functions to their own file, renamed a couple of them, added a convience function and used it a lot. I plan on adding several more convience functions. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 16 Dec 2004 21:47:54 +0000
parents 35068a87b59d
children ca3e0882d377
comparison
equal deleted inserted replaced
10391:38256d3e8324 10392:a8f9e5ce4f92
48 #define YAHOO_ICON_CHECKSUM_KEY "icon_checksum" 48 #define YAHOO_ICON_CHECKSUM_KEY "icon_checksum"
49 #define YAHOO_PICURL_SETTING "picture_url" 49 #define YAHOO_PICURL_SETTING "picture_url"
50 #define YAHOO_PICCKSUM_SETTING "picture_checksum" 50 #define YAHOO_PICCKSUM_SETTING "picture_checksum"
51 #define YAHOO_PICEXPIRE_SETTING "picture_expire" 51 #define YAHOO_PICEXPIRE_SETTING "picture_expire"
52 52
53 enum yahoo_service { /* these are easier to see in hex */ 53
54 YAHOO_SERVICE_LOGON = 1,
55 YAHOO_SERVICE_LOGOFF,
56 YAHOO_SERVICE_ISAWAY,
57 YAHOO_SERVICE_ISBACK,
58 YAHOO_SERVICE_IDLE, /* 5 (placemarker) */
59 YAHOO_SERVICE_MESSAGE,
60 YAHOO_SERVICE_IDACT,
61 YAHOO_SERVICE_IDDEACT,
62 YAHOO_SERVICE_MAILSTAT,
63 YAHOO_SERVICE_USERSTAT, /* 0xa */
64 YAHOO_SERVICE_NEWMAIL,
65 YAHOO_SERVICE_CHATINVITE,
66 YAHOO_SERVICE_CALENDAR,
67 YAHOO_SERVICE_NEWPERSONALMAIL,
68 YAHOO_SERVICE_NEWCONTACT,
69 YAHOO_SERVICE_ADDIDENT, /* 0x10 */
70 YAHOO_SERVICE_ADDIGNORE,
71 YAHOO_SERVICE_PING,
72 YAHOO_SERVICE_GOTGROUPRENAME,
73 YAHOO_SERVICE_SYSMESSAGE = 0x14,
74 YAHOO_SERVICE_SKINNAME = 0x15,
75 YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
76 YAHOO_SERVICE_CONFINVITE = 0x18,
77 YAHOO_SERVICE_CONFLOGON,
78 YAHOO_SERVICE_CONFDECLINE,
79 YAHOO_SERVICE_CONFLOGOFF,
80 YAHOO_SERVICE_CONFADDINVITE,
81 YAHOO_SERVICE_CONFMSG,
82 YAHOO_SERVICE_CHATLOGON,
83 YAHOO_SERVICE_CHATLOGOFF,
84 YAHOO_SERVICE_CHATMSG = 0x20,
85 YAHOO_SERVICE_GAMELOGON = 0x28,
86 YAHOO_SERVICE_GAMELOGOFF,
87 YAHOO_SERVICE_GAMEMSG = 0x2a,
88 YAHOO_SERVICE_FILETRANSFER = 0x46,
89 YAHOO_SERVICE_VOICECHAT = 0x4A,
90 YAHOO_SERVICE_NOTIFY = 0x4B,
91 YAHOO_SERVICE_VERIFY,
92 YAHOO_SERVICE_P2PFILEXFER,
93 YAHOO_SERVICE_PEEPTOPEER = 0x4F,
94 YAHOO_SERVICE_WEBCAM,
95 YAHOO_SERVICE_AUTHRESP = 0x54,
96 YAHOO_SERVICE_LIST = 0x55,
97 YAHOO_SERVICE_AUTH = 0x57,
98 YAHOO_SERVICE_ADDBUDDY = 0x83,
99 YAHOO_SERVICE_REMBUDDY = 0x84,
100 YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/
101 YAHOO_SERVICE_REJECTCONTACT,
102 YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
103 /* YAHOO_SERVICE_??? = 0x8A, */
104 YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/
105 YAHOO_SERVICE_CHATGOTO,
106 YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */
107 YAHOO_SERVICE_CHATLEAVE,
108 YAHOO_SERVICE_CHATEXIT = 0x9b,
109 YAHOO_SERVICE_CHATADDINVITE = 0x9d,
110 YAHOO_SERVICE_CHATLOGOUT = 0xa0,
111 YAHOO_SERVICE_CHATPING,
112 YAHOO_SERVICE_COMMENT = 0xa8,
113 YAHOO_SERVICE_AVATAR = 0xbc,
114 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
115 YAHOO_SERVICE_PICTURE = 0xbe,
116 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
117 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
118 YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5,
119 YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6,
120 YAHOO_SERVICE_AVATAR_UPDATE = 0xc7,
121 YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8,
122 YAHOO_SERVICE_AUDIBLE = 0xd0,
123 YAHOO_SERVICE_WEBLOGIN = 0x0226,
124 YAHOO_SERVICE_SMS_MSG = 0x02ea
125 };
126 54
127 #define YAHOO_STATUS_TYPE_OFFLINE "offline" 55 #define YAHOO_STATUS_TYPE_OFFLINE "offline"
128 #define YAHOO_STATUS_TYPE_ONLINE "online" 56 #define YAHOO_STATUS_TYPE_ONLINE "online"
129 #define YAHOO_STATUS_TYPE_AVAILABLE "available" 57 #define YAHOO_STATUS_TYPE_AVAILABLE "available"
130 #define YAHOO_STATUS_TYPE_AVAILABLE_WM "available-wm" 58 #define YAHOO_STATUS_TYPE_AVAILABLE_WM "available-wm"
198 struct yahoo_buddy_icon_upload_data *picture_upload_todo; 126 struct yahoo_buddy_icon_upload_data *picture_upload_todo;
199 127
200 struct _YchtConn *ycht; 128 struct _YchtConn *ycht;
201 }; 129 };
202 130
203 struct yahoo_pair {
204 int key;
205 char *value;
206 };
207
208 struct yahoo_packet {
209 guint16 service;
210 guint32 status;
211 guint32 id;
212 GSList *hash;
213 };
214
215 131
216 #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) 132 #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255)
217 133
218
219 #define YAHOO_WEBMESSENGER_PROTO_VER 0x0065
220 #define YAHOO_PROTO_VER 0x000c
221
222
223 #define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4)
224 134
225 /* sometimes i wish prpls could #include things from other prpls. then i could just 135 /* sometimes i wish prpls could #include things from other prpls. then i could just
226 * use the routines from libfaim and not have to admit to knowing how they work. */ 136 * use the routines from libfaim and not have to admit to knowing how they work. */
227 #define yahoo_put16(buf, data) ( \ 137 #define yahoo_put16(buf, data) ( \
228 (*(buf) = (unsigned char)((data)>>8)&0xff), \ 138 (*(buf) = (unsigned char)((data)>>8)&0xff), \
239 (((*((buf)+1))<<16)&0x00ff0000) + \ 149 (((*((buf)+1))<<16)&0x00ff0000) + \
240 (((*((buf)+2))<< 8)&0x0000ff00) + \ 150 (((*((buf)+2))<< 8)&0x0000ff00) + \
241 (((*((buf)+3) )&0x000000ff))) 151 (((*((buf)+3) )&0x000000ff)))
242 152
243 153
244 struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id);
245 void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value);
246 int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt);
247 int yahoo_send_packet_special(int fd, struct yahoo_packet *pkt, int pad);
248 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data);
249 int yahoo_packet_length(struct yahoo_packet *pkt);
250 void yahoo_packet_free(struct yahoo_packet *pkt);
251 154
252 /* util.c */ 155 /* util.c */
253 void yahoo_init_colorht(); 156 void yahoo_init_colorht();
254 void yahoo_dest_colorht(); 157 void yahoo_dest_colorht();
255 char *yahoo_codes_to_html(const char *x); 158 char *yahoo_codes_to_html(const char *x);