src/protocols/oscar/flap_connection.c

changeset 13610
b2c15a312144
parent 13609
a6fbfad454b6
child 13611
53cbfd2b9361
equal deleted inserted replaced
13609:a6fbfad454b6 13610:b2c15a312144
117 FlapConnection *conn; 117 FlapConnection *conn;
118 118
119 conn = g_new0(FlapConnection, 1); 119 conn = g_new0(FlapConnection, 1);
120 conn->od = od; 120 conn->od = od;
121 conn->buffer_outgoing = gaim_circ_buffer_new(0); 121 conn->buffer_outgoing = gaim_circ_buffer_new(0);
122 conn->inside = g_new0(aim_conn_inside_t, 1);
123 conn->fd = -1; 122 conn->fd = -1;
124 conn->subtype = -1; 123 conn->subtype = -1;
125 conn->type = type; 124 conn->type = type;
126 125
127 od->oscar_connections = g_list_prepend(od->oscar_connections, conn); 126 od->oscar_connections = g_list_prepend(od->oscar_connections, conn);
150 conn->subtype = src->subtype; 149 conn->subtype = src->subtype;
151 conn->seqnum = src->seqnum; 150 conn->seqnum = src->seqnum;
152 conn->internal = src->internal; 151 conn->internal = src->internal;
153 conn->lastactivity = src->lastactivity; 152 conn->lastactivity = src->lastactivity;
154 153
155 if (src->inside != NULL) 154 /* TODO: Clone groups and rates */
156 {
157 /*
158 * XXX should clone this section as well, but since currently
159 * this function only gets called for some of that rendezvous
160 * crap, and not on SNAC connections, its probably okay for
161 * now.
162 *
163 */
164 }
165 155
166 return conn; 156 return conn;
167 } 157 }
168 158
169 /** 159 /**
251 * Free conn->internal, if necessary 241 * Free conn->internal, if necessary
252 */ 242 */
253 if (conn->type == SNAC_FAMILY_CHAT) 243 if (conn->type == SNAC_FAMILY_CHAT)
254 flap_connection_destroy_chat(od, conn); 244 flap_connection_destroy_chat(od, conn);
255 245
256 if (conn->inside != NULL) 246 flap_connection_destroy_snacgroups(conn->groups);
257 { 247 flap_connection_destroy_rates(conn->rates);
258 aim_conn_inside_t *inside = (aim_conn_inside_t *)conn->inside;
259
260 flap_connection_destroy_snacgroups(inside->groups);
261 flap_connection_destroy_rates(inside->rates);
262
263 free(inside);
264 }
265 248
266 od->oscar_connections = g_list_remove(od->oscar_connections, conn); 249 od->oscar_connections = g_list_remove(od->oscar_connections, conn);
267 g_free(conn); 250 g_free(conn);
268 251
269 account = gaim_connection_get_account(od->gc); 252 account = gaim_connection_get_account(od->gc);
373 * 356 *
374 */ 357 */
375 void 358 void
376 flap_connection_addgroup(FlapConnection *conn, guint16 group) 359 flap_connection_addgroup(FlapConnection *conn, guint16 group)
377 { 360 {
378 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
379 struct snacgroup *sg; 361 struct snacgroup *sg;
380 362
381 sg = g_new0(struct snacgroup, 1); 363 sg = g_new0(struct snacgroup, 1);
382 364
383 gaim_debug_misc("oscar", "Adding group 0x%04x to connection " 365 gaim_debug_misc("oscar", "Adding group 0x%04x to connection "
384 "of type 0x%04hx\n", group, conn->type); 366 "of type 0x%04hx\n", group, conn->type);
385 sg->group = group; 367 sg->group = group;
386 368
387 sg->next = ins->groups; 369 sg->next = conn->groups;
388 ins->groups = sg; 370 conn->groups = sg;
389 } 371 }
390 372
391 /** 373 /**
392 * Find a FlapConnection that supports the given oscar 374 * Find a FlapConnection that supports the given oscar
393 * family. 375 * family.
400 GList *cur; 382 GList *cur;
401 383
402 for (cur = od->oscar_connections; cur != NULL; cur = cur->next) 384 for (cur = od->oscar_connections; cur != NULL; cur = cur->next)
403 { 385 {
404 FlapConnection *conn; 386 FlapConnection *conn;
405 aim_conn_inside_t *ins;
406 struct snacgroup *sg; 387 struct snacgroup *sg;
407 388
408 conn = cur->data; 389 conn = cur->data;
409 ins = (aim_conn_inside_t *)conn->inside; 390
410 391 for (sg = conn->groups; sg != NULL; sg = sg->next)
411 for (sg = ins->groups; sg != NULL; sg = sg->next)
412 { 392 {
413 if (sg->group == group) 393 if (sg->group == group)
414 return conn; 394 return conn;
415 } 395 }
416 } 396 }

mercurial