Ticket #458: google-talk-invis.patch
File google-talk-invis.patch, 3.8 KB (added by , at 2008-11-14T15:58:26Z) |
---|
-
protocols/jabber/iq.c
diff -Naur bitlbee-1.2.3-orig/protocols/jabber/iq.c bitlbee-1.2.3/protocols/jabber/iq.c
old new 153 153 reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); 154 154 pack = 0; 155 155 } 156 } 156 } 157 else if( strcmp( s, "google:shared-status" ) == 0 ) 158 { 159 xt_free_node( reply ); 160 reply = NULL; 161 pack = 0; 162 } 157 163 else 158 164 { 159 165 xt_free_node( reply ); … … 267 273 { 268 274 struct jabber_data *jd = ic->proto_data; 269 275 char *type; 270 276 271 277 if( !( type = xt_find_attr( node, "type" ) ) ) 272 278 { 273 279 imcb_log( ic, "Warning: Received incomplete IQ packet while authenticating" ); … … 289 295 if( !jabber_get_roster( ic ) ) 290 296 return XT_ABORT; 291 297 } 292 298 299 /* Register to google shared status settings */ 293 300 return XT_HANDLED; 294 301 } 295 302 … … 324 331 325 332 int jabber_get_roster( struct im_connection *ic ) 326 333 { 327 struct xt_node *node ;334 struct xt_node *node, *n; 328 335 int st; 336 337 338 n = xt_new_node( "query", NULL, NULL ); 339 xt_add_attr( n, "xmlns", "google:shared-status" ); 340 xt_add_attr( n, "version", "2" ); 341 n = jabber_make_packet( "iq", "get", NULL, n); 342 343 jabber_write_packet( ic, n ); 329 344 345 xt_free_node( n ); 346 330 347 imcb_log( ic, "Authenticated, requesting buddy list" ); 331 348 332 349 node = xt_new_node( "query", NULL, NULL ); -
protocols/jabber/jabber.c
diff -Naur bitlbee-1.2.3-orig/protocols/jabber/jabber.c bitlbee-1.2.3/protocols/jabber/jabber.c
old new 380 380 381 381 /* Save all this info. We need it, for example, when changing the priority setting. */ 382 382 state = (void *) jabber_away_state_by_name( state_txt ); 383 jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */383 jd->away_state = state ? state : (void *) (jabber_away_state_list+4); /* Fall back to "Away" if necessary. */ 384 384 g_free( jd->away_message ); 385 385 jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; 386 386 -
protocols/jabber/presence.c
diff -Naur bitlbee-1.2.3-orig/protocols/jabber/presence.c bitlbee-1.2.3/protocols/jabber/presence.c
old new 205 205 int presence_send_update( struct im_connection *ic ) 206 206 { 207 207 struct jabber_data *jd = ic->proto_data; 208 struct xt_node *node, *cap ;208 struct xt_node *node, *cap, *n; 209 209 char *show = jd->away_state->code; 210 210 char *status = jd->away_message; 211 211 struct groupchat *c; 212 212 int st; 213 int invisible=0; 214 static char fid[1024]; 215 216 if(show && *show=='x') 217 invisible = 1; 218 219 n = xt_new_node( "query", NULL, NULL ); 220 xt_add_attr( n, "xmlns", "google:shared-status" ); 221 xt_add_attr( n, "version", "2" ); 222 223 cap = xt_new_node("status",status,NULL); 224 xt_add_child(n,cap); 225 226 if(*show == 'd') 227 cap = xt_new_node("show","dnd",NULL); 228 else 229 cap = xt_new_node("show","default",NULL); 230 xt_add_child(n,cap); 231 232 cap = xt_new_node("status-list",NULL,NULL); 233 xt_add_attr(cap,"show","default"); 234 xt_add_child(n,cap); 235 236 cap = xt_new_node("status-list",NULL,NULL); 237 xt_add_attr(cap,"show","dnd"); 238 xt_add_child(n,cap); 239 240 cap = xt_new_node("invisible",NULL,NULL); 241 if(invisible) 242 xt_add_attr(cap,"value","true"); 243 else 244 xt_add_attr(cap,"value","false"); 245 xt_add_child(n,cap); 246 247 sprintf(fid,"%s@%s",jd->username,jd->server); 248 n = jabber_make_packet( "iq", "set", fid, n); 249 st = jabber_write_packet( ic, n ); 250 xt_free_node( n ); 251 252 if(invisible) 253 return st; 213 254 214 255 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 215 256 xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );