annotate src/protocols/oscar/conn.c @ 13299:b2b26d2ac2ef

[gaim-migrate @ 15665] Compile committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 16 Feb 2006 02:20:30 +0000
parents b08f8f3c9197
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
1 /*
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
2 * Gaim's oscar protocol plugin
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
3 * This file is the legal property of its developers.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
4 * Please see the AUTHORS file distributed alongside this file.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
5 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
6 * This library is free software; you can redistribute it and/or
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
8 * License as published by the Free Software Foundation; either
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
9 * version 2 of the License, or (at your option) any later version.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
10 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
11 * This library is distributed in the hope that it will be useful,
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
14 * Lesser General Public License for more details.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
15 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
17 * License along with this library; if not, write to the Free Software
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
19 */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
20
8888
8592f296db16 [gaim-migrate @ 9657]
Mark Doliner <mark@kingant.net>
parents: 8880
diff changeset
21 /**
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
22 * Low-level connection handling.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 * Does all this gloriously nifty connection handling stuff...
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents: 12414
diff changeset
28 #include "oscar.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #ifndef _WIN32
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include <netdb.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include <sys/socket.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include <netinet/in.h>
3717
988485669631 [gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3694
diff changeset
34 #endif
988485669631 [gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3694
diff changeset
35
988485669631 [gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3694
diff changeset
36 #ifdef _WIN32
988485669631 [gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3694
diff changeset
37 #include "win32dep.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
40 /**
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
41 * In OSCAR, every connection has a set of SNAC groups associated
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
42 * with it. These are the groups that you can send over this connection
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
43 * without being guaranteed a "Not supported" SNAC error.
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
44 *
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
45 * The grand theory of things says that these associations transcend
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
46 * what libfaim calls "connection types" (conn->type). You can probably
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
47 * see the elegance here, but since I want to revel in it for a bit, you
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
48 * get to hear it all spelled out.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
49 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
50 * So let us say that you have your core BOS connection running. One
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
51 * of your modules has just given you a SNAC of the group 0x0004 to send
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
52 * you. Maybe an IM destined for some twit in Greenland. So you start
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
53 * at the top of your connection list, looking for a connection that
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
54 * claims to support group 0x0004. You find one. Why, that neat BOS
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
55 * connection of yours can do that. So you send it on its way.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
56 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
57 * Now, say, that fellow from Greenland has friends and they all want to
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
58 * meet up with you in a lame chat room. This has landed you a SNAC
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
59 * in the family 0x000e and you have to admit you're a bit lost. You've
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
60 * searched your connection list for someone who wants to make your life
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
61 * easy and deliver this SNAC for you, but there isn't one there.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
62 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
63 * Here comes the good bit. Without even letting anyone know, particularly
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 7474
diff changeset
64 * the module that decided to send this SNAC, and definitely not that twit
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
65 * in Greenland, you send out a service request. In this request, you have
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
66 * marked the need for a connection supporting group 0x000e. A few seconds
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
67 * later, you receive a service redirect with an IP address and a cookie in
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
68 * it. Great, you say. Now I have something to do. Off you go, making
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
69 * that connection. One of the first things you get from this new server
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
70 * is a message saying that indeed it does support the group you were looking
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
71 * for. So you continue and send rate confirmation and all that.
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
72 *
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
73 * Then you remember you had that SNAC to send, and now you have a means to
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
74 * do it, and you do, and everyone is happy. Except the Greenlander, who is
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
75 * still stuck in the bitter cold.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
76 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
77 * Oh, and this is useful for building the Migration SNACs, too. In the
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
78 * future, this may help convince me to implement rate limit mitigation
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
79 * for real. We'll see.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
80 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
81 * Just to make me look better, I'll say that I've known about this great
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
82 * scheme for quite some time now. But I still haven't convinced myself
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
83 * to make libfaim work that way. It would take a fair amount of effort,
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
84 * and probably some client API changes as well. (Whenever I don't want
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
85 * to do something, I just say it would change the client API. Then I
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
86 * instantly have a couple of supporters of not doing it.)
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
87 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
88 * Generally, addgroup is only called by the internal handling of the
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
89 * server ready SNAC. So if you want to do something before that, you'll
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
90 * have to be more creative. That is done rather early, though, so I don't
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
91 * think you have to worry about it. Unless you're me. I care deeply
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
92 * about such inane things.
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
93 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
94 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
95 void
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
96 aim_conn_addgroup(OscarConnection *conn, guint16 group)
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
97 {
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
98 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
99 struct snacgroup *sg;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
100
13262
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
101 sg = g_new0(struct snacgroup, 1);
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
102
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11162
diff changeset
103 gaim_debug_misc("oscar", "adding group 0x%04x\n", group);
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
104 sg->group = group;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
105
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
106 sg->next = ins->groups;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
107 ins->groups = sg;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
108 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
109
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
110 OscarConnection *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
111 aim_conn_findbygroup(OscarSession *sess, guint16 group)
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
112 {
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
113 GList *cur;;
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
114
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
115 for (cur = sess->oscar_connections; cur; cur = cur->next)
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
116 {
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
117 OscarConnection *conn;
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
118 aim_conn_inside_t *ins;
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
119 struct snacgroup *sg;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
120
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
121 conn = cur->data;
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
122 ins = (aim_conn_inside_t *)conn->inside;
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
123
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
124 for (sg = ins->groups; sg; sg = sg->next)
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
125 {
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
126 if (sg->group == group)
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
127 return conn;
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
128 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
129 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
130
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
131 return NULL;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
132 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
133
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
134 static void
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
135 connkill_snacgroups(struct snacgroup *head)
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
136 {
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
137 struct snacgroup *sg;
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
138 for (sg = head; sg; )
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
139 {
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
140 struct snacgroup *tmp;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
141
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
142 tmp = sg->next;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
143 free(sg);
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
144 sg = tmp;
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
145 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
146 }
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
147
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
148 static void
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
149 connkill_rates(struct rateclass *head)
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
150 {
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
151 struct rateclass *rc;
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
152
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
153 for (rc = head; rc; )
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
154 {
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
155 struct rateclass *tmp;
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
156 struct snacpair *sp;
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
157
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
158 tmp = rc->next;
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
159
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
160 for (sp = rc->members; sp; ) {
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
161 struct snacpair *tmpsp;
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
162
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
163 tmpsp = sp->next;
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
164 free(sp);
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
165 sp = tmpsp;
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
166 }
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
167 free(rc);
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
168
2675
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
169 rc = tmp;
e759254b29bb [gaim-migrate @ 2688]
Adam Fritzler <mid@auk.cx>
parents: 2672
diff changeset
170 }
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
171 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
172
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
173 void
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
174 oscar_connection_destroy(OscarSession *sess, OscarConnection *conn)
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
175 {
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
176 aim_rxqueue_cleanbyconn(sess, conn);
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
177 aim_tx_cleanqueue(sess, conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
178
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
179 if (conn->fd != -1)
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
180 aim_conn_close(sess, conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
181
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
182 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
183 * This will free ->internal if it necessary...
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
184 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
185 if (conn->type == AIM_CONN_TYPE_CHAT)
13262
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
186 oscar_connection_destroy_chat(sess, conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
187
13260
2d5a1d2a520e [gaim-migrate @ 15626]
Mark Doliner <mark@kingant.net>
parents: 13259
diff changeset
188 if (conn->inside != NULL)
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
189 {
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
190 aim_conn_inside_t *inside = (aim_conn_inside_t *)conn->inside;
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
191
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
192 connkill_snacgroups(inside->groups);
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
193 connkill_rates(inside->rates);
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
194
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
195 free(inside);
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
196 }
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
197
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
198 gaim_circ_buffer_destroy(conn->buffer_outgoing);
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
199 g_free(conn);
13260
2d5a1d2a520e [gaim-migrate @ 15626]
Mark Doliner <mark@kingant.net>
parents: 13259
diff changeset
200
2d5a1d2a520e [gaim-migrate @ 15626]
Mark Doliner <mark@kingant.net>
parents: 13259
diff changeset
201 sess->oscar_connections = g_list_remove(sess->oscar_connections, conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
202 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
203
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 /**
10271
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
205 * This sends an empty channel 4 SNAC. This is sent to signify
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
206 * that we're logging off. This shouldn't really be necessary--
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
207 * usually the AIM server will detect that the TCP connection has
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
208 * been destroyed.
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
209 */
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
210 static int
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
211 aim_flap_close(OscarSession *sess, OscarConnection *conn)
10271
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
212 {
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
213 FlapFrame *fr;
10271
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
214
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
215 if (!sess || !conn)
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
216 return -EINVAL;
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
217
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
218 if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x04, 0)))
10271
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
219 return -ENOMEM;
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
220
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
221 aim_tx_enqueue(sess, fr);
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
222
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
223 return 0;
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
224 }
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
225
361c9170d8af [gaim-migrate @ 11420]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
226 /**
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 * Allocate a new empty connection structure.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 *
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
229 * @param sess The oscar session associated with this connection.
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
230 * @return Returns the new connection structure.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
232 static OscarConnection *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
233 aim_conn_getnext(OscarSession *sess)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 {
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
235 OscarConnection *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
237 conn = g_new0(OscarConnection, 1);
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
238 conn->inside = g_new0(aim_conn_inside_t, 1);
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
239 conn->buffer_outgoing = gaim_circ_buffer_new(-1);
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
240 conn->fd = -1;
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
241 conn->subtype = -1;
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
242 conn->type = -1;
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
243 conn->seqnum = 0;
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
244 conn->lastactivity = 0;
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
245 conn->handlerlist = NULL;
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
246
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
247 sess->oscar_connections = g_list_prepend(sess->oscar_connections, conn);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
248
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
249 return conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 /**
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 * Close (but not free) a connection.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 *
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
255 * This leaves everything untouched except for clearing the
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 * handler list and setting the fd to -1 (used to recognize
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
257 * dead connections). It will also remove cookies if necessary.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 *
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
259 * @param conn The connection to close.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
261 void
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
262 aim_conn_close(OscarSession *sess, OscarConnection *conn)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 {
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
264 if (conn->type == AIM_CONN_TYPE_BOS)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
265 aim_flap_close(sess, conn);
5435
a2f26666de42 [gaim-migrate @ 5817]
Mark Doliner <mark@kingant.net>
parents: 5124
diff changeset
266
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
267 if (conn->fd >= 0)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
268 close(conn->fd);
5435
a2f26666de42 [gaim-migrate @ 5817]
Mark Doliner <mark@kingant.net>
parents: 5124
diff changeset
269
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
270 conn->fd = -1;
5435
a2f26666de42 [gaim-migrate @ 5817]
Mark Doliner <mark@kingant.net>
parents: 5124
diff changeset
271
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
272 if (conn->handlerlist)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
273 aim_clearhandlers(conn);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 /**
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
277 * Locates a connection of the specified type in the
8866
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
278 * specified session.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 *
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
280 * XXX - Except for rendezvous, all uses of this should be removed and
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
281 * aim_conn_findbygroup() should be used instead.
8866
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
282 *
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
283 * @param sess The session to search.
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
284 * @param type The type of connection to look for.
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
285 * @return Returns the first connection found of the given target type,
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
286 * or NULL if none could be found.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
288 OscarConnection *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
289 aim_getconn_type(OscarSession *sess, int type)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 {
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
291 GList *cur;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
293 for (cur = sess->oscar_connections; cur; cur = cur->next)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
294 {
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
295 OscarConnection *conn;
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
296 conn = cur->data;
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
297 if ((conn->type == type) &&
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
298 !(conn->status & AIM_CONN_STATUS_INPROGRESS))
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
299 return conn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
300 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
302 return NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
305 OscarConnection *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
306 aim_getconn_type_all(OscarSession *sess, int type)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 {
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
308 GList *cur;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
310 for (cur = sess->oscar_connections; cur; cur = cur->next)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
311 {
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
312 OscarConnection *conn;
13259
3128ef5250ad [gaim-migrate @ 15625]
Mark Doliner <mark@kingant.net>
parents: 13256
diff changeset
313 conn = cur->data;
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
314 if (conn->type == type)
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
315 return conn;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
316 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
318 return NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 /**
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
322 * Clone an OscarConnection.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 * A new connection is allocated, and the values are filled in
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
325 * appropriately.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 *
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
327 * @param sess The session containing this connection.
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
328 * @param src The connection to clone.
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
329 * @return Returns a pointer to the new OscarConnection, or %NULL on error.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
331 OscarConnection *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
332 aim_cloneconn(OscarSession *sess, OscarConnection *src)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 {
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
334 OscarConnection *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335
13262
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
336 conn = aim_conn_getnext(sess);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
337 conn->fd = src->fd;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
338 conn->type = src->type;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
339 conn->subtype = src->subtype;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
340 conn->seqnum = src->seqnum;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
341 conn->internal = src->internal;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
342 conn->lastactivity = src->lastactivity;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
343 conn->sessv = src->sessv;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
344 aim_clonehandlers(sess, conn, src);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
346 if (src->inside) {
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
347 /*
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
348 * XXX should clone this section as well, but since currently
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
349 * this function only gets called for some of that rendezvous
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
350 * crap, and not on SNAC connections, its probably okay for
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
351 * now.
2270
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
352 *
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
353 */
d82efea341ef [gaim-migrate @ 2280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
354 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
356 return conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 /**
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 * Opens a new connection to the specified dest host of specified
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 * type, using the proxy settings if available. If @host is %NULL,
11162
ccb38cf22483 [gaim-migrate @ 13263]
Mark Doliner <mark@kingant.net>
parents: 11154
diff changeset
362 * the connection is allocated and returned, but no connection
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 * is made.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 * FIXME: Return errors in a more sane way.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 *
8866
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
367 * @param sess Session to create connection in
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
368 * @param type Type of connection to create
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
370 OscarConnection *
13254
e9802db22b06 [gaim-migrate @ 15620]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
371 oscar_connection_new(OscarSession *sess, int type)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 {
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
373 OscarConnection *conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374
13262
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
375 conn = aim_conn_getnext(sess);
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
376 conn->sessv = sess;
11162
ccb38cf22483 [gaim-migrate @ 13263]
Mark Doliner <mark@kingant.net>
parents: 11154
diff changeset
377 conn->type = type;
ccb38cf22483 [gaim-migrate @ 13263]
Mark Doliner <mark@kingant.net>
parents: 11154
diff changeset
378 conn->fd = -1;
ccb38cf22483 [gaim-migrate @ 13263]
Mark Doliner <mark@kingant.net>
parents: 11154
diff changeset
379 conn->status = 0;
13262
b08f8f3c9197 [gaim-migrate @ 15628]
Mark Doliner <mark@kingant.net>
parents: 13260
diff changeset
380
11162
ccb38cf22483 [gaim-migrate @ 13263]
Mark Doliner <mark@kingant.net>
parents: 11154
diff changeset
381 return conn;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 /**
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
385 * Determine if a connection is connecting.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 *
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
387 * @param conn Connection to examine.
8866
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
388 * @return Returns nonzero if the connection is in the process of
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
389 * connecting (or if it just completed and
c2dff943e240 [gaim-migrate @ 9634]
Luke Schierer <lschiere@pidgin.im>
parents: 8735
diff changeset
390 * aim_conn_completeconnect() has yet to be called on it).
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
392 int
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
393 aim_conn_isconnecting(OscarConnection *conn)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
395
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
396 if (!conn)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
397 return 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
398
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
399 return !!(conn->status & AIM_CONN_STATUS_INPROGRESS);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
402 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
403 * XXX this is nearly as ugly as proxyconnect().
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
404 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
405 int
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
406 aim_conn_completeconnect(OscarSession *sess, OscarConnection *conn)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
408 if (!conn || (conn->fd == -1))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
409 return -1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
410
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
411 if (!(conn->status & AIM_CONN_STATUS_INPROGRESS))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
412 return -1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413
5124
2e78141ec1b5 [gaim-migrate @ 5487]
Mark Doliner <mark@kingant.net>
parents: 4830
diff changeset
414 fcntl(conn->fd, F_SETFL, 0);
2e78141ec1b5 [gaim-migrate @ 5487]
Mark Doliner <mark@kingant.net>
parents: 4830
diff changeset
415
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
416 conn->status &= ~AIM_CONN_STATUS_INPROGRESS;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
418 /* Flush out the queues if there was something waiting for this conn */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
419 aim_tx_flushqueue(sess);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
421 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
424 OscarSession *
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
425 aim_conn_getsess(OscarConnection *conn)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
428 if (!conn)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
429 return NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
431 return (OscarSession *)conn->sessv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433
8880
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
434 /**
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
435 * No-op. This sends an empty channel 5 SNAC. WinAIM 4.x and higher
ec3e041dc3bd [gaim-migrate @ 9649]
Mark Doliner <mark@kingant.net>
parents: 8866
diff changeset
436 * sends these _every minute_ to keep the connection alive.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
437 */
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
438 int
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
439 aim_flap_nop(OscarSession *sess, OscarConnection *conn)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
440 {
13239
f260d319bbbc [gaim-migrate @ 15605]
Mark Doliner <mark@kingant.net>
parents: 13234
diff changeset
441 FlapFrame *fr;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
442
13253
87a7c3077c19 [gaim-migrate @ 15619]
Mark Doliner <mark@kingant.net>
parents: 13252
diff changeset
443 if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x05, 0)))
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
444 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
445
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
446 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
447
7283
b8fcbff88438 [gaim-migrate @ 7863]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
448 /* clean out SNACs over 60sec old */
b8fcbff88438 [gaim-migrate @ 7863]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
449 aim_cleansnacs(sess, 60);
b8fcbff88438 [gaim-migrate @ 7863]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
450
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
451 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2675
diff changeset
452 }