Changes in / [638feab:842cd8d]
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
r638feab r842cd8d 54 54 55 55 s = set_add( &a->set, "auto_reconnect", "true", set_eval_bool, a ); 56 57 s = set_add( &a->set, "nick_source", "handle", NULL, a );58 56 59 57 s = set_add( &a->set, "password", NULL, set_eval_account, a ); -
bitlbee.c
r638feab r842cd8d 109 109 chdir( "/" ); 110 110 111 if( getenv( "_BITLBEE_RESTART_STATE" ) == NULL ) 112 for( i = 0; i < 3; i ++ ) 113 if( close( i ) == 0 ) 114 { 115 /* Keep something bogus on those fd's just in case. */ 116 open( "/dev/null", O_WRONLY ); 117 } 111 /* Sometimes std* are already closed (for example when we're in a RESTARTed 112 BitlBee process. So let's only close TTY-fds. */ 113 if( isatty( 0 ) ) close( 0 ); 114 if( isatty( 1 ) ) close( 1 ); 115 if( isatty( 2 ) ) close( 2 ); 118 116 } 119 117 #endif -
bitlbee.conf
r638feab r842cd8d 120 120 ## Proxy = socks5://socksproxy.localnet.com 121 121 122 ## Protocols offered by bitlbee123 ##124 ## As recompiling may be quite unpractical for some people, this option125 ## allows to remove the support of protocol, even if compiled in. If126 ## nothing is given, there are no restrictions.127 ##128 ## Protocols = jabber yahoo129 130 122 131 123 [defaults] -
bitlbee.h
r638feab r842cd8d 27 27 #define _BITLBEE_H 28 28 29 #ifndef _GNU_SOURCE30 29 #define _GNU_SOURCE /* Stupid GNU :-P */ 31 #endif32 30 33 31 /* Depend on Windows 2000 for now since we need getaddrinfo() */ … … 35 33 36 34 #define PACKAGE "BitlBee" 37 #define BITLBEE_VERSION "1.2. 5"35 #define BITLBEE_VERSION "1.2.4" 38 36 #define VERSION BITLBEE_VERSION 39 37 -
conf.c
r638feab r842cd8d 63 63 conf->ping_timeout = 300; 64 64 conf->user = NULL; 65 conf->protocols = NULL;66 65 proxytype = 0; 67 66 … … 308 307 conf->user = g_strdup( ini->value ); 309 308 } 310 else if( g_strcasecmp( ini->key, "protocols" ) == 0 )311 {312 g_strfreev( conf->protocols );313 conf->protocols = g_strsplit_set( ini->value, " \t,;", -1 );314 }315 309 else 316 310 { -
conf.h
r638feab r842cd8d 50 50 int ping_timeout; 51 51 char *user; 52 char **protocols;53 52 } conf_t; 54 53 -
configure
r638feab r842cd8d 444 444 fi 445 445 446 if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then447 echo448 echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'449 echo 'Install xmlto if you want online help to work.'450 fi451 452 446 echo 453 447 if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then … … 535 529 ;; 536 530 Darwin ) 537 echo 'STRIP=\# skip strip' >> Makefile.settings538 531 ;; 539 532 IRIX ) -
doc/CHANGES
r638feab r842cd8d 3 3 4 4 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on 5 6 Version 1.2.5:7 - Many bug fixes, including a fix for MSN login issues, Jabber login timing8 issues, Yahoo! crashes at login time with huge contact lists,9 - Avoid linking in a static version of libresolv now that glibc has all10 relevant functions available in the dynamic version.11 - Improved away state code and added the ability to set (non-away) status12 messages using "set status" (also possible per account) and see them in13 blist and /whois output.14 - Added a post-1.2 equivalent of encode/decode to quickly encrypt/decrypt15 passwords in a way that BitlBee can read them.16 - Allow using the full name for generating nicknames, instead of just the17 handle. This is especially useful when using the Facebook XMPP server.18 - Auto reconnect is now enabled by default since all protocols can properly19 detect cases where auto reconnect should be avoided (i.e. concurrent20 logins).21 - Changed the default resource_select setting which should reduce message22 routing issues on Jabber (i.e. messages going someone's phone instead of23 the main client).24 25 Fixed 17 Mar 201026 5 27 6 Version 1.2.4: -
doc/user-guide/commands.xml
r638feab r842cd8d 608 608 </bitlbee-setting> 609 609 610 <bitlbee-setting name="nick_source" type="string" scope="account">611 <default>handle</default>612 <possible-values>handle, full_name, first_name</possible-values>613 614 <description>615 <para>616 By default, BitlBee generates a nickname for every contact by taking its handle and chopping off everything after the @. In some cases, this gives very inconvenient nicknames. The Facebook XMPP server is a good example, as all Facebook XMPP handles are numeric.617 </para>618 619 <para>620 With this setting set to <emphasis>full_name</emphasis>, the person's full name is used to generate a nickname. Or if you don't like long nicknames, set this setting to <emphasis>first_name</emphasis> instead and only the first word will be used. Note that the full name can be full of non-ASCII characters which will be stripped off.621 </para>622 </description>623 </bitlbee-setting>624 625 610 <bitlbee-setting name="ops" type="string" scope="global"> 626 611 <default>both</default> … … 716 701 717 702 <bitlbee-setting name="resource_select" type="string" scope="account"> 718 <default> activity</default>703 <default>priority</default> 719 704 <possible-values>priority, activity</possible-values> 720 705 -
irc.c
r638feab r842cd8d 166 166 s = set_add( &irc->set, "away_devoice", "true", set_eval_away_devoice, irc ); 167 167 s = set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); 168 s = set_add( &irc->set, "auto_reconnect", " true", set_eval_bool, irc );168 s = set_add( &irc->set, "auto_reconnect", "false", set_eval_bool, irc ); 169 169 s = set_add( &irc->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, irc ); 170 170 s = set_add( &irc->set, "buddy_sendbuffer", "false", set_eval_bool, irc ); -
irc_commands.c
r638feab r842cd8d 497 497 else if( u->away ) 498 498 irc_reply( irc, 301, "%s :%s", u->nick, u->away ); 499 if( u->status_msg )500 irc_reply( irc, 333, "%s :Status: %s", u->nick, u->status_msg );501 499 502 500 irc_reply( irc, 318, "%s :End of /WHOIS list", nick ); -
lib/misc.c
r638feab r842cd8d 34 34 #include "nogaim.h" 35 35 #include "base64.h" 36 #include "md5.h"37 36 #include <stdio.h> 38 37 #include <stdlib.h> … … 524 523 525 524 /* Word wrapping. Yes, I know this isn't UTF-8 clean. I'm willing to take the risk. */ 526 char *word_wrap( c onst char *msg, int line_len )525 char *word_wrap( char *msg, int line_len ) 527 526 { 528 527 GString *ret = g_string_sized_new( strlen( msg ) + 16 ); -
lib/misc.h
r638feab r842cd8d 62 62 G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain ); 63 63 64 G_MODULE_EXPORT char *word_wrap( c onst char *msg, int line_len );64 G_MODULE_EXPORT char *word_wrap( char *msg, int line_len ); 65 65 66 66 G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl ); -
protocols/jabber/io.c
r638feab r842cd8d 375 375 376 376 if( ( c = xt_find_node( node->children, "bind" ) ) ) 377 jd->flags |= JFLAG_WANT_BIND; 377 { 378 reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) ); 379 xt_add_attr( reply, "xmlns", XMLNS_BIND ); 380 reply = jabber_make_packet( "iq", "set", NULL, reply ); 381 jabber_cache_add( ic, reply, jabber_pkt_bind_sess ); 382 383 if( !jabber_write_packet( ic, reply ) ) 384 return XT_ABORT; 385 386 jd->flags |= JFLAG_WAIT_BIND; 387 } 378 388 379 389 if( ( c = xt_find_node( node->children, "session" ) ) ) 380 jd->flags |= JFLAG_WANT_SESSION; 381 382 if( jd->flags & JFLAG_AUTHENTICATED ) 383 return jabber_pkt_bind_sess( ic, NULL, NULL ); 390 { 391 reply = xt_new_node( "session", NULL, NULL ); 392 xt_add_attr( reply, "xmlns", XMLNS_SESSION ); 393 reply = jabber_make_packet( "iq", "set", NULL, reply ); 394 jabber_cache_add( ic, reply, jabber_pkt_bind_sess ); 395 396 if( !jabber_write_packet( ic, reply ) ) 397 return XT_ABORT; 398 399 jd->flags |= JFLAG_WAIT_SESSION; 400 } 401 402 /* This flag is already set if we authenticated via SASL, so now 403 we can resume the session in the new stream, if we don't have 404 to bind/initialize the session. */ 405 if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 ) 406 { 407 if( !jabber_get_roster( ic ) ) 408 return XT_ABORT; 409 } 384 410 385 411 return XT_HANDLED; … … 415 441 imcb_log( ic, "Converting stream to TLS" ); 416 442 417 jd->flags |= JFLAG_STARTTLS_DONE;418 443 jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic ); 419 444 … … 506 531 jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic ); 507 532 508 greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" " 509 "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", 510 ( jd->flags & JFLAG_STARTTLS_DONE ) ? "" : "<?xml version='1.0' ?>", 511 jd->server ); 533 greet = g_strdup_printf( "<?xml version='1.0' ?>" 534 "<stream:stream to=\"%s\" xmlns=\"jabber:client\" " 535 "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server ); 512 536 513 537 st = jabber_write( ic, greet, strlen( greet ) ); -
protocols/jabber/iq.c
r638feab r842cd8d 298 298 { 299 299 struct jabber_data *jd = ic->proto_data; 300 struct xt_node *c , *reply = NULL;300 struct xt_node *c; 301 301 char *s; 302 302 303 if( node &&( c = xt_find_node( node->children, "bind" ) ) )303 if( ( c = xt_find_node( node->children, "bind" ) ) ) 304 304 { 305 305 c = xt_find_node( c->children, "jid" ); … … 307 307 strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) 308 308 imcb_log( ic, "Server changed session resource string to `%s'", s + 1 ); 309 } 310 311 if( jd->flags & JFLAG_WANT_BIND ) 312 { 313 reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) ); 314 xt_add_attr( reply, "xmlns", XMLNS_BIND ); 315 jd->flags &= ~JFLAG_WANT_BIND; 316 } 317 else if( jd->flags & JFLAG_WANT_SESSION ) 318 { 319 reply = xt_new_node( "session", NULL, NULL ); 320 xt_add_attr( reply, "xmlns", XMLNS_SESSION ); 321 jd->flags &= ~JFLAG_WANT_SESSION; 322 } 323 324 if( reply != NULL ) 325 { 326 reply = jabber_make_packet( "iq", "set", NULL, reply ); 327 jabber_cache_add( ic, reply, jabber_pkt_bind_sess ); 328 329 if( !jabber_write_packet( ic, reply ) ) 330 return XT_ABORT; 331 } 332 else if( ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 ) 309 310 jd->flags &= ~JFLAG_WAIT_BIND; 311 } 312 else 313 { 314 jd->flags &= ~JFLAG_WAIT_SESSION; 315 } 316 317 if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 ) 333 318 { 334 319 if( !jabber_get_roster( ic ) ) -
protocols/jabber/jabber.h
r638feab r842cd8d 40 40 JFLAG_STREAM_RESTART = 4, /* Set when we want to restart the stream (after 41 41 SASL or TLS). */ 42 JFLAG_WA NT_SESSION = 8, /* Set if the server wants a <session/> tag42 JFLAG_WAIT_SESSION = 8, /* Set if we sent a <session> tag and need a reply 43 43 before we continue. */ 44 JFLAG_WA NT_BIND = 16, /* ... for <bind> tag. */44 JFLAG_WAIT_BIND = 16, /* ... for <bind> tag. */ 45 45 JFLAG_WANT_TYPING = 32, /* Set if we ever sent a typing notification, this 46 46 activates all XEP-85 related code. */ 47 47 JFLAG_XMLCONSOLE = 64, /* If the user added an xmlconsole buddy. */ 48 JFLAG_STARTTLS_DONE = 128, /* If a plaintext session was converted to TLS. */49 48 } jabber_flags_t; 50 49 -
protocols/msn/msn.c
r638feab r842cd8d 26 26 #include "nogaim.h" 27 27 #include "msn.h" 28 29 int msn_chat_id;30 GSList *msn_connections;31 GSList *msn_switchboards;32 28 33 29 static char *msn_set_display_name( set_t *set, char *value ); -
protocols/msn/msn.h
r638feab r842cd8d 135 135 #define STATUS_SB_CHAT_SPARE 8 /* Same, but also for groupchats (not used yet). */ 136 136 137 externint msn_chat_id;137 int msn_chat_id; 138 138 extern const struct msn_away_state msn_away_state_list[]; 139 139 extern const struct msn_status_code msn_status_code_list[]; … … 144 144 connection), the callback should check whether it's still listed here 145 145 before doing *anything* else. */ 146 externGSList *msn_connections;147 externGSList *msn_switchboards;146 GSList *msn_connections; 147 GSList *msn_switchboards; 148 148 149 149 /* ns.c */ -
protocols/msn/ns.c
r638feab r842cd8d 229 229 } 230 230 } 231 else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 )231 else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 ) 232 232 { 233 233 set_t *s; 234 234 235 if( num_parts == 7 ) 236 { 237 http_decode( cmd[4] ); 238 239 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) ); 240 ic->displayname[sizeof(ic->displayname)-1] = 0; 241 242 if( ( s = set_find( &ic->acc->set, "display_name" ) ) ) 243 { 244 g_free( s->value ); 245 s->value = g_strdup( cmd[4] ); 246 } 247 } 248 else 249 { 250 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 235 http_decode( cmd[4] ); 236 237 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) ); 238 ic->displayname[sizeof(ic->displayname)-1] = 0; 239 240 if( ( s = set_find( &ic->acc->set, "display_name" ) ) ) 241 { 242 g_free( s->value ); 243 s->value = g_strdup( cmd[4] ); 251 244 } 252 245 -
protocols/nogaim.c
r638feab r842cd8d 98 98 void register_protocol (struct prpl *p) 99 99 { 100 int i; 101 gboolean refused = global.conf->protocols != NULL; 102 103 for (i = 0; global.conf->protocols && global.conf->protocols[i]; i++) 104 { 105 if (g_strcasecmp(p->name, global.conf->protocols[i]) == 0) 106 refused = FALSE; 107 } 108 109 if (refused) 110 log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name); 111 else 112 protocols = g_list_append(protocols, p); 100 protocols = g_list_append(protocols, p); 113 101 } 114 102 … … 383 371 /* list.c */ 384 372 385 void imcb_add_buddy( struct im_connection *ic, c onst char *handle, constchar *group )373 void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ) 386 374 { 387 375 user_t *u; … … 457 445 } 458 446 459 void imcb_rename_buddy( struct im_connection *ic, c onst char *handle, constchar *realname )447 void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ) 460 448 { 461 449 user_t *u = user_findhandle( ic, handle ); 462 char *set;463 450 464 451 if( !u || !realname ) return; … … 473 460 imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); 474 461 } 475 476 set = set_getstr( &ic->acc->set, "nick_source" ); 477 if( strcmp( set, "handle" ) != 0 ) 478 { 479 char *name = g_strdup( realname ); 480 481 if( strcmp( set, "first_name" ) == 0 ) 482 { 483 int i; 484 for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {} 485 name[i] = '\0'; 486 } 487 488 imcb_buddy_nick_hint( ic, handle, name ); 489 490 g_free( name ); 491 } 492 } 493 494 void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) 462 } 463 464 void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ) 495 465 { 496 466 user_t *u; … … 502 472 /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM 503 473 modules to suggest a nickname for a handle. */ 504 void imcb_buddy_nick_hint( struct im_connection *ic, c onst char *handle, constchar *nick )474 void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick ) 505 475 { 506 476 user_t *u = user_findhandle( ic, handle ); … … 647 617 oo = u->online; 648 618 649 g_free( u->away ); 650 g_free( u->status_msg ); 651 u->away = u->status_msg = NULL; 619 if( u->away ) 620 { 621 g_free( u->away ); 622 u->away = NULL; 623 } 652 624 653 625 if( ( flags & OPT_LOGGED_IN ) && !u->online ) … … 687 659 } 688 660 } 689 else 690 { 691 u->status_msg = g_strdup( message ); 692 } 661 /* else waste_any_state_information_for_now(); */ 693 662 694 663 /* LISPy... */ … … 715 684 } 716 685 717 void imcb_buddy_msg( struct im_connection *ic, c onst char *handle, char *msg, uint32_t flags, time_t sent_at )686 void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at ) 718 687 { 719 688 irc_t *irc = ic->irc; … … 848 817 } 849 818 850 void imcb_chat_msg( struct groupchat *c, c onst char *who, char *msg, uint32_t flags, time_t sent_at )819 void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at ) 851 820 { 852 821 struct im_connection *ic = c->ic; … … 920 889 /* buddy_chat.c */ 921 890 922 void imcb_chat_add_buddy( struct groupchat *b, c onst char *handle )891 void imcb_chat_add_buddy( struct groupchat *b, char *handle ) 923 892 { 924 893 user_t *u = user_findhandle( b->ic, handle ); … … 955 924 956 925 /* This function is one BIG hack... :-( EREWRITE */ 957 void imcb_chat_remove_buddy( struct groupchat *b, c onst char *handle, constchar *reason )926 void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason ) 958 927 { 959 928 user_t *u; -
protocols/nogaim.h
r638feab r842cd8d 275 275 * user, usually after a login, or if the user added a buddy and the IM 276 276 * server confirms that the add was successful. Don't forget to do this! */ 277 G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, c onst char *handle, constchar *group );278 G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, c onst char *handle, char *group );277 G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ); 278 G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ); 279 279 G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ); 280 G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, c onst char *handle, constchar *realname );281 G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, c onst char *handle, constchar *nick );280 G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ); 281 G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick ); 282 282 283 283 /* Buddy activity */ … … 289 289 /* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle ); 290 290 /* Call when a handle says something. 'flags' and 'sent_at may be just 0. */ 291 G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, c onst char *handle, char *msg, uint32_t flags, time_t sent_at );291 G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at ); 292 292 G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ); 293 293 G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle ); … … 302 302 * user, too. */ 303 303 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ); 304 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, c onst char *handle );304 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle ); 305 305 /* To remove a handle from a group chat. Reason can be NULL. */ 306 G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, c onst char *handle, constchar *reason );306 G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason ); 307 307 /* To tell BitlBee 'who' said 'msg' in 'c'. 'flags' and 'sent_at' can be 0. */ 308 G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, c onst char *who, char *msg, uint32_t flags, time_t sent_at );308 G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at ); 309 309 /* System messages specific to a groupchat, so they can be displayed in the right context. */ 310 310 G_MODULE_EXPORT void imcb_chat_log( struct groupchat *c, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); -
protocols/yahoo/libyahoo2.c
r638feab r842cd8d 855 855 } 856 856 857 static YList * bud_str2list(char *rawlist) 858 { 859 YList * l = NULL; 860 861 char **lines; 862 char **split; 863 char **buddies; 864 char **tmp, **bud; 865 866 lines = y_strsplit(rawlist, "\n", -1); 867 for (tmp = lines; *tmp; tmp++) { 868 struct yahoo_buddy *newbud; 869 870 split = y_strsplit(*tmp, ":", 2); 871 if (!split) 872 continue; 873 if (!split[0] || !split[1]) { 874 y_strfreev(split); 875 continue; 876 } 877 buddies = y_strsplit(split[1], ",", -1); 878 879 for (bud = buddies; bud && *bud; bud++) { 880 newbud = y_new0(struct yahoo_buddy, 1); 881 newbud->id = strdup(*bud); 882 newbud->group = strdup(split[0]); 883 884 if(y_list_find_custom(l, newbud, is_same_bud)) { 885 FREE(newbud->id); 886 FREE(newbud->group); 887 FREE(newbud); 888 continue; 889 } 890 891 newbud->real_name = NULL; 892 893 l = y_list_append(l, newbud); 894 895 NOTICE(("Added buddy %s to group %s", newbud->id, newbud->group)); 896 } 897 898 y_strfreev(buddies); 899 y_strfreev(split); 900 } 901 y_strfreev(lines); 902 903 return l; 904 } 905 857 906 static char * getcookie(char *rawcookie) 858 907 { … … 1311 1360 } 1312 1361 1313 static void yahoo_process_status(struct yahoo_input_data *yid, 1314 1362 1363 static void yahoo_process_status(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1315 1364 { 1316 1365 YList *l; 1317 1366 struct yahoo_data *yd = yid->yd; 1318 1367 1319 struct yahoo_process_status_entry *u; 1368 struct user 1369 { 1370 char *name; /* 7 name */ 1371 int state; /* 10 state */ 1372 int flags; /* 13 flags, bit 0 = pager, bit 1 = chat, bit 2 = game */ 1373 int mobile; /* 60 mobile */ 1374 char *msg; /* 19 custom status message */ 1375 int away; /* 47 away (or invisible)*/ 1376 int buddy_session; /* 11 state */ 1377 int f17; /* 17 in chat? then what about flags? */ 1378 int idle; /* 137 seconds idle */ 1379 int f138; /* 138 state */ 1380 char *f184; /* 184 state */ 1381 int f192; /* 192 state */ 1382 int f10001; /* 10001 state */ 1383 int f10002; /* 10002 state */ 1384 int f198; /* 198 state */ 1385 char *f197; /* 197 state */ 1386 char *f205; /* 205 state */ 1387 int f213; /* 213 state */ 1388 } *u; 1320 1389 1321 1390 YList *users = 0; 1322 1391 1323 1392 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { 1324 YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 1325 YAHOO_LOGIN_DUPL, NULL); 1326 return; 1327 } 1328 1329 /* Status updates may be spread accross multiple packets and not 1330 even on buddy boundaries, so keeping some state is important. 1331 So, continue where we left off, and only add a user entry to 1332 the list once it's complete (301-315 End buddy). */ 1333 u = yd->half_user; 1393 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_DUPL, NULL); 1394 return; 1395 } 1334 1396 1335 1397 for (l = pkt->hash; l; l = l->next) { … … 1337 1399 1338 1400 switch (pair->key) { 1339 case 300: /* Begin buddy */ 1340 if (!strcmp(pair->value, "315") && !u) { 1341 u = yd->half_user = y_new0(struct yahoo_process_status_entry, 1); 1401 case 0: /* we won't actually do anything with this */ 1402 NOTICE(("key %d:%s", pair->key, pair->value)); 1403 break; 1404 case 1: /* we don't get the full buddy list here. */ 1405 if (!yd->logged_in) { 1406 yd->logged_in = TRUE; 1407 if(yd->current_status < 0) 1408 yd->current_status = yd->initial_status; 1409 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL); 1342 1410 } 1343 1411 break; 1344 case 301: /* End buddy */ 1345 if (!strcmp(pair->value, "315") && u) { 1346 /* Sometimes user info comes in an odd format with no 1347 "begin buddy" but *with* an "end buddy". Don't add 1348 it twice. */ 1349 if (!y_list_find(users, u)) 1350 users = y_list_prepend(users, u); 1351 u = yd->half_user = NULL; 1352 } 1353 break; 1354 case 0: /* we won't actually do anything with this */ 1412 case 8: /* how many online buddies we have */ 1355 1413 NOTICE(("key %d:%s", pair->key, pair->value)); 1356 1414 break; 1357 case 1: /* we don't get the full buddy list here. */ 1358 if (!yd->logged_in) { 1359 yd->logged_in = 1; 1360 if (yd->current_status < 0) 1361 yd->current_status = yd->initial_status; 1362 YAHOO_CALLBACK(ext_yahoo_login_response) (yd-> 1363 client_id, YAHOO_LOGIN_OK, NULL); 1364 } 1365 break; 1366 case 8: /* how many online buddies we have */ 1367 NOTICE(("key %d:%s", pair->key, pair->value)); 1368 break; 1369 case 7: /* the current buddy */ 1370 if (!u) { 1371 /* This will only happen in case of a single level message */ 1372 u = y_new0(struct yahoo_process_status_entry, 1); 1373 users = y_list_prepend(users, u); 1374 } 1415 case 7: /* the current buddy */ 1416 u = y_new0(struct user, 1); 1375 1417 u->name = pair->value; 1376 break; 1377 case 10: /* state */ 1378 u->state = strtol(pair->value, NULL, 10); 1379 break; 1380 case 19: /* custom status message */ 1381 u->msg = pair->value; 1382 break; 1383 case 47: /* is it an away message or not. Not applicable for YMSG16 anymore */ 1384 u->away = atoi(pair->value); 1385 break; 1386 case 137: /* seconds idle */ 1387 u->idle = atoi(pair->value); 1388 break; 1389 case 11: /* this is the buddy's session id */ 1390 u->buddy_session = atoi(pair->value); 1391 break; 1392 case 17: /* in chat? */ 1393 u->f17 = atoi(pair->value); 1394 break; 1395 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ 1396 u->flags = atoi(pair->value); 1397 break; 1398 case 60: /* SMS -> 1 MOBILE USER */ 1418 users = y_list_prepend(users, u); 1419 break; 1420 case 10: /* state */ 1421 ((struct user*)users->data)->state = strtol(pair->value, NULL, 10); 1422 break; 1423 case 19: /* custom status message */ 1424 ((struct user*)users->data)->msg = pair->value; 1425 break; 1426 case 47: /* is it an away message or not */ 1427 ((struct user*)users->data)->away = atoi(pair->value); 1428 break; 1429 case 137: /* seconds idle */ 1430 ((struct user*)users->data)->idle = atoi(pair->value); 1431 break; 1432 case 11: /* this is the buddy's session id */ 1433 ((struct user*)users->data)->buddy_session = atoi(pair->value); 1434 break; 1435 case 17: /* in chat? */ 1436 ((struct user*)users->data)->f17 = atoi(pair->value); 1437 break; 1438 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ 1439 ((struct user*)users->data)->flags = atoi(pair->value); 1440 break; 1441 case 60: /* SMS -> 1 MOBILE USER */ 1399 1442 /* sometimes going offline makes this 2, but invisible never sends it */ 1400 u->mobile = atoi(pair->value);1443 ((struct user*)users->data)->mobile = atoi(pair->value); 1401 1444 break; 1402 1445 case 138: 1403 u->f138 = atoi(pair->value);1446 ((struct user*)users->data)->f138 = atoi(pair->value); 1404 1447 break; 1405 1448 case 184: 1406 u->f184 = pair->value;1449 ((struct user*)users->data)->f184 = pair->value; 1407 1450 break; 1408 1451 case 192: 1409 u->f192 = atoi(pair->value);1452 ((struct user*)users->data)->f192 = atoi(pair->value); 1410 1453 break; 1411 1454 case 10001: 1412 u->f10001 = atoi(pair->value);1455 ((struct user*)users->data)->f10001 = atoi(pair->value); 1413 1456 break; 1414 1457 case 10002: 1415 u->f10002 = atoi(pair->value);1458 ((struct user*)users->data)->f10002 = atoi(pair->value); 1416 1459 break; 1417 1460 case 198: 1418 u->f198 = atoi(pair->value);1461 ((struct user*)users->data)->f198 = atoi(pair->value); 1419 1462 break; 1420 1463 case 197: 1421 u->f197 = pair->value;1464 ((struct user*)users->data)->f197 = pair->value; 1422 1465 break; 1423 1466 case 205: 1424 u->f205 = pair->value;1467 ((struct user*)users->data)->f205 = pair->value; 1425 1468 break; 1426 1469 case 213: 1427 u->f213 = atoi(pair->value); 1428 break; 1429 case 16: /* Custom error message */ 1430 YAHOO_CALLBACK(ext_yahoo_error) (yd->client_id, 1431 pair->value, 0, E_CUSTOM); 1470 ((struct user*)users->data)->f213 = atoi(pair->value); 1471 break; 1472 case 16: /* Custom error message */ 1473 YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, pair->value, 0, E_CUSTOM); 1432 1474 break; 1433 1475 default: 1434 WARNING(("unknown status key %d:%s", pair->key, 1435 pair->value)); 1436 break; 1437 } 1438 } 1439 1476 WARNING(("unknown status key %d:%s", pair->key, pair->value)); 1477 break; 1478 } 1479 } 1480 1440 1481 while (users) { 1441 1482 YList *t = users; 1442 struct yahoo_process_status_entry*u = users->data;1483 struct user *u = users->data; 1443 1484 1444 1485 if (u->name != NULL) { 1445 if (pkt->service == 1446 YAHOO_SERVICE_LOGOFF 1447 /*|| u->flags == 0 No flags for YMSG16 */ ) { 1448 YAHOO_CALLBACK(ext_yahoo_status_changed) (yd-> 1449 client_id, u->name, 1450 YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1486 if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */ 1487 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1451 1488 } else { 1452 1489 /* Key 47 always seems to be 1 for YMSG16 */ 1453 if 1490 if(!u->state) 1454 1491 u->away = 0; 1455 1492 else 1456 1493 u->away = 1; 1457 1494 1458 YAHOO_CALLBACK(ext_yahoo_status_changed) (yd-> 1459 client_id, u->name, u->state, u->msg, 1460 u->away, u->idle, u->mobile); 1495 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1461 1496 } 1462 1497 } … … 1468 1503 } 1469 1504 1470 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, 1471 struct yahoo_packet *pkt) 1505 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1472 1506 { 1473 1507 struct yahoo_data *yd = yid->yd; … … 1481 1515 struct yahoo_pair *pair = l->data; 1482 1516 1483 switch 1517 switch(pair->key) { 1484 1518 case 300: 1485 1519 case 301: 1486 1520 case 302: 1487 break; /* Separators. Our logic does not need them */1488 1521 case 303: 1489 if ( 318 == atoi(pair->value))1522 if ( 315 == atoi(pair->value) ) 1490 1523 last_packet = 1; 1491 1524 break; 1492 1525 case 65: 1526 g_free(cur_group); 1493 1527 cur_group = strdup(pair->value); 1494 1528 break; … … 1496 1530 newbud = y_new0(struct yahoo_buddy, 1); 1497 1531 newbud->id = strdup(pair->value); 1498 if (cur_group) 1532 if (cur_group) { 1499 1533 newbud->group = strdup(cur_group); 1500 else if (yd->buddies) { 1501 struct yahoo_buddy *lastbud = 1502 (struct yahoo_buddy *)y_list_nth(yd-> 1503 buddies, 1504 y_list_length(yd->buddies) - 1)->data; 1505 newbud->group = strdup(lastbud->group); 1506 } else 1507 newbud->group = strdup("Buddies"); 1534 } else { 1535 YList *last; 1536 struct yahoo_buddy *lastbud; 1537 1538 for (last = yd->buddies; last && last->next; last = last->next); 1539 if (last) { 1540 lastbud = last->data; 1541 newbud->group = strdup(lastbud->group); 1542 } else { 1543 newbud->group = strdup("Buddies"); 1544 } 1545 } 1508 1546 1509 1547 yd->buddies = y_list_append(yd->buddies, newbud); … … 1512 1550 } 1513 1551 } 1552 1553 g_free(cur_group); 1514 1554 1515 1555 /* we could be getting multiple packets here */ 1516 if ( pkt->hash && !last_packet)1517 return; 1518 1519 YAHOO_CALLBACK(ext_yahoo_got_buddies) 1520 1521 /* Logged in */1556 if (last_packet) 1557 return; 1558 1559 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies); 1560 1561 /*** We login at the very end of the packet communication */ 1522 1562 if (!yd->logged_in) { 1523 yd->logged_in = 1;1524 if 1563 yd->logged_in = TRUE; 1564 if(yd->current_status < 0) 1525 1565 yd->current_status = yd->initial_status; 1526 YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id, 1527 YAHOO_LOGIN_OK, NULL); 1528 1529 /* 1530 yahoo_set_away(yd->client_id, yd->initial_status, NULL, 1531 (yd->initial_status == YAHOO_STATUS_AVAILABLE) ? 0 : 1); 1532 1533 yahoo_get_yab(yd->client_id); 1534 */ 1535 } 1536 1537 } 1538 1539 static void yahoo_process_list(struct yahoo_input_data *yid, 1540 struct yahoo_packet *pkt) 1566 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL); 1567 } 1568 } 1569 1570 static void yahoo_process_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1541 1571 { 1542 1572 struct yahoo_data *yd = yid->yd; 1543 1573 YList *l; 1544 1574 1545 /* we could be getting multiple packets here */ 1575 if (!yd->logged_in) { 1576 yd->logged_in = TRUE; 1577 if(yd->current_status < 0) 1578 yd->current_status = yd->initial_status; 1579 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL); 1580 } 1581 1546 1582 for (l = pkt->hash; l; l = l->next) { 1547 1583 struct yahoo_pair *pair = l->data; 1548 1584 1549 switch (pair->key) { 1550 case 89: /* identities */ 1585 switch(pair->key) { 1586 case 87: /* buddies */ 1587 if(!yd->rawbuddylist) 1588 yd->rawbuddylist = strdup(pair->value); 1589 else { 1590 yd->rawbuddylist = y_string_append(yd->rawbuddylist, pair->value); 1591 } 1592 break; 1593 1594 case 88: /* ignore list */ 1595 if(!yd->ignorelist) 1596 yd->ignorelist = strdup("Ignore:"); 1597 yd->ignorelist = y_string_append(yd->ignorelist, pair->value); 1598 break; 1599 1600 case 89: /* identities */ 1551 1601 { 1552 char **identities = 1553 y_strsplit(pair->value, ",", -1); 1554 int i; 1555 for (i = 0; identities[i]; i++) 1556 yd->identities = 1557 y_list_append(yd->identities, 1602 char **identities = y_strsplit(pair->value, ",", -1); 1603 int i; 1604 for(i=0; identities[i]; i++) 1605 yd->identities = y_list_append(yd->identities, 1558 1606 strdup(identities[i])); 1559 1607 y_strfreev(identities); 1560 1608 } 1561 YAHOO_CALLBACK(ext_yahoo_got_identities) (yd->client_id, 1562 yd->identities); 1563 break; 1564 case 59: /* cookies */ 1565 if (pair->value[0] == 'Y') { 1609 YAHOO_CALLBACK(ext_yahoo_got_identities)(yd->client_id, yd->identities); 1610 break; 1611 case 59: /* cookies */ 1612 if(yd->ignorelist) { 1613 yd->ignore = bud_str2list(yd->ignorelist); 1614 FREE(yd->ignorelist); 1615 YAHOO_CALLBACK(ext_yahoo_got_ignore)(yd->client_id, yd->ignore); 1616 } 1617 if(yd->rawbuddylist) { 1618 yd->buddies = bud_str2list(yd->rawbuddylist); 1619 FREE(yd->rawbuddylist); 1620 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies); 1621 } 1622 1623 if(pair->value[0]=='Y') { 1566 1624 FREE(yd->cookie_y); 1567 1625 FREE(yd->login_cookie); … … 1570 1628 yd->login_cookie = getlcookie(yd->cookie_y); 1571 1629 1572 } else if (pair->value[0] =='T') {1630 } else if(pair->value[0]=='T') { 1573 1631 FREE(yd->cookie_t); 1574 1632 yd->cookie_t = getcookie(pair->value); 1575 1633 1576 } else if (pair->value[0] =='C') {1634 } else if(pair->value[0]=='C') { 1577 1635 FREE(yd->cookie_c); 1578 1636 yd->cookie_c = getcookie(pair->value); 1579 } 1580 1581 break;1582 case 3: /* my id */1583 case 90: /* 1 */ 1584 case 100: /* 0 */1585 case 101: /* NULL*/1586 case 102: /* NULL*/1587 case 93: /* 86400/1440 */1588 break;1589 }1590 }1591 1592 if (yd->cookie_y && yd->cookie_t) /* We don't get cookie_c anymore */1593 YAHOO_CALLBACK(ext_yahoo_got_cookies) (yd->client_id);1637 } 1638 1639 if(yd->cookie_y && yd->cookie_t) 1640 YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id); 1641 1642 break; 1643 case 3: /* my id */ 1644 case 90: /* 1 */ 1645 case 100: /* 0 */ 1646 case 101: /* NULL */ 1647 case 102: /* NULL */ 1648 case 93: /* 86400/1440 */ 1649 break; 1650 } 1651 } 1594 1652 } 1595 1653 -
protocols/yahoo/yahoo.c
r638feab r842cd8d 227 227 yd->current_status = YAHOO_STATUS_CUSTOM; 228 228 } 229 else if( msg)229 else if( state ) 230 230 yd->current_status = YAHOO_STATUS_CUSTOM; 231 231 else -
protocols/yahoo/yahoo2_types.h
r638feab r842cd8d 196 196 197 197 void *server_settings; 198 199 struct yahoo_process_status_entry *half_user;200 198 }; 201 199 … … 263 261 }; 264 262 265 struct yahoo_process_status_entry {266 char *name; /* 7 name */267 int state; /* 10 state */268 int flags; /* 13 flags, bit 0 = pager, bit 1 = chat, bit 2 = game */269 int mobile; /* 60 mobile */270 char *msg; /* 19 custom status message */271 int away; /* 47 away (or invisible) */272 int buddy_session; /* 11 state */273 int f17; /* 17 in chat? then what about flags? */274 int idle; /* 137 seconds idle */275 int f138; /* 138 state */276 char *f184; /* 184 state */277 int f192; /* 192 state */278 int f10001; /* 10001 state */279 int f10002; /* 10002 state */280 int f198; /* 198 state */281 char *f197; /* 197 state */282 char *f205; /* 205 state */283 int f213; /* 213 state */284 };285 286 263 #ifdef __cplusplus 287 264 } -
root_commands.c
r638feab r842cd8d 143 143 storage_status_t status = storage_load( irc, cmd[1] ); 144 144 char *account_on[] = { "account", "on", NULL }; 145 146 if( strchr( irc->umode, 'R' ) != NULL )147 {148 irc_usermsg( irc, "You're already logged in." );149 return;150 }151 145 152 146 switch (status) { … … 914 908 online = 1; 915 909 else 916 online = away = 1;910 online = away = 1; 917 911 918 912 if( strchr( irc->umode, 'b' ) != NULL ) … … 927 921 if( online == 1 ) 928 922 { 929 char st[256] = "Online";930 931 if( u->status_msg )932 g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg );933 934 923 g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user ); 935 irc_usermsg( irc, format, u->nick, s, st);924 irc_usermsg( irc, format, u->nick, s, "Online" ); 936 925 } 937 926 -
user.h
r638feab r842cd8d 34 34 35 35 char *away; 36 char *status_msg; /* Non-IRC extension, but nice on IM. */37 36 38 37 char is_private;
Note: See TracChangeset
for help on using the changeset viewer.