annotate libpurple/protocols/oscar/family_icbm.c @ 31648:fa88dc1dcabb

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 12 Feb 2011 04:17:09 +0900
parents 0462bec07414 0c0b94fb9ac7
children 4a34689eeb33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
2 * Purple's oscar protocol plugin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * This file is the legal property of its developers.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Please see the AUTHORS file distributed alongside this file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * version 2 of the License, or (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * Lesser General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19653
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * Family 0x0004 - Routines for sending/receiving Instant Messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 * Note the term ICBM (Inter-Client Basic Message) which blankets
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 * all types of generically routed through-server messages. Within
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 * the ICBM types (family 4), a channel is defined. Each channel
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 * represents a different type of message. Channel 1 is used for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 * what would commonly be called an "instant message". Channel 2
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 * is used for negotiating "rendezvous". These transactions end in
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 * something more complex happening, such as a chat invitation, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 * a file transfer. Channel 3 is used for chat messages (not in
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 * the same family as these channels). Channel 4 is used for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 * various ICQ messages. Examples are normal messages, URLs, and
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 * old-style authorization.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 * In addition to the channel, every ICBM contains a cookie. For
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 * standard IMs, these are only used for error messages. However,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 * the more complex rendezvous messages make suitably more complex
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 * use of this field.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 * TODO: Split this up into an im.c file an an icbm.c file. It
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 * will be beautiful, you'll see.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 * Make sure flap_connection_findbygroup is used by all functions.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
47 #include "encoding.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "oscar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "peer.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "win32dep.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
55 #include "util.h"
30511
9623db527d1e merged from im.pidgin.pidgin
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 30383 30406
diff changeset
56 #include "debug.h" /* yaz */
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
57
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
58 static const char * const errcodereason[] = {
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
59 N_("Invalid error"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
60 N_("Not logged in"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
61 N_("Cannot receive IM due to parental controls"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
62 N_("Cannot send SMS without accepting terms"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
63 N_("Cannot send SMS"), /* SMS_WITHOUT_DISCLAIMER is weird */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
64 N_("Cannot send SMS to this country"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
65 N_("Unknown error"), /* Undocumented */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
66 N_("Unknown error"), /* Undocumented */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
67 N_("Cannot send SMS to unknown country"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
68 N_("Bot accounts cannot initiate IMs"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
69 N_("Bot account cannot IM this user"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
70 N_("Bot account reached IM limit"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
71 N_("Bot account reached daily IM limit"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
72 N_("Bot account reached monthly IM limit"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
73 N_("Unable to receive offline messages"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
74 N_("Offline message store full")
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
75 };
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
76 static const int errcodereasonlen = G_N_ELEMENTS(errcodereason);
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
77
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 * Add a standard ICBM header to the given bstream with the given
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 * information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 * @param bs The bstream to write the ICBM header to.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 * @param c c is for cookie, and cookie is for me.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 * @param channel The ICBM channel (1 through 4).
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
85 * @param bn Null-terminated scrizeen nizame.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 * @return The number of bytes written. It's really not useful.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
88 static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 byte_stream_putraw(bs, c, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 byte_stream_put16(bs, channel);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
92 byte_stream_put8(bs, strlen(bn));
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
93 byte_stream_putstr(bs, bn);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
94 return 8+2+1+strlen(bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 * Generates a random ICBM cookie in a character array of length 8
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 * and copies it into the variable passed as cookie
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 * TODO: Maybe we should stop limiting our characters to the visible range?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 void aim_icbm_makecookie(guchar *cookie)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 /* Should be like "21CBF95" and null terminated */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 for (i = 0; i < 7; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 cookie[i] = 0x30 + ((guchar)rand() % 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 cookie[7] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 /*
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
113 * Subtype 0x0001 - Error
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
114 */
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
115 static int
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
116 error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
117 {
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
118 aim_snac_t *snac2;
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
119 guint16 reason, errcode = 0;
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
120 const char *bn;
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
121 GSList *tlvlist;
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
122 PurpleConnection *gc = od->gc;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
123 #ifdef TODOFT
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
124 PurpleXfer *xfer;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
125 #endif
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
126 const char *reason_str;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
127 char *buf;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
128
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
129 snac2 = aim_remsnac(od, snac->id);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
130 if (!snac2) {
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
131 purple_debug_misc("oscar", "icbm error: received response from unknown request!\n");
30404
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 30379
diff changeset
132 return 1;
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
133 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
134
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
135 if (snac2->family != SNAC_FAMILY_ICBM) {
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
136 purple_debug_misc("oscar", "icbm error: received response from invalid request! %d\n", snac2->family);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
137 g_free(snac2->data);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
138 g_free(snac2);
30404
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 30379
diff changeset
139 return 1;
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
140 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
141
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
142 /* Data is assumed to be the destination bn */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
143 bn = snac2->data;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
144 if (!bn || bn[0] == '\0') {
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
145 purple_debug_misc("oscar", "icbm error: received response from request without a buddy name!\n");
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
146 g_free(snac2->data);
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
147 g_free(snac2);
30404
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 30379
diff changeset
148 return 1;
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
149 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
150
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
151 reason = byte_stream_get16(bs);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
152
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
153 tlvlist = aim_tlvlist_read(bs);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
154 if (aim_tlv_gettlv(tlvlist, 0x0008, 1))
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
155 errcode = aim_tlv_get16(tlvlist, 0x0008, 1);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
156 aim_tlvlist_free(tlvlist);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
157
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
158 purple_debug_error("oscar",
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
159 "Message error with bn %s and reason %hu and errcode %hu\n",
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
160 (bn != NULL ? bn : ""), reason, errcode);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
161
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
162 #ifdef TODOFT
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
163 /* If this was a file transfer request, bn is a cookie */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
164 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, bn))) {
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
165 purple_xfer_cancel_remote(xfer);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
166 return 1;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
167 }
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
168 #endif
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
169
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
170 /* Notify the user that the message wasn't delivered */
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
171 reason_str = oscar_get_msgerr_reason(reason);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
172 if (errcode != 0 && errcode < errcodereasonlen)
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
173 buf = g_strdup_printf(_("Unable to send message: %s (%s)"), reason_str,
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
174 _(errcodereason[errcode]));
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
175 else
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
176 buf = g_strdup_printf(_("Unable to send message: %s"), reason_str);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
177
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
178 if (!purple_conv_present_error(bn, purple_connection_get_account(gc), buf)) {
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
179 g_free(buf);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
180 if (errcode != 0 && errcode < errcodereasonlen)
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
181 buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
182 bn ? bn : "(unknown)", reason_str,
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
183 _(errcodereason[errcode]));
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
184 else
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
185 buf = g_strdup_printf(_("Unable to send message to %s: %s"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
186 bn ? bn : "(unknown)", reason_str);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
187 purple_notify_error(od->gc, NULL, buf, reason_str);
30405
c1b8e619f1b8 Super tiny optimisation
Mark Doliner <mark@kingant.net>
parents: 30404
diff changeset
188 }
30406
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
189 g_free(buf);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
190
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
191 g_free(snac2->data);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
192 g_free(snac2);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
193
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 30405
diff changeset
194 return 1;
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
195 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
196
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 * Subtype 0x0002 - Set ICBM parameters.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 * I definitely recommend sending this. If you don't, you'll be stuck
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 * with the rather unreasonable defaults.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
207 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
210 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 if (!params)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
216 byte_stream_new(&bs, 16);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 /* This is read-only (see Parameter Reply). Must be set to zero here. */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
219 byte_stream_put16(&bs, 0x0000);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 /* These are all read-write */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
222 byte_stream_put32(&bs, params->flags);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
223 byte_stream_put16(&bs, params->maxmsglen);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
224 byte_stream_put16(&bs, params->maxsenderwarn);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
225 byte_stream_put16(&bs, params->maxrecverwarn);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
226 byte_stream_put32(&bs, params->minmsginterval);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
227
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
228 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0);
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
229 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, snacid, &bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
230
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
231 byte_stream_destroy(&bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
232
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 * Subtype 0x0004 - Request ICBM parameter information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 int aim_im_reqparams(OscarData *od)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 FlapConnection *conn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
244 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
247 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 * Subtype 0x0005 - Receive parameter information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 static int aim_im_paraminfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 struct aim_icbmparameters params;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 params.maxchan = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 params.flags = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 params.maxmsglen = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 params.maxsenderwarn = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 params.maxrecverwarn = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 params.minmsginterval = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
27608
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27282
diff changeset
267 params.flags = AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27282
diff changeset
268 | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27282
diff changeset
269 | AIM_IMPARAM_FLAG_EVENTS_ALLOWED
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27282
diff changeset
270 | AIM_IMPARAM_FLAG_SMS_SUPPORTED
30148
787d82881a3e Rename this flag and add a happy bumble bee comment
Mark Doliner <mark@kingant.net>
parents: 30143
diff changeset
271 | AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED
787d82881a3e Rename this flag and add a happy bumble bee comment
Mark Doliner <mark@kingant.net>
parents: 30143
diff changeset
272 | AIM_IMPARAM_FLAG_USE_HTML_FOR_ICQ;
21723
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19680
diff changeset
273 params.maxmsglen = 8000;
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19680
diff changeset
274 params.minmsginterval = 0;
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19680
diff changeset
275
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19680
diff changeset
276 aim_im_setparams(od, &params);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 * Subtype 0x0006 - Send an ICBM (instant message).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 * Possible flags:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 * online (probably ICQ only).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 * Implementation note: Since this is one of the most-used functions
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 * in all of libfaim, it is written with performance in mind. As such,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 * it is not as clear as it could be in respect to how this message is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 * supposed to be layed out. Most obviously, tlvlists should be used
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 * instead of writing out the bytes manually.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 FlapConnection *conn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 ByteStream data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 int msgtlvlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
304 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 if (!args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
310 if (!args->msg || (args->msglen <= 0))
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
311 return -EINVAL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
313 if (args->msglen > MAXMSGLEN)
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
314 return -E2BIG;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 /* Painfully calculate the size of the message TLV */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 msgtlvlen = 1 + 1; /* 0501 */
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
318 msgtlvlen += 2 + args->featureslen;
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
319 msgtlvlen += 2 /* 0101 */ + 2 /* block len */;
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
320 msgtlvlen += 4 /* charset */ + args->msglen;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 byte_stream_new(&data, msgtlvlen + 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 /* Generate an ICBM cookie */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
328 aim_im_puticbm(&data, cookie, 0x0001, args->destbn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 /* Message TLV (type 0x0002) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 byte_stream_put16(&data, 0x0002);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 byte_stream_put16(&data, msgtlvlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 /* Features TLV (type 0x0501) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 byte_stream_put16(&data, 0x0501);
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
336 byte_stream_put16(&data, args->featureslen);
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
337 byte_stream_putraw(&data, args->features, args->featureslen);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
339 /* Insert message text in a TLV (type 0x0101) */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
340 byte_stream_put16(&data, 0x0101);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
342 /* Message block length */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
343 byte_stream_put16(&data, args->msglen + 0x04);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
345 /* Character set */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
346 byte_stream_put16(&data, args->charset);
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
347 /* Character subset -- we always use 0 here */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
348 byte_stream_put16(&data, 0x0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
350 /* Message. Not terminated */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
351 byte_stream_putraw(&data, (guchar *)args->msg, args->msglen);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 /* Set the Autoresponse flag */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 if (args->flags & AIM_IMFLAGS_AWAY) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 byte_stream_put16(&data, 0x0004);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 byte_stream_put16(&data, 0x0000);
22342
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
357 } else {
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
358 /* Set the Request Acknowledge flag */
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
359 byte_stream_put16(&data, 0x0003);
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
360 byte_stream_put16(&data, 0x0000);
22342
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
361
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
362 if (args->flags & AIM_IMFLAGS_OFFLINE) {
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
363 /* Allow this message to be queued as an offline message */
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
364 byte_stream_put16(&data, 0x0006);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
365 byte_stream_put16(&data, 0x0000);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22337
diff changeset
366 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 * Set the I HAVE A REALLY PURTY ICON flag.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 * XXX - This should really only be sent on initial
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 * IMs and when you change your icon.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 if (args->flags & AIM_IMFLAGS_HASICON) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 byte_stream_put16(&data, 0x0008);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 byte_stream_put16(&data, 0x000c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 byte_stream_put32(&data, args->iconlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 byte_stream_put16(&data, 0x0001);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 byte_stream_put16(&data, args->iconsum);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 byte_stream_put32(&data, args->iconstamp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 * Set the Buddy Icon Requested flag.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 * XXX - Every time? Surely not...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 if (args->flags & AIM_IMFLAGS_BUDDYREQ) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 byte_stream_put16(&data, 0x0009);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 byte_stream_put16(&data, 0x0000);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 /* XXX - should be optional */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
393 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, args->destbn, strlen(args->destbn)+1);
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
394
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
395 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &data);
22702
6f5f0a4de7f4 Fixed the final stragglers in need of byte_stream_destroy()
Evan Schoenberg <evan.s@dreskin.net>
parents: 22700
diff changeset
396 byte_stream_destroy(&data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 /* clean out SNACs over 60sec old */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 aim_cleansnacs(od, 60);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 * Subtype 0x0006 - Send a chat invitation.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
407 int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
410 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 IcbmCookie *msgcookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 struct aim_invite_priv *priv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 guchar cookie[8];
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
415 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 ByteStream hdrbs;
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
417 // yaz
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
418 char *ucs = NULL;
25495
b81b1732fb64 - follow a change in oscar.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25494
diff changeset
419 gsize bytes;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
421 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
424 if (!bn || !msg || !roomname)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
429 byte_stream_new(&bs, 1142+strlen(bn)+strlen(roomname)+strlen(msg));
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
430
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
431 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 /* XXX should be uncached by an unwritten 'invite accept' handler */
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
434 priv = g_malloc(sizeof(struct aim_invite_priv));
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
435 priv->bn = g_strdup(bn);
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
436 priv->roomname = g_strdup(roomname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 priv->exchange = exchange;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 priv->instance = instance;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 if ((msgcookie = aim_mkcookie(cookie, AIM_COOKIETYPE_INVITE, priv)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 aim_cachecookie(od, msgcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 else
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
443 g_free(priv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 /* ICBM Header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
446 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 * TLV t(0005)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 * Everything else is inside this TLV.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 * Sigh. AOL was rather inconsistent right here. So we have
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 * to play some minor tricks. Right inside the type 5 is some
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 * raw data, followed by a series of TLVs.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 */
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
458 #if 0
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
464 #endif
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
465 //yaz
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
466 // convert msg to ascii first. if it succeed, send as plain ascii.
27805
80d3f4ff1cae - fixed the offset of encoding field in ODC frame to be sent to peer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27803
diff changeset
467 // if it fails, convert msg into UTF-16BE, and send it.
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
468 ucs = g_convert(msg, strlen(msg), "ASCII", "UTF-8", NULL, &bytes, NULL);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
469 if(ucs){
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
470 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
472 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
473 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
474 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
475
25495
b81b1732fb64 - follow a change in oscar.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25494
diff changeset
476 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
b81b1732fb64 - follow a change in oscar.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 25494
diff changeset
477 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
27773
0f3a131d23da - import nosuke's hash 244 patch and others to yahoo plugin
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27771
diff changeset
478 aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, strlen(msg), (guint8 *)msg);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
479 free(ucs);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
480 } else {
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
481 byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2+4+11);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
482
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
483 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
484 byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
485 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
486
25494
a79b96ba2b49 propagate from branch 'im.pidgin.pidgin' (head 8ae64558f2dc02cbc051dda2e2e6e4270b03f7f3)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 17445 25490
diff changeset
487 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
27773
0f3a131d23da - import nosuke's hash 244 patch and others to yahoo plugin
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27771
diff changeset
488 aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 11, (guint8 *)"unicode-2-0");
25494
a79b96ba2b49 propagate from branch 'im.pidgin.pidgin' (head 8ae64558f2dc02cbc051dda2e2e6e4270b03f7f3)
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 17445 25490
diff changeset
489 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
490 //yaz
27803
8dfe3a985fc1 replaced deprecated UCS-2BE with UTF-16BE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27782
diff changeset
491 ucs = g_convert(msg, strlen(msg), "UTF-16BE", "UTF-8", NULL, &bytes, NULL);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
492 if(ucs){
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
493 botch_ucs(ucs, bytes);
27773
0f3a131d23da - import nosuke's hash 244 patch and others to yahoo plugin
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 27771
diff changeset
494 aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, bytes, (guint8 *)ucs);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
495 free(ucs);
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
496 }
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
497 }
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
498 #if 0
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
499 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
500 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
501 aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg);
25467
be098f796b32 yaz patch has been applied.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 15823
diff changeset
502 #endif
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
503 aim_tlvlist_add_chatroom(&inner_tlvlist, 0x2711, exchange, roomname, instance);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
504 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
505
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
506 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
507 byte_stream_destroy(&hdrbs);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
508
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
509 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
510
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
511 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
512 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
514 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
515
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
516 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 * Subtype 0x0006 - Send your icon to a given user.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 * This is also performance sensitive. (If you can believe it...)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
527 int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
530 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
534 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
537 if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
542 byte_stream_new(&bs, 8+2+1+strlen(bn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
544 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
547 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 * TLV t(0005)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 * Encompasses everything below.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
554 byte_stream_put16(&bs, 0x0005);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
555 byte_stream_put16(&bs, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT));
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
556
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
557 byte_stream_put16(&bs, 0x0000);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
558 byte_stream_putraw(&bs, cookie, 8);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
559 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 /* TLV t(000a) */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
562 byte_stream_put16(&bs, 0x000a);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
563 byte_stream_put16(&bs, 0x0002);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
564 byte_stream_put16(&bs, 0x0001);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 /* TLV t(000f) */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
567 byte_stream_put16(&bs, 0x000f);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
568 byte_stream_put16(&bs, 0x0000);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 /* TLV t(2711) */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
571 byte_stream_put16(&bs, 0x2711);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
572 byte_stream_put16(&bs, 4+4+4+iconlen+strlen(AIM_ICONIDENT));
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
573 byte_stream_put16(&bs, 0x0000);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
574 byte_stream_put16(&bs, iconsum);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
575 byte_stream_put32(&bs, iconlen);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
576 byte_stream_put32(&bs, stamp);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
577 byte_stream_putraw(&bs, icon, iconlen);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
578 byte_stream_putstr(&bs, AIM_ICONIDENT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 /* TLV t(0003) */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
581 byte_stream_put16(&bs, 0x0003);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
582 byte_stream_put16(&bs, 0x0000);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
583
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
584 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
585
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
586 byte_stream_destroy(&bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
587
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 * Cancel a rendezvous invitation. It could be an invitation to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 * establish a direct connection, or a file-send, or a chat invite.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 aim_im_sendch2_cancel(PeerConnection *peer_conn)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 OscarData *od;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
600 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
602 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 od = peer_conn->od;
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
606 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
610 byte_stream_new(&bs, 118+strlen(peer_conn->bn));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
612 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
615 aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
617 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 byte_stream_new(&hdrbs, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 byte_stream_putraw(&hdrbs, peer_conn->cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 byte_stream_putcaps(&hdrbs, peer_conn->type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 /* This TLV means "cancel!" */
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
626 aim_tlvlist_add_16(&inner_tlvlist, 0x000b, 0x0001);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
627 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
628
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
629 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
630 byte_stream_destroy(&hdrbs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
632 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
633
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
634 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
635 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
637 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
638
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
639 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 * Subtype 0x0006 - Send an "I accept and I've connected to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 * you" message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 aim_im_sendch2_connected(PeerConnection *peer_conn)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 OscarData *od;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
651 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 od = peer_conn->od;
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
655 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
659 byte_stream_new(&bs, 11+strlen(peer_conn->bn) + 4+2+8+16);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
661 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
664 aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
665
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
666 byte_stream_put16(&bs, 0x0005);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
667 byte_stream_put16(&bs, 0x001a);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
668 byte_stream_put16(&bs, AIM_RENDEZVOUS_CONNECTED);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
669 byte_stream_putraw(&bs, peer_conn->cookie, 8);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
670 byte_stream_putcaps(&bs, peer_conn->type);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
671
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
672 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
673
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
674 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 * Subtype 0x0006 - Send a direct connect rendezvous ICBM. This
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 * could have a number of meanings, depending on the content:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 * "I want you to connect to me"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 * "I want to connect to you"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 * "I want to connect through a proxy server"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 void
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
685 aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
688 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
690 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
693 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
697 byte_stream_new(&bs, 246+strlen(bn));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
699 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
702 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
704 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 byte_stream_new(&hdrbs, 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
712 aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
713 aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
714 aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
715 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
716 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
717 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
718
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
719 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
720 byte_stream_destroy(&hdrbs);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
721
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
722 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
723
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
724 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
725 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
727 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
728
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
729 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 * Subtype 0x0006 - Send a direct connect rendezvous ICBM asking the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 * remote user to connect to us via a proxy server.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 void
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
737 aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
740 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
742 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744 guint8 ip_comp[4];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
746 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
750 byte_stream_new(&bs, 246+strlen(bn));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
752 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
755 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
757 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 byte_stream_new(&hdrbs, 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
765 aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
766 aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
767 aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
768 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
769 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
770 aim_tlvlist_add_noval(&inner_tlvlist, 0x0010);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 /* Send the bitwise complement of the port and ip. As a check? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 ip_comp[0] = ~ip[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 ip_comp[1] = ~ip[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 ip_comp[2] = ~ip[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 ip_comp[3] = ~ip[3];
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
777 aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
778 aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
779
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
780 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
781
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
782 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
783 byte_stream_destroy(&hdrbs);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
784
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
785 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
786
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
787 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
788 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
790 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
791
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
792 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 * Subtype 0x0006 - Send an "I want to send you this file" message
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 void
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
800 aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
803 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
805 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807
27987
993483dda1b8 Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <paul@darkrain42.org>
parents: 27608
diff changeset
808 g_return_if_fail(bn != NULL);
993483dda1b8 Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <paul@darkrain42.org>
parents: 27608
diff changeset
809 g_return_if_fail(ip != NULL);
993483dda1b8 Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <paul@darkrain42.org>
parents: 27608
diff changeset
810
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
811 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
815 byte_stream_new(&bs, 1014);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
817 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
820 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
822 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 byte_stream_new(&hdrbs, 512);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
830 aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
831 aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
832 aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
833 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
834 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 /* TODO: Send 0x0016 and 0x0017 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 if (filename != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 {
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
839 ByteStream inner_bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 /* Begin TLV t(2711) */
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
842 byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
843 byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
844 byte_stream_put16(&inner_bs, numfiles);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
845 byte_stream_put32(&inner_bs, size);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 /* Filename - NULL terminated, for some odd reason */
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
848 byte_stream_putstr(&inner_bs, filename);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
849 byte_stream_put8(&inner_bs, 0x00);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
850
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
851 aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, inner_bs.len, inner_bs.data);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
852 byte_stream_destroy(&inner_bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 /* End TLV t(2711) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
856 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
857 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
858 byte_stream_destroy(&hdrbs);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
859
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
860 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
861
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
862 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
863 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
865 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
866
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
867 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 * Subtype 0x0006 - Send a sendfile connect rendezvous ICBM asking the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 * remote user to connect to us via a proxy server.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 void
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
875 aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
878 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
880 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 guint8 ip_comp[4];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
884 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
888 byte_stream_new(&bs, 1014);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
890 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 /* ICBM header */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
893 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
895 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 byte_stream_new(&hdrbs, 512);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
903 aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
904 aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
905 aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
906 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
907 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
908 aim_tlvlist_add_noval(&inner_tlvlist, 0x0010);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 /* Send the bitwise complement of the port and ip. As a check? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 ip_comp[0] = ~ip[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 ip_comp[1] = ~ip[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 ip_comp[2] = ~ip[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 ip_comp[3] = ~ip[3];
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
915 aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
916 aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 if (filename != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 {
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
920 ByteStream filename_bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 /* Begin TLV t(2711) */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
923 byte_stream_new(&filename_bs, 2+2+4+strlen(filename)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
924 byte_stream_put16(&filename_bs, (numfiles > 1) ? 0x0002 : 0x0001);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
925 byte_stream_put16(&filename_bs, numfiles);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
926 byte_stream_put32(&filename_bs, size);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 /* Filename - NULL terminated, for some odd reason */
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
929 byte_stream_putstr(&filename_bs, filename);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
930 byte_stream_put8(&filename_bs, 0x00);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
931
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
932 aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, filename_bs.len, filename_bs.data);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
933 byte_stream_destroy(&filename_bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 /* End TLV t(2711) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
937 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
938
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
939 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
940 byte_stream_destroy(&hdrbs);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
941
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
942 aim_tlvlist_write(&bs, &outer_tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
943
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
944 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
945 aim_tlvlist_free(outer_tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
947 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
948
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
949 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
952 static void
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
953 incomingim_ch1_parsemsg(OscarData *od, aim_userinfo_t *userinfo, ByteStream *message, struct aim_incomingim_ch1_args *args)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 {
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
955 PurpleAccount *account = purple_connection_get_account(od->gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 /*
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
957 * We're interested in the inner TLV 0x101, which contains precious, precious message.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 */
30826
bbb27d65681f Bstream cleanups:
ivan.komarov@soc.pidgin.im
parents: 30824
diff changeset
959 while (byte_stream_bytes_left(message) >= 4) {
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
960 guint16 type = byte_stream_get16(message);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
961 guint16 length = byte_stream_get16(message);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
962 if (type == 0x101) {
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
963 gchar *msg;
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
964 guint16 msglen = length - 4; /* charset + charsubset */
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
965 guint16 charset = byte_stream_get16(message);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
966 byte_stream_advance(message, 2); /* charsubset */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
968 msg = byte_stream_getstr(message, msglen);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
969 args->msg = oscar_decode_im(account, userinfo->bn, charset, msg, msglen);
31519
0c0b94fb9ac7 oscar: Fix a memleak on receipt of messages
Paul Aurich <paul@darkrain42.org>
parents: 31086
diff changeset
970 g_free(msg);
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
971 } else {
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
972 byte_stream_advance(message, length);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
973 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
977 static int
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
978 incomingim_ch1(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, ByteStream *bs, guint8 *cookie)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 {
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
980 guint16 type, length;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 struct aim_incomingim_ch1_args args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 unsigned int endpos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 memset(&args, 0, sizeof(args));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 * This used to be done using tlvchains. For performance reasons,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 * I've changed it to process the TLVs in-place. This avoids lots
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 * of per-IM memory allocations.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 */
30826
bbb27d65681f Bstream cleanups:
ivan.komarov@soc.pidgin.im
parents: 30824
diff changeset
993 while (byte_stream_bytes_left(bs) >= 4)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 type = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 length = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997
30826
bbb27d65681f Bstream cleanups:
ivan.komarov@soc.pidgin.im
parents: 30824
diff changeset
998 if (length > byte_stream_bytes_left(bs))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 {
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1000 purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 endpos = byte_stream_curpos(bs) + length;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 if (type == 0x0002) { /* Message Block */
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
1007 ByteStream tlv02;
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
1008 byte_stream_init(&tlv02, bs->data + bs->offset, length);
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
1009 incomingim_ch1_parsemsg(od, userinfo, &tlv02, &args);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 } else if (type == 0x0003) { /* Server Ack Requested */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 args.icbmflags |= AIM_IMFLAGS_ACK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 } else if (type == 0x0004) { /* Message is Auto Response */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 args.icbmflags |= AIM_IMFLAGS_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 } else if (type == 0x0006) { /* Message was received offline. */
22337
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1015 /*
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1016 * This flag is set on incoming offline messages for both
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1017 * AIM and ICQ accounts.
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1018 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 args.icbmflags |= AIM_IMFLAGS_OFFLINE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 args.iconlen = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 byte_stream_get16(bs); /* 0x0001 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 args.iconsum = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 args.iconstamp = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 * This looks to be a client bug. MacAIM 4.3 will
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 * send this tag, but with all zero values, in the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 * first message of a conversation. This makes no
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 * sense whatsoever, so I'm going to say its a bug.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 * You really shouldn't advertise a zero-length icon
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 * anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 if (args.iconlen)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 args.icbmflags |= AIM_IMFLAGS_HASICON;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 } else if (type == 0x0009) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 args.icbmflags |= AIM_IMFLAGS_BUDDYREQ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040 } else if (type == 0x000b) { /* Non-direct connect typing notification */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 args.icbmflags |= AIM_IMFLAGS_TYPINGNOT;
22337
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1042 } else if (type == 0x0016) {
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1043 /*
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1044 * UTC timestamp for when the message was sent. Only
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1045 * provided for offline messages.
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1046 */
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1047 args.timestamp = byte_stream_get32(bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 * This is here to protect ourselves from ourselves. That
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 * is, if something above doesn't completely parse its value
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053 * section, or, worse, overparses it, this will set the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 * stream where it needs to be in order to land on the next
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 * TLV when the loop continues.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 byte_stream_setpos(bs, endpos);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 ret = userfunc(od, conn, frame, channel, userinfo, &args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064
30824
5661f30d1b8e Got rid of receiving multipart messages over channel 1, which simplified the code
ivan.komarov@soc.pidgin.im
parents: 30823
diff changeset
1065 g_free(args.msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 incomingim_ch2_buddylist(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 * This goes like this...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 * group name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 * group name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 * num of buddies in group
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 * ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 * group name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 * group name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 * num of buddies in group
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088 * ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 * ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 */
30826
bbb27d65681f Bstream cleanups:
ivan.komarov@soc.pidgin.im
parents: 30824
diff changeset
1091 while (byte_stream_bytes_left(servdata))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 guint16 gnlen, numb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095 char *gn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 gnlen = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 gn = byte_stream_getstr(servdata, gnlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 numb = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 for (i = 0; i < numb; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 guint16 bnlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 char *bn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 bnlen = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 bn = byte_stream_getstr(servdata, bnlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1108 purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1110 g_free(bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1113 g_free(gn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 incomingim_ch2_buddyicon_free(OscarData *od, IcbmArgsCh2 *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 {
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1122 g_free(args->info.icon.icon);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 incomingim_ch2_buddyicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130 args->info.icon.checksum = byte_stream_get32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 args->info.icon.length = byte_stream_get32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 args->info.icon.timestamp = byte_stream_get32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 args->info.icon.icon = byte_stream_getraw(servdata, args->info.icon.length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 args->destructor = (void *)incomingim_ch2_buddyicon_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 incomingim_ch2_chat_free(OscarData *od, IcbmArgsCh2 *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 /* XXX - aim_chat_roominfo_free() */
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1144 g_free(args->info.chat.roominfo.name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 incomingim_ch2_chat(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 * Chat room info.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 aim_chat_readroominfo(servdata, &args->info.chat.roominfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 args->destructor = (void *)incomingim_ch2_chat_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 {
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1163 g_free((char *)args->info.rtfmsg.msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167 * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 * kind of odd. This sends the client ICQRTF since that is all that I've seen
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 * SERVERRELAY used for.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 * Note that this is all little-endian. Cringe.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 {
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1177 guint16 hdrlen, msglen;
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1178
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1179 args->destructor = (void *)incomingim_ch2_icqserverrelay_free;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1181 #define SKIP_HEADER(expected_hdrlen) \
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1182 hdrlen = byte_stream_getle16(servdata); \
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1183 if (hdrlen != expected_hdrlen) { \
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1184 purple_debug_warning("oscar", "Expected to find a header with length " #expected_hdrlen "; ignoring message"); \
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1185 return; \
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1186 } \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 byte_stream_advance(servdata, hdrlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1189 SKIP_HEADER(0x001b);
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1190 SKIP_HEADER(0x000e);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1192 args->info.rtfmsg.msgtype = byte_stream_get8(servdata);
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1193 /*
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1194 * Copied from http://iserverd.khstu.ru/oscar/message.html:
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1195 * xx byte message flags
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1196 * xx xx word (LE) status code
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1197 * xx xx word (LE) priority code
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1198 *
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1199 * We don't need any of these, so just skip them.
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1200 */
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1201 byte_stream_advance(servdata, 1 + 2 + 2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 msglen = byte_stream_getle16(servdata);
30815
47dfe1d54e9e Fixed (I hope) #12284.
ivan.komarov@soc.pidgin.im
parents: 30795
diff changeset
1204 args->info.rtfmsg.msg = byte_stream_getstr(servdata, msglen);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208 incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 {
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1210 g_free(args->info.sendfile.filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 /* Someone is sending us a file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1214 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215 incomingim_ch2_sendfile(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 int flen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 args->destructor = (void *)incomingim_ch2_sendfile_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 /* Maybe there is a better way to tell what kind of sendfile
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 * this is? Maybe TLV t(000a)? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 /* subtype is one of AIM_OFT_SUBTYPE_* */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225 args->info.sendfile.subtype = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 args->info.sendfile.totfiles = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227 args->info.sendfile.totsize = byte_stream_get32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 * I hope to God I'm right when I guess that there is a
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 * 32 char max filename length for single files. I think
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 * OFT tends to do that. Gotta love inconsistency. I saw
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233 * a 26 byte filename?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 /* AAA - create an byte_stream_getnullstr function (don't anymore)(maybe) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 /* Use an inelegant way of getting the null-terminated filename,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 * since there's no easy bstream routine. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238 for (flen = 0; byte_stream_get8(servdata); flen++);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 byte_stream_advance(servdata, -flen -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 args->info.sendfile.filename = byte_stream_getstr(servdata, flen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242 /* There is sometimes more after the null-terminated filename,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 * but I'm unsure of its format. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 /* I don't believe him. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 /* There is sometimes a null byte inside a unicode filename,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 * but as far as I can tell the filename is the last
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247 * piece of data that will be in this message. --Jonathan */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 typedef void (*ch2_args_destructor_t)(OscarData *od, IcbmArgsCh2 *args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1252 static int incomingim_ch2(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 aim_tlv_t *block1, *servdatatlv;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1256 GSList *list2;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 aim_tlv_t *tlv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 IcbmArgsCh2 args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 ByteStream bbs, sdbs, *sdbsptr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260 guint8 *cookie2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1263 char proxyip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 char clientip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 char verifiedip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 memset(&args, 0, sizeof(args));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 * There's another block of TLVs embedded in the type 5 here.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273 if (block1 == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275 /* The server sent us ch2 ICBM without ch2 info? Weird. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 return 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 byte_stream_init(&bbs, block1->value, block1->length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 * First two bytes represent the status of the connection.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282 * One of the AIM_RENDEZVOUS_ defines.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284 * 0 is a request, 1 is a cancel, 2 is an accept
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286 args.status = byte_stream_get16(&bbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 * Next comes the cookie. Should match the ICBM cookie.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291 cookie2 = byte_stream_getraw(&bbs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 if (memcmp(cookie, cookie2, 8) != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1294 purple_debug_warning("oscar",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 "Cookies don't match in rendezvous ICBM, bailing out.\n");
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1296 g_free(cookie2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 return 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 memcpy(args.cookie, cookie2, 8);
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1300 g_free(cookie2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 * The next 16bytes are a capability block so we can
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 * identify what type of rendezvous this is.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 args.type = aim_locate_getcaps(od, &bbs, 0x10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309 * What follows may be TLVs or nothing, depending on the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310 * purpose of the message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312 * Ack packets for instance have nothing more to them.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314 list2 = aim_tlvlist_read(&bbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1316 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 * IP address to proxy the file transfer through.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319 * TODO: I don't like this. Maybe just read in an int? Or inet_ntoa...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 tlv = aim_tlv_gettlv(list2, 0x0002, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323 snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1327 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328 * IP address from the perspective of the client.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1330 tlv = aim_tlv_gettlv(list2, 0x0003, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332 snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 * Verified IP address (from the perspective of Oscar).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 * This is added by the server.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 tlv = aim_tlv_gettlv(list2, 0x0004, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 * Port number for something.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 if (aim_tlv_gettlv(list2, 0x0005, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 args.port = aim_tlv_get16(list2, 0x0005, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 * File transfer "request number":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 * 0x0001 - Initial file transfer request for no proxy or stage 1 proxy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 * 0x0002 - "Reply request" for a stage 2 proxy (receiver wants to use proxy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 * 0x0003 - A third request has been sent; applies only to stage 3 proxied transfers
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 if (aim_tlv_gettlv(list2, 0x000a, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360 args.requestnumber = aim_tlv_get16(list2, 0x000a, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1363 * Terminate connection/error code. 0x0001 means the other user
30865
1cdae196aac8 Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30838
diff changeset
1364 * cancelled the connection.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 if (aim_tlv_gettlv(list2, 0x000b, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 args.errorcode = aim_tlv_get16(list2, 0x000b, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1368
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 * Invitation message / chat description.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 if (aim_tlv_gettlv(list2, 0x000c, 1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 args.msg = aim_tlv_getstr(list2, 0x000c, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 args.msglen = aim_tlv_getlength(list2, 0x000c, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1377 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1378 * Character set.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1379 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 if (aim_tlv_gettlv(list2, 0x000d, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 args.encoding = aim_tlv_getstr(list2, 0x000d, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 * Language.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 if (aim_tlv_gettlv(list2, 0x000e, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 args.language = aim_tlv_getstr(list2, 0x000e, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 * Flag meaning we should proxy the file transfer through an AIM server
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392 if (aim_tlv_gettlv(list2, 0x0010, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 args.use_proxy = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 if (strlen(proxyip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 args.proxyip = (char *)proxyip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397 if (strlen(clientip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 args.clientip = (char *)clientip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399 if (strlen(verifiedip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400 args.verifiedip = (char *)verifiedip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 * This must be present in PROPOSALs, but will probably not
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404 * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 * Service Data blocks are module-specific in format.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 byte_stream_init(&sdbs, servdatatlv->value, servdatatlv->length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 sdbsptr = &sdbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415 * The rest of the handling depends on what type it is.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 * Not all of them have special handling (yet).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 if (args.type & OSCAR_CAPABILITY_BUDDYICON)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 incomingim_ch2_buddyicon(od, conn, mod, frame, snac, userinfo, &args, sdbsptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422 incomingim_ch2_buddylist(od, conn, mod, frame, snac, userinfo, &args, sdbsptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 else if (args.type & OSCAR_CAPABILITY_CHAT)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 incomingim_ch2_chat(od, conn, mod, frame, snac, userinfo, &args, sdbsptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 incomingim_ch2_icqserverrelay(od, conn, mod, frame, snac, userinfo, &args, sdbsptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 else if (args.type & OSCAR_CAPABILITY_SENDFILE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 incomingim_ch2_sendfile(od, conn, mod, frame, snac, userinfo, &args, sdbsptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432 ret = userfunc(od, conn, frame, channel, userinfo, &args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 if (args.destructor)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 ((ch2_args_destructor_t)args.destructor)(od, &args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1438 g_free((char *)args.msg);
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1439 g_free((char *)args.encoding);
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1440 g_free((char *)args.language);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1442 aim_tlvlist_free(list2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1447 static int incomingim_ch4(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 ByteStream meat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 aim_tlv_t *block;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 struct aim_incomingim_ch4_args args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 * Make a bstream for the meaty part. Yum. Meat.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 byte_stream_init(&meat, block->value, block->length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 args.uin = byte_stream_getle32(&meat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463 args.type = byte_stream_getle8(&meat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 args.flags = byte_stream_getle8(&meat);
19640
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17445
diff changeset
1465 if (args.type == 0x1a)
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17445
diff changeset
1466 /* There seems to be a problem with the length in SMS msgs from server, this fixed it */
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17445
diff changeset
1467 args.msglen = block->length - 6;
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17445
diff changeset
1468 else
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17445
diff changeset
1469 args.msglen = byte_stream_getle16(&meat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 args.msg = (gchar *)byte_stream_getraw(&meat, args.msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 ret = userfunc(od, conn, frame, channel, userinfo, &args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1475 g_free(args.msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 * Subtype 0x0007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 * It can easily be said that parsing ICBMs is THE single
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484 * most difficult thing to do in the in AIM protocol. In
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 * fact, I think I just did say that.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487 * Below is the best damned solution I've come up with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 * over the past sixteen months of battling with it. This
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 * can parse both away and normal messages from every client
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 * I have access to. Its not fast, its not clean. But it works.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 static int incomingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 guchar *cookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 guint16 channel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 aim_userinfo_t userinfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 memset(&userinfo, 0x00, sizeof(aim_userinfo_t));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 * Read ICBM Cookie.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 * Channel ID.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 * Channel 0x0001 is the message channel. It is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 * used to send basic ICBMs.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 * Channel 0x0002 is the Rendezvous channel, which
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 * is where Chat Invitiations and various client-client
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 * connection negotiations come from.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 * Channel 0x0003 is used for chat messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 * Channel 0x0004 is used for ICQ authorization, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 * possibly any system notice.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523 channel = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 * Extract the standard user info block.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1528 * Note that although this contains TLVs that appear contiguous
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 * with the TLVs read below, they are two different pieces. The
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 * userinfo block contains the number of TLVs that contain user
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531 * information, the rest are not even though there is no separation.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 * You can start reading the message TLVs after aim_info_extract()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533 * parses out the standard userinfo block.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 * That also means that TLV types can be duplicated between the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536 * userinfo block and the rest of the message, however there should
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 * never be two TLVs of the same type in one block.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1539 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 aim_info_extract(od, bs, &userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 * From here on, its depends on what channel we're on.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 * Technically all channels have a TLV list have this, however,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 * for the common channel 1 case, in-place parsing is used for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 * performance reasons (less memory allocation).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 if (channel == 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 ret = incomingim_ch1(od, conn, mod, frame, snac, channel, &userinfo, bs, cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 } else if (channel == 2) {
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1554 GSList *tlvlist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 * Read block of TLVs (not including the userinfo data). All
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 * further data is derived from what is parsed here.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 tlvlist = aim_tlvlist_read(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 ret = incomingim_ch2(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1564 aim_tlvlist_free(tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 } else if (channel == 4) {
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1567 GSList *tlvlist;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 tlvlist = aim_tlvlist_read(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1571 aim_tlvlist_free(tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1574 purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 aim_info_free(&userinfo);
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1578 g_free(cookie);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1580 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 /* Subtype 0x000a */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 static int missedcall(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 guint16 channel, nummissed, reason;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 aim_userinfo_t userinfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590
30826
bbb27d65681f Bstream cleanups:
ivan.komarov@soc.pidgin.im
parents: 30824
diff changeset
1591 while (byte_stream_bytes_left(bs)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593 channel = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 aim_info_extract(od, bs, &userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 nummissed = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596 reason = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 ret = userfunc(od, conn, frame, channel, &userinfo, nummissed, reason);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1600
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601 aim_info_free(&userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1605 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 * Subtype 0x000b
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 * Possible codes:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1611 * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1614 int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1617 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 aim_snacid_t snacid;
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1619 GSList *tlvlist = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
1621 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1624 byte_stream_new(&bs, 8+2+1+strlen(bn)+6);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
1626 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1627
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1628 byte_stream_putraw(&bs, cookie, 8);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1629
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1630 byte_stream_put16(&bs, 0x0002); /* channel */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1631 byte_stream_put8(&bs, strlen(bn));
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1632 byte_stream_putstr(&bs, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1634 aim_tlvlist_add_16(&tlvlist, 0x0003, code);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1635 aim_tlvlist_write(&bs, &tlvlist);
17445
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17235
diff changeset
1636 aim_tlvlist_free(tlvlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
1638 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, snacid, &bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
1639
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1640 byte_stream_destroy(&bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 /*
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1646 * Subtype 0x000b.
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1647 * Send confirmation for a channel 2 message (Miranda wants it by default).
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1648 */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1649 void
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1650 aim_im_send_icq_confirmation(OscarData *od, const char *bn, const guchar *cookie)
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1651 {
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1652 ByteStream bs;
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1653 aim_snacid_t snacid;
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1654 guint32 header_size, data_size;
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1655 guint16 cookie2 = (guint16)g_random_int();
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1656
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1657 purple_debug_misc("oscar", "Sending message ack to %s\n", bn);
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1658
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1659 header_size = 8 + 2 + 1 + strlen(bn) + 2;
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1660 data_size = 2 + 1 + 16 + 4*2 + 2*3 + 4*3 + 1*2 + 2*3 + 1;
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1661 byte_stream_new(&bs, header_size + data_size);
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1662
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1663 /* The message header. */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1664 aim_im_puticbm(&bs, cookie, 0x0002, bn);
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1665 byte_stream_put16(&bs, 0x0003); /* reason */
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1666
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1667 /* The actual message. */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1668 byte_stream_putle16(&bs, 0x1b); /* subheader #1 length */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1669 byte_stream_put8(&bs, 0x08); /* protocol version */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1670 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY);
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1671 byte_stream_put32(&bs, 0x3); /* client features */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1672 byte_stream_put32(&bs, 0x0004); /* DC type */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1673 byte_stream_put16(&bs, cookie2); /* a cookie, chosen by fair dice roll */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1674 byte_stream_putle16(&bs, 0x0e); /* header #2 len? */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1675 byte_stream_put16(&bs, cookie2); /* the same cookie again */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1676 byte_stream_put32(&bs, 0); /* unknown */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1677 byte_stream_put32(&bs, 0); /* unknown */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1678 byte_stream_put32(&bs, 0); /* unknown */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1679 byte_stream_put8(&bs, 0x01); /* plain text message */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1680 byte_stream_put8(&bs, 0x00); /* no message flags */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1681 byte_stream_put16(&bs, 0x0000); /* no icq status */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1682 byte_stream_put16(&bs, 0x0100); /* priority */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1683 byte_stream_putle16(&bs, 1); /* query message len */
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1684 byte_stream_put8(&bs, 0x00); /* empty query message */
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1685
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1686 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0);
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
1687 flap_connection_send_snac(od, flap_connection_findbygroup(od, SNAC_FAMILY_ICBM), SNAC_FAMILY_ICBM, 0x000b, snacid, &bs);
30832
3eb2dd8a1cc7 Miranda expects a client ack from the other side for channel 2 messages,
ivan.komarov@soc.pidgin.im
parents: 30826
diff changeset
1688 byte_stream_destroy(&bs);
22402
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1689 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22342
diff changeset
1690
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692 * Subtype 0x000b - Receive the response from an ICQ status message
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 * request (in which case this contains the ICQ status message) or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694 * a file transfer or direct IM request was declined.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 static int clientautoresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1697 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1698 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 guint16 channel, reason;
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1701 char *bn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 guchar *cookie;
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1703 guint8 bnlen;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1704 char *xml = NULL;
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1705 guint16 hdrlen;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1706 int curpos;
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1707 guint16 num1, num2;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1708 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1709 PurpleBuddy *buddy;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1710 PurplePresence *presence;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1711 PurpleStatus *status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1713 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714 channel = byte_stream_get16(bs);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1715 bnlen = byte_stream_get8(bs);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1716 bn = byte_stream_getstr(bs, bnlen);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 reason = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
1719 if (channel == 0x0002)
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
1720 {
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1721 hdrlen = byte_stream_getle16(bs);
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1722 if (hdrlen == 27 && bs->len > (27 + 51)) {
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1723 byte_stream_advance(bs, 51);
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1724 num1 = byte_stream_getle16(bs);
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1725 num2 = byte_stream_getle16(bs);
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1726 purple_debug_misc("oscar", "X-Status: num1 %hu, num2 %hu\n", num1, num2);
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1727
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1728 if (num1 == 0x4f00 && num2 == 0x3b00) {
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1729 byte_stream_advance(bs, 86);
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1730 curpos = byte_stream_curpos(bs);
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1731 xml = byte_stream_getstr(bs, bs->len - curpos);
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1732 purple_debug_misc("oscar", "X-Status: Received XML reply\n");
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1733 if (xml) {
30702
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1734 GString *xstatus;
31086
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1735 char *tmp1, *tmp2, *unescaped_xstatus;
30702
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1736
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1737 /* purple_debug_misc("oscar", "X-Status: XML reply: %s\n", xml); */
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1738
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1739 xstatus = g_string_new(NULL);
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1740
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1741 tmp1 = strstr(xml, "&lt;title&gt;");
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1742 if (tmp1 != NULL) {
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1743 tmp1 += 13;
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1744 tmp2 = strstr(tmp1, "&lt;/title&gt;");
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1745 if (tmp2 != NULL)
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1746 g_string_append_len(xstatus, tmp1, tmp2 - tmp1);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1747 }
30702
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1748 tmp1 = strstr(xml, "&lt;desc&gt;");
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1749 if (tmp1 != NULL) {
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1750 tmp1 += 12;
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1751 tmp2 = strstr(tmp1, "&lt;/desc&gt;");
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1752 if (tmp2 != NULL) {
31086
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1753 if (xstatus->len > 0 && tmp2 > tmp1)
30702
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1754 g_string_append(xstatus, " - ");
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1755 g_string_append_len(xstatus, tmp1, tmp2 - tmp1);
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1756 }
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1757 }
31086
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1758 unescaped_xstatus = purple_unescape_text(xstatus->str);
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1759 g_string_free(xstatus, TRUE);
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1760 if (*unescaped_xstatus) {
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1761 purple_debug_misc("oscar", "X-Status reply: %s\n", unescaped_xstatus);
30702
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1762 account = purple_connection_get_account(od->gc);
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1763 buddy = purple_find_buddy(account, bn);
6829b27ee4c8 This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <mark@kingant.net>
parents: 30633
diff changeset
1764 presence = purple_buddy_get_presence(buddy);
31086
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1765 status = purple_presence_get_status(presence, "mood");
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1766 if (status) {
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1767 purple_prpl_got_user_status(account, bn,
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1768 "mood",
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1769 PURPLE_MOOD_NAME, purple_status_get_attr_string(status, PURPLE_MOOD_NAME),
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1770 PURPLE_MOOD_COMMENT, unescaped_xstatus, NULL);
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1771 }
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1772 }
31086
1558900f47e5 Merged my changes that fix #11964 and #12593. Mark looked over them
ivan.komarov@soc.pidgin.im
parents: 31035
diff changeset
1773 g_free(unescaped_xstatus);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1774 } else {
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1775 purple_debug_misc("oscar", "X-Status: Can't get XML reply string\n");
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1776 }
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1777 } else {
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1778 purple_debug_misc("oscar", "X-Status: 0x0004, 0x000b not an xstatus reply\n");
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1779 }
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1780
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1781 }
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
1782
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783 } else if (channel == 0x0004) { /* ICQ message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 switch (reason) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 guint8 statusmsgtype, *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 guint16 len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 guint32 state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790 len = byte_stream_getle16(bs); /* Should be 0x001b */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791 byte_stream_advance(bs, len); /* Unknown */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793 len = byte_stream_getle16(bs); /* Should be 0x000e */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 byte_stream_advance(bs, len); /* Unknown */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796 statusmsgtype = byte_stream_getle8(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 switch (statusmsgtype) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798 case 0xe8:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 state = AIM_ICQ_STATE_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 case 0xe9:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 case 0xea:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805 state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807 case 0xeb:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810 case 0xec:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 state = AIM_ICQ_STATE_CHAT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 state = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818 byte_stream_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819 byte_stream_getle16(bs); /* Unknown - 0x0000 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820 byte_stream_getle16(bs); /* Unknown - 0x0000 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822 len = byte_stream_getle16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 msg = byte_stream_getraw(bs, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1826 ret = userfunc(od, conn, frame, channel, bn, reason, state, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1828 g_free(msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 } break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1831 default: {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1833 ret = userfunc(od, conn, frame, channel, bn, reason);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 } break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 } /* end switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1838 g_free(cookie);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1839 g_free(bn);
29851
5391094529c6 propagate from branch 'im.pidgin.pidgin' (head a59a573e3b9b2eb42ff728ba9ff56095f5c9e0d0)
Richard Laager <rlaager@wiktel.com>
parents: 25440 29812
diff changeset
1840 g_free(xml);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 /*
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
1846 * Subtype 0x000c - Receive an ack after sending an ICBM. The ack contains the ICBM header of the message you sent.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 static int msgack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 guint16 ch;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 guchar *cookie;
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1852 char *bn;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 ch = byte_stream_get16(bs);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1857 bn = byte_stream_getstr(bs, byte_stream_get8(bs));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858
30818
9d386bf63eab Stop using custom encodings (and LATIN-1, for that matter) for sending
ivan.komarov@soc.pidgin.im
parents: 30815
diff changeset
1859 purple_debug_info("oscar", "Sent message to %s.\n", bn);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1860
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1861 g_free(bn);
17235
1927f4ead3ca Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15823
diff changeset
1862 g_free(cookie);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1864 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1865 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1867 /*
22337
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1868 * Subtype 0x0010 - Request any offline messages that are waiting for
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1869 * us. This is the "new" way of handling offline messages which is
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1870 * used for both AIM and ICQ. The old way is to use the ugly
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1871 * aim_icq_reqofflinemsgs() function, but that is no longer necessary.
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1872 *
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1873 * We set the 0x00000100 flag on the ICBM message parameters, which
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1874 * tells the oscar servers that we support offline messages. When we
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1875 * set that flag the servers do not automatically send us offline
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1876 * messages. Instead we must request them using this function. This
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1877 * should happen after sending the 0x0001/0x0002 "client online" SNAC.
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1878 */
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1879 int aim_im_reqofflinemsgs(OscarData *od)
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1880 {
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1881 FlapConnection *conn;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1882
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1883 if (!od || !(conn = flap_connection_findbygroup(od, 0x0002)))
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1884 return -EINVAL;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1885
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
1886 aim_genericreq_n(od, conn, SNAC_FAMILY_ICBM, 0x0010);
22337
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1887
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1888 return 0;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1889 }
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1890
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1891 /*
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892 * Subtype 0x0014 - Send a mini typing notification (mtn) packet.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1895 * and Purple 0.60 and newer.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1897 */
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1898 int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 FlapConnection *conn;
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1901 ByteStream bs;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 if (!od || !(conn = flap_connection_findbygroup(od, 0x0002)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1905 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1907 if (!bn)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1908 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1910 byte_stream_new(&bs, 11 + strlen(bn) + 2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
1912 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1914 /* ICBM cookie */
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1915 byte_stream_put32(&bs, 0x00000000);
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1916 byte_stream_put32(&bs, 0x00000000);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918 /*
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1919 * Channel (should be 0x0001 for mtn)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1920 */
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1921 byte_stream_put16(&bs, channel);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 /*
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1924 * Dest buddy name
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 */
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1926 byte_stream_put8(&bs, strlen(bn));
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
1927 byte_stream_putstr(&bs, bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929 /*
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1930 * Event (should be 0x0000, 0x0001, or 0x0002 for mtn)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 */
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
1932 byte_stream_put16(&bs, event);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1933
30838
abf34893ce88 Fix a compile error from my merge
Mark Doliner <mark@kingant.net>
parents: 30837
diff changeset
1934 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, snacid, &bs);
22700
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1935
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22402
diff changeset
1936 byte_stream_destroy(&bs);
22829
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22702
diff changeset
1937
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1938 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1939 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 /*
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1942 * Subtype 0x0006 - Send eXtra Status request
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1943 */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1944 int icq_im_xstatus_request(OscarData *od, const char *sn)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1945 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1946 FlapConnection *conn;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1947 aim_snacid_t snacid;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1948 guchar cookie[8];
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1949 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1950 ByteStream bs, header, plugindata;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1951 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1952 const char *fmt;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1953 char *statxml;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1954 int xmllen;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1955
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1956 static const guint8 pluginid[] = {
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1957 0x09, 0x46, 0x13, 0x49, 0x4C, 0x7F, 0x11, 0xD1,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1958 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1959 };
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1960
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1961 static const guint8 c_plugindata[] = {
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1962 0x1B, 0x00, 0x0A,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1963 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1964 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1965 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x01, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1966 0x01, 0x00, 0x00, 0x4F, 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0, 0x9C,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1967 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x53, 0x63, 0x72, 0x69, 0x70,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1968 0x74, 0x20, 0x50, 0x6C, 0x75, 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1969 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1970 0x72, 0x72, 0x69, 0x76, 0x65, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
1971 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1972 };
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1973
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1974 if (!od || !(conn = flap_connection_findbygroup(od, 0x0004)))
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1975 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1976
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1977 if (!sn)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1978 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1979
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1980 fmt = "<N><QUERY>&lt;Q&gt;&lt;PluginID&gt;srvMng&lt;/PluginID&gt;&lt;/Q&gt;</QUERY><NOTIFY>&lt;srv&gt;&lt;id&gt;cAwaySrv&lt;/id&gt;&lt;req&gt;&lt;id&gt;AwayStat&lt;/id&gt;&lt;trans&gt;2&lt;/trans&gt;&lt;senderId&gt;%s&lt;/senderId&gt;&lt;/req&gt;&lt;/srv&gt;</NOTIFY></N>\r\n";
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1981
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1982 account = purple_connection_get_account(od->gc);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1983
31035
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
1984 statxml = g_strdup_printf(fmt, account->username);
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
1985 xmllen = strlen(statxml);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1986
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1987 aim_icbm_makecookie(cookie);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1988
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1989 byte_stream_new(&bs, 10 + 8 + 2 + 1 + strlen(sn) + 2
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1990 + 2 + 2 + 8 + 16 + 2 + 2 + 2 + 2 + 2
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1991 + 2 + 2 + sizeof(c_plugindata) + xmllen
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1992 + 2 + 2);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
1993
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1994 snacid = aim_cachesnac(od, 0x0004, 0x0006, 0x0000, NULL, 0);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1995 aim_im_puticbm(&bs, cookie, 0x0002, sn);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1996
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1997 byte_stream_new(&header, (7*2) + 16 + 8 + 2 + sizeof(c_plugindata) + xmllen); /* TLV 0x0005 Stream + Size */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1998 byte_stream_put16(&header, 0x0000); /* Message Type: Request */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
1999 byte_stream_putraw(&header, cookie, sizeof(cookie)); /* Message ID */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2000 byte_stream_putraw(&header, pluginid, sizeof(pluginid)); /* Plugin ID */
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2001
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2002 aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2003 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2004
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2005 /* Add Plugin Specific Data */
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2006 byte_stream_new(&plugindata, (sizeof(c_plugindata) + xmllen));
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2007 byte_stream_putraw(&plugindata, c_plugindata, sizeof(c_plugindata)); /* Content of TLV 0x2711 */
31035
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
2008 byte_stream_putraw(&plugindata, (const guint8*)statxml, xmllen);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2009
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2010 aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, (sizeof(c_plugindata) + xmllen), plugindata.data);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2011
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2012 aim_tlvlist_write(&header, &inner_tlvlist);
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2013 aim_tlvlist_free(inner_tlvlist);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2014
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2015 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&header), header.data);
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2016 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); /* Empty TLV 0x0003 */
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2017
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2018 aim_tlvlist_write(&bs, &outer_tlvlist);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2019
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2020 purple_debug_misc("oscar", "X-Status Request\n");
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
2021 flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x0006, snacid, &bs, TRUE);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2022
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2023 aim_tlvlist_free(outer_tlvlist);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2024 byte_stream_destroy(&header);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2025 byte_stream_destroy(&plugindata);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2026 byte_stream_destroy(&bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2027 g_free(statxml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2028
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2029 return 0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2030 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2031
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2032 int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2033 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2034 FlapConnection *conn;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2035 ByteStream bs;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2036 aim_snacid_t snacid;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2037 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2038 PurpleStatus *status;
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2039 const char *fmt;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2040 const char *formatted_msg;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2041 char *msg;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2042 char *statxml;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2043 const char *title;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2044 int len;
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2045
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2046 static const guint8 plugindata[] = {
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2047 0x1B, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2048 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2050 0x01, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2052 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x4F,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2053 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2054 0x9C, 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2055 0x00, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x50, 0x6C, 0x75,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2056 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2057 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2058 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x72, 0x72, 0x69, 0x76, 0x65, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2059 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2060 0x00, 0x00, 0x00, 0xF3, 0x01, 0x00, 0x00, 0xEF, 0x01, 0x00, 0x00
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2061 };
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2062
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2063 fmt = "<NR><RES>&lt;ret event='OnRemoteNotification'&gt;&lt;srv&gt;&lt;id&gt;cAwaySrv&lt;/id&gt;&lt;val srv_id='cAwaySrv'&gt;&lt;Root&gt;&lt;CASXtraSetAwayMessage&gt;&lt;/CASXtraSetAwayMessage&gt;&l t;uin&gt;%s&lt;/uin&gt;&lt;index&gt;1&lt;/index&gt;&lt;title&gt;%s&lt;/title&gt;&lt;desc&gt;%s&lt;/desc&gt;&lt;/Root&gt;&lt;/val&gt;&lt;/srv&gt;&lt;srv&gt;&lt;id&gt;cRandomizerSrv&lt;/id&gt;&lt;val srv_id='cRandomizerSrv'&gt;undefined&lt;/val&gt;&lt;/srv&gt;&lt;/ret&gt;</RES></NR>\r\n";
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2064
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2065 if (!od || !(conn = flap_connection_findbygroup(od, 0x0002)))
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2066 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2067
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2068 if (!sn)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2069 return -EINVAL;
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2070
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2071 account = purple_connection_get_account(od->gc);
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2072 if (!account)
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2073 return -EINVAL;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2074
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2075 /* if (!strcmp(account->username, sn))
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2076 icq_im_xstatus_request(od, sn); */
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2077
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2078 status = purple_presence_get_active_status(account->presence);
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2079 if (!status)
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2080 return -EINVAL;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2081
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2082 title = purple_status_get_name(status);
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2083 if (!title)
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2084 return -EINVAL;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2085
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2086 formatted_msg = purple_status_get_attr_string(status, "message");
30633
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2087 if (!formatted_msg)
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2088 return -EINVAL;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2089
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2090 msg = purple_markup_strip_html(formatted_msg);
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2091 if (!msg)
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2092 return -EINVAL;
62f7ea77feb3 Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <mark@kingant.net>
parents: 30628
diff changeset
2093
31035
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
2094 statxml = g_strdup_printf(fmt, account->username, title, msg);
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
2095 len = strlen(statxml);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2096
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2097 purple_debug_misc("oscar", "X-Status AutoReply: %s, %s\n", formatted_msg, msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2098
31035
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
2099 byte_stream_new(&bs, 10 + 8 + 2 + 1 + strlen(sn) + 2 + sizeof(plugindata) + len); /* 16 extra */
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2100
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2101 snacid = aim_cachesnac(od, 0x0004, 0x000b, 0x0000, NULL, 0);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2102 aim_im_puticbm(&bs, cookie, 0x0002, sn);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2103 byte_stream_put16(&bs, 0x0003);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2104 byte_stream_putraw(&bs, plugindata, sizeof(plugindata));
31035
6f8a8685eef1 Simplify the way that string length and memory allocation is done.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30865
diff changeset
2105 byte_stream_putraw(&bs, (const guint8*)statxml, len);
30628
d24c975c68a5 Remove some stray spaces
Mark Doliner <mark@kingant.net>
parents: 30406
diff changeset
2106
30833
11c54d781835 Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents: 30832
diff changeset
2107 flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x000b, snacid, &bs, TRUE);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2108
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2109 g_free(statxml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2110 g_free(msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2111 byte_stream_destroy(&bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2112
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2113 return 0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2114 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2115
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23315
diff changeset
2116 /*
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 * Subtype 0x0014 - Receive a mini typing notification (mtn) packet.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
2120 * and Purple 0.60 and newer.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2122 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 aim_rxcallback_t userfunc;
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2127 char *bn;
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2128 guint8 bnlen;
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2129 guint16 channel, event;
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2130
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2131 byte_stream_advance(bs, 8); /* ICBM cookie */
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2132 channel = byte_stream_get16(bs);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2133 bnlen = byte_stream_get8(bs);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2134 bn = byte_stream_getstr(bs, bnlen);
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2135 event = byte_stream_get16(bs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
28588
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28587
diff changeset
2138 ret = userfunc(od, conn, frame, channel, bn, event);
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2139
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24613
diff changeset
2140 g_free(bn);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2142 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 static int
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 {
28865
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
2148 if (snac->subtype == 0x0001)
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
2149 return error(od, conn, mod, frame, snac, bs);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28588
diff changeset
2150 else if (snac->subtype == 0x0005)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151 return aim_im_paraminfo(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 else if (snac->subtype == 0x0007)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 return incomingim(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154 else if (snac->subtype == 0x000a)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 return missedcall(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156 else if (snac->subtype == 0x000b)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157 return clientautoresp(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 else if (snac->subtype == 0x000c)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2159 return msgack(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 else if (snac->subtype == 0x0014)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161 return mtn_receive(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2163 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166 int
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 msg_modfirst(OscarData *od, aim_module_t *mod)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 {
23315
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22829
diff changeset
2169 mod->family = SNAC_FAMILY_ICBM;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170 mod->version = 0x0001;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 mod->toolid = 0x0110;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 mod->toolversion = 0x0629;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 mod->flags = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 strncpy(mod->name, "messaging", sizeof(mod->name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175 mod->snachandler = snachandler;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 }