Changes in / [efbc154:bb839e8]
- Files:
-
- 7 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
refbc154 rbb839e8 126 126 ctags: 127 127 ctags `find . -name "*.c"` `find . -name "*.h"` 128 129 # Using this as a bogus Make target to test if a GNU-compatible version of130 # make is available.131 helloworld:132 @echo Hello World -
bitlbee.c
refbc154 rbb839e8 36 36 static gboolean bitlbee_io_new_client( gpointer data, gint fd, b_input_condition condition ); 37 37 38 static gboolean try_listen( struct addrinfo *res )39 {40 int i;41 42 global.listen_socket = socket( res->ai_family, res->ai_socktype, res->ai_protocol );43 if( global.listen_socket < 0 )44 {45 log_error( "socket" );46 return FALSE;47 }48 49 #ifdef IPV6_V6ONLY50 if( res->ai_family == AF_INET6 )51 {52 i = 0;53 setsockopt( global.listen_socket, IPPROTO_IPV6, IPV6_V6ONLY,54 (char *) &i, sizeof( i ) );55 }56 #endif57 58 /* TIME_WAIT (?) sucks.. */59 i = 1;60 setsockopt( global.listen_socket, SOL_SOCKET, SO_REUSEADDR, &i, sizeof( i ) );61 62 i = bind( global.listen_socket, res->ai_addr, res->ai_addrlen );63 if( i == -1 )64 {65 closesocket( global.listen_socket );66 global.listen_socket = -1;67 68 log_error( "bind" );69 return FALSE;70 }71 72 return TRUE;73 }74 75 38 int bitlbee_daemon_init() 76 39 { … … 79 42 FILE *fp; 80 43 81 log_link( LOGLVL_ERROR, LOGOUTPUT_ CONSOLE);82 log_link( LOGLVL_WARNING, LOGOUTPUT_ CONSOLE);44 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); 45 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 83 46 84 47 memset( &hints, 0, sizeof( hints ) ); … … 100 63 101 64 global.listen_socket = -1; 102 103 /* Try IPv6 first (which will become an IPv6+IPv4 socket). */ 65 104 66 for( res = addrinfo_bind; res; res = res->ai_next ) 105 if( res->ai_family == AF_INET6 && try_listen( res ) ) 106 break; 107 108 /* The rest (so IPv4, I guess). */ 109 if( res == NULL ) 110 for( res = addrinfo_bind; res; res = res->ai_next ) 111 if( res->ai_family != AF_INET6 && try_listen( res ) ) 112 break; 113 67 { 68 global.listen_socket = socket( res->ai_family, res->ai_socktype, res->ai_protocol ); 69 if( global.listen_socket < 0 ) 70 continue; 71 72 /* TIME_WAIT (?) sucks.. */ 73 i = 1; 74 setsockopt( global.listen_socket, SOL_SOCKET, SO_REUSEADDR, &i, sizeof( i ) ); 75 76 i = bind( global.listen_socket, res->ai_addr, res->ai_addrlen ); 77 if( i == -1 ) 78 { 79 log_error( "bind" ); 80 return( -1 ); 81 } 82 83 break; 84 } 85 114 86 freeaddrinfo( addrinfo_bind ); 115 87 … … 135 107 exit( 0 ); 136 108 137 setsid();138 109 chdir( "/" ); 139 110 … … 166 137 #endif 167 138 168 if( !global.conf->nofork )169 {170 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );171 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );172 }173 174 139 return( 0 ); 175 140 } -
bitlbee.h
refbc154 rbb839e8 35 35 36 36 #define PACKAGE "BitlBee" 37 #define BITLBEE_VERSION "1.2. 6"37 #define BITLBEE_VERSION "1.2.5" 38 38 #define VERSION BITLBEE_VERSION 39 #define BITLBEE_VER(a,b,c) (((a) << 16) + ((b) << 8) + (c))40 #define BITLBEE_VERSION_CODE BITLBEE_VER(1, 2, 6)41 39 42 40 #define MAX_STRING 511 -
conf.c
refbc154 rbb839e8 79 79 } 80 80 81 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u: V" ) ) >= 0 )81 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 ) 82 82 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 83 83 { … … 145 145 " -d Specify alternative user configuration directory\n" 146 146 " -x Command-line interface to password encryption/hashing\n" 147 " -h Show this help page.\n" 148 " -V Show version info.\n" ); 149 return NULL; 150 } 151 else if( opt == 'V' ) 152 { 153 printf( "BitlBee %s\nAPI version %06x\n", 154 BITLBEE_VERSION, BITLBEE_VERSION_CODE ); 147 " -h Show this help page.\n" ); 155 148 return NULL; 156 149 } -
configure
refbc154 rbb839e8 26 26 oscar=1 27 27 yahoo=1 28 twitter=129 28 30 29 debug=0 … … 67 66 --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar 68 67 --yahoo=0/1 Disable/enable Yahoo part $yahoo 69 --twitter=0/1 Disable/enable Twitter part $twitter70 68 71 69 --debug=0/1 Disable/enable debugging $debug … … 269 267 detect_ldap() 270 268 { 271 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)269 TMPFILE=$(mktemp) 272 270 if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then 273 271 cat<<EOF>>Makefile.settings … … 297 295 detect_resolv_dynamic() 298 296 { 299 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)297 TMPFILE=$(mktemp) 300 298 ret=1 301 299 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null … … 311 309 detect_resolv_static() 312 310 { 313 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)311 TMPFILE=$(mktemp) 314 312 ret=1 315 313 for i in $systemlibdirs; do … … 478 476 fi 479 477 480 if ! make helloworld > /dev/null 2>&1; then481 echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."482 echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"483 echo "under the name 'gmake'."484 echo485 if gmake helloworld > /dev/null 2>&1; then486 echo "gmake seems to be available on your machine, great."487 echo488 else489 echo "gmake is not installed (or not working). Please try to install it."490 echo491 fi492 fi493 494 478 cat <<EOF>bitlbee.pc 495 479 prefix=$prefix … … 540 524 fi 541 525 542 if [ "$twitter" = 0 ]; then543 echo '#undef WITH_TWITTER' >> config.h544 else545 echo '#define WITH_TWITTER' >> config.h546 protocols=$protocols'twitter '547 protoobjs=$protoobjs'twitter_mod.o '548 fi549 550 526 if [ "$protocols" = "PROTOCOLS = " ]; then 551 527 echo "Warning: You haven't selected any communication protocol to compile!" -
doc/CHANGES
refbc154 rbb839e8 3 3 4 4 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on 5 6 Version 1.2.6:7 - Native (very basic) support for Twitter, implemented by Geert Mulders.8 Currently supported are posting tweets, reading the ones of people you9 follow, and sending (not yet receiving!) direct messages.10 - Fixed format of status messages in /WHOIS to improve IRC client11 compatibility.12 - Show timestamps of offline messages/channel backlogs.13 - Allow saving MSN display names locally since sometimes this stuff breaks14 server-side. (Use the local_display_name per-account setting.)15 - Suppress empty "Headline:" messages for certain new XMPP broadcast16 messages.17 - Better handling of XMPP contacts with multiple resources on-line. Default18 behaviour now is to write to wherever the last message came from, or to19 the bare JID (usually becomes a broadcast) if there wasn't any recent msg.20 - The usual misc. bug fixes.21 22 Finished ...23 5 24 6 Version 1.2.5: … … 41 23 the main client). 42 24 43 Fi nished 17 Mar 201025 Fixed 17 Mar 2010 44 26 45 27 Version 1.2.4: -
doc/user-guide/commands.xml
refbc154 rbb839e8 21 21 <description> 22 22 <para> 23 Adds an account on the given server with the specified protocol, username and password to the account list. Supported protocols right now are: Jabber, MSN, OSCAR (AIM/ICQ) , Yahoo and Twitter. For more information about adding an account, see <emphasis>help account add <protocol></emphasis>.23 Adds an account on the given server with the specified protocol, username and password to the account list. Supported protocols right now are: Jabber, MSN, OSCAR (AIM/ICQ) and Yahoo. For more information about adding an account, see <emphasis>help account add <protocol></emphasis>. 24 24 </para> 25 25 </description> … … 63 63 </ircexample> 64 64 </bitlbee-command> 65 66 <bitlbee-command name="twitter">67 <syntax>account add twitter <handle> <password></syntax>68 69 <description>70 <para>71 This module gives you simple access to Twitter. Although it uses the Twitter API, only Twitter itself is supported at the moment.72 </para>73 74 <para>75 By default all your Twitter contacts will come from a contact called twitter_(yourusername). You can change this behaviour using the <emphasis>mode</emphasis> setting (see <emphasis>help set mode</emphasis>).76 </para>77 78 <para>79 To send tweets yourself, send them to the twitter_(yourusername) contact, or just write in the groupchat channel if you enabled that option.80 </para>81 </description>82 </bitlbee-command>83 65 84 66 <bitlbee-command name="yahoo"> … … 419 401 420 402 <bitlbee-setting name="auto_reconnect" type="boolean" scope="both"> 421 <default> true</default>403 <default>false</default> 422 404 423 405 <description> … … 574 556 <para> 575 557 With this option enabled, root will inform you when someone in your buddy list changes his/her "friendly name". 576 </para>577 </description>578 </bitlbee-setting>579 580 <bitlbee-setting name="display_timestamps" type="boolean" scope="global">581 <default>true</default>582 583 <description>584 <para>585 When incoming messages are old (i.e. offline messages and channel backlogs), BitlBee will prepend them with a timestamp. If you find them ugly or useless, you can use this setting to hide them.586 558 </para> 587 559 </description> … … 637 609 </bitlbee-setting> 638 610 639 <bitlbee-setting name="local_display_name" type="boolean" scope="account">640 <default>false</default>641 642 <description>643 <para>644 Mostly meant to work around a bug in MSN servers (forgetting the display name set by the user), this setting tells BitlBee to store your display name locally and set this name on the MSN servers when connecting.645 </para>646 </description>647 648 </bitlbee-setting>649 650 611 <bitlbee-setting name="mail_notifications" type="boolean" scope="account"> 651 612 <default>false</default> … … 654 615 <para> 655 616 Some protocols (MSN, Yahoo!) can notify via IM about new e-mail. Since most people use their Hotmail/Yahoo! addresses as a spam-box, this is disabled default. If you want these notifications, you can enable this setting. 656 </para>657 </description>658 659 </bitlbee-setting>660 661 <bitlbee-setting name="mode" type="string" scope="account">662 <possible-values>one, many, chat</possible-values>663 <default>one</default>664 665 <description>666 <para>667 By default, everything from the Twitter module will come from one nick, twitter_(yourusername). If you prefer to have individual nicks for everyone, you can set this setting to "many" instead.668 </para>669 670 <para>671 If you prefer to have all your Twitter things in a separate channel, you can set this setting to "chat".672 </para>673 674 <para>675 In the last two modes, you can send direct messages by /msg'ing your contacts directly. Note, however, that incoming DMs are not fetched yet.676 617 </para> 677 618 </description> … … 883 824 <para> 884 825 If BitlBee fails to detect this sometimes (most likely in AIM messages over an ICQ connection), you can set this setting to <emphasis>always</emphasis>, but this might sometimes accidentally strip non-HTML things too. 885 </para>886 </description>887 </bitlbee-setting>888 889 <bitlbee-setting name="timezone" type="string" scope="global">890 <default>local</default>891 <possible-values>local, utc, gmt, timezone-spec</possible-values>892 893 <description>894 <para>895 If message timestamps are available for offline messages or chatroom backlogs, BitlBee will display them as part of the message. By default it will use the local timezone. If you're not in the same timezone as the BitlBee server, you can adjust the timestamps using this setting.896 </para>897 898 <para>899 Values local/utc/gmt should be self-explanatory. timezone-spec is a time offset in hours:minutes, for example: -8 for Pacific Standard Time, +2 for Central European Summer Time, +5:30 for Indian Standard Time.900 826 </para> 901 827 </description> -
irc.c
refbc154 rbb839e8 52 52 { 53 53 irc_t *irc = set->data; 54 char *test;55 gsize test_bytes = 0;56 54 GIConv ic, oc; 57 55 … … 59 57 value = g_strdup( "utf-8" ); 60 58 59 if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 ) 60 { 61 return NULL; 62 } 61 63 if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 ) 62 64 { 63 return NULL; 64 } 65 66 /* Do a test iconv to see if the user picked an IRC-compatible 67 charset (for example utf-16 goes *horribly* wrong). */ 68 if( ( test = g_convert_with_iconv( " ", 1, oc, NULL, &test_bytes, NULL ) ) == NULL || 69 test_bytes > 1 ) 70 { 71 g_free( test ); 72 g_iconv_close( oc ); 73 irc_usermsg( irc, "Unsupported character set: The IRC protocol " 74 "only supports 8-bit character sets." ); 75 return NULL; 76 } 77 g_free( test ); 78 79 if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 ) 80 { 81 g_iconv_close( oc ); 65 g_iconv_close( ic ); 82 66 return NULL; 83 67 } … … 191 175 s = set_add( &irc->set, "default_target", "root", NULL, irc ); 192 176 s = set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc ); 193 s = set_add( &irc->set, "display_timestamps", "true", set_eval_bool, irc );194 177 s = set_add( &irc->set, "handle_unknown", "root", NULL, irc ); 195 178 s = set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc ); … … 205 188 s->flags |= SET_NULL_OK; 206 189 s = set_add( &irc->set, "strip_html", "true", NULL, irc ); 207 s = set_add( &irc->set, "timezone", "local", set_eval_timezone, irc );208 190 s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); 209 191 s = set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc ); -
irc_commands.c
refbc154 rbb839e8 498 498 irc_reply( irc, 301, "%s :%s", u->nick, u->away ); 499 499 if( u->status_msg ) 500 irc_reply( irc, 3 20, "%s :%s", u->nick, u->status_msg );500 irc_reply( irc, 333, "%s :Status: %s", u->nick, u->status_msg ); 501 501 502 502 irc_reply( irc, 318, "%s :End of /WHOIS list", nick ); -
lib/misc.c
refbc154 rbb839e8 77 77 78 78 return mktime(&tm); 79 }80 81 time_t mktime_utc( struct tm *tp )82 {83 struct tm utc;84 time_t res, tres;85 86 tp->tm_isdst = -1;87 res = mktime( tp );88 /* Problem is, mktime() just gave us the GMT timestamp for the89 given local time... While the given time WAS NOT local. So90 we should fix this now.91 92 Now I could choose between messing with environment variables93 (kludgy) or using timegm() (not portable)... Or doing the94 following, which I actually prefer...95 96 tzset() may also work but in other places I actually want to97 use local time.98 99 FFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUU!! */100 gmtime_r( &res, &utc );101 utc.tm_isdst = -1;102 if( utc.tm_hour == tp->tm_hour && utc.tm_min == tp->tm_min )103 /* Sweet! We're in UTC right now... */104 return res;105 106 tres = mktime( &utc );107 res += res - tres;108 109 /* Yes, this is a hack. And it will go wrong around DST changes.110 BUT this is more likely to be threadsafe than messing with111 environment variables, and possibly more portable... */112 113 return res;114 79 } 115 80 -
lib/misc.h
refbc154 rbb839e8 43 43 44 44 G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec ); 45 G_MODULE_EXPORT time_t mktime_utc( struct tm *tp );46 45 double gettime( void ); 47 46 -
log.c
refbc154 rbb839e8 172 172 fprintf(stdout, "Debug: %s\n", message); 173 173 #endif 174 /* Always log stuff in syslogs too. */175 log_syslog(level, message);176 174 return; 177 175 } -
protocols/jabber/jabber_util.c
refbc154 rbb839e8 667 667 time_t jabber_get_timestamp( struct xt_node *xt ) 668 668 { 669 struct tm tp, utc; 669 670 struct xt_node *c; 671 time_t res, tres; 670 672 char *s = NULL; 671 struct tm tp;672 673 673 674 for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) … … 687 688 tp.tm_year -= 1900; 688 689 tp.tm_mon --; 689 690 return mktime_utc( &tp ); 690 tp.tm_isdst = -1; /* GRRRRRRRRRRR */ 691 692 res = mktime( &tp ); 693 /* Problem is, mktime() just gave us the GMT timestamp for the 694 given local time... While the given time WAS NOT local. So 695 we should fix this now. 696 697 Now I could choose between messing with environment variables 698 (kludgy) or using timegm() (not portable)... Or doing the 699 following, which I actually prefer... */ 700 gmtime_r( &res, &utc ); 701 utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */ 702 if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min ) 703 /* Sweet! We're in UTC right now... */ 704 return res; 705 706 tres = mktime( &utc ); 707 res += res - tres; 708 709 /* Yes, this is a hack. And it will go wrong around DST changes. 710 BUT this is more likely to be threadsafe than messing with 711 environment variables, and possibly more portable... */ 712 713 return res; 691 714 } 692 715 -
protocols/msn/msn.c
refbc154 rbb839e8 31 31 GSList *msn_switchboards; 32 32 33 static char * set_eval_display_name( set_t *set, char *value );33 static char *msn_set_display_name( set_t *set, char *value ); 34 34 35 35 static void msn_init( account_t *acc ) 36 36 { 37 set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc ); 38 set_add( &acc->set, "local_display_name", "false", set_eval_bool, acc ); 39 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 40 set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 37 set_t *s; 38 39 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 40 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 41 42 s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 43 44 s = set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 41 45 } 42 46 … … 165 169 static void msn_set_my_name( struct im_connection *ic, char *info ) 166 170 { 167 msn_set_display_name( ic, info );171 msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info ); 168 172 } 169 173 … … 281 285 } 282 286 283 static char * set_eval_display_name( set_t *set, char *value )287 static char *msn_set_display_name( set_t *set, char *value ) 284 288 { 285 289 account_t *acc = set->data; 286 290 struct im_connection *ic = acc->ic; 287 288 /* Allow any name if we're offline. */ 291 struct msn_data *md; 292 char buf[1024], *fn; 293 294 /* Double-check. */ 289 295 if( ic == NULL ) 290 return value; 296 return NULL; 297 298 md = ic->proto_data; 291 299 292 300 if( strlen( value ) > 129 ) … … 295 303 return NULL; 296 304 } 305 306 fn = msn_http_encode( value ); 307 308 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn ); 309 msn_write( ic, buf, strlen( buf ) ); 310 g_free( fn ); 297 311 298 312 /* Returning NULL would be better, because the server still has to 299 313 confirm the name change. However, it looks a bit confusing to the 300 314 user. */ 301 return msn_set_display_name( ic, value ) ? value : NULL;315 return value; 302 316 } 303 317 -
protocols/msn/msn.h
refbc154 rbb839e8 167 167 char *msn_http_encode( const char *input ); 168 168 void msn_msgq_purge( struct im_connection *ic, GSList **list ); 169 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );170 169 171 170 /* tables.c */ -
protocols/msn/msn_util.c
refbc154 rbb839e8 38 38 imcb_error( ic, "Short write() to main server" ); 39 39 imc_logout( ic, TRUE ); 40 return 0;41 } 42 43 return 1;40 return( 0 ); 41 } 42 43 return( 1 ); 44 44 } 45 45 … … 377 377 g_string_free( ret, TRUE ); 378 378 } 379 380 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname )381 {382 char *fn = msn_http_encode( rawname );383 struct msn_data *md = ic->proto_data;384 char buf[1024];385 386 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );387 g_free( fn );388 389 return msn_write( ic, buf, strlen( buf ) ) != 0;390 } -
protocols/msn/ns.c
refbc154 rbb839e8 35 35 36 36 static void msn_auth_got_passport_token( struct msn_auth_data *mad ); 37 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name );38 37 39 38 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) … … 232 231 else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 ) 233 232 { 233 set_t *s; 234 234 235 if( num_parts == 7 ) 235 msn_ns_got_display_name( ic, cmd[4] ); 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 } 236 248 else 249 { 237 250 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 251 } 238 252 239 253 imcb_log( ic, "Authenticated, getting buddy list" ); … … 559 573 return( 0 ); 560 574 } 561 #if 0562 /* Discard this one completely for now since I don't care about the ack563 and since MSN servers can apparently screw up the formatting. */564 575 else if( strcmp( cmd[0], "REA" ) == 0 ) 565 576 { … … 592 603 } 593 604 } 594 #endif595 605 else if( strcmp( cmd[0], "IPG" ) == 0 ) 596 606 { … … 742 752 } 743 753 } 744 745 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name )746 {747 set_t *s;748 749 if( ( s = set_find( &ic->acc->set, "display_name" ) ) == NULL )750 return FALSE; /* Shouldn't happen.. */751 752 http_decode( name );753 754 if( s->value && strcmp( s->value, name ) == 0 )755 {756 return TRUE;757 /* The names match, nothing to worry about. */758 }759 else if( s->value != NULL &&760 ( strcmp( name, ic->acc->user ) == 0 ||761 set_getbool( &ic->acc->set, "local_display_name" ) ) )762 {763 /* The server thinks our display name is our e-mail address764 which is probably wrong, or the user *wants* us to do this:765 Always use the locally set display_name. */766 return msn_set_display_name( ic, s->value );767 }768 else769 {770 if( s->value && *s->value )771 imcb_log( ic, "BitlBee thinks your display name is `%s' but "772 "the MSN server says it's `%s'. Using the MSN "773 "server's name. Set local_display_name to true "774 "to use the local name.", s->value, name );775 776 if( g_utf8_validate( name, -1, NULL ) )777 {778 g_free( s->value );779 s->value = g_strdup( name );780 }781 else782 {783 imcb_log( ic, "Warning: Friendly name in server response was corrupted" );784 }785 786 return TRUE;787 }788 } -
protocols/nogaim.c
refbc154 rbb839e8 39 39 40 40 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); 41 static char *format_timestamp( irc_t *irc, time_t msg_ts );42 41 43 42 GSList *connections; … … 133 132 extern void byahoo_initmodule(); 134 133 extern void jabber_initmodule(); 135 extern void twitter_initmodule();136 134 137 135 #ifdef WITH_MSN … … 149 147 #ifdef WITH_JABBER 150 148 jabber_initmodule(); 151 #endif152 153 #ifdef WITH_TWITTER154 twitter_initmodule();155 149 #endif 156 150 … … 724 718 { 725 719 irc_t *irc = ic->irc; 726 char *wrapped , *ts = NULL;720 char *wrapped; 727 721 user_t *u; 728 722 … … 766 760 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) ) 767 761 strip_html( msg ); 768 769 if( set_getbool( &ic->irc->set, "display_timestamps" ) && 770 ( ts = format_timestamp( irc, sent_at ) ) ) 771 { 772 char *new = g_strconcat( ts, msg, NULL ); 773 g_free( ts ); 774 ts = msg = new; 775 } 776 762 777 763 wrapped = word_wrap( msg, 425 ); 778 764 irc_msgfrom( irc, u->nick, wrapped ); 779 765 g_free( wrapped ); 780 g_free( ts );781 766 } 782 767 … … 820 805 821 806 return c; 822 }823 824 void imcb_chat_name_hint( struct groupchat *c, const char *name )825 {826 if( !c->joined )827 {828 struct im_connection *ic = c->ic;829 char stripped[MAX_NICK_LENGTH+1], *full_name;830 831 strncpy( stripped, name, MAX_NICK_LENGTH );832 stripped[MAX_NICK_LENGTH] = '\0';833 nick_strip( stripped );834 if( set_getbool( &ic->irc->set, "lcnicks" ) )835 nick_lc( stripped );836 837 full_name = g_strdup_printf( "&%s", stripped );838 839 if( stripped[0] &&840 nick_cmp( stripped, ic->irc->channel + 1 ) != 0 &&841 irc_chat_by_channel( ic->irc, full_name ) == NULL )842 {843 g_free( c->channel );844 c->channel = full_name;845 }846 else847 {848 g_free( full_name );849 }850 }851 807 } 852 808 … … 911 867 if( c && u ) 912 868 { 913 char *ts = NULL; 914 if( set_getbool( &ic->irc->set, "display_timestamps" ) ) 915 ts = format_timestamp( ic->irc, sent_at ); 916 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped ); 917 g_free( ts ); 869 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped ); 918 870 } 919 871 else … … 1109 1061 } 1110 1062 1111 char *set_eval_timezone( set_t *set, char *value ) 1112 { 1113 char *s; 1114 1115 if( strcmp( value, "local" ) == 0 || 1116 strcmp( value, "gmt" ) == 0 || strcmp( value, "utc" ) == 0 ) 1117 return value; 1118 1119 /* Otherwise: +/- at the beginning optional, then one or more numbers, 1120 possibly followed by a colon and more numbers. Don't bother bound- 1121 checking them since users are free to shoot themselves in the foot. */ 1122 s = value; 1123 if( *s == '+' || *s == '-' ) 1124 s ++; 1125 1126 /* \d+ */ 1127 if( !isdigit( *s ) ) 1128 return SET_INVALID; 1129 while( *s && isdigit( *s ) ) s ++; 1130 1131 /* EOS? */ 1132 if( *s == '\0' ) 1133 return value; 1134 1135 /* Otherwise, colon */ 1136 if( *s != ':' ) 1137 return SET_INVALID; 1138 s ++; 1139 1140 /* \d+ */ 1141 if( !isdigit( *s ) ) 1142 return SET_INVALID; 1143 while( *s && isdigit( *s ) ) s ++; 1144 1145 /* EOS */ 1146 return *s == '\0' ? value : SET_INVALID; 1147 } 1148 1149 static char *format_timestamp( irc_t *irc, time_t msg_ts ) 1150 { 1151 time_t now_ts = time( NULL ); 1152 struct tm now, msg; 1153 char *set; 1154 1155 /* If the timestamp is <= 0 or less than a minute ago, discard it as 1156 it doesn't seem to add to much useful info and/or might be noise. */ 1157 if( msg_ts <= 0 || msg_ts > now_ts - 60 ) 1158 return NULL; 1159 1160 set = set_getstr( &irc->set, "timezone" ); 1161 if( strcmp( set, "local" ) == 0 ) 1162 { 1163 localtime_r( &now_ts, &now ); 1164 localtime_r( &msg_ts, &msg ); 1165 } 1166 else 1167 { 1168 int hr, min = 0, sign = 60; 1169 1170 if( set[0] == '-' ) 1171 { 1172 sign *= -1; 1173 set ++; 1174 } 1175 else if( set[0] == '+' ) 1176 { 1177 set ++; 1178 } 1179 1180 if( sscanf( set, "%d:%d", &hr, &min ) >= 1 ) 1181 { 1182 msg_ts += sign * ( hr * 60 + min ); 1183 now_ts += sign * ( hr * 60 + min ); 1184 } 1185 1186 gmtime_r( &now_ts, &now ); 1187 gmtime_r( &msg_ts, &msg ); 1188 } 1189 1190 if( msg.tm_year == now.tm_year && msg.tm_yday == now.tm_yday ) 1191 return g_strdup_printf( "\x02[\x02\x02\x02%02d:%02d:%02d\x02]\x02 ", 1192 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1193 else 1194 return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d " 1195 "%02d:%02d:%02d\x02]\x02 ", 1196 msg.tm_year + 1900, msg.tm_mon, msg.tm_mday, 1197 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1198 } 1063 1064 1199 1065 1200 1066 /* The plan is to not allow straight calls to prpl functions anymore, but do … … 1239 1105 { 1240 1106 char *away, *msg = NULL; 1241 1242 if( ic->acc->prpl->away_states == NULL ||1243 ic->acc->prpl->set_away == NULL )1244 return 0;1245 1107 1246 1108 away = set_getstr( &ic->acc->set, "away" ) ? -
protocols/nogaim.h
refbc154 rbb839e8 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_name_hint( struct groupchat *c, const char *name );305 304 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle ); 306 305 /* To remove a handle from a group chat. Reason can be NULL. */ … … 325 324 326 325 /* Misc. stuff */ 327 char *set_eval_timezone( set_t *set, char *value );328 326 char *set_eval_away_devoice( set_t *set, char *value ); 329 327 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); -
storage_xml.c
refbc154 rbb839e8 496 496 goto write_error; 497 497 498 fsync( fd );499 498 close( fd ); 500 499 -
unix.c
refbc154 rbb839e8 73 73 74 74 i = bitlbee_inetd_init(); 75 log_message( LOGLVL_INFO, "Bitl Bee %s starting in inetd mode.", BITLBEE_VERSION );75 log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); 76 76 77 77 } 78 78 else if( global.conf->runmode == RUNMODE_DAEMON ) 79 79 { 80 log_link( LOGLVL_ERROR, LOGOUTPUT_ CONSOLE);81 log_link( LOGLVL_WARNING, LOGOUTPUT_ CONSOLE);80 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); 81 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 82 82 83 83 i = bitlbee_daemon_init(); 84 log_message( LOGLVL_INFO, "Bitl Bee %s starting in daemon mode.", BITLBEE_VERSION );84 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); 85 85 } 86 86 else if( global.conf->runmode == RUNMODE_FORKDAEMON ) 87 87 { 88 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );89 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );90 91 88 /* In case the operator requests a restart, we need this. */ 92 89 old_cwd = g_malloc( 256 ); … … 99 96 100 97 i = bitlbee_daemon_init(); 101 log_message( LOGLVL_INFO, "Bitl Bee %s starting in forking daemon mode.", BITLBEE_VERSION );98 log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION ); 102 99 } 103 100 if( i != 0 )
Note: See TracChangeset
for help on using the changeset viewer.