- Timestamp:
- 2006-09-21T19:48:17Z (18 years ago)
- Branches:
- master
- Children:
- 5997488
- Parents:
- 5bcf70a
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r5bcf70a rdeff040 122 122 } 123 123 124 /* TODO: For away state handling, implement some list like the one for MSN. */ 124 125 static GList *jabber_away_states( struct gaim_connection *gc ) 125 126 { … … 136 137 static void jabber_set_away( struct gaim_connection *gc, char *state, char *message ) 137 138 { 139 /* For now let's just always set state to "away" and send the message, if available. */ 140 presence_send( gc, NULL, g_strcasecmp( state, "Online" ) == 0 ? NULL : "away", message ); 141 } 142 143 static void jabber_keepalive( struct gaim_connection *gc ) 144 { 145 /* Just any whitespace character is enough as a keepalive for XMPP sessions. */ 146 jabber_write( gc, "\n", 1 ); 138 147 } 139 148 140 149 void jabber_init() 141 150 { 142 struct prpl *ret = g_new0( struct prpl, 1);151 struct prpl *ret = g_new0( struct prpl, 1 ); 143 152 144 153 ret->name = "jabber"; … … 158 167 // ret->chat_leave = jabber_chat_leave; 159 168 // ret->chat_open = jabber_chat_open; 160 //ret->keepalive = jabber_keepalive;169 ret->keepalive = jabber_keepalive; 161 170 // ret->add_permit = jabber_add_permit; 162 171 // ret->rem_permit = jabber_rem_permit; … … 166 175 ret->handle_cmp = g_strcasecmp; 167 176 168 register_protocol( ret);177 register_protocol( ret ); 169 178 } 170 171 #if 0172 int main( int argc, char *argv[] )173 {174 struct xt_parser *xt = xt_new( NULL );175 struct xt_node *msg;176 int i;177 char buf[512];178 179 msg = xt_new_node( "message", NULL, xt_new_node( "body", "blaataap-test", NULL ) );180 xt_add_child( msg, xt_new_node( "html", NULL, xt_new_node( "body", "<b>blaataap in html</b>", NULL ) ) );181 xt_add_attr( msg, "xmlns", "jabber:client" );182 xt_add_attr( xt_find_node( msg->children, "html" ), "xmlns", "html rotte zooi" );183 printf( "%s\n", xt_to_string( msg ) );184 185 while( ( i = read( 0, buf, 512 ) ) > 0 )186 {187 if( xt_feed( xt, buf, i ) < 1 )188 break;189 }190 xt->handlers = jabber_handlers;191 xt_handle( xt, NULL );192 193 xt_cleanup( xt, NULL );194 printf( "%d\n", xt->root );195 196 xt_free( xt );197 }198 #endif -
protocols/jabber/jabber.h
r5bcf70a rdeff040 46 46 xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ); 47 47 int presence_announce( struct gaim_connection *gc ); 48 int presence_send( struct gaim_connection *gc, char *to, char *show, char *status ); 48 49 49 50 /* jabber_util.c */ -
protocols/jabber/presence.c
r5bcf70a rdeff040 54 54 } 55 55 56 /* Send the <presence/> tag that finalizes the whole login process, from here 57 we'll actually show up as online to our buddies. */ 56 58 int presence_announce( struct gaim_connection *gc ) 57 59 { … … 69 71 return st; 70 72 } 73 74 int presence_send( struct gaim_connection *gc, char *to, char *show, char *status ) 75 { 76 struct xt_node *node; 77 int st; 78 79 node = jabber_make_packet( "presence", NULL, to, NULL ); 80 if( show ) 81 xt_add_child( node, xt_new_node( "show", show, NULL ) ); 82 if( status ) 83 xt_add_child( node, xt_new_node( "status", status, NULL ) ); 84 85 st = jabber_write_packet( gc, node ); 86 87 xt_free_node( node ); 88 return st; 89 }
Note: See TracChangeset
for help on using the changeset viewer.