Changeset a214954 for protocols/jabber
- Timestamp:
- 2006-09-24T20:00:09Z (18 years ago)
- Branches:
- master
- Children:
- eab2ac4
- Parents:
- 4ecdc69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r4ecdc69 ra214954 118 118 static int jabber_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away ) 119 119 { 120 struct xt_node *node ;120 struct xt_node *node, *event; 121 121 int st; 122 123 /* 124 event = xt_new_node( "active", NULL, NULL ); 125 xt_add_attr( event, "xlmns", "http://jabber.org/protocol/chatstates" ); 126 127 event = xt_new_node( "x", NULL, xt_new_node( "composing", NULL, NULL ) ); 128 xt_add_attr( event, "xmlns", "jabber:x:event" ); 129 */ 122 130 123 131 node = xt_new_node( "body", message, NULL ); 124 132 node = jabber_make_packet( "message", "chat", who, node ); 133 xt_add_child( node, event ); 125 134 st = jabber_write_packet( gc, node ); 126 135 xt_free_node( node ); … … 169 178 static void jabber_keepalive( struct gaim_connection *gc ) 170 179 { 180 struct jabber_data *jd = gc->proto_data; 181 struct xt_node *c, *prev; 182 171 183 /* Just any whitespace character is enough as a keepalive for XMPP sessions. */ 172 184 jabber_write( gc, "\n", 1 ); 185 186 /* Let's abuse this keepalive for garbage collection of the node cache too. 187 It runs every minute, so let's mark every node with a special flag the 188 first time we see it, and clean it up the second time (clean up all 189 packets with the flag set). 190 191 node->flags is normally only used by xmltree itself for parsing/handling, 192 so it should be safe to use the variable for gc. */ 193 194 /* This horrible loop is explained in xmltree.c. Makes me wonder if maybe I 195 didn't choose the perfect data structure... */ 196 for( prev = NULL, c = jd->node_cache->children; c; prev = c, c = c ? c->next : jd->node_cache->children ) 197 { 198 if( c->flags == 0 ) 199 { 200 c->flags ++; 201 } 202 else 203 { 204 if( prev ) 205 prev->next = c->next; 206 else 207 jd->node_cache->children = c->next; 208 209 xt_free_node( c ); 210 c = prev; 211 } 212 } 173 213 } 174 214
Note: See TracChangeset
for help on using the changeset viewer.