Changeset cfbb3a6 for protocols/jabber
- Timestamp:
- 2006-09-24T18:08:07Z (18 years ago)
- Branches:
- master
- Children:
- 8e5e2e9
- Parents:
- e101506
- Location:
- protocols/jabber
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
re101506 rcfbb3a6 184 184 return st; 185 185 } 186 187 int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name ) 188 { 189 struct xt_node *node; 190 int st; 191 192 /* Build the item entry */ 193 node = xt_new_node( "item", NULL, NULL ); 194 xt_add_attr( node, "jid", handle ); 195 if( name ) 196 xt_add_attr( node, "name", name ); 197 198 /* And pack it into a roster-add packet */ 199 node = xt_new_node( "query", NULL, node ); 200 xt_add_attr( node, "xmlns", "jabber:iq:roster" ); 201 node = jabber_make_packet( "iq", "set", NULL, node ); 202 203 st = jabber_write_packet( gc, node ); 204 205 xt_free_node( node ); 206 return st; 207 } 208 209 int jabber_remove_from_roster( struct gaim_connection *gc, char *handle ) 210 { 211 struct xt_node *node; 212 int st; 213 214 /* Build the item entry */ 215 node = xt_new_node( "item", NULL, NULL ); 216 xt_add_attr( node, "jid", handle ); 217 xt_add_attr( node, "subscription", "remove" ); 218 219 /* And pack it into a roster-add packet */ 220 node = xt_new_node( "query", NULL, node ); 221 xt_add_attr( node, "xmlns", "jabber:iq:roster" ); 222 node = jabber_make_packet( "iq", "set", NULL, node ); 223 224 st = jabber_write_packet( gc, node ); 225 226 xt_free_node( node ); 227 return st; 228 } -
protocols/jabber/jabber.c
re101506 rcfbb3a6 153 153 154 154 presence_send_update( gc ); 155 } 156 157 static void jabber_add_buddy( struct gaim_connection *gc, char *who ) 158 { 159 if( jabber_add_to_roster( gc, who, NULL ) ) 160 presence_send_request( gc, who, "subscribe" ); 161 } 162 163 static void jabber_remove_buddy( struct gaim_connection *gc, char *who, char *group ) 164 { 165 if( jabber_remove_from_roster( gc, who ) ) 166 presence_send_request( gc, who, "unsubscribe" ); 155 167 } 156 168 … … 175 187 // ret->set_info = jabber_set_info; 176 188 // ret->get_info = jabber_get_info; 177 //ret->add_buddy = jabber_add_buddy;178 //ret->remove_buddy = jabber_remove_buddy;189 ret->add_buddy = jabber_add_buddy; 190 ret->remove_buddy = jabber_remove_buddy; 179 191 // ret->chat_send = jabber_chat_send; 180 192 // ret->chat_invite = jabber_chat_invite; -
protocols/jabber/jabber.h
re101506 rcfbb3a6 73 73 int jabber_start_iq_auth( struct gaim_connection *gc ); 74 74 int jabber_get_roster( struct gaim_connection *gc ); 75 int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name ); 76 int jabber_remove_from_roster( struct gaim_connection *gc, char *handle ); 75 77 78 /* message.c */ 76 79 xt_status jabber_pkt_message( struct xt_node *node, gpointer data ); 77 80 … … 79 82 xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ); 80 83 int presence_send_update( struct gaim_connection *gc ); 84 int presence_send_request( struct gaim_connection *gc, char *handle, char *request ); 81 85 82 86 /* jabber_util.c */ -
protocols/jabber/presence.c
re101506 rcfbb3a6 78 78 return st; 79 79 } 80 81 /* Send a subscribe/unsubscribe request to a buddy. */ 82 int presence_send_request( struct gaim_connection *gc, char *handle, char *request ) 83 { 84 struct xt_node *node; 85 int st; 86 87 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 88 xt_add_attr( node, "to", handle ); 89 xt_add_attr( node, "type", request ); 90 91 st = jabber_write_packet( gc, node ); 92 93 xt_free_node( node ); 94 return st; 95 }
Note: See TracChangeset
for help on using the changeset viewer.