Changes in / [51a799e:ba7d16f]


Ignore:
Files:
13 deleted
54 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r51a799e rba7d16f  
    126126ctags:
    127127        ctags `find . -name "*.c"` `find . -name "*.h"`
    128 
    129 # Using this as a bogus Make target to test if a GNU-compatible version of
    130 # make is available.
    131 helloworld:
    132         @echo Hello World
  • bitlbee.c

    r51a799e rba7d16f  
    3636static gboolean bitlbee_io_new_client( gpointer data, gint fd, b_input_condition condition );
    3737
    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_V6ONLY             
    50         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 #endif
    57 
    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 
    7538int bitlbee_daemon_init()
    7639{
     
    7942        FILE *fp;
    8043       
    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 );
    8346       
    8447        memset( &hints, 0, sizeof( hints ) );
     
    10063
    10164        global.listen_socket = -1;
    102        
    103         /* Try IPv6 first (which will become an IPv6+IPv4 socket). */
     65
    10466        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
    11486        freeaddrinfo( addrinfo_bind );
    11587
     
    12193        }
    12294       
    123         global.listen_watch_source_id = b_input_add( global.listen_socket, B_EV_IO_READ, bitlbee_io_new_client, NULL );
     95        global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );
    12496       
    12597#ifndef _WIN32
     
    135107                        exit( 0 );
    136108               
    137                 setsid();
    138109                chdir( "/" );
    139110               
     
    166137#endif
    167138       
    168         if( !global.conf->nofork )
    169         {
    170                 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
    171                 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
    172         }
    173        
    174139        return( 0 );
    175140}
     
    321286                        child->pid = client_pid;
    322287                        child->ipc_fd = fds[0];
    323                         child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
     288                        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    324289                        child_list = g_slist_append( child_list, child );
    325290                       
     
    349314                        /* We can store the IPC fd there now. */
    350315                        global.listen_socket = fds[1];
    351                         global.listen_watch_source_id = b_input_add( fds[1], B_EV_IO_READ, ipc_child_read, irc );
     316                        global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );
    352317                       
    353318                        close( fds[0] );
  • bitlbee.h

    r51a799e rba7d16f  
    3535
    3636#define PACKAGE "BitlBee"
    37 #define BITLBEE_VERSION "1.2.6a"
     37#define BITLBEE_VERSION "1.2.5"
    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)
    4139
    4240#define MAX_STRING 511
  • conf.c

    r51a799e rba7d16f  
    8282        }
    8383       
    84         while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:V" ) ) >= 0 )
     84        while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 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"
    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 );
     150                                "  -h  Show this help page.\n" );
    158151                        return NULL;
    159152                }
  • configure

    r51a799e rba7d16f  
    2626oscar=1
    2727yahoo=1
    28 twitter=1
    29 purple=1
    3028
    3129debug=0
     
    6866--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
    6967--yahoo=0/1     Disable/enable Yahoo part               $yahoo
    70 --twitter=0/1 Disable/enable Twitter part               $twitter
    71 
    72 --purple=0/1    Disable/enable libpurple support        $purple
    7368
    7469--debug=0/1     Disable/enable debugging                $debug
     
    272267detect_ldap()
    273268{
    274         TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     269        TMPFILE=$(mktemp)
    275270        if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
    276271                cat<<EOF>>Makefile.settings
     
    300295detect_resolv_dynamic()
    301296{
    302         TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     297        TMPFILE=$(mktemp)
    303298        ret=1
    304299        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null
     
    314309detect_resolv_static()
    315310{
    316         TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
     311        TMPFILE=$(mktemp)
    317312        ret=1
    318313        for i in $systemlibdirs; do
     
    481476fi
    482477
    483 if ! make helloworld > /dev/null 2>&1; then
    484         echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
    485         echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
    486         echo "under the name 'gmake'."
    487         echo
    488         if gmake helloworld > /dev/null 2>&1; then
    489                 echo "gmake seems to be available on your machine, great."
    490                 echo
    491         else
    492                 echo "gmake is not installed (or not working). Please try to install it."
    493                 echo
    494         fi
    495 fi
    496 
    497478cat <<EOF>bitlbee.pc
    498479prefix=$prefix
     
    511492protoobjs=''
    512493
    513 if [ "$purple" = 0 ]; then
    514         echo '#undef WITH_PURPLE' >> config.h
    515 else
    516         if ! $PKG_CONFIG purple; then
    517                 echo
    518                 echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
    519                 exit 1
    520         fi
    521         echo '#define WITH_PURPLE' >> config.h
    522         cat<<EOF>>Makefile.settings
    523 EFLAGS += $($PKG_CONFIG purple --libs)
    524 PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
    525 EOF
    526         protocols=$protocols'purple '
    527         protoobjs=$protoobjs'purple_mod.o '
    528 
    529         # Having both libpurple and native IM modules in one binary may
    530         # do strange things. Let's not do that.
    531         msn=0
    532         jabber=0
    533         oscar=0
    534         yahoo=0
    535         twitter=0
    536        
    537         if [ "$events" = "libevent" ]; then
    538                 echo
    539                 echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
    540                 echo 'outside libpurple, talking to GLib directly. At least for now the combination'
    541                 echo 'libpurple + libevent is *not* recommended!'
    542         fi
    543 fi
    544 
    545494if [ "$msn" = 0 ]; then
    546495        echo '#undef WITH_MSN' >> config.h
     
    575524fi
    576525
    577 if [ "$twitter" = 0 ]; then
    578         echo '#undef WITH_TWITTER' >> config.h
    579 else
    580         echo '#define WITH_TWITTER' >> config.h
    581         protocols=$protocols'twitter '
    582         protoobjs=$protoobjs'twitter_mod.o '
    583 fi
    584 
    585526if [ "$protocols" = "PROTOCOLS = " ]; then
    586527        echo "Warning: You haven't selected any communication protocol to compile!"
  • dcc.c

    r51a799e rba7d16f  
    154154
    155155        /* watch */
    156         df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_send_proto, df );
     156        df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_send_proto, df );
    157157
    158158        df->ic->irc->file_transfers = g_slist_prepend( df->ic->irc->file_transfers, file );
     
    267267        file_transfer_t *file = df->ft;
    268268       
    269         if( ( cond & B_EV_IO_READ ) &&
     269        if( ( cond & GAIM_INPUT_READ ) &&
    270270            ( file->status & FT_STATUS_LISTENING ) )
    271271        {       
     
    287287
    288288                /* reschedule for reading on new fd */
    289                 df->watch_in = b_input_add( fd, B_EV_IO_READ, dccs_send_proto, df );
     289                df->watch_in = b_input_add( fd, GAIM_INPUT_READ, dccs_send_proto, df );
    290290
    291291                return FALSE;
    292292        }
    293293
    294         if( cond & B_EV_IO_READ )
     294        if( cond & GAIM_INPUT_READ )
    295295        {
    296296                int ret;
     
    364364
    365365        /* watch */
    366         df->watch_out = b_input_add( df->fd, B_EV_IO_WRITE, dccs_recv_proto, df );
     366        df->watch_out = b_input_add( df->fd, GAIM_INPUT_WRITE, dccs_recv_proto, df );
    367367        ft->write_request = dccs_recv_write_request;
    368368
     
    377377        file_transfer_t *ft = df->ft;
    378378
    379         if( ( cond & B_EV_IO_WRITE ) &&
     379        if( ( cond & GAIM_INPUT_WRITE ) &&
    380380            ( ft->status & FT_STATUS_CONNECTING ) )
    381381        {
    382382                ft->status = FT_STATUS_TRANSFERRING;
    383383
    384                 //df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_recv_proto, df );
     384                //df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_recv_proto, df );
    385385
    386386                df->watch_out = 0;
     
    388388        }
    389389
    390         if( cond & B_EV_IO_READ )
     390        if( cond & GAIM_INPUT_READ )
    391391        {
    392392                int ret, done;
     
    445445                return dcc_abort( df, "BUG: write_request() called while watching" );
    446446
    447         df->watch_in = b_input_add( df->fd, B_EV_IO_READ, dccs_recv_proto, df );
     447        df->watch_in = b_input_add( df->fd, GAIM_INPUT_READ, dccs_recv_proto, df );
    448448
    449449        return TRUE;
     
    488488
    489489        if( df->bytes_sent < df->ft->file_size )
    490                 df->watch_out = b_input_add( df->fd, B_EV_IO_WRITE, dccs_send_can_write, df );
     490                df->watch_out = b_input_add( df->fd, GAIM_INPUT_WRITE, dccs_send_can_write, df );
    491491
    492492        return TRUE;
  • debian/bitlbee.init

    r51a799e rba7d16f  
    3838d_start() {
    3939        # Make sure BitlBee can actually write its PID...
    40         touch $PIDFILE
    41         chown bitlbee: $PIDFILE
     40        touch /var/run/bitlbee.pid
     41        chown bitlbee: /var/run/bitlbee.pid
    4242       
    4343        start-stop-daemon --start --quiet --pidfile $PIDFILE \
  • debian/changelog

    r51a799e rba7d16f  
    1 bitlbee (1.2.6a-1) unstable; urgency=low
    2 
    3   * New upstream version.
    4   * Native support for Twitter.
    5   * Fixed /WHOIS response format. (Closes: #576120)
    6   * Problems with bitlbee-skype are solved by now. (Closes: #575572)
    7 
    8  -- Wilmer van der Gaast <wilmer@peer.gaast.net>  Tue, 20 Apr 2010 00:34:51 +0200
    9 
    101bitlbee (1.2.5-1) unstable; urgency=low
    112
  • debian/control

    r51a799e rba7d16f  
    55Uploaders: Jelmer Vernooij <jelmer@samba.org>
    66Standards-Version: 3.8.0
    7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf, libpurple-dev
     7Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf
    88Homepage: http://www.bitlbee.org/
    99Vcs-Bzr: http://code.bitlbee.org/bitlbee/
  • debian/rules

    r51a799e rba7d16f  
    11#!/usr/bin/make -f
    22
    3 BITLBEE_CONFIGURE_FLAGS ?=
    43DEBUG ?= 0
    54
     
    1514build-arch-stamp:
    1615        [ -d debian ]
    17         ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent $(BITLBEE_CONFIGURE_FLAGS)
     16        ./configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent
    1817        $(MAKE)
    1918#       $(MAKE) -C doc/ all
     
    10099                find usr -type f -exec md5sum {} \; > DEBIAN/md5sums
    101100
    102         dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev -v1:$(BITLBEE_VERSION)-0
     101        dpkg-gencontrol -ldebian/changelog -isp -pbitlbee-dev -Pdebian/bitlbee-dev
    103102
    104103        dpkg --build debian/bitlbee-dev ..
  • doc/CHANGES

    r51a799e rba7d16f  
    33
    44http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on
    5 
    6 Version 1.2.6a:
    7 - Fixed a typo that renders the Twitter groupchat mode unusable. A last-
    8   minute change that came a few minutes late.
    9 
    10 Finished 19 Apr 2010
    11 
    12 Version 1.2.6:
    13 - Native (very basic) support for Twitter, implemented by Geert Mulders.
    14   Currently supported are posting tweets, reading the ones of people you
    15   follow, and sending (not yet receiving!) direct messages.
    16 - Fixed format of status messages in /WHOIS to improve IRC client
    17   compatibility.
    18 - Show timestamps of offline messages/channel backlogs.
    19 - Allow saving MSN display names locally since sometimes this stuff breaks
    20   server-side. (Use the local_display_name per-account setting.)
    21 - Suppress empty "Headline:" messages for certain new XMPP broadcast
    22   messages.
    23 - Better handling of XMPP contacts with multiple resources on-line. Default
    24   behaviour now is to write to wherever the last message came from, or to
    25   the bare JID (usually becomes a broadcast) if there wasn't any recent msg.
    26 - Added a switchboard_keepalives setting which should solve some issues with
    27   talking to offline MSN contacts. (Although full support for offline
    28   messages is not ready yet!)
    29 - The usual misc. bug fixes.
    30 
    31 Finished 19 Apr 2010
    325
    336Version 1.2.5:
     
    5023  the main client).
    5124
    52 Finished 17 Mar 2010
     25Fixed 17 Mar 2010
    5326
    5427Version 1.2.4:
  • doc/user-guide/commands.xml

    r51a799e rba7d16f  
    2121                        <description>
    2222                                <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 &lt;protocol&gt;</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 &lt;protocol&gt;</emphasis>.
    2424                                </para>
    2525                        </description>
     
    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 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 
    82                                         <para>
    83                                                 Since Twitter now requires OAuth authentication, you should not enter your Twitter password into BitlBee. Just type a bogus password. The first time you log in, BitlBee will start OAuth authentication. (See <emphasis>help set oauth</emphasis>.)
    84                                         </para>
    85                                 </description>
    86                         </bitlbee-command>
    8765
    8866                        <bitlbee-command name="yahoo">
     
    423401
    424402        <bitlbee-setting name="auto_reconnect" type="boolean" scope="both">
    425                 <default>true</default>
     403                <default>false</default>
    426404
    427405                <description>
     
    578556                        <para>
    579557                                With this option enabled, root will inform you when someone in your buddy list changes his/her "friendly name".
    580                         </para>
    581                 </description>
    582         </bitlbee-setting>
    583 
    584         <bitlbee-setting name="display_timestamps" type="boolean" scope="global">
    585                 <default>true</default>
    586 
    587                 <description>
    588                         <para>
    589                                 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.
    590558                        </para>
    591559                </description>
     
    641609        </bitlbee-setting>
    642610
    643         <bitlbee-setting name="local_display_name" type="boolean" scope="account">
    644                 <default>false</default>
    645 
    646                 <description>
    647                         <para>
    648                                 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.
    649                         </para>
    650                 </description>
    651 
    652         </bitlbee-setting>
    653 
    654611        <bitlbee-setting name="mail_notifications" type="boolean" scope="account">
    655612                <default>false</default>
     
    658615                        <para>
    659616                                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.
    660                         </para>
    661                 </description>
    662 
    663         </bitlbee-setting>
    664 
    665         <bitlbee-setting name="message_length" type="integer" scope="account">
    666                 <default>140</default>
    667 
    668                 <description>
    669                         <para>
    670                                 Since Twitter rejects messages longer than 140 characters, BitlBee can count message length and emit a warning instead of waiting for Twitter to reject it.
    671                         </para>
    672 
    673                         <para>
    674                                 You can change this limit here but this won't disable length checks on Twitter's side. You can also set it to 0 to disable the check in case you believe BitlBee doesn't count the characters correctly.
    675                         </para>
    676                 </description>
    677 
    678         </bitlbee-setting>
    679 
    680         <bitlbee-setting name="mode" type="string" scope="account">
    681                 <possible-values>one, many, chat</possible-values>
    682                 <default>one</default>
    683 
    684                 <description>
    685                         <para>
    686                                 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.
    687                         </para>
    688                        
    689                         <para>
    690                                 If you prefer to have all your Twitter things in a separate channel, you can set this setting to "chat".
    691                         </para>
    692                        
    693                         <para>
    694                                 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.
    695617                        </para>
    696618                </description>
     
    722644        </bitlbee-setting>
    723645
    724         <bitlbee-setting name="oauth" type="boolean" scope="account">
    725                 <default>true</default>
    726 
    727                 <description>
    728                         <para>
    729                                 This enables OAuth authentication for Twitter accounts. From June 2010 this will be mandatory.
    730                         </para>
    731 
    732                         <para>
    733                                 With OAuth enabled, you shouldn't tell BitlBee your Twitter password. Just add your account with a bogus password and type <emphasis>account on</emphasis>. BitlBee will then give you a URL to authenticate with Twitter. If this succeeds, Twitter will return a PIN code which you can give back to BitlBee to finish the process.
    734                         </para>
    735 
    736                         <para>
    737                                 The resulting access token will be saved permanently, so you have to do this only once.
    738                         </para>
    739                 </description>
    740 
    741         </bitlbee-setting>
    742 
    743646        <bitlbee-setting name="ops" type="string" scope="global">
    744647                <default>both</default>
     
    876779        </bitlbee-setting>
    877780
    878         <bitlbee-setting name="show_offline" type="boolean" scope="global">
    879                 <default>false</default>
    880 
    881                 <description>
    882                         <para>
    883                                 If enabled causes BitlBee to also show offline users in Channel. Online-users will get op, away-users voice and offline users none of both. This option takes effect as soon as you reconnect.
    884                         </para>
    885                 </description>
    886         </bitlbee-setting>
    887 
    888781        <bitlbee-setting name="simulate_netsplit" type="boolean" scope="global">
    889782                <default>true</default>
     
    931824                        <para>
    932825                                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.
    933                         </para>
    934                 </description>
    935         </bitlbee-setting>
    936 
    937         <bitlbee-setting name="switchboard_keepalives" type="boolean" scope="account">
    938                 <default>false</default>
    939 
    940                 <description>
    941                         <para>
    942                                 Turn on this flag if you have difficulties talking to offline/invisible contacts.
    943                         </para>
    944                        
    945                         <para>
    946                                 With this setting enabled, BitlBee will send keepalives to MSN switchboards with offline/invisible contacts every twenty seconds. This should keep the server and client on the other side from shutting it down.
    947                         </para>
    948                        
    949                         <para>
    950                                 This is useful because BitlBee doesn't support MSN offline messages yet and the MSN servers won't let the user reopen switchboards to offline users. Once offline messaging is supported, this flag might be removed.
    951                         </para>
    952                 </description>
    953         </bitlbee-setting>
    954 
    955         <bitlbee-setting name="timezone" type="string" scope="global">
    956                 <default>local</default>
    957                 <possible-values>local, utc, gmt, timezone-spec</possible-values>
    958 
    959                 <description>
    960                         <para>
    961                                 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.
    962                         </para>
    963 
    964                         <para>
    965                                 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.
    966826                        </para>
    967827                </description>
  • help.c

    r51a799e rba7d16f  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2009 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2005 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    169169        return NULL;
    170170}
    171 
    172 int help_add_mem( help_t **help, const char *title, const char *content )
    173 {
    174         help_t *h, *l = NULL;
    175        
    176         for( h = *help; h; h = h->next )
    177         {
    178                 if( g_strcasecmp( h->title, title ) == 0 )
    179                         return 0;
    180                
    181                 l = h;
    182         }
    183        
    184         if( l )
    185                 h = l->next = g_new0( struct help, 1 );
    186         else
    187                 *help = h = g_new0( struct help, 1 );
    188         h->fd = -1;
    189         h->title = g_strdup( title );
    190         h->length = strlen( content );
    191         h->offset.mem_offset = g_strdup( content );
    192        
    193         return 1;
    194 }
  • help.h

    r51a799e rba7d16f  
    4646void help_free( help_t **help );
    4747char *help_get( help_t **help, char *title );
    48 int help_add_mem( help_t **help, const char *title, const char *content_ );
    4948
    5049#endif
  • ipc.c

    r51a799e rba7d16f  
    514514        }
    515515               
    516         child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
     516        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    517517       
    518518        child_list = g_slist_append( child_list, child );
     
    552552        }
    553553       
    554         b_input_add( serversock, B_EV_IO_READ, new_ipc_client, NULL );
     554        b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
    555555       
    556556        return 1;
     
    597597                        return 0;
    598598                }
    599                 child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
     599                child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    600600               
    601601                child_list = g_slist_append( child_list, child );
  • irc.c

    r51a799e rba7d16f  
    5252{
    5353        irc_t *irc = set->data;
    54         char *test;
    55         gsize test_bytes = 0;
    5654        GIConv ic, oc;
    5755
     
    5957                value = g_strdup( "utf-8" );
    6058
     59        if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 )
     60        {
     61                return NULL;
     62        }
    6163        if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 )
    6264        {
    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 );
    8266                return NULL;
    8367        }
     
    125109        sock_make_nonblocking( irc->fd );
    126110       
    127         irc->r_watch_source_id = b_input_add( irc->fd, B_EV_IO_READ, bitlbee_io_current_client_read, irc );
     111        irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
    128112       
    129113        irc->status = USTATUS_OFFLINE;
     
    191175        s = set_add( &irc->set, "default_target", "root", NULL, irc );
    192176        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 );
    194177        s = set_add( &irc->set, "handle_unknown", "root", NULL, irc );
    195178        s = set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc );
     
    201184        s = set_add( &irc->set, "root_nick", irc->mynick, set_eval_root_nick, irc );
    202185        s = set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc );
    203         s = set_add( &irc->set, "show_offline", "false", set_eval_bool, irc );
    204186        s = set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc );
    205187        s = set_add( &irc->set, "status", NULL,  set_eval_away_status, irc );
    206188        s->flags |= SET_NULL_OK;
    207189        s = set_add( &irc->set, "strip_html", "true", NULL, irc );
    208         s = set_add( &irc->set, "timezone", "local", set_eval_timezone, irc );
    209190        s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc );
    210191        s = set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc );
     
    214195        /* Evaluator sets the iconv/oconv structures. */
    215196        set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) );
    216        
    217         nogaim_init();
    218197       
    219198        return( irc );
     
    698677                   in the event queue. */
    699678                /* Really can't be done as long as the code doesn't do error checking very well:
    700                 if( bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE ) ) */
     679                if( bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE ) ) */
    701680               
    702681                /* So just always do it via the event handler. */
    703                 irc->w_watch_source_id = b_input_add( irc->fd, B_EV_IO_WRITE, bitlbee_io_current_client_write, irc );
     682                irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
    704683        }
    705684       
     
    727706                if( now )
    728707                {
    729                         bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE );
     708                        bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE );
    730709                }
    731710                temp = temp->next;
  • irc_commands.c

    r51a799e rba7d16f  
    498498                        irc_reply( irc, 301, "%s :%s", u->nick, u->away );
    499499                if( u->status_msg )
    500                         irc_reply( irc, 320, "%s :%s", u->nick, u->status_msg );
     500                        irc_reply( irc, 333, "%s :Status: %s", u->nick, u->status_msg );
    501501               
    502502                irc_reply( irc, 318, "%s :End of /WHOIS list", nick );
  • lib/Makefile

    r51a799e rba7d16f  
    1010
    1111# [SH] Program variables
    12 objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o
     12objects = arc.o base64.o $(EVENT_HANDLER) http_client.o ini.o md5.o misc.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ftutil.o
    1313
    1414CFLAGS += -Wall
  • lib/events.h

    r51a799e rba7d16f  
    4848   the given callback function. */
    4949typedef enum {
    50         B_EV_IO_READ = 1 << 0,
    51         B_EV_IO_WRITE = 1 << 1,
    52         B_EV_FLAG_FORCE_ONCE = 1 << 16,
    53         B_EV_FLAG_FORCE_REPEAT = 1 << 17,
     50        GAIM_INPUT_READ = 1 << 1,
     51        GAIM_INPUT_WRITE = 1 << 2
    5452} b_input_condition;
    5553typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond);
  • lib/events_glib.c

    r51a799e rba7d16f  
    4949        b_event_handler function;
    5050        gpointer data;
    51         guint flags;
    5251} GaimIOClosure;
    5352
     
    7776
    7877        if (condition & GAIM_READ_COND)
    79                 gaim_cond |= B_EV_IO_READ;
     78                gaim_cond |= GAIM_INPUT_READ;
    8079        if (condition & GAIM_WRITE_COND)
    81                 gaim_cond |= B_EV_IO_WRITE;
     80                gaim_cond |= GAIM_INPUT_WRITE;
    8281       
    8382        event_debug( "gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data );
     
    8887                event_debug( "Returned FALSE, cancelling.\n" );
    8988       
    90         if (closure->flags & B_EV_FLAG_FORCE_ONCE)
    91                 return FALSE;
    92         else if (closure->flags & B_EV_FLAG_FORCE_REPEAT)
    93                 return TRUE;
    94         else
    95                 return st;
     89        return st;
    9690}
    9791
     
    111105        closure->function = function;
    112106        closure->data = data;
    113         closure->flags = condition;
    114107       
    115         if (condition & B_EV_IO_READ)
     108        if (condition & GAIM_INPUT_READ)
    116109                cond |= GAIM_READ_COND;
    117         if (condition & B_EV_IO_WRITE)
     110        if (condition & GAIM_INPUT_WRITE)
    118111                cond |= GAIM_WRITE_COND;
    119112       
  • lib/events_libevent.c

    r51a799e rba7d16f  
    6060        b_event_handler function;
    6161        void *data;
    62         guint flags;
    6362};
    6463
     
    127126        {
    128127                if( event & EV_READ )
    129                         cond |= B_EV_IO_READ;
     128                        cond |= GAIM_INPUT_READ;
    130129                if( event & EV_WRITE )
    131                         cond |= B_EV_IO_WRITE;
     130                        cond |= GAIM_INPUT_WRITE;
    132131        }
    133132       
     
    151150                return;
    152151        }
    153         else if( !st && !( b_ev->flags & B_EV_FLAG_FORCE_REPEAT ) )
     152        else if( !st )
    154153        {
    155154                event_debug( "Handler returned FALSE: " );
     
    175174        event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) ", fd, condition, function, data );
    176175       
    177         if( ( condition & B_EV_IO_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) ||
    178             ( condition & B_EV_IO_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )
     176        if( ( condition & GAIM_INPUT_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) ||
     177            ( condition & GAIM_INPUT_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )
    179178        {
    180179                /* We'll stick with this libevent entry, but give it a new BitlBee id. */
     
    199198               
    200199                out_cond = EV_PERSIST;
    201                 if( condition & B_EV_IO_READ )
     200                if( condition & GAIM_INPUT_READ )
    202201                        out_cond |= EV_READ;
    203                 if( condition & B_EV_IO_WRITE )
     202                if( condition & GAIM_INPUT_WRITE )
    204203                        out_cond |= EV_WRITE;
    205204               
     
    213212        }
    214213       
    215         b_ev->flags = condition;
    216214        g_hash_table_insert( id_hash, &b_ev->id, b_ev );
    217215        return b_ev->id;
  • lib/http_client.c

    r51a799e rba7d16f  
    149149        if( req->bytes_written < req->request_length )
    150150                req->inpa = b_input_add( source,
    151                                          req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_WRITE,
     151                                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
    152152                                         http_connected, req );
    153153        else
    154                 req->inpa = b_input_add( source, B_EV_IO_READ, http_incoming_data, req );
     154                req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
    155155       
    156156        return FALSE;
     
    234234        /* There will be more! */
    235235        req->inpa = b_input_add( req->fd,
    236                                  req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_READ,
     236                                 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
    237237                                 http_incoming_data, req );
    238238       
  • lib/misc.c

    r51a799e rba7d16f  
    7777       
    7878        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 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;
    11479}
    11580
     
    306271        for( i = j = 0; t[i]; i ++, j ++ )
    307272        {
    308                 if( !isalnum( t[i] ) && !strchr( "._-~", t[i] ) )
     273                /* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */
     274                if( !isalnum( t[i] ) )
    309275                {
    310276                        sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] );
  • lib/misc.h

    r51a799e rba7d16f  
    4343
    4444G_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 );
    4645double gettime( void );
    4746
  • lib/proxy.c

    r51a799e rba7d16f  
    9191                b_event_remove(phb->inpa);
    9292                if( phb->proxy_func )
    93                         phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ);
     93                        phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);
    9494                else {
    95                         phb->func(phb->data, -1, B_EV_IO_READ);
     95                        phb->func(phb->data, -1, GAIM_INPUT_READ);
    9696                        g_free(phb);
    9797                }
     
    102102        b_event_remove(phb->inpa);
    103103        if( phb->proxy_func )
    104                 phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ);
     104                phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);
    105105        else {
    106                 phb->func(phb->data, source, B_EV_IO_READ);
     106                phb->func(phb->data, source, GAIM_INPUT_READ);
    107107                g_free(phb);
    108108        }
     
    147147                return -1;
    148148        } else {
    149                 phb->inpa = b_input_add(fd, B_EV_IO_WRITE, gaim_io_connected, phb);
     149                phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
    150150                phb->fd = fd;
    151151               
     
    179179        if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING)) == 0) ||
    180180            (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) {
    181                 phb->func(phb->data, source, B_EV_IO_READ);
     181                phb->func(phb->data, source, GAIM_INPUT_READ);
    182182                g_free(phb->host);
    183183                g_free(phb);
     
    186186
    187187        close(source);
    188         phb->func(phb->data, -1, B_EV_IO_READ);
     188        phb->func(phb->data, -1, GAIM_INPUT_READ);
    189189        g_free(phb->host);
    190190        g_free(phb);
     
    204204        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
    205205                close(source);
    206                 phb->func(phb->data, -1, B_EV_IO_READ);
     206                phb->func(phb->data, -1, GAIM_INPUT_READ);
    207207                g_free(phb->host);
    208208                g_free(phb);
     
    215215        if (send(source, cmd, strlen(cmd), 0) < 0) {
    216216                close(source);
    217                 phb->func(phb->data, -1, B_EV_IO_READ);
     217                phb->func(phb->data, -1, GAIM_INPUT_READ);
    218218                g_free(phb->host);
    219219                g_free(phb);
     
    230230                if (send(source, cmd, strlen(cmd), 0) < 0) {
    231231                        close(source);
    232                         phb->func(phb->data, -1, B_EV_IO_READ);
     232                        phb->func(phb->data, -1, GAIM_INPUT_READ);
    233233                        g_free(phb->host);
    234234                        g_free(phb);
     
    240240        if (send(source, cmd, strlen(cmd), 0) < 0) {
    241241                close(source);
    242                 phb->func(phb->data, -1, B_EV_IO_READ);
    243                 g_free(phb->host);
    244                 g_free(phb);
    245                 return FALSE;
    246         }
    247 
    248         phb->inpa = b_input_add(source, B_EV_IO_READ, http_canread, phb);
     242                phb->func(phb->data, -1, GAIM_INPUT_READ);
     243                g_free(phb->host);
     244                g_free(phb);
     245                return FALSE;
     246        }
     247
     248        phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);
    249249       
    250250        return FALSE;
     
    273273        memset(packet, 0, sizeof(packet));
    274274        if (read(source, packet, 9) >= 4 && packet[1] == 90) {
    275                 phb->func(phb->data, source, B_EV_IO_READ);
     275                phb->func(phb->data, source, GAIM_INPUT_READ);
    276276                g_free(phb->host);
    277277                g_free(phb);
     
    280280
    281281        close(source);
    282         phb->func(phb->data, -1, B_EV_IO_READ);
     282        phb->func(phb->data, -1, GAIM_INPUT_READ);
    283283        g_free(phb->host);
    284284        g_free(phb);
     
    299299        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
    300300                close(source);
    301                 phb->func(phb->data, -1, B_EV_IO_READ);
     301                phb->func(phb->data, -1, GAIM_INPUT_READ);
    302302                g_free(phb->host);
    303303                g_free(phb);
     
    309309        if (!(hp = gethostbyname(phb->host))) {
    310310                close(source);
    311                 phb->func(phb->data, -1, B_EV_IO_READ);
     311                phb->func(phb->data, -1, GAIM_INPUT_READ);
    312312                g_free(phb->host);
    313313                g_free(phb);
     
    326326        if (write(source, packet, 9) != 9) {
    327327                close(source);
    328                 phb->func(phb->data, -1, B_EV_IO_READ);
    329                 g_free(phb->host);
    330                 g_free(phb);
    331                 return FALSE;
    332         }
    333 
    334         phb->inpa = b_input_add(source, B_EV_IO_READ, s4_canread, phb);
     328                phb->func(phb->data, -1, GAIM_INPUT_READ);
     329                g_free(phb->host);
     330                g_free(phb);
     331                return FALSE;
     332        }
     333
     334        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
    335335       
    336336        return FALSE;
     
    359359        if (read(source, buf, 10) < 10) {
    360360                close(source);
    361                 phb->func(phb->data, -1, B_EV_IO_READ);
     361                phb->func(phb->data, -1, GAIM_INPUT_READ);
    362362                g_free(phb->host);
    363363                g_free(phb);
     
    366366        if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
    367367                close(source);
    368                 phb->func(phb->data, -1, B_EV_IO_READ);
    369                 g_free(phb->host);
    370                 g_free(phb);
    371                 return FALSE;
    372         }
    373 
    374         phb->func(phb->data, source, B_EV_IO_READ);
     368                phb->func(phb->data, -1, GAIM_INPUT_READ);
     369                g_free(phb->host);
     370                g_free(phb);
     371                return FALSE;
     372        }
     373
     374        phb->func(phb->data, source, GAIM_INPUT_READ);
    375375        g_free(phb->host);
    376376        g_free(phb);
     
    396396        if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) {
    397397                close(source);
    398                 phb->func(phb->data, -1, B_EV_IO_READ);
     398                phb->func(phb->data, -1, GAIM_INPUT_READ);
    399399                g_free(phb->host);
    400400                g_free(phb);
     
    402402        }
    403403
    404         phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread_again, phb);
     404        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
    405405}
    406406
     
    414414        if (read(source, buf, 2) < 2) {
    415415                close(source);
    416                 phb->func(phb->data, -1, B_EV_IO_READ);
     416                phb->func(phb->data, -1, GAIM_INPUT_READ);
    417417                g_free(phb->host);
    418418                g_free(phb);
     
    422422        if ((buf[0] != 0x01) || (buf[1] != 0x00)) {
    423423                close(source);
    424                 phb->func(phb->data, -1, B_EV_IO_READ);
     424                phb->func(phb->data, -1, GAIM_INPUT_READ);
    425425                g_free(phb->host);
    426426                g_free(phb);
     
    442442        if (read(source, buf, 2) < 2) {
    443443                close(source);
    444                 phb->func(phb->data, -1, B_EV_IO_READ);
     444                phb->func(phb->data, -1, GAIM_INPUT_READ);
    445445                g_free(phb->host);
    446446                g_free(phb);
     
    450450        if ((buf[0] != 0x05) || (buf[1] == 0xff)) {
    451451                close(source);
    452                 phb->func(phb->data, -1, B_EV_IO_READ);
     452                phb->func(phb->data, -1, GAIM_INPUT_READ);
    453453                g_free(phb->host);
    454454                g_free(phb);
     
    465465                if (write(source, buf, 3 + i + j) < 3 + i + j) {
    466466                        close(source);
    467                         phb->func(phb->data, -1, B_EV_IO_READ);
     467                        phb->func(phb->data, -1, GAIM_INPUT_READ);
    468468                        g_free(phb->host);
    469469                        g_free(phb);
     
    471471                }
    472472
    473                 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_readauth, phb);
     473                phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
    474474        } else {
    475475                s5_sendconnect(phb, source);
     
    491491        if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
    492492                close(source);
    493                 phb->func(phb->data, -1, B_EV_IO_READ);
     493                phb->func(phb->data, -1, GAIM_INPUT_READ);
    494494                g_free(phb->host);
    495495                g_free(phb);
     
    513513        if (write(source, buf, i) < i) {
    514514                close(source);
    515                 phb->func(phb->data, -1, B_EV_IO_READ);
    516                 g_free(phb->host);
    517                 g_free(phb);
    518                 return FALSE;
    519         }
    520 
    521         phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread, phb);
     515                phb->func(phb->data, -1, GAIM_INPUT_READ);
     516                g_free(phb->host);
     517                g_free(phb);
     518                return FALSE;
     519        }
     520
     521        phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
    522522       
    523523        return FALSE;
  • lib/ssl_bogus.c

    r51a799e rba7d16f  
    5959b_input_condition ssl_getdirection( void *conn )
    6060{
    61         return B_EV_IO_READ;
     61        return GAIM_INPUT_READ;
    6262}
    6363
  • lib/ssl_client.h

    r51a799e rba7d16f  
    7171G_MODULE_EXPORT int ssl_getfd( void *conn );
    7272
    73 /* This function returns B_EV_IO_READ/WRITE. With SSL connections it's
     73/* This function returns GAIM_INPUT_READ/WRITE. With SSL connections it's
    7474   possible that something has to be read while actually were trying to
    7575   write something (think about key exchange/refresh/etc). So when an
  • lib/ssl_gnutls.c

    r51a799e rba7d16f  
    106106        struct scd *conn = data;
    107107       
    108         return ssl_connected( conn, conn->fd, B_EV_IO_WRITE );
     108        return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );
    109109}
    110110
     
    244244{
    245245        return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
    246                 B_EV_IO_WRITE : B_EV_IO_READ );
    247 }
     246                GAIM_INPUT_WRITE : GAIM_INPUT_READ );
     247}
  • lib/ssl_nss.c

    r51a799e rba7d16f  
    193193{
    194194        /* Just in case someone calls us, let's return the most likely case: */
    195         return B_EV_IO_READ;
     195        return GAIM_INPUT_READ;
    196196}
  • lib/ssl_openssl.c

    r51a799e rba7d16f  
    102102        struct scd *conn = data;
    103103       
    104         return ssl_connected( conn, conn->fd, B_EV_IO_WRITE );
     104        return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );
    105105}
    106106
     
    270270b_input_condition ssl_getdirection( void *conn )
    271271{
    272         return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ );
    273 }
     272        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
     273}
  • lib/ssl_sspi.c

    r51a799e rba7d16f  
    275275GaimInputCondition ssl_getdirection( void *conn )
    276276{
    277         return B_EV_IO_WRITE; /* FIXME: or B_EV_IO_READ */
    278 }
     277        return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */
     278}
  • lib/url.c

    r51a799e rba7d16f  
    2727
    2828/* Convert an URL to a url_t structure */
    29 int url_set( url_t *url, const char *set_url )
     29int url_set( url_t *url, char *set_url )
    3030{
    3131        char s[MAX_STRING+1];
  • lib/url.h

    r51a799e rba7d16f  
    4242} url_t;
    4343
    44 int url_set( url_t *url, const char *set_url );
     44int url_set( url_t *url, char *set_url );
  • lib/xmltree.c

    r51a799e rba7d16f  
    449449        while( node )
    450450        {
    451                 char *colon;
    452                
    453                 if( g_strcasecmp( node->name, name ) == 0 ||
    454                     ( ( colon = strchr( node->name, ':' ) ) &&
    455                       g_strcasecmp( colon + 1, name ) == 0 ) )
     451                if( g_strcasecmp( node->name, name ) == 0 )
    456452                        break;
    457453               
     
    465461{
    466462        int i;
    467         char *colon;
    468463       
    469464        if( !node )
     
    473468                if( g_strcasecmp( node->attr[i].key, key ) == 0 )
    474469                        break;
    475        
    476         /* This is an awful hack that only takes care of namespace prefixes
    477            inside a tag. Since IMHO excessive namespace usage in XMPP is
    478            massive overkill anyway (this code exists for almost four years
    479            now and never really missed it): Meh. */
    480         if( !node->attr[i].key && strcmp( key, "xmlns" ) == 0 &&
    481             ( colon = strchr( node->name, ':' ) ) )
    482         {
    483                 *colon = '\0';
    484                 for( i = 0; node->attr[i].key; i ++ )
    485                         if( strncmp( node->attr[i].key, "xmlns:", 6 ) == 0 &&
    486                             strcmp( node->attr[i].key + 6, node->name ) == 0 )
    487                                 break;
    488                 *colon = ':';
    489         }
    490470       
    491471        return node->attr[i].value;
  • log.c

    r51a799e rba7d16f  
    172172                fprintf(stdout, "Debug: %s\n", message);
    173173#endif
    174         /* Always log stuff in syslogs too. */
    175         log_syslog(level, message);
    176174        return;
    177175}
  • protocols/jabber/conference.c

    r51a799e rba7d16f  
    272272                }
    273273               
    274                 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS )
    275                 {
    276                         /* If JIDs are anonymized, add them to the local
    277                            list for the duration of this chat. */
     274                if( bud != jc->me )
     275                {
    278276                        imcb_add_buddy( ic, bud->ext_jid, NULL );
    279277                        imcb_buddy_nick_hint( ic, bud->ext_jid, bud->resource );
  • protocols/jabber/io.c

    r51a799e rba7d16f  
    6464                   most cases it probably won't be necessary.) */
    6565                if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
    66                         jd->w_inpa = b_input_add( jd->fd, B_EV_IO_WRITE, jabber_write_callback, ic );
     66                        jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
    6767        }
    6868        else
     
    504504       
    505505        if( jd->r_inpa <= 0 )
    506                 jd->r_inpa = b_input_add( jd->fd, B_EV_IO_READ, jabber_read_callback, ic );
     506                jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
    507507       
    508508        greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
  • protocols/jabber/jabber_util.c

    r51a799e rba7d16f  
    671671time_t jabber_get_timestamp( struct xt_node *xt )
    672672{
     673        struct tm tp, utc;
    673674        struct xt_node *c;
     675        time_t res, tres;
    674676        char *s = NULL;
    675         struct tm tp;
    676677       
    677678        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     
    691692        tp.tm_year -= 1900;
    692693        tp.tm_mon --;
    693        
    694         return mktime_utc( &tp );
     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;
    695718}
    696719
  • protocols/jabber/message.c

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

    r51a799e rba7d16f  
    406406                        bt->phase = BS_PHASE_CONNECTED;
    407407                       
    408                         bt->tf->watch_out = b_input_add( fd, B_EV_IO_WRITE, jabber_bs_recv_handshake, bt );
     408                        bt->tf->watch_out = b_input_add( fd, GAIM_INPUT_WRITE, jabber_bs_recv_handshake, bt );
    409409
    410410                        /* since it takes forever(3mins?) till connect() fails on itself we schedule a timeout */
     
    433433                        bt->phase = BS_PHASE_REQUEST;
    434434
    435                         bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_recv_handshake, bt );
     435                        bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_recv_handshake, bt );
    436436
    437437                        bt->tf->watch_out = 0;
     
    589589
    590590        tf->ft->data = tf;
    591         tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt );
     591        tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );
    592592        tf->ft->write_request = jabber_bs_recv_write_request;
    593593
     
    631631                if( ( ret == -1 ) && ( errno == EAGAIN ) )
    632632                {
    633                         tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt );
     633                        tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );
    634634                        return FALSE;
    635635                }
     
    707707                imcb_file_finished( ft );
    708708        else
    709                 bt->tf->watch_out = b_input_add( tf->fd, B_EV_IO_WRITE, jabber_bs_send_can_write, bt );
     709                bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
    710710               
    711711        return TRUE;
     
    918918                                bt->streamhosts = g_slist_append( bt->streamhosts, sh );
    919919
    920                                 bt->tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_send_handshake, bt );
     920                                bt->tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );
    921921                                bt->connect_timeout = b_timeout_add( JABBER_BS_LISTEN_TIMEOUT * 1000, jabber_bs_connect_timeout, bt );
    922922                        } else {
     
    10551055                        bt->phase = BS_PHASE_CONNECTED;
    10561056
    1057                         bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_send_handshake, bt );
     1057                        bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );
    10581058                        return FALSE;
    10591059                }
  • protocols/msn/invitation.c

    r51a799e rba7d16f  
    209209        sock_make_nonblocking( fd );
    210210
    211         msn_file->r_event_id = b_input_add( fd, B_EV_IO_READ, msn_ftp_read, file );
     211        msn_file->r_event_id = b_input_add( fd, GAIM_INPUT_READ, msn_ftp_read, file );
    212212
    213213        return FALSE;
     
    230230        }
    231231
    232         msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftps_connected, file );
     232        msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftps_connected, file );
    233233
    234234        g_snprintf( buf, sizeof( buf ),
     
    318318       
    319319        sock_make_nonblocking( msn_file->fd );
    320         msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file );
     320        msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );
    321321       
    322322        return FALSE;
     
    415415            ( msn_file->data_sent + msn_file->sbufpos - 3 < file->file_size ) ) {
    416416                if( !msn_file->w_event_id )
    417                         msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file );
     417                        msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );
    418418                return TRUE;
    419419        }
     
    452452                /* we might already be listening if this is data from an overflow */
    453453                if( !msn_file->w_event_id )
    454                         msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file );
     454                        msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );
    455455        }
    456456
     
    617617
    618618        msn_file->r_event_id =
    619                 b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file );
     619                b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );
    620620
    621621        return TRUE;
  • protocols/msn/msn.c

    r51a799e rba7d16f  
    3131GSList *msn_switchboards;
    3232
    33 static char *set_eval_display_name( set_t *set, char *value );
     33static char *msn_set_display_name( set_t *set, char *value );
    3434
    3535static void msn_init( account_t *acc )
    3636{
    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 );
    4143}
    4244
     
    169171static void msn_set_my_name( struct im_connection *ic, char *info )
    170172{
    171         msn_set_display_name( ic, info );
     173        msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
    172174}
    173175
     
    285287}
    286288
    287 static char *set_eval_display_name( set_t *set, char *value )
     289static char *msn_set_display_name( set_t *set, char *value )
    288290{
    289291        account_t *acc = set->data;
    290292        struct im_connection *ic = acc->ic;
    291        
    292         /* Allow any name if we're offline. */
     293        struct msn_data *md;
     294        char buf[1024], *fn;
     295       
     296        /* Double-check. */
    293297        if( ic == NULL )
    294                 return value;
     298                return NULL;
     299       
     300        md = ic->proto_data;
    295301       
    296302        if( strlen( value ) > 129 )
     
    299305                return NULL;
    300306        }
     307       
     308        fn = msn_http_encode( value );
     309       
     310        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
     311        msn_write( ic, buf, strlen( buf ) );
     312        g_free( fn );
    301313       
    302314        /* Returning NULL would be better, because the server still has to
    303315           confirm the name change. However, it looks a bit confusing to the
    304316           user. */
    305         return msn_set_display_name( ic, value ) ? value : NULL;
     317        return value;
    306318}
    307319
  • protocols/msn/msn.h

    r51a799e rba7d16f  
    3131#define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r"
    3232#define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"
    33 #define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r"
    3433
    3534#ifdef DEBUG_MSN
     
    5453                           "TypingUser: %s\r\n" \
    5554                           "\r\n\r\n"
    56 
    57 #define SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \
    58                              "Content-Type: text/x-ping\r\n" \
    59                              "\r\n\r\n"
    6055
    6156#define PROFILE_URL "http://members.msn.com/"
     
    8984        gint inp;
    9085        struct msn_handler_data *handler;
    91         gint keepalive;
    9286       
    9387        int trId;
     
    168162char *msn_http_encode( const char *input );
    169163void msn_msgq_purge( struct im_connection *ic, GSList **list );
    170 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );
    171164
    172165/* tables.c */
     
    187180gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
    188181int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m );
    189 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial );
    190 void msn_sb_stop_keepalives( struct msn_switchboard *sb );
    191182
    192183/* invitation.c */
  • protocols/msn/msn_util.c

    r51a799e rba7d16f  
    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
     
    377377        g_string_free( ret, TRUE );
    378378}
    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

    r51a799e rba7d16f  
    3535
    3636static 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 );
    3837
    3938gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
     
    7675        if( msn_write( ic, s, strlen( s ) ) )
    7776        {
    78                 ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic );
     77                ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
    7978                imcb_log( ic, "Connected to server, waiting for reply" );
    8079        }
     
    232231                else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 )
    233232                {
     233                        set_t *s;
     234                       
    234235                        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                        }
    236248                        else
     249                        {
    237250                                imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
     251                        }
    238252                       
    239253                        imcb_log( ic, "Authenticated, getting buddy list" );
     
    422436        else if( strcmp( cmd[0], "FLN" ) == 0 )
    423437        {
    424                 if( cmd[1] == NULL )
    425                         return 1;
    426                
    427                 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL );
    428                
    429                 msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE );
     438                if( cmd[1] )
     439                        imcb_buddy_status( ic, cmd[1], 0, NULL, NULL );
    430440        }
    431441        else if( strcmp( cmd[0], "NLN" ) == 0 )
     
    453463                                   ( st != msn_away_state_list ? OPT_AWAY : 0 ),
    454464                                   st->name, NULL );
    455                
    456                 msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) );
    457465        }
    458466        else if( strcmp( cmd[0], "RNG" ) == 0 )
     
    559567                return( 0 );
    560568        }
    561 #if 0
    562         /* Discard this one completely for now since I don't care about the ack
    563            and since MSN servers can apparently screw up the formatting. */
    564569        else if( strcmp( cmd[0], "REA" ) == 0 )
    565570        {
     
    592597                }
    593598        }
    594 #endif
    595599        else if( strcmp( cmd[0], "IPG" ) == 0 )
    596600        {
     
    742746        }
    743747}
    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 address
    764                    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         else
    769         {
    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                 else
    782                 {
    783                         imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
    784                 }
    785                
    786                 return TRUE;
    787         }
    788 }
  • protocols/msn/sb.c

    r51a799e rba7d16f  
    180180                        i = strlen( buf );
    181181                }
    182                 else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 )
    183                 {
    184                         buf = g_strdup( SB_KEEPALIVE_HEADERS );
    185                         i = strlen( buf );
    186                 }
    187182                else
    188183                {
     
    261256       
    262257        msn_msgq_purge( ic, &sb->msgq );
    263         msn_sb_stop_keepalives( sb );
    264258       
    265259        if( sb->key ) g_free( sb->key );
     
    321315       
    322316        if( msn_sb_write( sb, buf, strlen( buf ) ) )
    323                 sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb );
     317                sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
    324318        else
    325319                debug( "Error %d while connecting to switchboard server", 2 );
     
    334328        struct msn_data *md = ic->proto_data;
    335329       
    336         if( msn_handler( sb->handler ) != -1 )
    337                 return TRUE;
    338        
    339         if( sb->msgq != NULL )
     330        if( msn_handler( sb->handler ) == -1 )
    340331        {
    341332                time_t now = time( NULL );
    342                 char buf[1024];
    343333               
    344334                if( now - md->first_sb_failure > 600 )
     
    357347                                      "There might be problems delivering your messages." );
    358348               
    359                 if( md->msgq == NULL )
    360                 {
    361                         md->msgq = sb->msgq;
    362                 }
    363                 else
    364                 {
    365                         GSList *l;
    366                        
    367                         for( l = md->msgq; l->next; l = l->next );
    368                         l->next = sb->msgq;
    369                 }
    370                 sb->msgq = NULL;
    371                
    372                 debug( "Moved queued messages back to the main queue, "
    373                        "creating a new switchboard to retry." );
    374                 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    375                 if( !msn_write( ic, buf, strlen( buf ) ) )
    376                         return FALSE;
    377         }
    378        
    379         msn_sb_destroy( sb );
    380         return FALSE;
     349                if( sb->msgq != NULL )
     350                {
     351                        char buf[1024];
     352                       
     353                        if( md->msgq == NULL )
     354                        {
     355                                md->msgq = sb->msgq;
     356                        }
     357                        else
     358                        {
     359                                GSList *l;
     360                               
     361                                for( l = md->msgq; l->next; l = l->next );
     362                                l->next = sb->msgq;
     363                        }
     364                        sb->msgq = NULL;
     365                       
     366                        debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." );
     367                        g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
     368                        if( !msn_write( ic, buf, strlen( buf ) ) )
     369                                return FALSE;
     370                }
     371               
     372                msn_sb_destroy( sb );
     373               
     374                return FALSE;
     375        }
     376        else
     377        {
     378                return TRUE;
     379        }
    381380}
    382381
     
    478477               
    479478                sb->ready = 1;
    480                
    481                 msn_sb_start_keepalives( sb, FALSE );
    482479        }
    483480        else if( strcmp( cmd[0], "CAL" ) == 0 )
     
    529526                        }
    530527                       
    531                         msn_sb_start_keepalives( sb, FALSE );
    532                        
    533528                        return( st );
    534529                }
     
    592587                if( sb->who )
    593588                {
    594                         msn_sb_stop_keepalives( sb );
    595                        
    596589                        /* This is a single-person chat, and the other person is leaving. */
    597590                        g_free( sb->who );
     
    756749        return( 1 );
    757750}
    758 
    759 static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond )
    760 {
    761         struct msn_switchboard *sb = data;
    762         return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE );
    763 }
    764 
    765 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial )
    766 {
    767         struct buddy *b;
    768        
    769         if( sb && sb->who && sb->keepalive == 0 &&
    770             ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present &&
    771             set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) )
    772         {
    773                 if( initial )
    774                         msn_sb_keepalive( sb, 0, 0 );
    775                
    776                 sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb );
    777         }
    778 }
    779 
    780 void msn_sb_stop_keepalives( struct msn_switchboard *sb )
    781 {
    782         if( sb && sb->keepalive > 0 )
    783         {
    784                 b_event_remove( sb->keepalive );
    785                 sb->keepalive = 0;
    786         }
    787 }
  • protocols/nogaim.c

    r51a799e rba7d16f  
    3939
    4040static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );
    41 static char *format_timestamp( irc_t *irc, time_t msg_ts );
    4241
    4342GSList *connections;
     
    117116{
    118117        GList *gl;
    119        
    120         for( gl = protocols; gl; gl = gl->next )
     118        for (gl = protocols; gl; gl = gl->next)
    121119        {
    122120                struct prpl *proto = gl->data;
    123                
    124                 if( g_strcasecmp( proto->name, name ) == 0 )
     121                if(!g_strcasecmp(proto->name, name))
    125122                        return proto;
    126123        }
    127        
    128124        return NULL;
    129125}
     
    136132        extern void byahoo_initmodule();
    137133        extern void jabber_initmodule();
    138         extern void twitter_initmodule();
    139         extern void purple_initmodule();
    140134
    141135#ifdef WITH_MSN
     
    153147#ifdef WITH_JABBER
    154148        jabber_initmodule();
    155 #endif
    156 
    157 #ifdef WITH_TWITTER
    158         twitter_initmodule();
    159 #endif
    160        
    161 #ifdef WITH_PURPLE
    162         purple_initmodule();
    163149#endif
    164150
     
    665651        u->away = u->status_msg = NULL;
    666652       
    667         if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online )
    668         {
    669                 /* always set users as online */
     653        if( ( flags & OPT_LOGGED_IN ) && !u->online )
     654        {
    670655                irc_spawn( ic->irc, u );
    671656                u->online = 1;
    672                 if( !( flags & OPT_LOGGED_IN ) )
    673                 {
    674                         /* set away message if user isn't really online */
    675                         u->away = g_strdup( "User is offline" );
    676                 }
    677         }
    678         else if( ( flags & OPT_LOGGED_IN ) && !u->online )
    679         {
    680                 irc_spawn( ic->irc, u );
    681                 u->online = 1;
    682657        }
    683658        else if( !( flags & OPT_LOGGED_IN ) && u->online )
     
    685660                struct groupchat *c;
    686661               
    687                 if( set_getbool( &ic->irc->set, "show_offline" ) )
    688                 {
    689                         /* keep offline users in channel and set away message to "offline" */
    690                         u->away = g_strdup( "User is offline" );
    691 
    692                         /* Keep showing him/her in the control channel but not in groupchats. */
    693                         for( c = ic->groupchats; c; c = c->next )
    694                         {
    695                                 if( remove_chat_buddy_silent( c, handle ) && c->joined )
    696                                         irc_part( c->ic->irc, u, c->channel );
    697                         }
     662                irc_kill( ic->irc, u );
     663                u->online = 0;
     664               
     665                /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
     666                for( c = ic->groupchats; c; c = c->next )
     667                        remove_chat_buddy_silent( c, handle );
     668        }
     669       
     670        if( flags & OPT_AWAY )
     671        {
     672                if( state && message )
     673                {
     674                        u->away = g_strdup_printf( "%s (%s)", state, message );
     675                }
     676                else if( state )
     677                {
     678                        u->away = g_strdup( state );
     679                }
     680                else if( message )
     681                {
     682                        u->away = g_strdup( message );
    698683                }
    699684                else
    700685                {
    701                         /* kill offline users */
    702                         irc_kill( ic->irc, u );
    703                         u->online = 0;
    704 
    705                         /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
    706                         for( c = ic->groupchats; c; c = c->next )
    707                                 remove_chat_buddy_silent( c, handle );
    708                 }
    709         }
    710 
    711         if( flags & OPT_AWAY )
    712         {
    713                 if( state && message )
    714                 {
    715                         u->away = g_strdup_printf( "%s (%s)", state, message );
    716                 }
    717                 else if( state )
    718                 {
    719                         u->away = g_strdup( state );
    720                 }
    721                 else if( message )
    722                 {
    723                         u->away = g_strdup( message );
    724                 }
    725                 else
    726                 {
    727686                        u->away = g_strdup( "Away" );
    728687                }
     
    733692        }
    734693       
    735         /* early if-clause for show_offline even if there is some redundant code here because this isn't LISP but C ;) */
    736         if( set_getbool( &ic->irc->set, "show_offline" ) && set_getbool( &ic->irc->set, "away_devoice" ) )
     694        /* LISPy... */
     695        if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
     696            ( u->online ) &&                                            /* Don't touch offline people */
     697            ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
     698              ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
    737699        {
    738700                char *from;
     
    747709                                                            ic->irc->myhost );
    748710                }
    749 
    750                 /* if we use show_offline, we op online users, voice away users, and devoice/deop offline users */
    751                 if( flags & OPT_LOGGED_IN )
    752                 {
    753                         /* user is "online" (either really online or away) */
    754                         irc_write( ic->irc, ":%s MODE %s %cv%co %s %s", from, ic->irc->channel,
    755                                                                   u->away?'+':'-', u->away?'-':'+', u->nick, u->nick );
    756                 }
    757                 else
    758                 {
    759                         /* user is offline */
    760                         irc_write( ic->irc, ":%s MODE %s -vo %s %s", from, ic->irc->channel, u->nick, u->nick );
    761                 }
    762         }
    763         else
    764         {
    765                 /* LISPy... */
    766                 if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    767                     ( u->online ) &&                                            /* Don't touch offline people */
    768                     ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    769                       ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
    770                 {
    771                         char *from;
    772 
    773                         if( set_getbool( &ic->irc->set, "simulate_netsplit" ) )
    774                         {
    775                                 from = g_strdup( ic->irc->myhost );
    776                         }
    777                         else
    778                         {
    779                                 from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
    780                                                                     ic->irc->myhost );
    781                         }
    782                         irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    783                                                                   u->away?'-':'+', u->nick );
    784                         g_free( from );
    785                 }
     711                irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
     712                                                          u->away?'-':'+', u->nick );
     713                g_free( from );
    786714        }
    787715}
     
    790718{
    791719        irc_t *irc = ic->irc;
    792         char *wrapped, *ts = NULL;
     720        char *wrapped;
    793721        user_t *u;
    794722       
     
    832760            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    833761                strip_html( msg );
    834        
    835         if( set_getbool( &ic->irc->set, "display_timestamps" ) &&
    836             ( ts = format_timestamp( irc, sent_at ) ) )
    837         {
    838                 char *new = g_strconcat( ts, msg, NULL );
    839                 g_free( ts );
    840                 ts = msg = new;
    841         }
    842        
     762
    843763        wrapped = word_wrap( msg, 425 );
    844764        irc_msgfrom( irc, u->nick, wrapped );
    845765        g_free( wrapped );
    846         g_free( ts );
    847766}
    848767
     
    886805       
    887806        return c;
    888 }
    889 
    890 void imcb_chat_name_hint( struct groupchat *c, const char *name )
    891 {
    892         if( !c->joined )
    893         {
    894                 struct im_connection *ic = c->ic;
    895                 char stripped[MAX_NICK_LENGTH+1], *full_name;
    896                
    897                 strncpy( stripped, name, MAX_NICK_LENGTH );
    898                 stripped[MAX_NICK_LENGTH] = '\0';
    899                 nick_strip( stripped );
    900                 if( set_getbool( &ic->irc->set, "lcnicks" ) )
    901                         nick_lc( stripped );
    902                
    903                 full_name = g_strdup_printf( "&%s", stripped );
    904                
    905                 if( stripped[0] &&
    906                     nick_cmp( stripped, ic->irc->channel + 1 ) != 0 &&
    907                     irc_chat_by_channel( ic->irc, full_name ) == NULL )
    908                 {
    909                         g_free( c->channel );
    910                         c->channel = full_name;
    911                 }
    912                 else
    913                 {
    914                         g_free( full_name );
    915                 }
    916         }
    917807}
    918808
     
    977867        if( c && u )
    978868        {
    979                 char *ts = NULL;
    980                 if( set_getbool( &ic->irc->set, "display_timestamps" ) )
    981                         ts = format_timestamp( ic->irc, sent_at );
    982                 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped );
    983                 g_free( ts );
     869                irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped );
    984870        }
    985871        else
     
    11751061}
    11761062
    1177 char *set_eval_timezone( set_t *set, char *value )
    1178 {
    1179         char *s;
    1180        
    1181         if( strcmp( value, "local" ) == 0 ||
    1182             strcmp( value, "gmt" ) == 0 || strcmp( value, "utc" ) == 0 )
    1183                 return value;
    1184        
    1185         /* Otherwise: +/- at the beginning optional, then one or more numbers,
    1186            possibly followed by a colon and more numbers. Don't bother bound-
    1187            checking them since users are free to shoot themselves in the foot. */
    1188         s = value;
    1189         if( *s == '+' || *s == '-' )
    1190                 s ++;
    1191        
    1192         /* \d+ */
    1193         if( !isdigit( *s ) )
    1194                 return SET_INVALID;
    1195         while( *s && isdigit( *s ) ) s ++;
    1196        
    1197         /* EOS? */
    1198         if( *s == '\0' )
    1199                 return value;
    1200        
    1201         /* Otherwise, colon */
    1202         if( *s != ':' )
    1203                 return SET_INVALID;
    1204         s ++;
    1205        
    1206         /* \d+ */
    1207         if( !isdigit( *s ) )
    1208                 return SET_INVALID;
    1209         while( *s && isdigit( *s ) ) s ++;
    1210        
    1211         /* EOS */
    1212         return *s == '\0' ? value : SET_INVALID;
    1213 }
    1214 
    1215 static char *format_timestamp( irc_t *irc, time_t msg_ts )
    1216 {
    1217         time_t now_ts = time( NULL );
    1218         struct tm now, msg;
    1219         char *set;
    1220        
    1221         /* If the timestamp is <= 0 or less than a minute ago, discard it as
    1222            it doesn't seem to add to much useful info and/or might be noise. */
    1223         if( msg_ts <= 0 || msg_ts > now_ts - 60 )
    1224                 return NULL;
    1225        
    1226         set = set_getstr( &irc->set, "timezone" );
    1227         if( strcmp( set, "local" ) == 0 )
    1228         {
    1229                 localtime_r( &now_ts, &now );
    1230                 localtime_r( &msg_ts, &msg );
    1231         }
    1232         else
    1233         {
    1234                 int hr, min = 0, sign = 60;
    1235                
    1236                 if( set[0] == '-' )
    1237                 {
    1238                         sign *= -1;
    1239                         set ++;
    1240                 }
    1241                 else if( set[0] == '+' )
    1242                 {
    1243                         set ++;
    1244                 }
    1245                
    1246                 if( sscanf( set, "%d:%d", &hr, &min ) >= 1 )
    1247                 {
    1248                         msg_ts += sign * ( hr * 60 + min );
    1249                         now_ts += sign * ( hr * 60 + min );
    1250                 }
    1251                
    1252                 gmtime_r( &now_ts, &now );
    1253                 gmtime_r( &msg_ts, &msg );
    1254         }
    1255        
    1256         if( msg.tm_year == now.tm_year && msg.tm_yday == now.tm_yday )
    1257                 return g_strdup_printf( "\x02[\x02\x02\x02%02d:%02d:%02d\x02]\x02 ",
    1258                                         msg.tm_hour, msg.tm_min, msg.tm_sec );
    1259         else
    1260                 return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d "
    1261                                         "%02d:%02d:%02d\x02]\x02 ",
    1262                                         msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday,
    1263                                         msg.tm_hour, msg.tm_min, msg.tm_sec );
    1264 }
     1063
     1064
    12651065
    12661066/* The plan is to not allow straight calls to prpl functions anymore, but do
     
    13051105{
    13061106        char *away, *msg = NULL;
    1307        
    1308         if( ic->acc->prpl->away_states == NULL ||
    1309             ic->acc->prpl->set_away == NULL )
    1310                 return 0;
    13111107       
    13121108        away = set_getstr( &ic->acc->set, "away" ) ?
  • protocols/nogaim.h

    r51a799e rba7d16f  
    134134         * - The user sees this name ie. when imcb_log() is used. */
    135135        const char *name;
    136         void *data;
    137136
    138137        /* Added this one to be able to add per-account settings, don't think
     
    308307 *   user, too. */
    309308G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle );
    310 G_MODULE_EXPORT void imcb_chat_name_hint( struct groupchat *c, const char *name );
    311309G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );
    312310/* To remove a handle from a group chat. Reason can be NULL. */
     
    331329
    332330/* Misc. stuff */
    333 char *set_eval_timezone( set_t *set, char *value );
    334331char *set_eval_away_devoice( set_t *set, char *value );
    335332gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
  • protocols/oscar/oscar.c

    r51a799e rba7d16f  
    205205static int gaim_icbm_param_info  (aim_session_t *, aim_frame_t *, ...);
    206206static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...);
     207static int gaim_memrequest       (aim_session_t *, aim_frame_t *, ...);
    207208static int gaim_selfinfo         (aim_session_t *, aim_frame_t *, ...);
    208209static int gaim_offlinemsg       (aim_session_t *, aim_frame_t *, ...);
     
    290291        odata = (struct oscar_data *)ic->proto_data;
    291292
    292         if (condition & B_EV_IO_READ) {
     293        if (condition & GAIM_INPUT_READ) {
    293294                if (aim_get_command(odata->sess, conn) >= 0) {
    294295                        aim_rxdispatch(odata->sess);
     
    362363
    363364        aim_conn_completeconnect(sess, conn);
    364         ic->inpa = b_input_add(conn->fd, B_EV_IO_READ,
     365        ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    365366                        oscar_callback, conn);
    366367       
     
    492493
    493494        aim_conn_completeconnect(sess, bosconn);
    494         ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ,
     495        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    495496                        oscar_callback, bosconn);
    496497        imcb_log(ic, _("Connection established, cookie sent"));
     
    569570        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ERROR, gaim_parse_genericerr, 0);
    570571        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BOS, AIM_CB_BOS_ERROR, gaim_parse_genericerr, 0);
     572        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, 0x1f, gaim_memrequest, 0);
    571573        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SELFINFO, gaim_selfinfo, 0);
    572574        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0);
     
    602604}
    603605
     606struct pieceofcrap {
     607        struct im_connection *ic;
     608        unsigned long offset;
     609        unsigned long len;
     610        char *modname;
     611        int fd;
     612        aim_conn_t *conn;
     613        unsigned int inpa;
     614};
     615
     616static gboolean damn_you(gpointer data, gint source, b_input_condition c)
     617{
     618        struct pieceofcrap *pos = data;
     619        struct oscar_data *od = pos->ic->proto_data;
     620        char in = '\0';
     621        int x = 0;
     622        unsigned char m[17];
     623
     624        while (read(pos->fd, &in, 1) == 1) {
     625                if (in == '\n')
     626                        x++;
     627                else if (in != '\r')
     628                        x = 0;
     629                if (x == 2)
     630                        break;
     631                in = '\0';
     632        }
     633        if (in != '\n') {
     634                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     635                                " You may be disconnected shortly.");
     636                b_event_remove(pos->inpa);
     637                closesocket(pos->fd);
     638                g_free(pos);
     639                return FALSE;
     640        }
     641        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
     642        read(pos->fd, m, 16);
     643        m[16] = '\0';
     644        b_event_remove(pos->inpa);
     645        closesocket(pos->fd);
     646        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
     647        g_free(pos);
     648       
     649        return FALSE;
     650}
     651
     652static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
     653        struct pieceofcrap *pos = data;
     654        char buf[BUF_LONG];
     655
     656        if (source < 0) {
     657                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     658                                " You may be disconnected shortly.");
     659                if (pos->modname)
     660                        g_free(pos->modname);
     661                g_free(pos);
     662                return FALSE;
     663        }
     664
     665        g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
     666                        "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
     667                        pos->offset, pos->len, pos->modname ? pos->modname : "");
     668        write(pos->fd, buf, strlen(buf));
     669        if (pos->modname)
     670                g_free(pos->modname);
     671        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     672        return FALSE;
     673}
     674
    604675/* size of icbmui.ocm, the largest module in AIM 3.5 */
    605676#define AIM_MAX_FILE_SIZE 98304
     677
     678int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
     679        va_list ap;
     680        struct pieceofcrap *pos;
     681        guint32 offset, len;
     682        char *modname;
     683        int fd;
     684
     685        va_start(ap, fr);
     686        offset = (guint32)va_arg(ap, unsigned long);
     687        len = (guint32)va_arg(ap, unsigned long);
     688        modname = va_arg(ap, char *);
     689        va_end(ap);
     690
     691        if (len == 0) {
     692                aim_sendmemblock(sess, fr->conn, offset, len, NULL,
     693                                AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
     694                return 1;
     695        }
     696        /* uncomment this when you're convinced it's right. remember, it's been wrong before.
     697        if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
     698                char *buf;
     699                int i = 8;
     700                if (modname)
     701                        i += strlen(modname);
     702                buf = g_malloc(i);
     703                i = 0;
     704                if (modname) {
     705                        memcpy(buf, modname, strlen(modname));
     706                        i += strlen(modname);
     707                }
     708                buf[i++] = offset & 0xff;
     709                buf[i++] = (offset >> 8) & 0xff;
     710                buf[i++] = (offset >> 16) & 0xff;
     711                buf[i++] = (offset >> 24) & 0xff;
     712                buf[i++] = len & 0xff;
     713                buf[i++] = (len >> 8) & 0xff;
     714                buf[i++] = (len >> 16) & 0xff;
     715                buf[i++] = (len >> 24) & 0xff;
     716                aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
     717                g_free(buf);
     718                return 1;
     719        }
     720        */
     721
     722        pos = g_new0(struct pieceofcrap, 1);
     723        pos->ic = sess->aux_data;
     724        pos->conn = fr->conn;
     725
     726        pos->offset = offset;
     727        pos->len = len;
     728        pos->modname = modname ? g_strdup(modname) : NULL;
     729
     730        fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
     731        if (fd < 0) {
     732                if (pos->modname)
     733                        g_free(pos->modname);
     734                g_free(pos);
     735                imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
     736                                " You may be disconnected shortly.");
     737        }
     738        pos->fd = fd;
     739
     740        return 1;
     741}
    606742
    607743static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
     
    702838
    703839        aim_conn_completeconnect(sess, tstconn);
    704         odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ,
     840        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    705841                                        oscar_callback, tstconn);
    706842       
     
    730866
    731867        aim_conn_completeconnect(sess, tstconn);
    732         odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ,
     868        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    733869                                oscar_callback, tstconn);
    734870       
     
    766902        aim_conn_completeconnect(sess, ccon->conn);
    767903        ccon->inpa = b_input_add(tstconn->fd,
    768                         B_EV_IO_READ,
     904                        GAIM_INPUT_READ,
    769905                        oscar_callback, tstconn);
    770906        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     
    25152651        char * chatname;
    25162652       
    2517         chatname = g_strdup_printf("%s%s_%d", isdigit(*ic->acc->user) ? "icq_" : "",
    2518                                    ic->acc->user, chat_id++);
     2653        chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++);
    25192654 
    25202655        ret = oscar_chat_join(ic, chatname, NULL, NULL);
  • protocols/yahoo/yahoo.c

    r51a799e rba7d16f  
    138138        struct im_connection *ic = imcb_new( acc );
    139139        struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 );
    140         char *s;
    141140       
    142141        yd->logged_in = FALSE;
    143142        yd->current_status = YAHOO_STATUS_AVAILABLE;
    144        
    145         if( ( s = strchr( acc->user, '@' ) ) && g_strcasecmp( s, "@yahoo.com" ) == 0 )
    146                 imcb_error( ic, "Your Yahoo! username should just be a username. "
    147                                 "Do not include any @domain part." );
    148143       
    149144        imcb_log( ic, "Connecting" );
     
    686681               
    687682                inp->d = d;
    688                 d->tag = inp->h = b_input_add( fd, B_EV_IO_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
     683                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
    689684        }
    690685        else if( cond == YAHOO_INPUT_WRITE )
     
    697692               
    698693                inp->d = d;
    699                 d->tag = inp->h = b_input_add( fd, B_EV_IO_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
     694                d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
    700695        }
    701696        else
     
    833828        YList *m;
    834829       
    835         if( g_strcasecmp( who, ic->acc->user ) == 0 )
    836                 /* WTF, Yahoo! seems to echo these now? */
    837                 return;
    838        
    839830        inv = g_malloc( sizeof( struct byahoo_conf_invitation ) );
    840831        memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
  • set.c

    r51a799e rba7d16f  
    2929char *SET_INVALID = "nee";
    3030
    31 set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data )
     31set_t *set_add( set_t **head, char *key, char *def, set_eval eval, void *data )
    3232{
    3333        set_t *s = set_find( head, key );
     
    6363}
    6464
    65 set_t *set_find( set_t **head, const char *key )
     65set_t *set_find( set_t **head, char *key )
    6666{
    6767        set_t *s = *head;
     
    7777}
    7878
    79 char *set_getstr( set_t **head, const char *key )
     79char *set_getstr( set_t **head, char *key )
    8080{
    8181        set_t *s = set_find( head, key );
     
    8787}
    8888
    89 int set_getint( set_t **head, const char *key )
     89int set_getint( set_t **head, char *key )
    9090{
    9191        char *s = set_getstr( head, key );
     
    101101}
    102102
    103 int set_getbool( set_t **head, const char *key )
     103int set_getbool( set_t **head, char *key )
    104104{
    105105        char *s = set_getstr( head, key );
     
    111111}
    112112
    113 int set_setstr( set_t **head, const char *key, char *value )
     113int set_setstr( set_t **head, char *key, char *value )
    114114{
    115115        set_t *s = set_find( head, key );
     
    150150}
    151151
    152 int set_setint( set_t **head, const char *key, int value )
     152int set_setint( set_t **head, char *key, int value )
    153153{
    154154        char s[24];     /* Not quite 128-bit clean eh? ;-) */
     
    158158}
    159159
    160 void set_del( set_t **head, const char *key )
     160void set_del( set_t **head, char *key )
    161161{
    162162        set_t *s = *head, *t = NULL;
     
    182182}
    183183
    184 int set_reset( set_t **head, const char *key )
     184int set_reset( set_t **head, char *key )
    185185{
    186186        set_t *s;
     
    211211{
    212212        return is_bool( value ) ? value : SET_INVALID;
    213 }
    214 
    215 char *set_eval_list( set_t *set, char *value )
    216 {
    217         GSList *options = set->eval_data, *opt;
    218        
    219         for( opt = options; opt; opt = opt->next )
    220                 if( strcmp( value, opt->data ) == 0 )
    221                         return value;
    222        
    223         /* TODO: It'd be nice to show the user a list of allowed values,
    224                  but we don't have enough context here to do that. May
    225                  want to fix that. */
    226        
    227         return NULL;
    228213}
    229214
  • set.h

    r51a799e rba7d16f  
    6969           set_setstr() should be able to free() the returned string! */
    7070        set_eval eval;
    71         void *eval_data;
    7271        struct set *next;
    7372} set_t;
    7473
    7574/* Should be pretty clear. */
    76 set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data );
     75set_t *set_add( set_t **head, char *key, char *def, set_eval eval, void *data );
    7776
    7877/* Returns the raw set_t. Might be useful sometimes. */
    79 set_t *set_find( set_t **head, const char *key );
     78set_t *set_find( set_t **head, char *key );
    8079
    8180/* Returns a pointer to the string value of this setting. Don't modify the
    8281   returned string, and don't free() it! */
    83 G_MODULE_EXPORT char *set_getstr( set_t **head, const char *key );
     82G_MODULE_EXPORT char *set_getstr( set_t **head, char *key );
    8483
    8584/* Get an integer. In previous versions set_getint() was also used to read
    8685   boolean values, but this SHOULD be done with set_getbool() now! */
    87 G_MODULE_EXPORT int set_getint( set_t **head, const char *key );
    88 G_MODULE_EXPORT int set_getbool( set_t **head, const char *key );
     86G_MODULE_EXPORT int set_getint( set_t **head, char *key );
     87G_MODULE_EXPORT int set_getbool( set_t **head, char *key );
    8988
    9089/* set_setstr() strdup()s the given value, so after using this function
    9190   you can free() it, if you want. */
    92 int set_setstr( set_t **head, const char *key, char *value );
    93 int set_setint( set_t **head, const char *key, int value );
    94 void set_del( set_t **head, const char *key );
    95 int set_reset( set_t **head, const char *key );
     91int set_setstr( set_t **head, char *key, char *value );
     92int set_setint( set_t **head, char *key, int value );
     93void set_del( set_t **head, char *key );
     94int set_reset( set_t **head, char *key );
    9695
    9796/* Two very useful generic evaluators. */
    9897char *set_eval_int( set_t *set, char *value );
    9998char *set_eval_bool( set_t *set, char *value );
    100 
    101 /* Another more complicated one. */
    102 char *set_eval_list( set_t *set, char *value );
    10399
    104100/* Some not very generic evaluators that really shouldn't be here... */
  • storage_xml.c

    r51a799e rba7d16f  
    496496                goto write_error;
    497497       
    498         fsync( fd );
    499498        close( fd );
    500499       
  • unix.c

    r51a799e rba7d16f  
    5656       
    5757        log_init();
    58        
    5958        global.conf_file = g_strdup( CONF_FILE_DEF );
    6059        global.conf = conf_load( argc, argv );
     
    6362       
    6463        b_main_init();
     64        nogaim_init();
    6565       
    6666        srand( time( NULL ) ^ getpid() );
    67        
    6867        global.helpfile = g_strdup( HELP_FILE );
    69         if( help_init( &global.help, global.helpfile ) == NULL )
    70                 log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );
    71 
    72         global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
    73         if( global.storage == NULL )
    74         {
    75                 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage );
    76                 return( 1 );
    77         }
    7868       
    7969        if( global.conf->runmode == RUNMODE_INETD )
     
    8373       
    8474                i = bitlbee_inetd_init();
    85                 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 );
    8676
    8777        }
    8878        else if( global.conf->runmode == RUNMODE_DAEMON )
    8979        {
    90                 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
    91                 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
     80                log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
     81                log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
    9282
    9383                i = bitlbee_daemon_init();
    94                 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 );
    9585        }
    9686        else if( global.conf->runmode == RUNMODE_FORKDAEMON )
    9787        {
    98                 log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE );
    99                 log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE );
    100 
    10188                /* In case the operator requests a restart, we need this. */
    10289                old_cwd = g_malloc( 256 );
     
    10996               
    11097                i = bitlbee_daemon_init();
    111                 log_message( LOGLVL_INFO, "BitlBee %s starting in forking daemon mode.", BITLBEE_VERSION );
     98                log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION );
    11299        }
    113100        if( i != 0 )
     
    126113                        setuid( pw->pw_uid );
    127114                }
     115        }
     116
     117        global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
     118        if( global.storage == NULL )
     119        {
     120                log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage );
     121                return( 1 );
    128122        }
    129123       
     
    145139        if( !getuid() || !geteuid() )
    146140                log_message( LOGLVL_WARNING, "BitlBee is running with root privileges. Why?" );
     141        if( help_init( &global.help, global.helpfile ) == NULL )
     142                log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );
    147143       
    148144        b_main_run();
Note: See TracChangeset for help on using the changeset viewer.