Changeset 995913b for protocols/jabber
- Timestamp:
- 2006-10-02T17:46:57Z (18 years ago)
- Branches:
- master
- Children:
- 6266fca
- Parents:
- 501b4e0
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r501b4e0 r995913b 148 148 { 149 149 struct xt_node *c; 150 150 151 if( !( jd->flags & JFLAG_AUTHENTICATED ) && 151 152 ( c = xt_find_node( orig->children, "query" ) ) && … … 199 200 { 200 201 if( !( jd->flags & JFLAG_AUTHENTICATED ) && 202 orig && 201 203 ( c = xt_find_node( orig->children, "query" ) ) && 202 204 ( c = xt_find_node( c->children, "username" ) ) && … … 207 209 return XT_ABORT; 208 210 } 209 else if( orig && 210 ( c = xt_find_node( orig->children, "query" ) ) && 211 ( c = xt_find_node( c->children, "active" ) ) ) 212 { 213 serv_got_crap( gc, "Error while activating privacy list, maybe it doesn't exist" ); 211 else if( ( xmlns && strcmp( xmlns, "jabber:iq:privacy" ) == 0 ) || 212 ( orig && 213 ( c = xt_find_node( orig->children, "query" ) ) && 214 ( s = xt_find_attr( c, "xmlns" ) ) && 215 strcmp( s, "jabber:iq:privacy" ) == 0 ) ) 216 { 217 /* All errors related to privacy lists. */ 218 if( ( c = xt_find_node( node->children, "error" ) ) == NULL ) 219 { 220 hide_login_progress_error( gc, "Received malformed error packet" ); 221 signoff( gc ); 222 return XT_ABORT; 223 } 224 225 if( xt_find_node( c->children, "item-not-found" ) ) 226 { 227 serv_got_crap( gc, "Error while activating privacy list, maybe it doesn't exist" ); 228 /* Should I do anything else here? */ 229 } 230 else if( xt_find_node( c->children, "feature-not-implemented" ) ) 231 { 232 jd->flags |= JFLAG_PRIVACY_BROKEN; 233 /* Probably there's no need to inform the user. 234 We can do that if the user ever tries to use 235 the block/allow commands. */ 236 } 214 237 } 215 238 } … … 327 350 node = jabber_make_packet( "iq", "get", NULL, node ); 328 351 329 st = jabber_write_packet( gc, node );330 331 xt_free_node( node );352 jabber_cache_packet( gc, node ); 353 st = jabber_write_packet( gc, node ); 354 332 355 return st; 333 356 } … … 347 370 return jabber_write_packet( gc, node ); 348 371 } 372 373 char *set_eval_privacy_list( set_t *set, char *value ) 374 { 375 account_t *acc = set->data; 376 struct jabber_data *jd = acc->gc->proto_data; 377 378 if( jd->flags & JFLAG_PRIVACY_BROKEN ) 379 { 380 serv_got_crap( acc->gc, "Privacy lists not supported by this server" ); 381 return NULL; 382 } 383 384 /* If we're on-line, return NULL and let the server decide if the 385 chosen list is valid. If we're off-line, just accept it and we'll 386 see later (when we connect). */ 387 if( acc->gc ) 388 jabber_set_privacy( acc->gc, value ); 389 390 return acc->gc ? NULL : value; 391 } -
protocols/jabber/jabber.c
r501b4e0 r995913b 42 42 s = set_add( &acc->set, "priority", "0", set_eval_priority, acc ); 43 43 44 s = set_add( &acc->set, "privacy_list", NULL, NULL, acc ); 45 /* TODO: Add evaluator. */ 44 s = set_add( &acc->set, "privacy_list", NULL, set_eval_privacy_list, acc ); 46 45 47 46 s = set_add( &acc->set, "resource", "BitlBee", NULL, acc ); … … 232 231 static void jabber_add_permit( struct gaim_connection *gc, char *who ) 233 232 { 234 presence_send_request( gc, who, "subscribed" ); 233 struct jabber_data *jd = gc->proto_data; 234 235 if( jd->flags & JFLAG_PRIVACY_BROKEN ) 236 { 237 serv_got_crap( gc, "Privacy lists not supported by this server" ); 238 return; 239 } 235 240 } 236 241 237 242 static void jabber_rem_permit( struct gaim_connection *gc, char *who ) 238 243 { 239 presence_send_request( gc, who, "unsubscribed" ); 244 struct jabber_data *jd = gc->proto_data; 245 246 if( jd->flags & JFLAG_PRIVACY_BROKEN ) 247 { 248 serv_got_crap( gc, "Privacy lists not supported by this server" ); 249 return; 250 } 240 251 } 241 252 -
protocols/jabber/jabber.h
r501b4e0 r995913b 37 37 JFLAG_WAIT_SESSION = 8, /* Set if we sent a <session> tag and need a reply before we continue. */ 38 38 JFLAG_WAIT_BIND = 16, /* ... for <bind> tag. */ 39 JFLAG_PRIVACY_BROKEN = 32, /* Or just not supported, actually. */ 39 40 } jabber_flags_t; 40 41 … … 83 84 int jabber_get_privacy( struct gaim_connection *gc ); 84 85 int jabber_set_privacy( struct gaim_connection *gc, char *name ); 86 char *set_eval_privacy_list( set_t *set, char *value ); 85 87 86 88 /* message.c */
Note: See TracChangeset
for help on using the changeset viewer.