Changeset 8b8def58
- Timestamp:
- 2010-06-24T09:14:34Z (14 years ago)
- Branches:
- master
- Children:
- 41d415b
- Parents:
- 7cd2e8a (diff), 38ff846 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/commands.xml
r7cd2e8a r8b8def58 1020 1020 </bitlbee-setting> 1021 1021 1022 <bitlbee-setting name="user_agent" type="string" scope="account"> 1023 <default>BitlBee</default> 1024 1025 <description> 1026 <para> 1027 Some Jabber servers are configured to only allow a few (or even just one) kinds of XMPP clients to connect to them. 1028 </para> 1029 1030 <para> 1031 You can change this setting to make BitlBee present itself as a different client, so that you can still connect to these servers. 1032 </para> 1033 </description> 1034 </bitlbee-setting> 1035 1022 1036 <bitlbee-setting name="web_aware" type="string" scope="account"> 1023 1037 <default>false</default> -
protocols/jabber/iq.c
r7cd2e8a r8b8def58 65 65 if( strcmp( s, XMLNS_VERSION ) == 0 ) 66 66 { 67 xt_add_child( reply, xt_new_node( "name", "BitlBee", NULL ) );67 xt_add_child( reply, xt_new_node( "name", set_getstr( &ic->acc->set, "user_agent" ), NULL ) ); 68 68 xt_add_child( reply, xt_new_node( "version", BITLBEE_VERSION, NULL ) ); 69 69 xt_add_child( reply, xt_new_node( "os", ARCH, NULL ) ); … … 108 108 xt_add_attr( c, "category", "client" ); 109 109 xt_add_attr( c, "type", "pc" ); 110 xt_add_attr( c, "name", "BitlBee");110 xt_add_attr( c, "name", set_getstr( &ic->acc->set, "user_agent" ) ); 111 111 xt_add_child( reply, c ); 112 112 -
protocols/jabber/jabber.c
r7cd2e8a r8b8def58 81 81 s = set_add( &acc->set, "tls", "try", set_eval_tls, acc ); 82 82 s->flags |= ACC_SET_OFFLINE_ONLY; 83 84 s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); 83 85 84 86 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); … … 486 488 { 487 489 /* Just any whitespace character is enough as a keepalive for XMPP sessions. */ 488 jabber_write( ic, "\n", 1 ); 490 if( !jabber_write( ic, "\n", 1 ) ) 491 return; 489 492 490 493 /* This runs the garbage collection every minute, which means every packet -
protocols/jabber/message.c
r7cd2e8a r8b8def58 55 55 struct xt_node *inv, *reason; 56 56 57 if( strcmp( ns, XMLNS_MUC_USER ) == 0 &&57 if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 && 58 58 ( inv = xt_find_node( c->children, "invite" ) ) ) 59 59 { -
protocols/twitter/twitter.c
r7cd2e8a r8b8def58 40 40 return 0; 41 41 42 // If the user uses multiple private message windows we need to get the43 // users buddies.44 if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "many") == 0)45 twitter_get_statuses_friends(ic, -1);46 47 42 // Do stuff.. 48 43 twitter_get_home_timeline(ic, -1); … … 56 51 struct twitter_data *td = ic->proto_data; 57 52 58 imcb_log( ic, " Connecting to Twitter" );53 imcb_log( ic, "Getting initial statuses" ); 59 54 60 55 // Run this once. After this queue the main loop function. … … 66 61 } 67 62 63 static void twitter_oauth_start( struct im_connection *ic ); 64 65 void twitter_login_finish( struct im_connection *ic ) 66 { 67 struct twitter_data *td = ic->proto_data; 68 69 if( set_getbool( &ic->acc->set, "oauth" ) && !td->oauth_info ) 70 twitter_oauth_start( ic ); 71 else if( g_strcasecmp( set_getstr( &ic->acc->set, "mode" ), "one" ) != 0 && 72 !( td->flags & TWITTER_HAVE_FRIENDS ) ) 73 { 74 imcb_log( ic, "Getting contact list" ); 75 twitter_get_statuses_friends( ic, -1 ); 76 } 77 else 78 twitter_main_loop_start( ic ); 79 } 68 80 69 81 static const struct oauth_service twitter_oauth = … … 128 140 ic->acc->pass = oauth_to_string( info ); 129 141 130 twitter_ main_loop_start( ic );142 twitter_login_finish( ic ); 131 143 } 132 144 … … 211 223 imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL ); 212 224 213 if( td->oauth_info || !set_getbool( &acc->set, "oauth" ) ) 214 twitter_main_loop_start( ic ); 215 else 216 twitter_oauth_start( ic ); 225 imcb_log( ic, "Connecting" ); 226 227 twitter_login_finish( ic ); 217 228 } 218 229 -
protocols/twitter/twitter.h
r7cd2e8a r8b8def58 33 33 #endif 34 34 35 typedef enum 36 { 37 TWITTER_HAVE_FRIENDS = 1, 38 } twitter_flags_t; 39 35 40 struct twitter_data 36 41 { … … 42 47 struct groupchat *home_timeline_gc; 43 48 gint http_fails; 49 twitter_flags_t flags; 44 50 45 51 gboolean url_ssl; … … 56 62 GSList *twitter_connections; 57 63 64 void twitter_login_finish( struct im_connection *ic ); 65 58 66 #endif //_TWITTER_H -
protocols/twitter/twitter_lib.c
r7cd2e8a r8b8def58 59 59 }; 60 60 61 static void twitter_groupchat_init(struct im_connection *ic); 62 61 63 /** 62 64 * Frees a twitter_xml_user struct. … … 433 435 } 434 436 437 static void twitter_groupchat_init(struct im_connection *ic) 438 { 439 char *name_hint; 440 struct groupchat *gc; 441 struct twitter_data *td = ic->proto_data; 442 443 td->home_timeline_gc = gc = imcb_chat_new( ic, "home/timeline" ); 444 445 name_hint = g_strdup_printf( "Twitter_%s", ic->acc->user ); 446 imcb_chat_name_hint( gc, name_hint ); 447 g_free( name_hint ); 448 } 449 435 450 /** 436 451 * Function that is called to see the statuses in a groupchat window. … … 445 460 // Create a new groupchat if it does not exsist. 446 461 if (!td->home_timeline_gc) 447 { 448 char *name_hint = g_strdup_printf( "Twitter_%s", ic->acc->user ); 449 td->home_timeline_gc = gc = imcb_chat_new( ic, "home/timeline" ); 450 imcb_chat_name_hint( gc, name_hint ); 451 g_free( name_hint ); 452 // Add the current user to the chat... 462 twitter_groupchat_init(ic); 463 464 gc = td->home_timeline_gc; 465 if (!gc->joined) 453 466 imcb_chat_add_buddy( gc, ic->acc->user ); 454 }455 else456 {457 gc = td->home_timeline_gc;458 }459 467 460 468 for ( l = list; l ; l = g_slist_next(l) ) … … 604 612 605 613 // Check if the HTTP request went well. 606 if (req->status_code != 200) { 614 if (req->status_code == 401) 615 { 616 imcb_error( ic, "Authentication failure" ); 617 imc_logout( ic, FALSE ); 618 return; 619 } else if (req->status_code != 200) { 607 620 // It didn't go well, output the error and return. 608 if (++td->http_fails >= 5) 609 imcb_error(ic, "Could not retrieve " TWITTER_SHOW_FRIENDS_URL ": %s", twitter_parse_error(req)); 610 621 imcb_error(ic, "Could not retrieve " TWITTER_SHOW_FRIENDS_URL ": %s", twitter_parse_error(req)); 622 imc_logout( ic, TRUE ); 611 623 return; 612 624 } else { 613 625 td->http_fails = 0; 614 626 } 627 628 if( !td->home_timeline_gc && 629 g_strcasecmp( set_getstr( &ic->acc->set, "mode" ), "chat" ) == 0 ) 630 twitter_groupchat_init( ic ); 615 631 616 632 txl = g_new0(struct twitter_xml_list, 1); … … 639 655 txl_free(txl); 640 656 g_free(txl); 657 658 td->flags |= TWITTER_HAVE_FRIENDS; 659 twitter_login_finish(ic); 641 660 } 642 661
Note: See TracChangeset
for help on using the changeset viewer.