Changeset bb95d43
- Timestamp:
- 2007-06-04T11:32:37Z (17 years ago)
- Branches:
- master
- Children:
- 54f2f55
- Parents:
- 6286f80
- Location:
- protocols/jabber
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/io.c
r6286f80 rbb95d43 44 44 struct jabber_data *jd = ic->proto_data; 45 45 gboolean ret; 46 47 if( jd->flags & JFLAG_XMLCONSOLE ) 48 { 49 char *msg; 50 51 msg = g_strdup_printf( "TX: %s", buf ); 52 imcb_buddy_msg( ic, JABBER_XMLCONSOLE_HANDLE, msg, 0, 0 ); 53 g_free( msg ); 54 } 46 55 47 56 if( jd->tx_len == 0 ) … … 484 493 } 485 494 495 static xt_status jabber_xmlconsole( struct xt_node *node, gpointer data ) 496 { 497 struct im_connection *ic = data; 498 struct jabber_data *jd = ic->proto_data; 499 500 if( jd->flags & JFLAG_XMLCONSOLE ) 501 { 502 char *msg, *pkt; 503 504 pkt = xt_to_string( node ); 505 msg = g_strdup_printf( "RX: %s", pkt ); 506 imcb_buddy_msg( ic, JABBER_XMLCONSOLE_HANDLE, msg, 0, 0 ); 507 g_free( msg ); 508 g_free( pkt ); 509 } 510 511 return XT_NEXT; 512 } 513 486 514 static const struct xt_handler_entry jabber_handlers[] = { 515 { NULL, "stream:stream", jabber_xmlconsole }, 487 516 { "stream:stream", "<root>", jabber_end_of_stream }, 488 517 { "message", "stream:stream", jabber_pkt_message }, -
protocols/jabber/jabber.c
r6286f80 rbb95d43 226 226 int st; 227 227 228 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 229 return jabber_write( ic, message, strlen( message ) ); 230 228 231 bud = jabber_buddy_by_jid( ic, who, 0 ); 229 232 … … 311 314 static void jabber_add_buddy( struct im_connection *ic, char *who, char *group ) 312 315 { 316 struct jabber_data *jd = ic->proto_data; 317 318 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 319 { 320 jd->flags |= JFLAG_XMLCONSOLE; 321 imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); 322 return; 323 } 324 313 325 if( jabber_add_to_roster( ic, who, NULL ) ) 314 326 presence_send_request( ic, who, "subscribe" ); … … 317 329 static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group ) 318 330 { 331 struct jabber_data *jd = ic->proto_data; 332 333 if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) 334 { 335 jd->flags &= ~JFLAG_XMLCONSOLE; 336 /* FIXME imcb_remove_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL ); */ 337 return; 338 } 339 319 340 /* We should always do this part. Clean up our administration a little bit. */ 320 341 jabber_buddy_remove_bare( ic, who ); -
protocols/jabber/jabber.h
r6286f80 rbb95d43 32 32 typedef enum 33 33 { 34 JFLAG_STREAM_STARTED = 1, 34 JFLAG_STREAM_STARTED = 1, /* Set when we detected the beginning of the stream 35 35 and want to do auth. */ 36 JFLAG_AUTHENTICATED = 2, 37 JFLAG_STREAM_RESTART = 4, 36 JFLAG_AUTHENTICATED = 2, /* Set when we're successfully authenticatd. */ 37 JFLAG_STREAM_RESTART = 4, /* Set when we want to restart the stream (after 38 38 SASL or TLS). */ 39 JFLAG_WAIT_SESSION = 8, 39 JFLAG_WAIT_SESSION = 8, /* Set if we sent a <session> tag and need a reply 40 40 before we continue. */ 41 JFLAG_WAIT_BIND = 16, 42 JFLAG_WANT_TYPING = 32, 41 JFLAG_WAIT_BIND = 16, /* ... for <bind> tag. */ 42 JFLAG_WANT_TYPING = 32, /* Set if we ever sent a typing notification, this 43 43 activates all XEP-85 related code. */ 44 JFLAG_XMLCONSOLE = 64, /* If the user added an xmlconsole buddy. */ 44 45 } jabber_flags_t; 45 46 … … 56 57 } jabber_buddy_flags_t; 57 58 58 #define JABBER_PORT_DEFAULT "5222"59 #define JABBER_PORT_MIN 522060 #define JABBER_PORT_MAX 522961 62 59 struct jabber_data 63 60 { … … 124 121 struct jabber_buddy *me; 125 122 }; 123 124 #define JABBER_XMLCONSOLE_HANDLE "xmlconsole" 125 126 #define JABBER_PORT_DEFAULT "5222" 127 #define JABBER_PORT_MIN 5220 128 #define JABBER_PORT_MAX 5229 126 129 127 130 /* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the -
protocols/jabber/xmltree.c
r6286f80 rbb95d43 188 188 g_strcasecmp( xt->handlers[i].parent, "<root>" ) == 0 ) ) ) 189 189 { 190 xt_print( node );191 192 190 st = xt->handlers[i].func( node, xt->data ); 193 191
Note: See TracChangeset
for help on using the changeset viewer.