annotate libpurple/protocols/oscar/family_icbm.c @ 29986:f18b6eb0ed02

Cleanup, basically. Move the icbm snac error handling from oscar.c to family_icbm.c so we don't have to bother we va_args. This is simpler, and gives us the benefit of type checking by the compiler, which will help avoid the crash bug we encountered.
author Mark Doliner <mark@kingant.net>
date Thu, 20 May 2010 02:44:00 +0000
parents c1b8e619f1b8
children d24c975c68a5 879baaf87aa2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
2 * Purple's oscar protocol plugin
15373
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
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19654
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "oscar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "peer.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "win32dep.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
54 #include "util.h"
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
55
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
56 static const char * const errcodereason[] = {
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
57 N_("Invalid error"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
58 N_("Not logged in"),
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
59 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: 29985
diff changeset
60 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: 29985
diff changeset
61 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: 29985
diff changeset
62 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: 29985
diff changeset
63 N_("Unknown error"), /* Undocumented */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
64 N_("Unknown error"), /* Undocumented */
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
65 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: 29985
diff changeset
66 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: 29985
diff changeset
67 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: 29985
diff changeset
68 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: 29985
diff changeset
69 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: 29985
diff changeset
70 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: 29985
diff changeset
71 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: 29985
diff changeset
72 N_("Offline message store full")
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
73 };
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
74 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
75
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 * 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
78 * information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 * @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
81 * @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
82 * @param channel The ICBM channel (1 through 4).
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
83 * @param bn Null-terminated scrizeen nizame.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 * @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
85 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
86 static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 byte_stream_putraw(bs, c, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 byte_stream_put16(bs, channel);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
90 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: 24665
diff changeset
91 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: 24665
diff changeset
92 return 8+2+1+strlen(bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
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 * 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
97 * 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
98 * 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
99 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 void aim_icbm_makecookie(guchar *cookie)
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 int i;
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 /* Should be like "21CBF95" and null terminated */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 for (i = 0; i < 7; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 cookie[i] = 0x30 + ((guchar)rand() % 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 cookie[7] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
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 * Takes a msghdr (and a length) and returns a client type
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 * code. Note that this is *only a guess* and has a low likelihood
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 * of actually being accurate.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 * Its based on experimental data, with the help of Eric Warmenhoven
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 * who seems to have collected a wide variety of different AIM clients.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 * Heres the current collection:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 * 4.3.2229, 4.4.2286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 * 0501 0003 0101 02 WinAIM 5
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 * 0501 0001 01 iChat x.x, mobile buddies
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any TOC client
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 * 0501 0002 0106 WinICQ 5.45.1.3777.85
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 * Note that in this function, only the feature bytes are tested, since
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 * the rest will always be the same.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 guint16 aim_im_fingerprint(const guint8 *msghdr, int len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 static const struct {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 guint16 clientid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 guint8 data[10];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 } fingerprints[] = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 /* AOL Mobile Communicator, WinAIM 1.0.414 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 { AIM_CLIENTTYPE_MC,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 3, {0x01, 0x01, 0x01}},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 { AIM_CLIENTTYPE_WINAIM,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 3, {0x01, 0x01, 0x02}},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 /* WinAIM 4.1.2010, libfaim */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 { AIM_CLIENTTYPE_WINAIM41,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 4, {0x01, 0x01, 0x01, 0x02}},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 { AIM_CLIENTTYPE_AOL_TOC,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 1, {0x01}},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 { 0, 0, {0x00}}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 if (!msghdr || (len <= 0))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 return AIM_CLIENTTYPE_UNKNOWN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 for (i = 0; fingerprints[i].len; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 if (fingerprints[i].len != len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 return fingerprints[i].clientid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 return AIM_CLIENTTYPE_UNKNOWN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
173 /*
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
174 * Subtype 0x0001 - Error
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
175 */
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
176 static int
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
177 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: 28229
diff changeset
178 {
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
179 aim_snac_t *snac2;
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
180 guint16 reason, errcode = 0;
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
181 const char *bn;
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
182 GSList *tlvlist;
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
183 PurpleConnection *gc = od->gc;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
184 #ifdef TODOFT
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
185 PurpleXfer *xfer;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
186 #endif
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
187 const char *reason_str;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
188 char *buf;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
189
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
190 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: 29985
diff changeset
191 if (!snac2) {
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
192 purple_debug_misc("oscar", "icbm error: received response from unknown request!\n");
29984
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 29960
diff changeset
193 return 1;
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
194 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
195
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
196 if (snac2->family != SNAC_FAMILY_ICBM) {
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
197 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: 28229
diff changeset
198 g_free(snac2->data);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
199 g_free(snac2);
29984
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 29960
diff changeset
200 return 1;
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
201 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
202
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
203 /* 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: 29985
diff changeset
204 bn = snac2->data;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
205 if (!bn || bn[0] == '\0') {
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
206 purple_debug_misc("oscar", "icbm error: received response from request without a buddy name!\n");
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
207 g_free(snac2->data);
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
208 g_free(snac2);
29984
6d96bfe048bc If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <mark@kingant.net>
parents: 29960
diff changeset
209 return 1;
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
210 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
211
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
212 reason = byte_stream_get16(bs);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
213
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
214 tlvlist = aim_tlvlist_read(bs);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
215 if (aim_tlv_gettlv(tlvlist, 0x0008, 1))
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
216 errcode = aim_tlv_get16(tlvlist, 0x0008, 1);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
217 aim_tlvlist_free(tlvlist);
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
218
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
219 purple_debug_error("oscar",
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
220 "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: 29985
diff changeset
221 (bn != NULL ? bn : ""), reason, errcode);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
222
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
223 #ifdef TODOFT
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
224 /* 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: 29985
diff changeset
225 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: 29985
diff changeset
226 purple_xfer_cancel_remote(xfer);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
227 return 1;
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
228 }
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
229 #endif
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
230
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
231 /* Notify the user that the message wasn't delivered */
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
232 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: 29985
diff changeset
233 if (errcode != 0 && errcode < errcodereasonlen)
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
234 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: 29985
diff changeset
235 _(errcodereason[errcode]));
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
236 else
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
237 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: 29985
diff changeset
238
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
239 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: 29985
diff changeset
240 g_free(buf);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
241 if (errcode != 0 && errcode < errcodereasonlen)
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
242 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: 29985
diff changeset
243 bn ? bn : "(unknown)", reason_str,
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
244 _(errcodereason[errcode]));
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
245 else
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
246 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: 29985
diff changeset
247 bn ? bn : "(unknown)", reason_str);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
248 purple_notify_error(od->gc, NULL, buf, reason_str);
29985
c1b8e619f1b8 Super tiny optimisation
Mark Doliner <mark@kingant.net>
parents: 29984
diff changeset
249 }
29986
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
250 g_free(buf);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
251
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
252
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
253
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
254
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
255 g_free(snac2->data);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
256 g_free(snac2);
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
257
f18b6eb0ed02 Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents: 29985
diff changeset
258 return 1;
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
259 }
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
260
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 * Subtype 0x0002 - Set ICBM parameters.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 * 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
265 * with the rather unreasonable defaults.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 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
269 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
271 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
274 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 if (!params)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
280 byte_stream_new(&bs, 16);
15373
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 /* This is read-only (see Parameter Reply). Must be set to zero here. */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
283 byte_stream_put16(&bs, 0x0000);
15373
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 /* These are all read-write */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
286 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: 22412
diff changeset
287 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: 22412
diff changeset
288 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: 22412
diff changeset
289 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: 22412
diff changeset
290 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: 22412
diff changeset
291
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
292 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0);
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
293 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, 0x0000, snacid, &bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
294
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
295 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
296
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 * Subtype 0x0004 - Request ICBM parameter information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 int aim_im_reqparams(OscarData *od)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 FlapConnection *conn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
308 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
311 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 }
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 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 * Subtype 0x0005 - Receive parameter information.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 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
321 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 struct aim_icbmparameters params;
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 params.maxchan = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 params.flags = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 params.maxmsglen = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 params.maxsenderwarn = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 params.maxrecverwarn = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 params.minmsginterval = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330
27532
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27200
diff changeset
331 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: 27200
diff changeset
332 | 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: 27200
diff changeset
333 | AIM_IMPARAM_FLAG_EVENTS_ALLOWED
074e67a105be Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <mark@kingant.net>
parents: 27200
diff changeset
334 | AIM_IMPARAM_FLAG_SMS_SUPPORTED
29736
787d82881a3e Rename this flag and add a happy bumble bee comment
Mark Doliner <mark@kingant.net>
parents: 29732
diff changeset
335 | AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED
787d82881a3e Rename this flag and add a happy bumble bee comment
Mark Doliner <mark@kingant.net>
parents: 29732
diff changeset
336 | 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: 19681
diff changeset
337 params.maxmsglen = 8000;
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19681
diff changeset
338 params.minmsginterval = 0;
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19681
diff changeset
339
b3e4b81456b0 Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <mark@kingant.net>
parents: 19681
diff changeset
340 aim_im_setparams(od, &params);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 * Subtype 0x0006 - Send an ICBM (instant message).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 * Possible flags:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 * 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
351 * AIM_IMFLAGS_ACK -- Requests that the server send an ack
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
352 * when the message is received (of type SNAC_FAMILY_ICBM/0x000c)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 * 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
354 * online (probably ICQ only).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 * Generally, you should use the lowest encoding possible to send
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 * your message. If you only use basic punctuation and the generic
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 * Latin alphabet, use ASCII7 (no flags). If you happen to use non-ASCII7
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 * characters, but they are all clearly defined in ISO-8859-1, then
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 * use that. Keep in mind that not all characters in the PC ASCII8
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 * character set are defined in the ISO standard. For those cases (most
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 * notably when the (r) symbol is used), you must use the full UNICODE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 * encoding for your message. In UNICODE mode, _all_ characters must
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 * occupy 16bits, including ones that are not special. (Remember that
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 * the first 128 UNICODE symbols are equivalent to ASCII7, however they
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 * must be prefixed with a zero high order byte.)
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 * I strongly discourage the use of UNICODE mode, mainly because none
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 * of the clients I use can parse those messages (and besides that,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 * wchars are difficult and non-portable to handle in most UNIX environments).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 * If you really need to include special characters, use the HTML UNICODE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 * entities. These are of the form &#2026; where 2026 is the hex
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 * representation of the UNICODE index (in this case, UNICODE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 * "Horizontal Ellipsis", or 133 in in ASCII8).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 * 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
377 * 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
378 * 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
379 * 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
380 * instead of writing out the bytes manually.
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 * XXX - more precise verification that we never send SNACs larger than 8192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 * XXX - check SNAC size for multipart
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 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
387 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 FlapConnection *conn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 ByteStream data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 int msgtlvlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 static const guint8 deffeatures[] = { 0x01, 0x01, 0x01, 0x02 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
395 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 return -EINVAL;
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 if (!args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 return -EINVAL;
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 if (args->flags & AIM_IMFLAGS_MULTIPART) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 if (args->mpmsg->numparts == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 if (!args->msg || (args->msglen <= 0))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
21724
d69d729ba19c The current oscar max message size appears to be 2544. I don't know
Mark Doliner <mark@kingant.net>
parents: 21723
diff changeset
408 if (args->msglen > MAXMSGLEN)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 return -E2BIG;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 /* 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
413 msgtlvlen = 1 + 1; /* 0501 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 msgtlvlen += 2 + args->featureslen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 msgtlvlen += 2 + sizeof(deffeatures);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 if (args->flags & AIM_IMFLAGS_MULTIPART) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 aim_mpmsg_section_t *sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 for (sec = args->mpmsg->parts; sec; sec = sec->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 msgtlvlen += 2 /* 0101 */ + 2 /* block len */;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 msgtlvlen += 4 /* charset */ + sec->datalen;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 msgtlvlen += 2 /* 0101 */ + 2 /* block len */;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 msgtlvlen += 4 /* charset */ + args->msglen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 }
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 byte_stream_new(&data, msgtlvlen + 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 /* Generate an ICBM cookie */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
439 aim_im_puticbm(&data, cookie, 0x0001, args->destbn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 /* Message TLV (type 0x0002) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 byte_stream_put16(&data, 0x0002);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 byte_stream_put16(&data, msgtlvlen);
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 /* Features TLV (type 0x0501) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 byte_stream_put16(&data, 0x0501);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 byte_stream_put16(&data, args->featureslen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 byte_stream_putraw(&data, args->features, args->featureslen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 byte_stream_put16(&data, sizeof(deffeatures));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 byte_stream_putraw(&data, deffeatures, sizeof(deffeatures));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 if (args->flags & AIM_IMFLAGS_MULTIPART) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 aim_mpmsg_section_t *sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 /* Insert each message part in a TLV (type 0x0101) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 for (sec = args->mpmsg->parts; sec; sec = sec->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 byte_stream_put16(&data, 0x0101);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 byte_stream_put16(&data, sec->datalen + 4);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 byte_stream_put16(&data, sec->charset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 byte_stream_put16(&data, sec->charsubset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 byte_stream_putraw(&data, (guchar *)sec->data, sec->datalen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 /* Insert message text in a TLV (type 0x0101) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 byte_stream_put16(&data, 0x0101);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 /* Message block length */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 byte_stream_put16(&data, args->msglen + 0x04);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 /* Character set */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 byte_stream_put16(&data, args->charset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 byte_stream_put16(&data, args->charsubset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 /* Message. Not terminated */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 byte_stream_putraw(&data, (guchar *)args->msg, args->msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 /* Set the Autoresponse flag */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 if (args->flags & AIM_IMFLAGS_AWAY) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 byte_stream_put16(&data, 0x0004);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 byte_stream_put16(&data, 0x0000);
22352
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
487 } else {
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
488 if (args->flags & AIM_IMFLAGS_ACK) {
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
489 /* Set the Request Acknowledge flag */
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
490 byte_stream_put16(&data, 0x0003);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
491 byte_stream_put16(&data, 0x0000);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
492 }
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
493
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
494 if (args->flags & AIM_IMFLAGS_OFFLINE) {
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
495 /* 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: 22347
diff changeset
496 byte_stream_put16(&data, 0x0006);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
497 byte_stream_put16(&data, 0x0000);
03b2b21b4c42 * Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <mark@kingant.net>
parents: 22347
diff changeset
498 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 * 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
503 * 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
504 * IMs and when you change your icon.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 if (args->flags & AIM_IMFLAGS_HASICON) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 byte_stream_put16(&data, 0x0008);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 byte_stream_put16(&data, 0x000c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 byte_stream_put32(&data, args->iconlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 byte_stream_put16(&data, 0x0001);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 byte_stream_put16(&data, args->iconsum);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 byte_stream_put32(&data, args->iconstamp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 * Set the Buddy Icon Requested flag.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 * XXX - Every time? Surely not...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 if (args->flags & AIM_IMFLAGS_BUDDYREQ) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 byte_stream_put16(&data, 0x0009);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 byte_stream_put16(&data, 0x0000);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 }
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 /* XXX - should be optional */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
525 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, args->destbn, strlen(args->destbn)+1);
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
526
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
527 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &data);
22719
6f5f0a4de7f4 Fixed the final stragglers in need of byte_stream_destroy()
Evan Schoenberg <evan.s@dreskin.net>
parents: 22717
diff changeset
528 byte_stream_destroy(&data);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 /* clean out SNACs over 60sec old */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 aim_cleansnacs(od, 60);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 * Simple wrapper for aim_im_sendch1_ext()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 * You cannot use aim_send_im if you need the HASICON flag. You must
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 * use aim_im_sendch1_ext directly for that.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 * aim_send_im also cannot be used if you require UNICODE messages, because
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 * that requires an explicit message length. Use aim_im_sendch1_ext().
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
546 int aim_im_sendch1(OscarData *od, const char *bn, guint16 flags, const char *msg)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 struct aim_sendimext_args args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
550 args.destbn = bn;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 args.flags = flags;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 args.msg = msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 args.msglen = strlen(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 args.charset = 0x0000;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 args.charsubset = 0x0000;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 /* Make these don't get set by accident -- they need aim_im_sendch1_ext */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 return aim_im_sendch1_ext(od, &args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 * Subtype 0x0006 - Send a chat invitation.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
566 int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
569 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 IcbmCookie *msgcookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 struct aim_invite_priv *priv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 guchar cookie[8];
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
574 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
577 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
580 if (!bn || !msg || !roomname)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
585 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: 24665
diff changeset
586
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
587 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 /* XXX should be uncached by an unwritten 'invite accept' handler */
17191
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: 15822
diff changeset
590 priv = g_malloc(sizeof(struct aim_invite_priv));
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
591 priv->bn = g_strdup(bn);
17191
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: 15822
diff changeset
592 priv->roomname = g_strdup(roomname);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 priv->exchange = exchange;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 priv->instance = instance;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 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
597 aim_cachecookie(od, msgcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 else
17191
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: 15822
diff changeset
599 g_free(priv);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 /* ICBM Header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
602 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
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 * TLV t(0005)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 * Everything else is inside this TLV.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 * 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
610 * 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
611 * 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
612 *
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 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
615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 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
618 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
620 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: 17191
diff changeset
621 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: 17191
diff changeset
622 aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
623 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: 17191
diff changeset
624 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
625
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
626 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
627 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: 22412
diff changeset
628
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
629 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
630
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
631 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
632 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
634 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
635
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
636 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 }
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 * 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
643 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 * 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
645 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
647 int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum)
15373
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 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
650 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
654 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
657 if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
662 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);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
664 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
667 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 * TLV t(0005)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 * Encompasses everything below.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
674 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: 22412
diff changeset
675 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: 22412
diff changeset
676
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
677 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: 22412
diff changeset
678 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: 22412
diff changeset
679 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 /* TLV t(000a) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
682 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: 22412
diff changeset
683 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: 22412
diff changeset
684 byte_stream_put16(&bs, 0x0001);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 /* TLV t(000f) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
687 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: 22412
diff changeset
688 byte_stream_put16(&bs, 0x0000);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 /* TLV t(2711) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
691 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: 22412
diff changeset
692 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: 22412
diff changeset
693 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: 22412
diff changeset
694 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: 22412
diff changeset
695 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: 22412
diff changeset
696 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: 22412
diff changeset
697 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: 22412
diff changeset
698 byte_stream_putstr(&bs, AIM_ICONIDENT);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 /* TLV t(0003) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
701 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: 22412
diff changeset
702 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: 22412
diff changeset
703
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
704 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
705
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
706 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
707
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 * Subtype 0x0006 - Send a rich text message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 * This only works for ICQ 2001b (thats 2001 not 2000). Better, only
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 * send it to clients advertising the RTF capability. In fact, if you send
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 * it to a client that doesn't support that capability, the server will gladly
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 * bounce it back to you.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 * You'd think this would be in icq.c, but, well, I'm trying to stick with
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 * the one-group-per-file scheme as much as possible. This could easily
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 * be an exception, since Rendezvous IMs are external of the Oscar core,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 * and therefore are undefined. Really I just need to think of a good way to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 * make an interface similar to what AOL actually uses. But I'm not using COM.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
729 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* OSCAR_CAPABILITY_ICQRTF capability in string form */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 int servdatalen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
735 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
738 if (!args || !args->destbn || !args->rtfmsg)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
745 byte_stream_new(&bs, 128+servdatalen);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
747 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
750 aim_im_puticbm(&bs, cookie, 0x0002, args->destbn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 /* TLV t(0005) - Encompasses everything below. */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
753 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: 22412
diff changeset
754 byte_stream_put16(&bs, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
755
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
756 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: 22412
diff changeset
757 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: 22412
diff changeset
758 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 /* t(000a) l(0002) v(0001) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
761 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: 22412
diff changeset
762 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: 22412
diff changeset
763 byte_stream_put16(&bs, 0x0001);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 /* t(000f) l(0000) v() */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
766 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: 22412
diff changeset
767 byte_stream_put16(&bs, 0x0000);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 /* Service Data TLV */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
770 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: 22412
diff changeset
771 byte_stream_put16(&bs, servdatalen);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
772
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
773 byte_stream_putle16(&bs, 11 + 16 /* 11 + (sizeof CLSID) */);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
774 byte_stream_putle16(&bs, 9);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
775 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
776 byte_stream_putle16(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
777 byte_stream_putle32(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
778 byte_stream_putle8(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
779 byte_stream_putle16(&bs, 0x03ea); /* trid1 */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
780
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
781 byte_stream_putle16(&bs, 14);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
782 byte_stream_putle16(&bs, 0x03eb); /* trid2 */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
783 byte_stream_putle32(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
784 byte_stream_putle32(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
785 byte_stream_putle32(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
786
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
787 byte_stream_putle16(&bs, 0x0001);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
788 byte_stream_putle32(&bs, 0);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
789 byte_stream_putle16(&bs, strlen(args->rtfmsg)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
790 byte_stream_putraw(&bs, (const guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
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: 22412
diff changeset
792 byte_stream_putle32(&bs, args->fgcolor);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
793 byte_stream_putle32(&bs, args->bgcolor);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
794 byte_stream_putle32(&bs, strlen(rtfcap)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
795 byte_stream_putraw(&bs, (const guint8 *)rtfcap, strlen(rtfcap)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
796
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
797 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
798
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
799 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
800
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 * 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
806 * 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
807 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 aim_im_sendch2_cancel(PeerConnection *peer_conn)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 OscarData *od;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
813 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
815 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 od = peer_conn->od;
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
819 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
823 byte_stream_new(&bs, 118+strlen(peer_conn->bn));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
825 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
828 aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
830 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 byte_stream_new(&hdrbs, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 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
836 byte_stream_putcaps(&hdrbs, peer_conn->type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 /* This TLV means "cancel!" */
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
839 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: 17191
diff changeset
840 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
841
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
842 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
843 byte_stream_destroy(&hdrbs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
845 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
846
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
847 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
848 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
850 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
851
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
852 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 }
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 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 * 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
857 * you" message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 aim_im_sendch2_connected(PeerConnection *peer_conn)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 OscarData *od;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
864 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 od = peer_conn->od;
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
868 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
872 byte_stream_new(&bs, 11+strlen(peer_conn->bn) + 4+2+8+16);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
874 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
877 aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
878
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
879 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: 22412
diff changeset
880 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: 22412
diff changeset
881 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: 22412
diff changeset
882 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: 22412
diff changeset
883 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: 22412
diff changeset
884
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
885 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
886
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
887 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 * 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
892 * 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
893 * "I want you to connect to me"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 * "I want to connect to you"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 * "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
896 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 void
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
898 aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
901 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
903 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
906 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
910 byte_stream_new(&bs, 246+strlen(bn));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
912 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
915 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
917 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 byte_stream_new(&hdrbs, 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
925 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: 17191
diff changeset
926 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: 17191
diff changeset
927 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: 17191
diff changeset
928 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: 17191
diff changeset
929 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: 17191
diff changeset
930 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
931
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
932 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
933 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: 22412
diff changeset
934
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
935 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
936
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
937 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
938 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
940 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
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: 22412
diff changeset
942 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 * 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
947 * 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
948 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 void
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
950 aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
953 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
955 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 guint8 ip_comp[4];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
959 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
963 byte_stream_new(&bs, 246+strlen(bn));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
965 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
968 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
970 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 byte_stream_new(&hdrbs, 128);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
978 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: 17191
diff changeset
979 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: 17191
diff changeset
980 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: 17191
diff changeset
981 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: 17191
diff changeset
982 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: 17191
diff changeset
983 aim_tlvlist_add_noval(&inner_tlvlist, 0x0010);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 /* 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
986 ip_comp[0] = ~ip[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 ip_comp[1] = ~ip[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 ip_comp[2] = ~ip[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 ip_comp[3] = ~ip[3];
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
990 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: 17191
diff changeset
991 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: 17191
diff changeset
992
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
993 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
994
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
995 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
996 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: 22412
diff changeset
997
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
998 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
999
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1000 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1001 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1003 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1004
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1005 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 * 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
1010 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 void
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1013 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)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1016 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1018 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020
27659
993483dda1b8 Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <paul@darkrain42.org>
parents: 27532
diff changeset
1021 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: 27532
diff changeset
1022 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: 27532
diff changeset
1023
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1024 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1028 byte_stream_new(&bs, 1014);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1030 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
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 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1033 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1035 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 byte_stream_new(&hdrbs, 512);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1043 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: 17191
diff changeset
1044 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: 17191
diff changeset
1045 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: 17191
diff changeset
1046 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: 17191
diff changeset
1047 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 /* TODO: Send 0x0016 and 0x0017 */
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 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 /* TODO: If the following is ever enabled, ensure that it is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 * not sent with a receive redirect or stage 3 proxy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053 * redirect for a file receive (same conditions for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 * sending 0x000f above)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 */
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1056 aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en");
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1057 aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii");
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1058 aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file.");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 #endif
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 if (filename != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 {
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1063 ByteStream inner_bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 /* Begin TLV t(2711) */
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1066 byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1067 byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1068 byte_stream_put16(&inner_bs, numfiles);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1069 byte_stream_put32(&inner_bs, size);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 /* Filename - NULL terminated, for some odd reason */
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1072 byte_stream_putstr(&inner_bs, filename);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1073 byte_stream_put8(&inner_bs, 0x00);
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1074
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1075 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: 22719
diff changeset
1076 byte_stream_destroy(&inner_bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 /* End TLV t(2711) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1080 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1081 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1082 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: 22412
diff changeset
1083
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1084 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1085
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1086 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1087 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1089 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1090
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1091 byte_stream_destroy(&bs);
15373
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095 * 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
1096 * 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
1097 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 void
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1099 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)
15373
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 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1102 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1104 GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 ByteStream hdrbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 guint8 ip_comp[4];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1108 conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109 if (conn == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1112 byte_stream_new(&bs, 1014);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1114 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
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 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1117 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1119 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 byte_stream_new(&hdrbs, 512);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123 byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 byte_stream_putraw(&hdrbs, cookie, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1127 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: 17191
diff changeset
1128 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: 17191
diff changeset
1129 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: 17191
diff changeset
1130 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: 17191
diff changeset
1131 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: 17191
diff changeset
1132 aim_tlvlist_add_noval(&inner_tlvlist, 0x0010);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 /* 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
1135 ip_comp[0] = ~ip[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 ip_comp[1] = ~ip[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 ip_comp[2] = ~ip[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 ip_comp[3] = ~ip[3];
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1139 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: 17191
diff changeset
1140 aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 /* TODO: If the following is ever enabled, ensure that it is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 * not sent with a receive redirect or stage 3 proxy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145 * redirect for a file receive (same conditions for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 * sending 0x000f above)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 */
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1148 aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en");
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1149 aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii");
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1150 aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file.");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 #endif
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 if (filename != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 {
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1155 ByteStream filename_bs;
15373
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 /* Begin TLV t(2711) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1158 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: 22412
diff changeset
1159 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: 22412
diff changeset
1160 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: 22412
diff changeset
1161 byte_stream_put32(&filename_bs, size);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 /* Filename - NULL terminated, for some odd reason */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1164 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: 22412
diff changeset
1165 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: 22412
diff changeset
1166
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1167 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: 22412
diff changeset
1168 byte_stream_destroy(&filename_bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 /* End TLV t(2711) */
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
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1172 aim_tlvlist_write(&hdrbs, &inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1173
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1174 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1175 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: 22412
diff changeset
1176
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1177 aim_tlvlist_write(&bs, &outer_tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1178
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1179 aim_tlvlist_free(inner_tlvlist);
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1180 aim_tlvlist_free(outer_tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1182 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1183
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1184 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 * Subtype 0x0006 - Request the status message of the given ICQ user.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 * @param od The oscar session.
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1191 * @param bn The UIN of the user of whom you wish to request info.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 * @param type The type of info you wish to request. This should be the current
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 * state of the user, as one of the AIM_ICQ_STATE_* defines.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 * @return Return 0 if no errors, otherwise return the error number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1196 int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1199 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1203 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)) || !bn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204 return -EINVAL;
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 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1208 byte_stream_new(&bs, 8+2+1+strlen(bn) + 4+0x5e + 4);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1210 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
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 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1213 aim_im_puticbm(&bs, cookie, 0x0002, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1214
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215 /* TLV t(0005) - Encompasses almost everything below. */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1216 byte_stream_put16(&bs, 0x0005); /* T */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1217 byte_stream_put16(&bs, 0x005e); /* L */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 { /* V */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1219 byte_stream_put16(&bs, 0x0000);
15373
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 /* Cookie */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1222 byte_stream_putraw(&bs, cookie, 8);
15373
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 /* Put the 16 byte server relay capability */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1225 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227 /* TLV t(000a) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1228 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: 22412
diff changeset
1229 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: 22412
diff changeset
1230 byte_stream_put16(&bs, 0x0001);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 /* TLV t(000f) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1233 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: 22412
diff changeset
1234 byte_stream_put16(&bs, 0x0000);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 /* TLV t(2711) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1237 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: 22412
diff changeset
1238 byte_stream_put16(&bs, 0x0036);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 { /* V */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1240 byte_stream_putle16(&bs, 0x001b); /* L */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1241 byte_stream_putle16(&bs, 0x0009); /* Protocol version */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1242 byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1243 byte_stream_putle16(&bs, 0x0000); /* Unknown */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1244 byte_stream_putle16(&bs, 0x0001); /* Client features? */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1245 byte_stream_putle16(&bs, 0x0000); /* Unknown */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1246 byte_stream_putle8(&bs, 0x00); /* Unkizown */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1247 byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1248
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1249 byte_stream_putle16(&bs, 0x000e); /* L */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1250 byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1251 byte_stream_putle32(&bs, 0x00000000); /* Unknown */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1252 byte_stream_putle32(&bs, 0x00000000); /* Unknown */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1253 byte_stream_putle32(&bs, 0x00000000); /* Unknown */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 /* The type of status message being requested */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 if (type & AIM_ICQ_STATE_CHAT)
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1257 byte_stream_putle16(&bs, 0x03ec);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 else if(type & AIM_ICQ_STATE_DND)
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1259 byte_stream_putle16(&bs, 0x03eb);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260 else if(type & AIM_ICQ_STATE_OUT)
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1261 byte_stream_putle16(&bs, 0x03ea);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 else if(type & AIM_ICQ_STATE_BUSY)
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1263 byte_stream_putle16(&bs, 0x03e9);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 else if(type & AIM_ICQ_STATE_AWAY)
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1265 byte_stream_putle16(&bs, 0x03e8);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1266
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1267 byte_stream_putle16(&bs, 0x0001); /* Status? */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1268 byte_stream_putle16(&bs, 0x0001); /* Priority of this message? */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1269 byte_stream_putle16(&bs, 0x0001); /* L */
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1270 byte_stream_putle8(&bs, 0x00); /* String of length L */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 } /* End TLV t(2711) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 } /* End TLV t(0005) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 /* TLV t(0003) */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1275 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: 22412
diff changeset
1276 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: 22412
diff changeset
1277
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1278 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1279
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1280 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1281
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282 return 0;
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
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 * Subtype 0x0006 - Send an ICQ-esque ICBM.
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 * This can be used to send an ICQ authorization reply (deny or grant). It is the "old way."
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 * The new way is to use SSI. I like the new way a lot better. This seems like such a hack,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 * mostly because it's in network byte order. Figuring this stuff out sometimes takes a while,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291 * but thats ok, because it gives me time to try to figure out what kind of drugs the AOL people
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 * were taking when they merged the two protocols.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 *
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1294 * @param bn The destination buddy name.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 * @param type The type of message. 0x0007 for authorization denied. 0x0008 for authorization granted.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296 * @param message The message you want to send, it should be null terminated.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 * @return Return 0 if no errors, otherwise return the error number.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1299 int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1300 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1302 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 guchar cookie[8];
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 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
1307 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1309 if (!bn || !type || !message)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1312 byte_stream_new(&bs, 8+3+strlen(bn)+12+strlen(message)+1+4);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1314 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0);
15373
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 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318 /* ICBM header */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1319 aim_im_puticbm(&bs, cookie, 0x0004, bn);
15373
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 * TLV t(0005)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 * ICQ data (the UIN and the message).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325 */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1326 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: 22412
diff changeset
1327 byte_stream_put16(&bs, 4 + 2+2+strlen(message)+1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328
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 * Your UIN
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331 */
24665
531922f4ea2a Minor cleanup: remove od->sn, since it's the same as PurpleAccount->username
Mark Doliner <mark@kingant.net>
parents: 23313
diff changeset
1332 byte_stream_putuid(&bs, od);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 * TLV t(type) l(strlen(message)+1) v(message+NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1337 byte_stream_putle16(&bs, type);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1338 byte_stream_putle16(&bs, strlen(message)+1);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1339 byte_stream_putraw(&bs, (const guint8 *)message, strlen(message)+1);
15373
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 * TLV t(0006) l(0000) v()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 */
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1344 byte_stream_put16(&bs, 0x0006);
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1345 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: 22412
diff changeset
1346
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
1347 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1348
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
1349 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
1350
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 return 0;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 * XXX - I don't see when this would ever get called...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 static int outgoingim(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
1358 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361 guchar cookie[8];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 guint16 channel;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1363 GSList *tlvlist;
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1364 char *bn;
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1365 int bnlen;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 guint16 icbmflags = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 guint8 flag1 = 0, flag2 = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1368 gchar *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369 aim_tlv_t *msgblock;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 /* ICBM Cookie. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 aim_icbm_makecookie(cookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 /* Channel ID */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 channel = byte_stream_get16(bs);
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 if (channel != 0x01) {
29960
815bd8b41638 I before E, except after C
Stu Tomlinson <stu@nosnilmot.com>
parents: 29736
diff changeset
1378 purple_debug_misc("oscar", "icbm: ICBM received on unsupported channel. Ignoring. (chan = %04x)\n", channel);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1379 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1382 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: 24665
diff changeset
1383 bn = byte_stream_getstr(bs, bnlen);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 tlvlist = aim_tlvlist_read(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 if (aim_tlv_gettlv(tlvlist, 0x0003, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 icbmflags |= AIM_IMFLAGS_ACK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 if (aim_tlv_gettlv(tlvlist, 0x0004, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 icbmflags |= AIM_IMFLAGS_AWAY;
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 ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 ByteStream mbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394 int featurelen, msglen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 byte_stream_init(&mbs, msgblock->value, msgblock->length);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 byte_stream_get8(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399 byte_stream_get8(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400 for (featurelen = byte_stream_get16(&mbs); featurelen; featurelen--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 byte_stream_get8(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 byte_stream_get8(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 byte_stream_get8(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 msglen = byte_stream_get16(&mbs) - 4; /* final block length */
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 flag1 = byte_stream_get16(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 flag2 = byte_stream_get16(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 msg = byte_stream_getstr(&mbs, msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1414 ret = userfunc(od, conn, frame, channel, bn, msg, icbmflags, flag1, flag2);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1415
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1416 g_free(bn);
17191
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: 15822
diff changeset
1417 g_free(msg);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
1418 aim_tlvlist_free(tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 * Ahh, the joys of nearly ridiculous over-engineering.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 * Not only do AIM ICBM's support multiple channels. Not only do they
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 * support multiple character sets. But they support multiple character
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 * sets / encodings within the same ICBM.
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 * These multipart messages allow for complex space savings techniques, which
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 * seem utterly unnecessary by today's standards. In fact, there is only
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432 * one client still in popular use that still uses this method: AOL for the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 * Macintosh, Version 5.0. Obscure, yes, I know.
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 * In modern (non-"legacy") clients, if the user tries to send a character
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 * that is not ISO-8859-1 or ASCII, the client will send the entire message
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 * as UNICODE, meaning that every character in the message will occupy the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 * full 16 bit UNICODE field, even if the high order byte would be zero.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 * Multipart messages prevent this wasted space by allowing the client to
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440 * only send the characters in UNICODE that need to be sent that way, and
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 * the rest of the message can be sent in whatever the native character
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 * set is (probably ASCII).
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 * An important note is that sections will be displayed in the order that
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 * they appear in the ICBM. There is no facility for merging or rearranging
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 * sections at run time. So if you have, say, ASCII then UNICODE then ASCII,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 * you must supply two ASCII sections with a UNICODE in the middle, and incur
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 * the associated overhead.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 * Normally I would have laughed and given a firm 'no' to supporting this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 * seldom-used feature, but something is attracting me to it. In the future,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 * it may be possible to abuse this to send mixed-media messages to other
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 * open source clients (like encryption or something) -- see faimtest for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 * examples of how to do this.
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 * I would definitely recommend avoiding this feature unless you really
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 * know what you are doing, and/or you have something neat to do with it.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm)
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463 memset(mpm, 0, sizeof(aim_mpmsg_t));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 static int mpmsg_addsection(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, gchar *data, guint16 datalen)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 aim_mpmsg_section_t *sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471
17191
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: 15822
diff changeset
1472 sec = g_malloc(sizeof(aim_mpmsg_section_t));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474 sec->charset = charset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 sec->charsubset = charsubset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 sec->data = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 sec->datalen = datalen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 sec->next = NULL;
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 if (!mpm->parts)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 mpm->parts = sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 aim_mpmsg_section_t *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 for (cur = mpm->parts; cur->next; cur = cur->next)
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 cur->next = sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 mpm->numparts++;
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 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 }
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 aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 gchar *dup;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498
17191
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: 15822
diff changeset
1499 dup = g_malloc(datalen);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 memcpy(dup, data, datalen);
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 if (mpmsg_addsection(od, mpm, charset, charsubset, dup, datalen) == -1) {
17191
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: 15822
diff changeset
1503 g_free(dup);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 }
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 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 }
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 /* XXX - should provide a way of saying ISO-8859-1 specifically */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii)
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 gchar *dup;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514
17191
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: 15822
diff changeset
1515 if (!(dup = g_strdup(ascii)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 if (mpmsg_addsection(od, mpm, 0x0000, 0x0000, dup, strlen(ascii)) == -1) {
17191
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: 15822
diff changeset
1519 g_free(dup);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 return -1;
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 return 0;
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 int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen)
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 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 ByteStream bs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531
17191
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: 15822
diff changeset
1532 buf = g_malloc(unicodelen * 2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 byte_stream_init(&bs, (guchar *)buf, unicodelen * 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536 /* We assume unicode is in /host/ byte order -- convert to network */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 for (i = 0; i < unicodelen; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 byte_stream_put16(&bs, unicode[i]);
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 if (mpmsg_addsection(od, mpm, 0x0002, 0x0000, buf, byte_stream_curpos(&bs)) == -1) {
17191
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: 15822
diff changeset
1541 g_free(buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 }
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 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 aim_mpmsg_section_t *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 for (cur = mpm->parts; cur; ) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 aim_mpmsg_section_t *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 tmp = cur->next;
17191
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: 15822
diff changeset
1556 g_free(cur->data);
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: 15822
diff changeset
1557 g_free(cur);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 cur = tmp;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561 mpm->numparts = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 mpm->parts = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 * Start by building the multipart structures, then pick the first
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 * human-readable section and stuff it into args->msg so no one gets
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 * suspicious.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 /* Should this be ASCII -> UNICODE -> Custom */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 static const guint16 charsetpri[] = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 AIM_CHARSET_ASCII, /* ASCII first */
28228
98c5109a3d1f Rename AIM_CHARSET_CUSTOM to AIM_CHARSET_LATIN_1 as described at
Mark Doliner <mark@kingant.net>
parents: 27659
diff changeset
1577 AIM_CHARSET_LATIN_1, /* then ISO-8859-1 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 AIM_CHARSET_UNICODE, /* UNICODE as last resort */
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 static const int charsetpricount = 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 ByteStream mbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 aim_mpmsg_section_t *sec;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 byte_stream_init(&mbs, data, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 while (byte_stream_empty(&mbs)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 guint16 msglen, flag1, flag2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 gchar *msgbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 byte_stream_get8(&mbs); /* 01 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 byte_stream_get8(&mbs); /* 01 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 /* Message string length, including character set info. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 msglen = byte_stream_get16(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596 if (msglen > byte_stream_empty(&mbs))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 {
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1598 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);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602 /* Character set info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 flag1 = byte_stream_get16(&mbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 flag2 = byte_stream_get16(&mbs);
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 /* Message. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 msglen -= 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608
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 * For now, we don't care what the encoding is. Just copy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1611 * it into a multipart struct and deal with it later. However,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 * always pad the ending with a NULL. This makes it easier
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 * to treat ASCII sections as strings. It won't matter for
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 * UNICODE or binary data, as you should never read past
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 * the specified data length, which will not include the pad.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 * XXX - There's an API bug here. For sending, the UNICODE is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 * given in host byte order (aim_mpmsg_addunicode), but here
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 * the received messages are given in network byte order.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 msgbuf = (gchar *)byte_stream_getraw(&mbs, msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 mpmsg_addsection(od, &args->mpmsg, flag1, flag2, msgbuf, msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 } /* while */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 args->icbmflags |= AIM_IMFLAGS_MULTIPART; /* always set */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 * Clients that support multiparts should never use args->msg, as it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 * will point to an arbitrary section.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633 * Here, we attempt to provide clients that do not support multipart
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 * messages with something to look at -- hopefully a human-readable
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 * string. But, failing that, a UNICODE message, or nothing at all.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 * Which means that even if args->msg is NULL, it does not mean the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 * message was blank.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 for (i = 0; i < charsetpricount; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 for (sec = args->mpmsg.parts; sec; sec = sec->next) {
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 if (sec->charset != charsetpri[i])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 /* Great. We found one. Fill it in. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648 args->charset = sec->charset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 args->charsubset = sec->charsubset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 /* Set up the simple flags */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 switch (args->charsubset)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 case 0x0000:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655 /* standard subencoding? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 case 0x000b:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658 args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660 case 0xffff:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 /* no subencoding */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 args->msg = sec->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 args->msglen = sec->datalen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1674 /* No human-readable sections found. Oh well. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675 args->charset = args->charsubset = 0xffff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676 args->msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 args->msglen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682 static int 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)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 {
27200
a2508ac2e536 Silence some warnings from gcc on OS X. None of these were actually valid.
Paul Aurich <paul@darkrain42.org>
parents: 25949
diff changeset
1684 guint16 type, length, magic1, msglen = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1685 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686 int ret = 0;
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1687 int rev = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 struct aim_incomingim_ch1_args args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689 unsigned int endpos;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 memset(&args, 0, sizeof(args));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 aim_mpmsg_init(od, &args.mpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694
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 * 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
1697 * 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
1698 * of per-IM memory allocations.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 while (byte_stream_empty(bs) >= 4)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 type = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 length = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 if (length > byte_stream_empty(bs))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 {
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1707 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);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 endpos = byte_stream_curpos(bs) + length;
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 if (type == 0x0002) { /* Message Block */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 * This TLV consists of the following:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 * - 0501 -- Unknown
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718 * - Features: Don't know how to interpret these
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 * - 0101 -- Unknown
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 * - Message
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721 *
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1722 * Slick and possible others reverse 'Features' and 'Messages' section.
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1723 * Thus, the TLV could have following layout:
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1724 * - 0101 -- Unknown (possibly magic for message section)
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1725 * - Message
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1726 * - 0501 -- Unknown (possibly magic for features section)
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1727 * - Features: Don't know how to interpret these
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1730 magic1 = byte_stream_get16(bs); /* 0501 or 0101 */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1731 if (magic1 == 0x101) /* Bad, message comes before attributes */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1732 {
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1733 /* Jump to the features section */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1734 msglen = byte_stream_get16(bs);
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1735 bs->offset += msglen;
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1736 rev = 1;
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1737
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1738 magic1 = byte_stream_get16(bs); /* 0501 */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1739 }
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1740
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1741 if (magic1 != 0x501)
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1742 {
25949
5725b3190905 Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
1743 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);
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1744 break;
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1745 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 args.featureslen = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 if (args.featureslen > byte_stream_empty(bs))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 {
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1750 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);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 if (args.featureslen == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 args.features = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 args.features = byte_stream_getraw(bs, args.featureslen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1762
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1763 if (rev)
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1764 {
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1765 /* Fix buffer back to message */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1766 bs->offset -= args.featureslen + 2 + 2 + msglen + 2 + 2;
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1767 }
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1768
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1769 magic1 = byte_stream_get16(bs); /* 01 01 */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1770 if (magic1 != 0x101) /* Bad, message comes before attributes */
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1771 {
25949
5725b3190905 Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25947
diff changeset
1772 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);
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1773 break;
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1774 }
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1775 msglen = byte_stream_get16(bs);
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1776
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 * The rest of the TLV contains one or more message
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779 * blocks...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 */
25462
a3e3c6331e06 Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
david.jedelsky@gmail.com
parents: 24665
diff changeset
1781 incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset - 2 - 2 /* XXX evil!!! */, msglen + 2 + 2, &args);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783 } else if (type == 0x0003) { /* Server Ack Requested */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 args.icbmflags |= AIM_IMFLAGS_ACK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 } 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
1788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789 args.icbmflags |= AIM_IMFLAGS_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791 } else if (type == 0x0006) { /* Message was received offline. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792
22347
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1793 /*
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1794 * 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
1795 * 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
1796 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 args.icbmflags |= AIM_IMFLAGS_OFFLINE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 } 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
1800
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 args.iconlen = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 byte_stream_get16(bs); /* 0x0001 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 args.iconsum = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 args.iconstamp = byte_stream_get32(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807 * 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
1808 * 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
1809 * 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
1810 * 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
1811 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 * 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
1813 * anyway.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 if (args.iconlen)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 args.icbmflags |= AIM_IMFLAGS_HASICON;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819 } else if (type == 0x0009) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821 args.icbmflags |= AIM_IMFLAGS_BUDDYREQ;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 } 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
1824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 args.icbmflags |= AIM_IMFLAGS_TYPINGNOT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826
22347
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1827 } 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
1828
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1829 /*
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1830 * 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
1831 * 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
1832 */
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1833 args.timestamp = byte_stream_get32(bs);
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
1834
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 } else if (type == 0x0017) {
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 if (length > byte_stream_empty(bs))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1838 {
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1839 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);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 }
17191
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: 15822
diff changeset
1842 g_free(args.extdata);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 args.extdatalen = length;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 if (args.extdatalen == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 args.extdata = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847 args.extdata = byte_stream_getraw(bs, args.extdatalen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1850 purple_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 * 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
1855 * 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
1856 * 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
1857 * 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
1858 * TLV when the loop continues.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1860 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1861 byte_stream_setpos(bs, endpos);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1862 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1865 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
1866 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
1867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1868 aim_mpmsg_free(od, &args.mpmsg);
17191
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: 15822
diff changeset
1869 g_free(args.features);
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: 15822
diff changeset
1870 g_free(args.extdata);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1872 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1873 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1876 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
1877 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1878 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 * This goes like this...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1880 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 * group name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 * group name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 * num of buddies in group
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1885 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1886 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1887 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1888 * ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889 * group name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 * group name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 * num of buddies in group
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892 * buddy name length
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893 * buddy name
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 * ...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895 * ...
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 while (byte_stream_empty(servdata))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1898 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899 guint16 gnlen, numb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901 char *gn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903 gnlen = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 gn = byte_stream_getstr(servdata, gnlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1905 numb = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1907 for (i = 0; i < numb; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1908 guint16 bnlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909 char *bn;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1910
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 bnlen = byte_stream_get16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 bn = byte_stream_getstr(servdata, bnlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
1914 purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915
17191
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: 15822
diff changeset
1916 g_free(bn);
15373
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
17191
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: 15822
diff changeset
1919 g_free(gn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1926 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
1927 {
17191
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: 15822
diff changeset
1928 g_free(args->info.icon.icon);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1932
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1933 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934 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
1935 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1936 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
1937 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
1938 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
1939 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
1940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 args->destructor = (void *)incomingim_ch2_buddyicon_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1943 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 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
1948 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949 /* XXX - aim_chat_roominfo_free() */
17191
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: 15822
diff changeset
1950 g_free(args->info.chat.roominfo.name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1953 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1956 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
1957 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1958 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1959 * Chat room info.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1960 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 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
1962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963 args->destructor = (void *)incomingim_ch2_chat_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1964 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1967 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
1968 {
17191
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: 15822
diff changeset
1969 g_free((char *)args->info.rtfmsg.rtfmsg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1973 * 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
1974 * 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
1975 * SERVERRELAY used for.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 * 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
1978 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981 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
1982 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 guint16 hdrlen, anslen, msglen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 if (byte_stream_empty(servdata) < 24)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 /* Someone sent us a short server relay ICBM. Weird. (Maybe?) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989 hdrlen = byte_stream_getle16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 byte_stream_advance(servdata, hdrlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 hdrlen = byte_stream_getle16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 byte_stream_advance(servdata, hdrlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 args->info.rtfmsg.msgtype = byte_stream_getle16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 anslen = byte_stream_getle32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1998 byte_stream_advance(servdata, anslen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 msglen = byte_stream_getle16(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 args->info.rtfmsg.rtfmsg = byte_stream_getstr(servdata, msglen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 args->info.rtfmsg.fgcolor = byte_stream_getle32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 args->info.rtfmsg.bgcolor = byte_stream_getle32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 hdrlen = byte_stream_getle32(servdata);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007 byte_stream_advance(servdata, hdrlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 args->destructor = (void *)incomingim_ch2_icqserverrelay_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 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
2014 {
17191
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: 15822
diff changeset
2015 g_free(args->info.sendfile.filename);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 /* Someone is sending us a file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 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
2021 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 int flen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 args->destructor = (void *)incomingim_ch2_sendfile_free;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 /* 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
2027 * this is? Maybe TLV t(000a)? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 /* subtype is one of AIM_OFT_SUBTYPE_* */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 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
2031 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
2032 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
2033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 * 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
2036 * 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
2037 * 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
2038 * a 26 byte filename?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 /* 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
2041 /* 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
2042 * since there's no easy bstream routine. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 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
2044 byte_stream_advance(servdata, -flen -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 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
2046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 /* 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
2048 * but I'm unsure of its format. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 /* I don't believe him. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050 /* 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
2051 * 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
2052 * 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
2053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 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
2056
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2057 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)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 aim_tlv_t *block1, *servdatatlv;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2061 GSList *list2;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 aim_tlv_t *tlv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 IcbmArgsCh2 args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 ByteStream bbs, sdbs, *sdbsptr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 guint8 *cookie2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 char proxyip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 char clientip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 char verifiedip[30] = {""};
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 memset(&args, 0, sizeof(args));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 * 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
2076 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077 block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 if (block1 == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080 /* 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
2081 return 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 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
2084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086 * 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
2087 * One of the AIM_RENDEZVOUS_ defines.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 * 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
2090 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 args.status = byte_stream_get16(&bbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 * 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
2095 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096 cookie2 = byte_stream_getraw(&bbs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 if (memcmp(cookie, cookie2, 8) != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
2099 purple_debug_warning("oscar",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 "Cookies don't match in rendezvous ICBM, bailing out.\n");
17191
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: 15822
diff changeset
2101 g_free(cookie2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 return 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 memcpy(args.cookie, cookie2, 8);
17191
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: 15822
diff changeset
2105 g_free(cookie2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 * 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
2109 * identify what type of rendezvous this is.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2111 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
2112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 * 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
2115 * purpose of the message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 * 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
2118 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 list2 = aim_tlvlist_read(&bbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120
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 * 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
2123 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 * 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
2125 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 tlv = aim_tlv_gettlv(list2, 0x0002, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2127 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 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
2129 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2133 * 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
2134 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135 tlv = aim_tlv_gettlv(list2, 0x0003, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2137 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
2138 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2139 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140
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 * 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
2143 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 * This is added by the server.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146 tlv = aim_tlv_gettlv(list2, 0x0004, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 if ((tlv != NULL) && (tlv->length == 4))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2148 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
2149 tlv->value[0], tlv->value[1],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2150 tlv->value[2], tlv->value[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 * Port number for something.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 if (aim_tlv_gettlv(list2, 0x0005, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156 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
2157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2159 * File transfer "request number":
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 * 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
2161 * 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
2162 * 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
2163 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 if (aim_tlv_gettlv(list2, 0x000a, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 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
2166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 * Terminate connection/error code. 0x0001 means the other user
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169 * canceled the connection.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 if (aim_tlv_gettlv(list2, 0x000b, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 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
2173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175 * Invitation message / chat description.
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 if (aim_tlv_gettlv(list2, 0x000c, 1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 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
2179 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
2180 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2182 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2183 * Character set.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 if (aim_tlv_gettlv(list2, 0x000d, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 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
2187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189 * Language.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191 if (aim_tlv_gettlv(list2, 0x000e, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2192 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
2193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2195 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2196 * Unknown -- no value
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 * Maybe means we should connect directly to transfer the file?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199 * Also used in ICQ Lite Beta 4.0 URLs. Also empty.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2201 /* I don't think this indicates a direct transfer; this flag is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2202 * also present in a stage 1 proxied file send request -- Jonathan */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 if (aim_tlv_gettlv(list2, 0x000f, 1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 /* Unhandled */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2209 * 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
2210 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 if (aim_tlv_gettlv(list2, 0x0010, 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212 args.use_proxy = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 if (strlen(proxyip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215 args.proxyip = (char *)proxyip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2216 if (strlen(clientip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2217 args.clientip = (char *)clientip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2218 if (strlen(verifiedip))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219 args.verifiedip = (char *)verifiedip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2221 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2222 * 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
2223 * 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
2224 * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2225 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2226 * 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
2227 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228 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
2229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2230 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
2231 sdbsptr = &sdbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2233 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2234 * 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
2235 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2236 * 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
2237 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 if (args.type & OSCAR_CAPABILITY_BUDDYICON)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 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
2240 else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 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
2242 else if (args.type & OSCAR_CAPABILITY_CHAT)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243 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
2244 else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 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
2246 else if (args.type & OSCAR_CAPABILITY_SENDFILE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 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
2248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 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
2251 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
2252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254 if (args.destructor)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 ((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
2256
17191
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: 15822
diff changeset
2257 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: 15822
diff changeset
2258 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: 15822
diff changeset
2259 g_free((char *)args.language);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2261 aim_tlvlist_free(list2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2266 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)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2267 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2268 ByteStream meat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2269 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2270 aim_tlv_t *block;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2271 struct aim_incomingim_ch4_args args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2274 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275 * 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
2276 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277 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
2278 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2279 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
2280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2281 args.uin = byte_stream_getle32(&meat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2282 args.type = byte_stream_getle8(&meat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2283 args.flags = byte_stream_getle8(&meat);
19641
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17369
diff changeset
2284 if (args.type == 0x1a)
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17369
diff changeset
2285 /* 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: 17369
diff changeset
2286 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: 17369
diff changeset
2287 else
eb0933e158a4 Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <mark@kingant.net>
parents: 17369
diff changeset
2288 args.msglen = byte_stream_getle16(&meat);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289 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
2290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2291 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
2292 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
2293
17191
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: 15822
diff changeset
2294 g_free(args.msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2295
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2297 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2299 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300 * Subtype 0x0007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302 * 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
2303 * 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
2304 * 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
2305 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306 * 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
2307 * 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
2308 * 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
2309 * 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
2310 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 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
2313 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2314 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2315 guchar *cookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 guint16 channel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 aim_userinfo_t userinfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319 memset(&userinfo, 0x00, sizeof(aim_userinfo_t));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2321 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2322 * Read ICBM Cookie.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2323 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2325
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327 * Channel ID.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2329 * 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
2330 * used to send basic ICBMs.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2331 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 * Channel 0x0002 is the Rendezvous channel, which
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2333 * 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
2334 * connection negotiations come from.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336 * Channel 0x0003 is used for chat messages.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2337 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338 * 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
2339 * possibly any system notice.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2341 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2342 channel = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2343
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2345 * Extract the standard user info block.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347 * 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
2348 * 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
2349 * 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
2350 * 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
2351 * 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
2352 * parses out the standard userinfo block.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2354 * 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
2355 * 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
2356 * 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
2357 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2359 aim_info_extract(od, bs, &userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362 * 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
2363 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2364 * 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
2365 * 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
2366 * performance reasons (less memory allocation).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2367 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2368 if (channel == 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2370 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
2371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372 } else if (channel == 2) {
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2373 GSList *tlvlist;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376 * 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
2377 * 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
2378 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379 tlvlist = aim_tlvlist_read(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2381 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
2382
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2383 aim_tlvlist_free(tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2385 } else if (channel == 4) {
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2386 GSList *tlvlist;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2387
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2388 tlvlist = aim_tlvlist_read(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2389 ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2390 aim_tlvlist_free(tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2392 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
2393 purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2396 aim_info_free(&userinfo);
17191
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: 15822
diff changeset
2397 g_free(cookie);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2398
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2399 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2402 /*
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2403 * Subtype 0x0008 - Send a warning to bn.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2404 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2405 * Flags:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2406 * AIM_WARN_ANON Send as an anonymous (doesn't count as much)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2407 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2408 * returns -1 on error (couldn't alloc packet), 0 on success.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2409 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2410 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2411 int aim_im_warn(OscarData *od, FlapConnection *conn, const char *bn, guint32 flags)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2412 {
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2413 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2414 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2415
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2416 if (!od || !conn || !bn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2417 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2418
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2419 byte_stream_new(&bs, strlen(bn)+3);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2420
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2421 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0008, 0x0000, bn, strlen(bn)+1);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2422
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2423 byte_stream_put16(&bs, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2424 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: 24665
diff changeset
2425 byte_stream_putstr(&bs, bn);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2426
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2427 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0008, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2428
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2429 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2431 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2434 /* Subtype 0x000a */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2435 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
2436 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2437 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2438 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2439 guint16 channel, nummissed, reason;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2440 aim_userinfo_t userinfo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2442 while (byte_stream_empty(bs)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2444 channel = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2445 aim_info_extract(od, bs, &userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2446 nummissed = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2447 reason = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2449 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
2450 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
2451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2452 aim_info_free(&userinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2455 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2456 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2457
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2458 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2459 * Subtype 0x000b
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2460 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2461 * Possible codes:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2462 * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2463 * 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
2464 * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2465 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2466 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2467 int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2468 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2469 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2470 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2471 aim_snacid_t snacid;
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2472 GSList *tlvlist = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2473
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2474 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2475 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2476
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2477 byte_stream_new(&bs, 8+2+1+strlen(bn)+6);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2478
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2479 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2480
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2481 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: 22412
diff changeset
2482
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2483 byte_stream_put16(&bs, 0x0002); /* channel */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2484 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: 24665
diff changeset
2485 byte_stream_putstr(&bs, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2486
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2487 aim_tlvlist_add_16(&tlvlist, 0x0003, code);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2488 aim_tlvlist_write(&bs, &tlvlist);
17369
f80f7e1047be Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents: 17191
diff changeset
2489 aim_tlvlist_free(tlvlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2490
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2491 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, 0x0000, snacid, &bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
2492
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2493 byte_stream_destroy(&bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2495 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2497
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2498 static void parse_status_note_text(OscarData *od, guchar *cookie, char *bn, ByteStream *bs)
22412
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2499 {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2500 struct aim_icq_info *info;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2501 struct aim_icq_info *prev_info;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2502 char *response;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2503 char *encoding;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2504 char *stripped_encoding;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2505 char *status_note_title;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2506 char *status_note_text;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2507 char *stripped_status_note_text;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2508 char *status_note;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2509 guint32 length;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2510 guint16 version;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2511 guint32 capability;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2512 guint8 message_type;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2513 guint16 status_code;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2514 guint16 text_length;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2515 guint32 request_length;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2516 guint32 response_length;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2517 guint32 encoding_length;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2518 PurpleAccount *account;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2519 PurpleBuddy *buddy;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2520 PurplePresence *presence;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2521 PurpleStatus *status;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2522
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2523 for (prev_info = NULL, info = od->icq_info; info != NULL; prev_info = info, info = info->next)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2524 {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2525 if (memcmp(&info->icbm_cookie, cookie, 8) == 0)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2526 {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2527 if (prev_info == NULL)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2528 od->icq_info = info->next;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2529 else
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2530 prev_info->next = info->next;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2531
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2532 break;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2533 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2534 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2535
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2536 if (info == NULL)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2537 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2538
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2539 status_note_title = info->status_note_title;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2540 g_free(info);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2541
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2542 length = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2543 if (length != 27) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2544 purple_debug_misc("oscar", "clientautoresp: incorrect header "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2545 "size; expected 27, received %u.\n", length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2546 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2547 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2548 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2549
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2550 version = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2551 if (version != 9) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2552 purple_debug_misc("oscar", "clientautoresp: incorrect version; "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2553 "expected 9, received %u.\n", version);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2554 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2555 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2556 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2557
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2558 capability = aim_locate_getcaps(od, bs, 0x10);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2559 if (capability != OSCAR_CAPABILITY_EMPTY) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2560 purple_debug_misc("oscar", "clientautoresp: plugin ID is not null.\n");
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2561 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2562 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2563 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2564
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2565 byte_stream_advance(bs, 2); /* unknown */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2566 byte_stream_advance(bs, 4); /* client capabilities flags */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2567 byte_stream_advance(bs, 1); /* unknown */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2568 byte_stream_advance(bs, 2); /* downcouner? */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2569
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2570 length = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2571 if (length != 14) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2572 purple_debug_misc("oscar", "clientautoresp: incorrect header "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2573 "size; expected 14, received %u.\n", length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2574 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2575 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2576 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2577
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2578 byte_stream_advance(bs, 2); /* downcounter? */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2579 byte_stream_advance(bs, 12); /* unknown */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2580
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2581 message_type = byte_stream_get8(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2582 if (message_type != 0x1a) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2583 purple_debug_misc("oscar", "clientautoresp: incorrect message "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2584 "type; expected 0x1a, received 0x%x.\n", message_type);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2585 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2586 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2587 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2588
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2589 byte_stream_advance(bs, 1); /* message flags */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2590
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2591 status_code = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2592 if (status_code != 0) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2593 purple_debug_misc("oscar", "clientautoresp: incorrect status "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2594 "code; expected 0, received %u.\n", status_code);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2595 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2596 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2597 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2598
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2599 byte_stream_advance(bs, 2); /* priority code */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2600
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2601 text_length = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2602 byte_stream_advance(bs, text_length); /* text */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2603
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2604 length = byte_stream_getle16(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2605 byte_stream_advance(bs, 18); /* unknown */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2606
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2607 request_length = byte_stream_getle32(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2608 if (length != 18 + 4 + request_length + 17) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2609 purple_debug_misc("oscar", "clientautoresp: incorrect block; "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2610 "expected length is %u, got %u.\n",
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2611 18 + 4 + request_length + 17, length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2612 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2613 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2614 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2615
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2616 byte_stream_advance(bs, request_length); /* x request */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2617 byte_stream_advance(bs, 17); /* unknown */
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2618
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2619 length = byte_stream_getle32(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2620 response_length = byte_stream_getle32(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2621 response = byte_stream_getstr(bs, response_length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2622 encoding_length = byte_stream_getle32(bs);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2623 if (length != 4 + response_length + 4 + encoding_length) {
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2624 purple_debug_misc("oscar", "clientautoresp: incorrect block; "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2625 "expected length is %u, got %u.\n",
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2626 4 + response_length + 4 + encoding_length, length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2627 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2628 g_free(response);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2629 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2630 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2631
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2632 encoding = byte_stream_getstr(bs, encoding_length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2633
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2634 account = purple_connection_get_account(od->gc);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2635
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2636 stripped_encoding = oscar_encoding_extract(encoding);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2637 status_note_text = oscar_encoding_to_utf8(account, stripped_encoding, response, response_length);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2638 stripped_status_note_text = purple_markup_strip_html(status_note_text);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2639
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2640 if (stripped_status_note_text != NULL && stripped_status_note_text[0] != 0)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2641 status_note = g_strdup_printf("%s: %s", status_note_title, stripped_status_note_text);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2642 else
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2643 status_note = g_strdup(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2644
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2645 g_free(status_note_title);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2646 g_free(response);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2647 g_free(encoding);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2648 g_free(stripped_encoding);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2649 g_free(status_note_text);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2650 g_free(stripped_status_note_text);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2651
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2652 buddy = purple_find_buddy(account, bn);
22412
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2653 if (buddy == NULL)
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2654 {
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2655 purple_debug_misc("oscar", "clientautoresp: buddy %s was not found.\n", bn);
22412
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2656 g_free(status_note);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2657 return;
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2658 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2659
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2660 purple_debug_misc("oscar", "clientautoresp: setting status "
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2661 "message to \"%s\".\n", status_note);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2662
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2663 presence = purple_buddy_get_presence(buddy);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2664 status = purple_presence_get_active_status(presence);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2665
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2666 purple_prpl_got_user_status(account, bn,
22412
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2667 purple_status_get_id(status),
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2668 "message", status_note, NULL);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2669
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2670 g_free(status_note);
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2671 }
75d53b0fae6c Move the status note parsing into a separate function, which I think
Mark Doliner <mark@kingant.net>
parents: 22352
diff changeset
2672
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2673 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2674 * 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
2675 * 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
2676 * 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
2677 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678 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
2679 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 guint16 channel, reason;
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2683 char *bn;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 guchar *cookie;
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2685 guint8 bnlen;
29418
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2686 char *xml = NULL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2687 int hdrlen;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2688 int curpos;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2689 int num1,num2;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2690 char *desc, *title, *temp;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2691 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2692 PurpleBuddy *buddy;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2693 PurplePresence *presence;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2694 PurpleStatus *status;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2695
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2696 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697 channel = byte_stream_get16(bs);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2698 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: 24665
diff changeset
2699 bn = byte_stream_getstr(bs, bnlen);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2700 reason = byte_stream_get16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
2702 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
2703 {
29418
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2704 hdrlen = byte_stream_getle16(bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2705 if ( ((hdrlen == 27 ) && (bs->len > (27 + 51)))) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2706 byte_stream_advance(bs, 51);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2707 num1 = byte_stream_getle16(bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2708 num2 = byte_stream_getle16(bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2709 purple_debug_misc("oscar", "X-Status: Num1 %i, num2 %i\n",num1, num2);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2710
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2711 if(((num1 == 0x4f00)&&(num2 == 0x3b00))) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2712 byte_stream_advance(bs, 86);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2713 curpos = byte_stream_curpos(bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2714 xml = byte_stream_getstr(bs, bs->len - curpos);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2715 purple_debug_misc("oscar", "X-Status: Received XML reply\n");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2716 if(xml) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2717 /* purple_debug_misc("oscar", "X-Status: XML reply: %s\n", (const char*) xml); */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2718 if ((desc=strstr(xml,"&lt;desc&gt;")) != NULL) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2719 temp=strstr(xml,"&lt;/desc&gt;");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2720 temp[0]=0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2721 desc=desc+12;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2722 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2723 if ((title=strstr(xml,"&lt;title&gt;")) != NULL) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2724 temp=strstr(xml,"&lt;/title&gt;");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2725 temp[0]=0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2726 title=title+13;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2727 } else {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2728 title="";
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2729 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2730 strcpy(xml,title);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2731 if (desc) {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2732 strcat(xml, " - ");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2733 strcat(xml, desc);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2734 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2735 purple_debug_misc("oscar", "X-Status reply: %s\n", (const char*)xml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2736 account = purple_connection_get_account(od->gc);
29460
a0fb6798d87c Made it compile again.
Marcus Lundblad <ml@update.uu.se>
parents: 29458
diff changeset
2737 buddy = purple_find_buddy(account, bn);
29418
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2738 presence = purple_buddy_get_presence(buddy);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2739 status = purple_presence_get_active_status(presence);
29460
a0fb6798d87c Made it compile again.
Marcus Lundblad <ml@update.uu.se>
parents: 29458
diff changeset
2740 purple_prpl_got_user_status(account, bn,
29418
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2741 purple_status_get_id(status), "message", xml, NULL);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2742 } else {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2743 purple_debug_misc("oscar", "X-Status: Can't get XML reply string\n");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2744 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2745 } else {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2746 purple_debug_misc("oscar", "X-Status: 0x0004, 0x000b not an xstatus reply\n" );
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2747 /* if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2748 ret = userfunc(od, conn, frame, channel, sn, reason); */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2749 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2750
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2751 }
21993
bb1190d6961c Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <mark@kingant.net>
parents: 21724
diff changeset
2752
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2753 } else if (channel == 0x0004) { /* ICQ message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2754 switch (reason) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2755 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
2756 guint8 statusmsgtype, *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2757 guint16 len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2758 guint32 state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2760 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
2761 byte_stream_advance(bs, len); /* Unknown */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2763 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
2764 byte_stream_advance(bs, len); /* Unknown */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2765
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 statusmsgtype = byte_stream_getle8(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 switch (statusmsgtype) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2768 case 0xe8:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2769 state = AIM_ICQ_STATE_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 case 0xe9:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772 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
2773 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774 case 0xea:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2775 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
2776 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 case 0xeb:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778 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
2779 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780 case 0xec:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781 state = AIM_ICQ_STATE_CHAT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2783 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2784 state = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2785 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2786 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2788 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
2789 byte_stream_getle16(bs); /* Unknown - 0x0000 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2790 byte_stream_getle16(bs); /* Unknown - 0x0000 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 len = byte_stream_getle16(bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793 msg = byte_stream_getraw(bs, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2795 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2796 ret = userfunc(od, conn, frame, channel, bn, reason, state, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797
17191
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: 15822
diff changeset
2798 g_free(msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2799 } break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2800
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2801 default: {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2802 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2803 ret = userfunc(od, conn, frame, channel, bn, reason);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2804 } break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2805 } /* end switch */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2806 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2807
17191
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: 15822
diff changeset
2808 g_free(cookie);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2809 g_free(bn);
29457
5391094529c6 propagate from branch 'im.pidgin.pidgin' (head a59a573e3b9b2eb42ff728ba9ff56095f5c9e0d0)
Richard Laager <rlaager@wiktel.com>
parents: 25949 29418
diff changeset
2810 g_free(xml);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 * Subtype 0x000c - Receive an ack after sending an ICBM.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2817 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2818 * You have to have send the message with the AIM_IMFLAGS_ACK flag set
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 * (TLV t(0003)). The ack contains the ICBM header of the message you
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 * sent.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2822 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823 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
2824 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2825 aim_rxcallback_t userfunc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826 guint16 ch;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827 guchar *cookie;
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2828 char *bn;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2830
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2831 cookie = byte_stream_getraw(bs, 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832 ch = byte_stream_get16(bs);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2833 bn = byte_stream_getstr(bs, byte_stream_get8(bs));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2835 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2836 ret = userfunc(od, conn, frame, ch, bn);
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2837
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2838 g_free(bn);
17191
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: 15822
diff changeset
2839 g_free(cookie);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2842 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2843
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2844 /*
22347
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2845 * 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
2846 * 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
2847 * 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
2848 * 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
2849 *
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2850 * 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
2851 * 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
2852 * 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
2853 * 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
2854 * 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
2855 */
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2856 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
2857 {
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2858 FlapConnection *conn;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2859
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2860 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
2861 return -EINVAL;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2862
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2863 aim_genericreq_n(od, conn, SNAC_FAMILY_ICBM, 0x0010);
22347
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2864
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2865 return 0;
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2866 }
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2867
a8c025929245 Add support for offline messages for AIM, thanks to some info from
Mark Doliner <mark@kingant.net>
parents: 21993
diff changeset
2868 /*
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2869 * 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
2870 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2871 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
2872 * and Purple 0.60 and newer.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2874 */
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2875 int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 FlapConnection *conn;
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2878 ByteStream bs;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2879 aim_snacid_t snacid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881 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
2882 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2884 if (!bn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 return -EINVAL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2887 byte_stream_new(&bs, 11+strlen(bn)+2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2889 snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2891 /* ICBM cookie */
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2892 byte_stream_put32(&bs, 0x00000000);
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2893 byte_stream_put32(&bs, 0x00000000);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 /*
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2896 * Channel (should be 0x0001 for mtn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 */
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2898 byte_stream_put16(&bs, channel);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 /*
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2901 * Dest buddy name
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 */
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
2903 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: 24665
diff changeset
2904 byte_stream_putstr(&bs, bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 /*
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2907 * Event (should be 0x0000, 0x0001, or 0x0002 for mtn)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 */
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
2909 byte_stream_put16(&bs, event);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2910
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
2911 flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs);
22717
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2912
979a81468e19 All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents: 22412
diff changeset
2913 byte_stream_destroy(&bs);
22856
ab2322195dab Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents: 22719
diff changeset
2914
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2918 /*
29418
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2919 * Subtype 0x0006 - Send eXtra Status request
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2920 */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2921 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: 23313
diff changeset
2922 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2923 FlapConnection *conn;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2924 aim_snacid_t snacid;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2925 guchar cookie[8];
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2926 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: 23313
diff changeset
2927 ByteStream bs, header, plugindata;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2928 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2929 const char *fmt;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2930 char *statxml;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2931 int xmllen;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2932
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2933 static const guint8 pluginid[] =
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2934 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2935 0x09, 0x46, 0x13, 0x49, 0x4C, 0x7F, 0x11, 0xD1,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2936 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2937 };
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2938
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2939 static const guint8 c_plugindata[] =
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2940 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2941 0x1B, 0x00, 0x0A,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2942 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2943 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2944 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x01, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2945 0x01, 0x00, 0x00, 0x4F, 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0, 0x9C,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2946 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x53, 0x63, 0x72, 0x69, 0x70,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2947 0x74, 0x20, 0x50, 0x6C, 0x75, 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2948 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2949 0x72, 0x72, 0x69, 0x76, 0x65, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2950 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2951 };
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2952
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2953 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: 23313
diff changeset
2954 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2955
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2956 if (!sn)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2957 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2958
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2959 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";
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2960
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2961 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: 23313
diff changeset
2962 xmllen = strlen(fmt) - 2 + strlen(account->username);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2963
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2964 statxml = (char*) g_malloc(xmllen);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2965 snprintf(statxml, xmllen, fmt, account->username);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2966
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2967 aim_icbm_makecookie(cookie);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2968
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2969 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: 23313
diff changeset
2970 + 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: 23313
diff changeset
2971 + 2 + 2 + sizeof(c_plugindata) + xmllen
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2972 + 2 + 2);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2973
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2974 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: 23313
diff changeset
2975 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: 23313
diff changeset
2976
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2977 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: 23313
diff changeset
2978 byte_stream_new(&plugindata, (sizeof(c_plugindata) + xmllen));
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2979
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2980 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: 23313
diff changeset
2981 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: 23313
diff changeset
2982 byte_stream_putraw(&header, pluginid, sizeof(pluginid)); /* Plugin ID */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2983
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2984 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: 23313
diff changeset
2985 aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2986
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2987 /* Add Plugin Specific Data */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2988 byte_stream_putraw(&plugindata, c_plugindata, sizeof(c_plugindata)); /* Content of TLV 0x2711 */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2989 byte_stream_putstr(&plugindata, statxml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2990
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2991 aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, (sizeof(c_plugindata) + xmllen), plugindata.data);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2992
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2993 aim_tlvlist_write(&header, &inner_tlvlist);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2994
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2995
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2996 aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&header), header.data);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2997 aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); /* Empty TLV 0x0003 */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2998
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
2999 aim_tlvlist_write(&bs, &outer_tlvlist);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3000
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3001 purple_debug_misc("oscar", "X-Status Request\n");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3002 flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs, TRUE);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3003
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3004 aim_tlvlist_free(inner_tlvlist);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3005 aim_tlvlist_free(outer_tlvlist);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3006 byte_stream_destroy(&header);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3007 byte_stream_destroy(&plugindata);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3008 byte_stream_destroy(&bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3009 g_free(statxml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3010
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3011 return 0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3012 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3013
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3014 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: 23313
diff changeset
3015 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3016 FlapConnection *conn;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3017 ByteStream bs;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3018 aim_snacid_t snacid;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3019 PurpleAccount *account;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3020 PurpleStatus *status;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3021 const char *fmt;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3022 const char *formatted_msg;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3023 char *msg;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3024 char *statxml;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3025 const char *title;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3026 int len;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3027
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3028 static const guint8 plugindata[] = {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3029 0x1B, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3030 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3031 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3032 0x01, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3033 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3034 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x4F,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3035 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3036 0x9C, 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3037 0x00, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x50, 0x6C, 0x75,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3038 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3039 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3040 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x72, 0x72, 0x69, 0x76, 0x65, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3041 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3042 0x00, 0x00, 0x00, 0xF3, 0x01, 0x00, 0x00, 0xEF, 0x01, 0x00, 0x00
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3043 };
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3044
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3045 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";
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3046
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3047
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3048 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: 23313
diff changeset
3049 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3050
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3051 if (!sn)
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3052 return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3053
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3054 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: 23313
diff changeset
3055 if(!account) return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3056
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3057 /* if (!strcmp(account->username, sn))
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3058 icq_im_xstatus_request(od, sn); */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3059
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3060 status = purple_presence_get_active_status(account->presence);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3061 if (!status) return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3062 title = purple_status_get_name(status);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3063 if (!title) return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3064 formatted_msg = purple_status_get_attr_string(status, "message");
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3065 if (!formatted_msg) return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3066 msg = purple_markup_strip_html(formatted_msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3067 if (!msg) return -EINVAL;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3068 len = strlen(fmt)-6+strlen(account->username)+strlen(title)+strlen(msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3069 statxml = (char*) g_malloc(len);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3070
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3071 snprintf(statxml, len, fmt,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3072 account->username, title, msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3073
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3074 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: 23313
diff changeset
3075
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3076 byte_stream_new(&bs, 10 + 8 + 2 + 1 + strlen(sn) + 2 + sizeof(plugindata) + strlen(statxml)); /* 16 extra */
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3077
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3078 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: 23313
diff changeset
3079 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: 23313
diff changeset
3080 byte_stream_put16(&bs, 0x0003);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3081 byte_stream_putraw(&bs, plugindata, sizeof(plugindata));
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3082 byte_stream_putraw(&bs, (const guint8*)statxml, strlen(statxml));
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3083
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3084 flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x000b, 0x0000, snacid, &bs, TRUE);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3085
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3086 g_free(statxml);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3087 g_free(msg);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3088 byte_stream_destroy(&bs);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3089
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3090 return 0;
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3091 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3092
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 23313
diff changeset
3093 /*
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3094 * 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
3095 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3096 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
3097 * and Purple 0.60 and newer.
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3098 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3099 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3100 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
3101 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102 int ret = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 aim_rxcallback_t userfunc;
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
3104 char *bn;
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
3105 guint8 bnlen;
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3106 guint16 channel, event;
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3107
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3108 byte_stream_advance(bs, 8); /* ICBM cookie */
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3109 channel = byte_stream_get16(bs);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
3110 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: 24665
diff changeset
3111 bn = byte_stream_getstr(bs, bnlen);
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3112 event = byte_stream_get16(bs);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3114 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
28229
8d5380556f12 Rename two variables based on insight from
Mark Doliner <mark@kingant.net>
parents: 28228
diff changeset
3115 ret = userfunc(od, conn, frame, channel, bn, event);
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
3116
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 24665
diff changeset
3117 g_free(bn);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3119 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3120 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122 static int
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 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
3124 {
28492
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
3125 if (snac->subtype == 0x0001)
28d73d34d792 oscar: Display more detailed error messages when an outgoing message is bounced.
aman@tmm1.net
parents: 28229
diff changeset
3126 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: 28229
diff changeset
3127 else if (snac->subtype == 0x0005)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128 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
3129 else if (snac->subtype == 0x0006)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3130 return outgoingim(od, conn, mod, frame, snac, bs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3131 else if (snac->subtype == 0x0007)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132 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
3133 else if (snac->subtype == 0x000a)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 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
3135 else if (snac->subtype == 0x000b)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3136 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
3137 else if (snac->subtype == 0x000c)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3138 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
3139 else if (snac->subtype == 0x0014)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 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
3141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145 int
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3146 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
3147 {
23313
9c0ee2491ed1 Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evan.s@dreskin.net>
parents: 22856
diff changeset
3148 mod->family = SNAC_FAMILY_ICBM;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3149 mod->version = 0x0001;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3150 mod->toolid = 0x0110;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3151 mod->toolversion = 0x0629;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3152 mod->flags = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3153 strncpy(mod->name, "messaging", sizeof(mod->name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3154 mod->snachandler = snachandler;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3156 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3157 }