Changeset 21c87a7


Ignore:
Timestamp:
2010-04-14T09:27:50Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d33679e
Parents:
81186cab (diff), 156bbd7 (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.
Message:

Merging loads of stuff from mainline.

Files:
8 added
23 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r81186cab r21c87a7  
    1111# Program variables
    1212#objects = chat.o
    13 objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)
     13objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)
    1414headers = account.h bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h
    1515subdirs = lib protocols
     
    127127ctags:
    128128        ctags `find . -name "*.c"` `find . -name "*.h"`
     129
     130# Using this as a bogus Make target to test if a GNU-compatible version of
     131# make is available.
     132helloworld:
     133        @echo Hello World
  • bitlbee.c

    r81186cab r21c87a7  
    4242        FILE *fp;
    4343       
    44         log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
    45         log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
     44        log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
     45        log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
    4646       
    4747        memset( &hints, 0, sizeof( hints ) );
     
    7070                        continue;
    7171
     72#ifdef IPV6_V6ONLY             
     73                if( res->ai_family == AF_INET6 )
     74                {
     75                        i = 0;
     76                        setsockopt( global.listen_socket, IPPROTO_IPV6, IPV6_V6ONLY,
     77                                    (char *) &i, sizeof( i ) );
     78                }
     79#endif
     80
    7281                /* TIME_WAIT (?) sucks.. */
    7382                i = 1;
     
    8089                        return( -1 );
    8190                }
    82 
    8391                break;
    8492        }
     
    107115                        exit( 0 );
    108116               
     117                setsid();
    109118                chdir( "/" );
    110119               
     
    137146#endif
    138147       
     148        if( !global.conf->nofork )
     149        {
     150                log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
     151                log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
     152        }
     153       
    139154        return( 0 );
    140155}
  • bitlbee.h

    r81186cab r21c87a7  
    3535
    3636#define PACKAGE "BitlBee"
    37 #define BITLBEE_VERSION "1.2.5"
     37#define BITLBEE_VERSION "1.2.6"
    3838#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)
    3941
    4042#define MAX_STRING 511
  • conf.c

    r81186cab r21c87a7  
    8282        }
    8383       
    84         while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 )
     84        while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:V" ) ) >= 0 )
    8585        /*     ^^^^ Just to make sure we skip this step from the REHASH handler. */
    8686        {
     
    148148                                "  -d  Specify alternative user configuration directory\n"
    149149                                "  -x  Command-line interface to password encryption/hashing\n"
    150                                 "  -h  Show this help page.\n" );
     150                                "  -h  Show this help page.\n"
     151                                "  -V  Show version info.\n" );
     152                        return NULL;
     153                }
     154                else if( opt == 'V' )
     155                {
     156                        printf( "BitlBee %s\nAPI version %06x\n",
     157                                BITLBEE_VERSION, BITLBEE_VERSION_CODE );
    151158                        return NULL;
    152159                }
  • configure

    r81186cab r21c87a7  
    2626oscar=1
    2727yahoo=1
     28twitter=1
    2829
    2930debug=0
     
    6667--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
    6768--yahoo=0/1     Disable/enable Yahoo part               $yahoo
     69--twitter=0/1 Disable/enable Twitter part               $twitter
    6870
    6971--debug=0/1     Disable/enable debugging                $debug
     
    267269detect_ldap()
    268270{
    269         TMPFILE=$(mktemp)
     271        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    270272        if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
    271273                cat<<EOF>>Makefile.settings
     
    295297detect_resolv_dynamic()
    296298{
    297         TMPFILE=$(mktemp)
     299        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    298300        ret=1
    299301        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null
     
    309311detect_resolv_static()
    310312{
    311         TMPFILE=$(mktemp)
     313        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    312314        ret=1
    313315        for i in $systemlibdirs; do
     
    476478fi
    477479
     480if ! make helloworld > /dev/null 2>&1; then
     481        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        echo
     485        if gmake helloworld > /dev/null 2>&1; then
     486                echo "gmake seems to be available on your machine, great."
     487                echo
     488        else
     489                echo "gmake is not installed (or not working). Please try to install it."
     490                echo
     491        fi
     492fi
     493
    478494cat <<EOF>bitlbee.pc
    479495prefix=$prefix
     
    524540fi
    525541
     542if [ "$twitter" = 0 ]; then
     543        echo '#undef WITH_TWITTER' >> config.h
     544else
     545        echo '#define WITH_TWITTER' >> config.h
     546        protocols=$protocols'twitter '
     547        protoobjs=$protoobjs'twitter_mod.o '
     548fi
     549
    526550if [ "$protocols" = "PROTOCOLS = " ]; then
    527551        echo "Warning: You haven't selected any communication protocol to compile!"
  • doc/CHANGES

    r81186cab r21c87a7  
    33
    44http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on
     5
     6Version 1.2.6:
     7- Native (very basic) support for Twitter.
     8- Fixed format of status messages in /WHOIS to improve IRC client
     9  compatibility.
     10- Show timestamps of offline messages/channel backlogs.
     11- Allow saving MSN display names locally since sometimes this stuff breaks
     12  server-side. (Use the local_display_name per-account setting.)
     13- Suppress empty "Headline:" messages for certain new XMPP broadcast
     14  messages.
     15- Better handling of XMPP contacts with multiple resources on-line. Default
     16  behaviour now is to write to wherever the last message came from, or to
     17  the bare JID (usually becomes a broadcast) if there wasn't any recent msg.
     18- The usual misc. bug fixes.
     19
     20Finished ...
    521
    622Version 1.2.5:
     
    2339  the main client).
    2440
    25 Fixed 17 Mar 2010
     41Finished 17 Mar 2010
    2642
    2743Version 1.2.4:
  • doc/user-guide/commands.xml

    r81186cab r21c87a7  
    6363                                </ircexample>
    6464                        </bitlbee-command>
     65                       
     66                        <bitlbee-command name="twitter">
     67                                <syntax>account add twitter &lt;handle&gt; &lt;password&gt;</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 show up in your contact list and their tweets will show up as private messages or in &amp;bitlbee depending on your settings. If you want them in a separate channel, use the use_groupchat setting (see <emphasis>help set use_groupchat</emphasis>).
     76                                        </para>
     77                                       
     78                                        <para>
     79                                                To send tweets yourself, send them to any of your Twitter contacts via /query (doesn't matter who), or just write in the groupchat channel if you enabled that option.
     80                                        </para>
     81                                </description>
     82                        </bitlbee-command>
    6583
    6684                        <bitlbee-command name="yahoo">
     
    401419
    402420        <bitlbee-setting name="auto_reconnect" type="boolean" scope="both">
    403                 <default>false</default>
     421                <default>true</default>
    404422
    405423                <description>
     
    556574                        <para>
    557575                                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.
    558586                        </para>
    559587                </description>
     
    609637        </bitlbee-setting>
    610638
     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
    611650        <bitlbee-setting name="mail_notifications" type="boolean" scope="account">
    612651                <default>false</default>
     
    828867        </bitlbee-setting>
    829868
     869        <bitlbee-setting name="timezone" type="string" scope="global">
     870                <default>local</default>
     871                <possible-values>local, utc, gmt, timezone-spec</possible-values>
     872
     873                <description>
     874                        <para>
     875                                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.
     876                        </para>
     877
     878                        <para>
     879                                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.
     880                        </para>
     881                </description>
     882        </bitlbee-setting>
     883
    830884        <bitlbee-setting name="tls" type="boolean" scope="account">
    831885                <default>try</default>
     
    862916                        <para>
    863917                                Sends you a /notice when a user starts typing a message (if supported by the IM protocol and the user's client). To use this, you most likely want to use a script in your IRC client to show this information in a more sensible way.
     918                        </para>
     919                </description>
     920        </bitlbee-setting>
     921
     922        <bitlbee-setting name="use_groupchat" type="boolean" scope="account">
     923                <default>false</default>
     924
     925                <description>
     926                        <para>
     927                                By default the Twitter module shows all Twitter contacts and their Tweet in &amp;bitlbee and/or private messages. With this setting enabled the module will show all contacts and their Tweets in a separate channel.
    864928                        </para>
    865929                </description>
  • irc.c

    r81186cab r21c87a7  
    105105        s = set_add( &b->set, "default_target", "root", NULL, irc );
    106106        s = set_add( &b->set, "display_namechanges", "false", set_eval_bool, irc );
     107        s = set_add( &b->set, "display_timestamps", "true", set_eval_bool, irc );
    107108        s = set_add( &b->set, "handle_unknown", "root", NULL, irc );
    108109        s = set_add( &b->set, "lcnicks", "true", set_eval_bool, irc );
     
    112113        s = set_add( &b->set, "root_nick", ROOT_NICK, NULL/*set_eval_root_nick*/, irc );
    113114        s = set_add( &b->set, "simulate_netsplit", "true", set_eval_bool, irc );
     115        s = set_add( &b->set, "timezone", "local", set_eval_timezone, irc );
    114116        s = set_add( &b->set, "to_char", ": ", set_eval_to_char, irc );
    115117        s = set_add( &b->set, "typing_notice", "false", set_eval_bool, irc );
     
    747749}
    748750
    749 
    750751static char *set_eval_charset( set_t *set, char *value )
    751752{
    752         irc_t *irc = set->data;
     753        irc_t *irc = (irc_t*) set->data;
     754        char *test;
     755        gsize test_bytes = 0;
    753756        GIConv ic, oc;
    754757
     
    756759                value = g_strdup( "utf-8" );
    757760
     761        if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 )
     762        {
     763                return NULL;
     764        }
     765       
     766        /* Do a test iconv to see if the user picked an IRC-compatible
     767           charset (for example utf-16 goes *horribly* wrong). */
     768        if( ( test = g_convert_with_iconv( " ", 1, oc, NULL, &test_bytes, NULL ) ) == NULL ||
     769            test_bytes > 1 )
     770        {
     771                g_free( test );
     772                g_iconv_close( oc );
     773                irc_usermsg( irc, "Unsupported character set: The IRC protocol "
     774                                  "only supports 8-bit character sets." );
     775                return NULL;
     776        }
     777        g_free( test );
     778       
    758779        if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 )
    759780        {
    760                 return NULL;
    761         }
    762         if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 )
    763         {
    764                 g_iconv_close( ic );
     781                g_iconv_close( oc );
    765782                return NULL;
    766783        }
  • irc.h

    r81186cab r21c87a7  
    211211gint irc_user_cmp( gconstpointer a_, gconstpointer b_ );
    212212
     213/* irc_util.c */
     214char *set_eval_timezone( struct set *set, char *value );
     215char *irc_format_timestamp( irc_t *irc, time_t msg_ts );
     216
    213217#endif
  • irc_im.c

    r81186cab r21c87a7  
    9999        irc_user_t *iu = (irc_user_t *) bu->ui_data;
    100100        char *dst, *prefix = NULL;
    101         char *wrapped;
     101        char *wrapped, *ts = NULL;
     102       
     103        if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )
     104                ts = irc_format_timestamp( irc, sent_at );
    102105       
    103106        if( iu->flags & IRC_USER_PRIVATE )
    104107        {
    105108                dst = irc->user->nick;
     109                prefix = ts;
     110                ts = NULL;
    106111        }
    107112        else
    108113        {
    109114                dst = ic->name;
    110                 prefix = g_strdup_printf( "%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ) );
     115                prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts );
    111116        }
    112117       
     
    116121        g_free( wrapped );
    117122        g_free( prefix );
     123        g_free( ts );
    118124       
    119125        return TRUE;
  • lib/misc.c

    r81186cab r21c87a7  
    7777       
    7878        return mktime(&tm);
     79}
     80
     81time_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 the
     89           given local time... While the given time WAS NOT local. So
     90           we should fix this now.
     91           
     92           Now I could choose between messing with environment variables
     93           (kludgy) or using timegm() (not portable)... Or doing the
     94           following, which I actually prefer...
     95           
     96           tzset() may also work but in other places I actually want to
     97           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 with
     111           environment variables, and possibly more portable... */
     112       
     113        return res;
    79114}
    80115
  • lib/misc.h

    r81186cab r21c87a7  
    4343
    4444G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );
     45G_MODULE_EXPORT time_t mktime_utc( struct tm *tp );
    4546double gettime( void );
    4647
  • log.c

    r81186cab r21c87a7  
    172172                fprintf(stdout, "Debug: %s\n", message);
    173173#endif
     174        /* Always log stuff in syslogs too. */
     175        log_syslog(level, message);
    174176        return;
    175177}
  • protocols/jabber/jabber_util.c

    r81186cab r21c87a7  
    671671time_t jabber_get_timestamp( struct xt_node *xt )
    672672{
    673         struct tm tp, utc;
    674673        struct xt_node *c;
    675         time_t res, tres;
    676674        char *s = NULL;
     675        struct tm tp;
    677676       
    678677        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     
    692691        tp.tm_year -= 1900;
    693692        tp.tm_mon --;
    694         tp.tm_isdst = -1; /* GRRRRRRRRRRR */
    695        
    696         res = mktime( &tp );
    697         /* Problem is, mktime() just gave us the GMT timestamp for the
    698            given local time... While the given time WAS NOT local. So
    699            we should fix this now.
    700        
    701            Now I could choose between messing with environment variables
    702            (kludgy) or using timegm() (not portable)... Or doing the
    703            following, which I actually prefer... */
    704         gmtime_r( &res, &utc );
    705         utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */
    706         if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min )
    707                 /* Sweet! We're in UTC right now... */
    708                 return res;
    709        
    710         tres = mktime( &utc );
    711         res += res - tres;
    712        
    713         /* Yes, this is a hack. And it will go wrong around DST changes.
    714            BUT this is more likely to be threadsafe than messing with
    715            environment variables, and possibly more portable... */
    716        
    717         return res;
     693       
     694        return mktime_utc( &tp );
    718695}
    719696
  • protocols/jabber/message.c

    r81186cab r21c87a7  
    8080                if( type && strcmp( type, "headline" ) == 0 )
    8181                {
    82                         c = xt_find_node( node->children, "subject" );
    83                         g_string_append_printf( fullmsg, "Headline: %s\n", c && c->text_len > 0 ? c->text : "" );
     82                        if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 )
     83                                g_string_append_printf( fullmsg, "Headline: %s\n", c->text );
    8484                       
    8585                        /* <x xmlns="jabber:x:oob"><url>http://....</url></x> can contain a URL, it seems. */
  • protocols/msn/msn.c

    r81186cab r21c87a7  
    3131GSList *msn_switchboards;
    3232
    33 static char *msn_set_display_name( set_t *set, char *value );
     33static char *set_eval_display_name( set_t *set, char *value );
    3434
    3535static void msn_init( account_t *acc )
    3636{
    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 );
     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 );
    4340}
    4441
     
    173170static void msn_set_my_name( struct im_connection *ic, char *info )
    174171{
    175         msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
     172        msn_set_display_name( ic, info );
    176173}
    177174
     
    289286}
    290287
    291 static char *msn_set_display_name( set_t *set, char *value )
     288static char *set_eval_display_name( set_t *set, char *value )
    292289{
    293290        account_t *acc = set->data;
    294291        struct im_connection *ic = acc->ic;
    295         struct msn_data *md;
    296         char buf[1024], *fn;
    297        
    298         /* Double-check. */
     292       
     293        /* Allow any name if we're offline. */
    299294        if( ic == NULL )
    300                 return NULL;
    301        
    302         md = ic->proto_data;
     295                return value;
    303296       
    304297        if( strlen( value ) > 129 )
     
    307300                return NULL;
    308301        }
    309        
    310         fn = msn_http_encode( value );
    311        
    312         g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
    313         msn_write( ic, buf, strlen( buf ) );
    314         g_free( fn );
    315302       
    316303        /* Returning NULL would be better, because the server still has to
    317304           confirm the name change. However, it looks a bit confusing to the
    318305           user. */
    319         return value;
     306        return msn_set_display_name( ic, value ) ? value : NULL;
    320307}
    321308
  • protocols/msn/msn.h

    r81186cab r21c87a7  
    162162char *msn_http_encode( const char *input );
    163163void msn_msgq_purge( struct im_connection *ic, GSList **list );
     164gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );
    164165
    165166/* tables.c */
  • protocols/msn/msn_util.c

    r81186cab r21c87a7  
    3838                imcb_error( ic, "Short write() to main server" );
    3939                imc_logout( ic, TRUE );
    40                 return( 0 );
    41         }
    42        
    43         return( 1 );
     40                return 0;
     41        }
     42       
     43        return 1;
    4444}
    4545
     
    376376        g_string_free( ret, TRUE );
    377377}
     378
     379gboolean msn_set_display_name( struct im_connection *ic, const char *rawname )
     380{
     381        char *fn = msn_http_encode( rawname );
     382        struct msn_data *md = ic->proto_data;
     383        char buf[1024];
     384       
     385        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
     386        g_free( fn );
     387       
     388        return msn_write( ic, buf, strlen( buf ) ) != 0;
     389}
  • protocols/msn/ns.c

    r81186cab r21c87a7  
    3535
    3636static void msn_auth_got_passport_token( struct msn_auth_data *mad );
     37static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name );
    3738
    3839gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
     
    231232                else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 )
    232233                {
    233                         set_t *s;
    234                        
    235234                        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                         }
     235                                msn_ns_got_display_name( ic, cmd[4] );
    248236                        else
    249                         {
    250237                                imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
    251                         }
    252238                       
    253239                        imcb_log( ic, "Authenticated, getting buddy list" );
     
    567553                return( 0 );
    568554        }
     555#if 0
     556        /* Discard this one completely for now since I don't care about the ack
     557           and since MSN servers can apparently screw up the formatting. */
    569558        else if( strcmp( cmd[0], "REA" ) == 0 )
    570559        {
     
    597586                }
    598587        }
     588#endif
    599589        else if( strcmp( cmd[0], "IPG" ) == 0 )
    600590        {
     
    746736        }
    747737}
     738
     739static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name )
     740{
     741        set_t *s;
     742       
     743        if( ( s = set_find( &ic->acc->set, "display_name" ) ) == NULL )
     744                return FALSE; /* Shouldn't happen.. */
     745       
     746        http_decode( name );
     747       
     748        if( s->value && strcmp( s->value, name ) == 0 )
     749        {
     750                return TRUE;
     751                /* The names match, nothing to worry about. */
     752        }
     753        else if( s->value != NULL &&
     754                 ( strcmp( name, ic->acc->user ) == 0 ||
     755                   set_getbool( &ic->acc->set, "local_display_name" ) ) )
     756        {
     757                /* The server thinks our display name is our e-mail address
     758                   which is probably wrong, or the user *wants* us to do this:
     759                   Always use the locally set display_name. */
     760                return msn_set_display_name( ic, s->value );
     761        }
     762        else
     763        {
     764                if( s->value && *s->value )
     765                        imcb_log( ic, "BitlBee thinks your display name is `%s' but "
     766                                      "the MSN server says it's `%s'. Using the MSN "
     767                                      "server's name. Set local_display_name to true "
     768                                      "to use the local name.", s->value, name );
     769               
     770                if( g_utf8_validate( name, -1, NULL ) )
     771                {
     772                        g_free( s->value );
     773                        s->value = g_strdup( name );
     774                }
     775                else
     776                {
     777                        imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
     778                }
     779               
     780                return TRUE;
     781        }
     782}
  • protocols/nogaim.c

    r81186cab r21c87a7  
    127127        extern void byahoo_initmodule();
    128128        extern void jabber_initmodule();
     129        extern void twitter_initmodule();
    129130
    130131#ifdef WITH_MSN
     
    142143#ifdef WITH_JABBER
    143144        jabber_initmodule();
     145#endif
     146
     147#ifdef WITH_TWITTER
     148        twitter_initmodule();
    144149#endif
    145150
     
    560565}
    561566
     567void imcb_chat_name_hint( struct groupchat *c, const char *name )
     568{
     569#if 0
     570        if( !c->joined )
     571        {
     572                struct im_connection *ic = c->ic;
     573                char stripped[MAX_NICK_LENGTH+1], *full_name;
     574               
     575                strncpy( stripped, name, MAX_NICK_LENGTH );
     576                stripped[MAX_NICK_LENGTH] = '\0';
     577                nick_strip( stripped );
     578                if( set_getbool( &ic->irc->set, "lcnicks" ) )
     579                        nick_lc( stripped );
     580               
     581                full_name = g_strdup_printf( "&%s", stripped );
     582               
     583                if( stripped[0] &&
     584                    nick_cmp( stripped, ic->irc->channel + 1 ) != 0 &&
     585                    irc_chat_by_channel( ic->irc, full_name ) == NULL )
     586                {
     587                        g_free( c->channel );
     588                        c->channel = full_name;
     589                }
     590                else
     591                {
     592                        g_free( full_name );
     593                }
     594        }
     595#endif
     596}
     597
    562598void imcb_chat_free( struct groupchat *c )
    563599{
     
    623659        if( c && u )
    624660        {
    625                 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped );
     661                char *ts = NULL;
     662                if( set_getbool( &ic->irc->set, "display_timestamps" ) )
     663                        ts = format_timestamp( ic->irc, sent_at );
     664                irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped );
     665                g_free( ts );
    626666        }
    627667        else
     
    826866#endif
    827867
    828 
    829 
    830868/* The plan is to not allow straight calls to prpl functions anymore, but do
    831869   them all from some wrappers. We'll start to define some down here: */
     
    852890{
    853891        char *away, *msg = NULL;
     892       
     893        if( ic->acc->prpl->away_states == NULL ||
     894            ic->acc->prpl->set_away == NULL )
     895                return 0;
    854896       
    855897        away = set_getstr( &ic->acc->set, "away" ) ?
  • protocols/nogaim.h

    r81186cab r21c87a7  
    299299 *   user, too. */
    300300G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle );
     301G_MODULE_EXPORT void imcb_chat_name_hint( struct groupchat *c, const char *name );
    301302G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );
    302303/* To remove a handle from a group chat. Reason can be NULL. */
  • storage_xml.c

    r81186cab r21c87a7  
    498498                goto write_error;
    499499       
     500        fsync( fd );
    500501        close( fd );
    501502       
  • unix.c

    r81186cab r21c87a7  
    7373       
    7474                i = bitlbee_inetd_init();
    75                 log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION );
     75                log_message( LOGLVL_INFO, "BitlBee %s starting in inetd mode.", BITLBEE_VERSION );
    7676
    7777        }
    7878        else if( global.conf->runmode == RUNMODE_DAEMON )
    7979        {
    80                 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
    81                 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
     80                log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
     81                log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
    8282
    8383                i = bitlbee_daemon_init();
    84                 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION );
     84                log_message( LOGLVL_INFO, "BitlBee %s starting in daemon mode.", BITLBEE_VERSION );
    8585        }
    8686        else if( global.conf->runmode == RUNMODE_FORKDAEMON )
    8787        {
     88                log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
     89                log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
     90
    8891                /* In case the operator requests a restart, we need this. */
    8992                old_cwd = g_malloc( 256 );
     
    9699               
    97100                i = bitlbee_daemon_init();
    98                 log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION );
     101                log_message( LOGLVL_INFO, "BitlBee %s starting in forking daemon mode.", BITLBEE_VERSION );
    99102        }
    100103        if( i != 0 )
Note: See TracChangeset for help on using the changeset viewer.