Changes in / [ae3dc99:f1b7711]


Ignore:
Files:
11 deleted
43 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rae3dc99 rf1b7711  
    1010
    1111# Program variables
    12 objects = account.o bitlbee.o chat.o crypting.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o
    13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h
     12objects = account.o bitlbee.o chat.o crypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o
     13headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h
    1414subdirs = lib protocols
    1515
  • bitlbee.c

    rae3dc99 rf1b7711  
    121121        }
    122122       
    123         global.listen_watch_source_id = b_input_add( global.listen_socket, B_EV_IO_READ, bitlbee_io_new_client, NULL );
     123        global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );
    124124       
    125125#ifndef _WIN32
     
    321321                        child->pid = client_pid;
    322322                        child->ipc_fd = fds[0];
    323                         child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
     323                        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    324324                        child_list = g_slist_append( child_list, child );
    325325                       
     
    349349                        /* We can store the IPC fd there now. */
    350350                        global.listen_socket = fds[1];
    351                         global.listen_watch_source_id = b_input_add( fds[1], B_EV_IO_READ, ipc_child_read, irc );
     351                        global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );
    352352                       
    353353                        close( fds[0] );
  • conf.c

    rae3dc99 rf1b7711  
    6363        conf->ping_timeout = 300;
    6464        conf->user = NULL;
    65         conf->ft_max_size = SIZE_MAX;
    66         conf->ft_max_kbps = G_MAXUINT;
    67         conf->ft_listen = NULL;
    6865        conf->protocols = NULL;
    6966        proxytype = 0;
     
    318315                                conf->user = g_strdup( ini->value );
    319316                        }
    320                         else if( g_strcasecmp( ini->key, "ft_max_size" ) == 0 )
    321                         {
    322                                 size_t ft_max_size;
    323                                 if( sscanf( ini->value, "%zu", &ft_max_size ) != 1 )
    324                                 {
    325                                         fprintf( stderr, "Invalid %s value: %s\n", ini->key, ini->value );
    326                                         return 0;
    327                                 }
    328                                 conf->ft_max_size = ft_max_size;
    329                         }
    330                         else if( g_strcasecmp( ini->key, "ft_max_kbps" ) == 0 )
    331                         {
    332                                 if( sscanf( ini->value, "%d", &i ) != 1 )
    333                                 {
    334                                         fprintf( stderr, "Invalid %s value: %s\n", ini->key, ini->value );
    335                                         return 0;
    336                                 }
    337                                 conf->ft_max_kbps = i;
    338                         }
    339                         else if( g_strcasecmp( ini->key, "ft_listen" ) == 0 )
    340                         {
    341                                 g_free( conf->ft_listen );
    342                                 conf->ft_listen = g_strdup( ini->value );
    343                         }
    344317                        else if( g_strcasecmp( ini->key, "protocols" ) == 0 )
    345318                        {
  • conf.h

    rae3dc99 rf1b7711  
    5050        int ping_timeout;
    5151        char *user;
    52         size_t ft_max_size;
    53         int ft_max_kbps;
    54         char *ft_listen;
    5552        char **protocols;
    5653} conf_t;
  • configure

    rae3dc99 rf1b7711  
    2727yahoo=1
    2828twitter=1
    29 purple=0
    3029
    3130debug=0
     
    6968--yahoo=0/1     Disable/enable Yahoo part               $yahoo
    7069--twitter=0/1 Disable/enable Twitter part               $twitter
    71 
    72 --purple=0/1    Disable/enable libpurple support        $purple
    7370
    7471--debug=0/1     Disable/enable debugging                $debug
     
    511508protoobjs=''
    512509
    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 fi
    536 
    537510if [ "$msn" = 0 ]; then
    538511        echo '#undef WITH_MSN' >> config.h
  • debian/rules

    rae3dc99 rf1b7711  
    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
  • doc/user-guide/commands.xml

    rae3dc99 rf1b7711  
    11201120
    11211121        </bitlbee-command>
    1122        
    1123         <bitlbee-command name="transfers">
    1124                 <short-description>Monitor, cancel, or reject file transfers</short-description>
    1125                 <syntax>transfers [&lt;cancel&gt; id | &lt;reject&gt;]</syntax>
    1126                
    1127                 <description>
    1128                         <para>
    1129                                 Without parameters the currently pending file transfers and their status will be listed. Available actions are <emphasis>cancel</emphasis> and <emphasis>reject</emphasis>. See <emphasis>help transfers &lt;action&gt;</emphasis> for more information.
    1130                         </para>
    1131 
    1132                         <ircexample>
    1133                                 <ircline nick="ulim">transfers</ircline>
    1134                         </ircexample>
    1135                 </description>
    1136                
    1137                 <bitlbee-command name="cancel">
    1138                         <short-description>Cancels the file transfer with the given id</short-description>
    1139                         <syntax>transfers &lt;cancel&gt; id</syntax>
    1140 
    1141                         <description>
    1142                                 <para>Cancels the file transfer with the given id</para>
    1143                         </description>
    1144 
    1145                         <ircexample>
    1146                                 <ircline nick="ulim">transfers cancel 1</ircline>
    1147                                 <ircline nick="root">Canceling file transfer for test</ircline>
    1148                         </ircexample>
    1149                 </bitlbee-command>
    1150 
    1151                 <bitlbee-command name="reject">
    1152                         <short-description>Rejects all incoming transfers</short-description>
    1153                         <syntax>transfers &lt;reject&gt;</syntax>
    1154 
    1155                         <description>
    1156                                 <para>Rejects all incoming (not already transferring) file transfers. Since you probably have only one incoming transfer at a time, no id is neccessary. Or is it?</para>
    1157                         </description>
    1158 
    1159                         <ircexample>
    1160                                 <ircline nick="ulim">transfers reject</ircline>
    1161                         </ircexample>
    1162                 </bitlbee-command>
    1163         </bitlbee-command>
    1164        
    11651122</chapter>
  • help.c

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    2929#include "crypting.h"
    3030#include "ipc.h"
    31 #include "dcc.h"
    3231
    3332static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
     
    126125        sock_make_nonblocking( irc->fd );
    127126       
    128         irc->r_watch_source_id = b_input_add( irc->fd, B_EV_IO_READ, bitlbee_io_current_client_read, irc );
     127        irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
    129128       
    130129        irc->status = USTATUS_OFFLINE;
     
    214213        /* Evaluator sets the iconv/oconv structures. */
    215214        set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) );
    216        
    217         nogaim_init();
    218215       
    219216        return( irc );
     
    698695                   in the event queue. */
    699696                /* 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 ) ) */
     697                if( bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE ) ) */
    701698               
    702699                /* 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 );
     700                irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
    704701        }
    705702       
     
    727724                if( now )
    728725                {
    729                         bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE );
     726                        bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE );
    730727                }
    731728                temp = temp->next;
     
    11281125                        return( 1 );
    11291126                }
    1130                 else if( g_strncasecmp( s + 1, "DCC", 3 ) == 0 )
    1131                 {
    1132                         if( u && u->ic && u->ic->acc->prpl->transfer_request )
    1133                         {
    1134                                 file_transfer_t *ft = dcc_request( u->ic, s + 5 );
    1135                                 if ( ft )
    1136                                         u->ic->acc->prpl->transfer_request( u->ic, ft, u->handle );
    1137                         }
    1138                         return( 1 );
    1139                 }               
    11401127                else
    11411128                {
    1142                         irc_usermsg( irc, "Supported CTCPs are ACTION, VERSION, PING, TYPING, DCC" );
     1129                        irc_usermsg( irc, "Non-ACTION CTCP's aren't supported" );
    11431130                        return( 0 );
    11441131                }
  • irc.h

    rae3dc99 rf1b7711  
    8383        struct query *queries;
    8484        struct account *accounts;
    85         GSList *file_transfers;
    8685        struct chat *chatrooms;
    8786       
  • lib/Makefile

    rae3dc99 rf1b7711  
    1010
    1111# [SH] Program variables
    12 objects = 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
     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
    1313
    1414CFLAGS += -Wall
  • lib/events.h

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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/proxy.c

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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}
  • protocols/jabber/Makefile

    rae3dc99 rf1b7711  
    1010
    1111# [SH] Program variables
    12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o s5bytestream.o sasl.o si.o
     12objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o
    1313
    1414CFLAGS += -Wall
  • protocols/jabber/io.c

    rae3dc99 rf1b7711  
    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/iq.c

    rae3dc99 rf1b7711  
    9191                        pack = 0;
    9292                }
    93                 else if( strcmp( s, XMLNS_DISCO_INFO ) == 0 )
    94                 {
    95                         const char *features[] = { XMLNS_DISCO_INFO,
     93                else if( strcmp( s, XMLNS_DISCOVER ) == 0 )
     94                {
     95                        const char *features[] = { XMLNS_DISCOVER,
    9696                                                   XMLNS_VERSION,
    9797                                                   XMLNS_TIME,
     
    9999                                                   XMLNS_MUC,
    100100                                                   XMLNS_PING,
    101                                                    XMLNS_SI,
    102                                                    XMLNS_BYTESTREAMS,
    103                                                    XMLNS_FILETRANSFER,
    104101                                                   NULL };
    105102                        const char **f;
     
    121118                {
    122119                        xt_free_node( reply );
    123                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
     120                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
    124121                        pack = 0;
    125122                }
     
    127124        else if( strcmp( type, "set" ) == 0 )
    128125        {
    129                 if( ( c = xt_find_node( node->children, "si" ) ) &&
    130                     ( s = xt_find_attr( c, "xmlns" ) ) &&
    131                     ( strcmp( s, XMLNS_SI ) == 0 ) )
    132                 {
    133                         return jabber_si_handle_request( ic, node, c );
    134                 }
    135                 else if( !( c = xt_find_node( node->children, "query" ) ) ||
    136                          !( s = xt_find_attr( c, "xmlns" ) ) )
     126                if( !( c = xt_find_node( node->children, "query" ) ) ||
     127                    !( s = xt_find_attr( c, "xmlns" ) ) )
    137128                {
    138129                        imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type );
    139130                        return XT_HANDLED;
    140131                }
    141                 else if( strcmp( s, XMLNS_ROSTER ) == 0 )
    142                 {
     132               
    143133                /* This is a roster push. XMPP servers send this when someone
    144134                   was added to (or removed from) the buddy list. AFAIK they're
    145135                   sent even if we added this buddy in our own session. */
     136                if( strcmp( s, XMLNS_ROSTER ) == 0 )
     137                {
    146138                        int bare_len = strlen( ic->acc->user );
    147139                       
     
    160152                               
    161153                                xt_free_node( reply );
    162                                 reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL );
     154                                reply = jabber_make_error_packet( node, "not-allowed", "cancel" );
    163155                                pack = 0;
    164156                        }
    165157                }
    166                 else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 )
    167                 {
    168                         /* Bytestream Request (stage 2 of file transfer) */
    169                         return jabber_bs_recv_request( ic, node, c );
    170                 }
    171158                else
    172159                {
    173160                        xt_free_node( reply );
    174                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
     161                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
    175162                        pack = 0;
    176163                }
     
    622609        return st;
    623610}
    624 
    625 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    626 
    627 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid )
    628 {
    629         struct xt_node *node, *query;
    630         struct jabber_buddy *bud;
    631        
    632         if( ( bud = jabber_buddy_by_jid( ic, bare_jid , 0 ) ) == NULL )
    633         {
    634                 /* Who cares about the unknown... */
    635                 imcb_log( ic, "Couldn't find buddy: %s", bare_jid);
    636                 return XT_HANDLED;
    637         }
    638        
    639         if( bud->features ) /* been here already */
    640                 return XT_HANDLED;
    641        
    642         node = xt_new_node( "query", NULL, NULL );
    643         xt_add_attr( node, "xmlns", XMLNS_DISCO_INFO );
    644        
    645         if( !( query = jabber_make_packet( "iq", "get", bare_jid, node ) ) )
    646         {
    647                 imcb_log( ic, "WARNING: Couldn't generate feature query" );
    648                 xt_free_node( node );
    649                 return XT_HANDLED;
    650         }
    651 
    652         jabber_cache_add( ic, query, jabber_iq_parse_features );
    653 
    654         return jabber_write_packet( ic, query ) ? XT_HANDLED : XT_ABORT;
    655 }
    656 
    657 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
    658 {
    659         struct xt_node *c;
    660         struct jabber_buddy *bud;
    661         char *feature, *xmlns, *from;
    662 
    663         if( !( from = xt_find_attr( node, "from" ) ) ||
    664             !( c = xt_find_node( node->children, "query" ) ) ||
    665             !( xmlns = xt_find_attr( c, "xmlns" ) ) ||
    666             !( strcmp( xmlns, XMLNS_DISCO_INFO ) == 0 ) )
    667         {
    668                 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" );
    669                 return XT_HANDLED;
    670         }
    671         if( ( bud = jabber_buddy_by_jid( ic, from, 0 ) ) == NULL )
    672         {
    673                 /* Who cares about the unknown... */
    674                 imcb_log( ic, "Couldn't find buddy: %s", from );
    675                 return XT_HANDLED;
    676         }
    677        
    678         c = c->children;
    679         while( ( c = xt_find_node( c, "feature" ) ) )
    680         {
    681                 feature = xt_find_attr( c, "var" );
    682                 if( feature )
    683                         bud->features = g_slist_append( bud->features, g_strdup( feature ) );
    684                 c = c->next;
    685         }
    686 
    687         return XT_HANDLED;
    688 }
    689 
    690 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    691 
    692 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns )
    693 {
    694         struct xt_node *node, *query;
    695         struct jabber_data *jd = ic->proto_data;
    696        
    697         node = xt_new_node( "query", NULL, NULL );
    698         xt_add_attr( node, "xmlns", xmlns );
    699        
    700         if( !( query = jabber_make_packet( "iq", "get", jid, node ) ) )
    701         {
    702                 imcb_log( ic, "WARNING: Couldn't generate server query" );
    703                 xt_free_node( node );
    704         }
    705 
    706         jd->have_streamhosts--;
    707         jabber_cache_add( ic, query, jabber_iq_parse_server_features );
    708 
    709         return jabber_write_packet( ic, query ) ? XT_HANDLED : XT_ABORT;
    710 }
    711 
    712 /*
    713  * Query the server for "items", query each "item" for identities, query each "item" that's a proxy for it's bytestream info
    714  */
    715 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
    716 {
    717         struct xt_node *c;
    718         struct jabber_data *jd = ic->proto_data;
    719         char *xmlns, *from;
    720 
    721         if( !( c = xt_find_node( node->children, "query" ) ) ||
    722             !( from = xt_find_attr( node, "from" ) ) ||
    723             !( xmlns = xt_find_attr( c, "xmlns" ) ) )
    724         {
    725                 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" );
    726                 return XT_HANDLED;
    727         }
    728 
    729         jd->have_streamhosts++;
    730 
    731         if( strcmp( xmlns, XMLNS_DISCO_ITEMS ) == 0 )
    732         {
    733                 char *itemjid;
    734 
    735                 /* answer from server */
    736        
    737                 c = c->children;
    738                 while( ( c = xt_find_node( c, "item" ) ) )
    739                 {
    740                         itemjid = xt_find_attr( c, "jid" );
    741                        
    742                         if( itemjid )
    743                                 jabber_iq_query_server( ic, itemjid, XMLNS_DISCO_INFO );
    744 
    745                         c = c->next;
    746                 }
    747         }
    748         else if( strcmp( xmlns, XMLNS_DISCO_INFO ) == 0 )
    749         {
    750                 char *category, *type;
    751 
    752                 /* answer from potential proxy */
    753 
    754                 c = c->children;
    755                 while( ( c = xt_find_node( c, "identity" ) ) )
    756                 {
    757                         category = xt_find_attr( c, "category" );
    758                         type = xt_find_attr( c, "type" );
    759 
    760                         if( type && ( strcmp( type, "bytestreams" ) == 0 ) &&
    761                             category && ( strcmp( category, "proxy" ) == 0 ) )
    762                                 jabber_iq_query_server( ic, from, XMLNS_BYTESTREAMS );
    763 
    764                         c = c->next;
    765                 }
    766         }
    767         else if( strcmp( xmlns, XMLNS_BYTESTREAMS ) == 0 )
    768         {
    769                 char *host, *jid, *port_s;
    770                 int port;
    771 
    772                 /* answer from proxy */
    773 
    774                 if( ( c = xt_find_node( c->children, "streamhost" ) ) &&
    775                     ( host = xt_find_attr( c, "host" ) ) &&
    776                     ( port_s = xt_find_attr( c, "port" ) ) &&
    777                     ( sscanf( port_s, "%d", &port ) == 1 ) &&
    778                     ( jid = xt_find_attr( c, "jid" ) ) )
    779                 {
    780                         jabber_streamhost_t *sh = g_new0( jabber_streamhost_t, 1 );
    781                        
    782                         sh->jid = g_strdup( jid );
    783                         sh->host = g_strdup( host );
    784                         g_snprintf( sh->port, sizeof( sh->port ), "%u", port );
    785 
    786                         imcb_log( ic, "Proxy found: jid %s host %s port %u", jid, host, port );
    787                         jd->streamhosts = g_slist_append( jd->streamhosts, sh );
    788                 }
    789         }
    790 
    791         if( jd->have_streamhosts == 0 )
    792                 jd->have_streamhosts++;
    793 
    794         return XT_HANDLED;
    795 }
  • protocols/jabber/jabber.c

    rae3dc99 rf1b7711  
    6565       
    6666        s = set_add( &acc->set, "priority", "0", set_eval_priority, acc );
    67 
    68         s = set_add( &acc->set, "proxy", "<local>;<auto>", NULL, acc );
    6967       
    7068        s = set_add( &acc->set, "resource", "BitlBee", NULL, acc );
     
    266264        struct jabber_data *jd = ic->proto_data;
    267265       
    268         while( jd->filetransfers )
    269                 imcb_file_canceled( ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" );
    270 
    271         while( jd->streamhosts )
    272         {
    273                 jabber_streamhost_t *sh = jd->streamhosts->data;
    274                 jd->streamhosts = g_slist_remove( jd->streamhosts, sh );
    275                 g_free( sh->jid );
    276                 g_free( sh->host );
    277                 g_free( sh );
    278         }
    279 
    280266        if( jd->fd >= 0 )
    281267                jabber_end_stream( ic );
     
    558544        ret->send_typing = jabber_send_typing;
    559545        ret->handle_cmp = g_strcasecmp;
    560         ret->transfer_request = jabber_si_transfer_request;
    561546
    562547        register_protocol( ret );
  • protocols/jabber/jabber.h

    rae3dc99 rf1b7711  
    6161} jabber_buddy_flags_t;
    6262
    63 /* Stores a streamhost's (a.k.a. proxy) data */
    64 typedef struct
    65 {
    66         char *jid;
    67         char *host;
    68         char port[6];
    69 } jabber_streamhost_t;
    70 
    7163typedef enum
    7264{
     
    9991        GHashTable *node_cache;
    10092        GHashTable *buddies;
    101 
    102         GSList *filetransfers;
    103         GSList *streamhosts;
    104         int have_streamhosts;
    10593};
    10694
     
    139127        struct jabber_away_state *away_state;
    140128        char *away_message;
    141         GSList *features;
    142129       
    143130        time_t last_msg;
     
    153140        char *my_full_jid; /* Separate copy because of case sensitivity. */
    154141        struct jabber_buddy *me;
    155 };
    156 
    157 struct jabber_transfer
    158 {
    159         /* bitlbee's handle for this transfer */
    160         file_transfer_t *ft;
    161 
    162         /* the stream's private handle */
    163         gpointer streamhandle;
    164 
    165         /* timeout for discover queries */
    166         gint disco_timeout;
    167         gint disco_timeout_fired;
    168 
    169         struct im_connection *ic;
    170 
    171         struct jabber_buddy *bud;
    172 
    173         int watch_in;
    174         int watch_out;
    175 
    176         char *ini_jid;
    177         char *tgt_jid;
    178         char *iq_id;
    179         char *sid;
    180         int accepted;
    181 
    182         size_t bytesread, byteswritten;
    183         int fd;
    184         struct sockaddr_storage saddr;
    185142};
    186143
     
    210167
    211168/* Some supported extensions/legacy stuff */
    212 #define XMLNS_AUTH         "jabber:iq:auth"                                      /* XEP-0078 */
    213 #define XMLNS_VERSION      "jabber:iq:version"                                   /* XEP-0092 */
    214 #define XMLNS_TIME         "jabber:iq:time"                                      /* XEP-0090 */
    215 #define XMLNS_PING         "urn:xmpp:ping"                                       /* XEP-0199 */
    216 #define XMLNS_VCARD        "vcard-temp"                                          /* XEP-0054 */
    217 #define XMLNS_DELAY        "jabber:x:delay"                                      /* XEP-0091 */
    218 #define XMLNS_XDATA        "jabber:x:data"                                       /* XEP-0004 */
    219 #define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"               /* XEP-0085 */
    220 #define XMLNS_DISCO_INFO   "http://jabber.org/protocol/disco#info"               /* XEP-0030 */
    221 #define XMLNS_DISCO_ITEMS  "http://jabber.org/protocol/disco#items"              /* XEP-0030 */
    222 #define XMLNS_MUC          "http://jabber.org/protocol/muc"                      /* XEP-0045 */
    223 #define XMLNS_MUC_USER     "http://jabber.org/protocol/muc#user"                 /* XEP-0045 */
    224 #define XMLNS_CAPS         "http://jabber.org/protocol/caps"                     /* XEP-0115 */
    225 #define XMLNS_FEATURE      "http://jabber.org/protocol/feature-neg"              /* XEP-0020 */
    226 #define XMLNS_SI           "http://jabber.org/protocol/si"                       /* XEP-0095 */
    227 #define XMLNS_FILETRANSFER "http://jabber.org/protocol/si/profile/file-transfer" /* XEP-0096 */
    228 #define XMLNS_BYTESTREAMS  "http://jabber.org/protocol/bytestreams"              /* XEP-0065 */
    229 #define XMLNS_IBB          "http://jabber.org/protocol/ibb"                      /* XEP-0047 */
     169#define XMLNS_AUTH         "jabber:iq:auth"                     /* XEP-0078 */
     170#define XMLNS_VERSION      "jabber:iq:version"                  /* XEP-0092 */
     171#define XMLNS_TIME         "jabber:iq:time"                     /* XEP-0090 */
     172#define XMLNS_PING         "urn:xmpp:ping"                      /* XEP-0199 */
     173#define XMLNS_VCARD        "vcard-temp"                         /* XEP-0054 */
     174#define XMLNS_DELAY        "jabber:x:delay"                     /* XEP-0091 */
     175#define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"  /* 0085 */
     176#define XMLNS_DISCOVER     "http://jabber.org/protocol/disco#info"  /* 0030 */
     177#define XMLNS_MUC          "http://jabber.org/protocol/muc"     /* XEP-0045 */
     178#define XMLNS_MUC_USER     "http://jabber.org/protocol/muc#user"/* XEP-0045 */
     179#define XMLNS_CAPS         "http://jabber.org/protocol/caps"    /* XEP-0115 */
    230180
    231181/* iq.c */
     
    237187int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name );
    238188int jabber_remove_from_roster( struct im_connection *ic, char *handle );
    239 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid );
    240 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns );
    241 
    242 /* si.c */
    243 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode );
    244 void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );
    245 void jabber_si_free_transfer( file_transfer_t *ft);
    246 
    247 /* s5bytestream.c */
    248 int jabber_bs_recv_request( struct im_connection *ic, struct xt_node *node, struct xt_node *qnode);
    249 gboolean jabber_bs_send_start( struct jabber_transfer *tf );
    250 gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int len );
    251189
    252190/* message.c */
     
    262200char *set_eval_tls( set_t *set, char *value );
    263201struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
    264 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code );
     202struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );
    265203void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func );
    266204struct xt_node *jabber_cache_get( struct im_connection *ic, char *id );
  • protocols/jabber/jabber_util.c

    rae3dc99 rf1b7711  
    9999}
    100100
    101 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code )
     101struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )
    102102{
    103103        struct xt_node *node, *c;
     
    111111        c = xt_new_node( "error", NULL, c );
    112112        xt_add_attr( c, "type", err_type );
    113        
    114         /* Add the error code, if present */
    115         if (err_code)
    116                 xt_add_attr( c, "code", err_code );
    117113       
    118114        /* To make the actual error packet, we copy the original packet and
  • protocols/msn/Makefile

    rae3dc99 rf1b7711  
    1010
    1111# [SH] Program variables
    12 objects = invitation.o msn.o msn_util.o ns.o passport.o sb.o tables.o
     12objects = msn.o msn_util.o ns.o passport.o sb.o tables.o
    1313
    1414CFLAGS += -Wall
  • protocols/msn/msn.c

    rae3dc99 rf1b7711  
    7979        if( md )
    8080        {
    81                 while( md->filetransfers ) {
    82                         imcb_file_canceled( md->filetransfers->data, "Closing connection" );
    83                 }
    84                
    8581                if( md->fd >= 0 )
    8682                        closesocket( md->fd );
     
    332328        ret->send_typing = msn_send_typing;
    333329        ret->handle_cmp = g_strcasecmp;
    334         ret->transfer_request = msn_ftp_transfer_request;
    335330
    336331        register_protocol(ret);
  • protocols/msn/msn.h

    rae3dc99 rf1b7711  
    7474        int sb_failures;
    7575        time_t first_sb_failure;
    76         GSList *filetransfers;
    7776       
    7877        const struct msn_away_state *away_state;
     
    190189void msn_sb_stop_keepalives( struct msn_switchboard *sb );
    191190
    192 /* invitation.c */
    193 void msn_ftp_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );
    194 
    195191#endif //_MSN_H
  • protocols/msn/ns.c

    rae3dc99 rf1b7711  
    7676        if( msn_write( ic, s, strlen( s ) ) )
    7777        {
    78                 ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic );
     78                ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
    7979                imcb_log( ic, "Connected to server, waiting for reply" );
    8080        }
  • protocols/msn/sb.c

    rae3dc99 rf1b7711  
    2929#include "passport.h"
    3030#include "md5.h"
    31 #include "invitation.h"
    3231
    3332static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond );
     
    174173                        buf = g_new0( char, i );
    175174                        i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user );
    176                 }
    177                 else if( strncmp( text, MSN_INVITE_HEADERS, sizeof( MSN_INVITE_HEADERS ) - 1 ) == 0 )
    178                 {
    179                         buf = g_strdup( text );
    180                         i = strlen( buf );
    181175                }
    182176                else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 )
     
    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 );
     
    705699                else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 )
    706700                {
    707                         char *command = msn_findheader( body, "Invitation-Command:", blen );
    708                         char *cookie = msn_findheader( body, "Invitation-Cookie:", blen );
    709                         unsigned int icookie;
     701                        char *itype = msn_findheader( body, "Application-GUID:", blen );
     702                        char buf[1024];
    710703                       
    711704                        g_free( ct );
    712705                       
    713                         /* Every invite should have both a Command and Cookie header */
    714                         if( !command || !cookie ) {
    715                                 g_free( command );
    716                                 g_free( cookie );
    717                                 imcb_log( ic, "Warning: No command or cookie from %s", sb->who );
    718                                 return 1;
    719                         }
    720                        
    721                         icookie = strtoul( cookie, NULL, 10 );
    722                         g_free( cookie );
    723                        
    724                         if( g_strncasecmp( command, "INVITE", 6 ) == 0 ) {
    725                                 msn_invitation_invite( sb, cmd[1], icookie, body, blen );
    726                         } else if( g_strncasecmp( command, "ACCEPT", 6 ) == 0 ) {
    727                                 msn_invitation_accept( sb, cmd[1], icookie, body, blen );
    728                         } else if( g_strncasecmp( command, "CANCEL", 6 ) == 0 ) {
    729                                 msn_invitation_cancel( sb, cmd[1], icookie, body, blen );
    730                         } else {
    731                                 imcb_log( ic, "Warning: Received invalid invitation with "
    732                                                 "command %s from %s", command, sb->who );
    733                         }
    734                        
    735                         g_free( command );
    736                 }
    737                 else if( g_strncasecmp( ct, "application/x-msnmsgrp2p", 24 ) == 0 )
    738                 {
    739                         imcb_error( sb->ic, "Cannot receive file from %s: BitlBee does not "
    740                                         "support msnmsgrp2p yet.", sb->who );
    741                         g_free( ct );
     706                        *buf = 0;
     707                       
     708                        if( !itype )
     709                                return( 1 );
     710                       
     711                        /* File transfer. */
     712                        if( strcmp( itype, "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" ) == 0 )
     713                        {
     714                                char *name = msn_findheader( body, "Application-File:", blen );
     715                                char *size = msn_findheader( body, "Application-FileSize:", blen );
     716                               
     717                                if( name && size )
     718                                {
     719                                        g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Filetransfer: `%s', %s bytes >>\n"
     720                                                    "Filetransfers are not supported by BitlBee for now...", name, size );
     721                                }
     722                                else
     723                                {
     724                                        strcpy( buf, "<< \x02""BitlBee\x02"" - Corrupted MSN filetransfer invitation message >>" );
     725                                }
     726                               
     727                                if( name ) g_free( name );
     728                                if( size ) g_free( size );
     729                        }
     730                        else
     731                        {
     732                                char *iname = msn_findheader( body, "Application-Name:", blen );
     733                               
     734                                g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Unknown MSN invitation - %s (%s) >>",
     735                                                                itype, iname ? iname : "no name" );
     736                               
     737                                if( iname ) g_free( iname );
     738                        }
     739                       
     740                        g_free( itype );
     741                       
     742                        if( !*buf )
     743                                return( 1 );
     744                       
     745                        if( sb->who )
     746                        {
     747                                imcb_buddy_msg( ic, cmd[1], buf, 0, 0 );
     748                        }
     749                        else if( sb->chat )
     750                        {
     751                                imcb_chat_msg( sb->chat, cmd[1], buf, 0, 0 );
     752                        }
     753                        else
     754                        {
     755                                /* PANIC! */
     756                        }
    742757                }
    743758                else if( g_strncasecmp( ct, "text/x-msmsgscontrol", 20 ) == 0 )
  • protocols/nogaim.c

    rae3dc99 rf1b7711  
    117117{
    118118        GList *gl;
    119        
    120         for( gl = protocols; gl; gl = gl->next )
     119        for (gl = protocols; gl; gl = gl->next)
    121120        {
    122121                struct prpl *proto = gl->data;
    123                
    124                 if( g_strcasecmp( proto->name, name ) == 0 )
     122                if(!g_strcasecmp(proto->name, name))
    125123                        return proto;
    126124        }
    127        
    128125        return NULL;
    129126}
     
    137134        extern void jabber_initmodule();
    138135        extern void twitter_initmodule();
    139         extern void purple_initmodule();
    140136
    141137#ifdef WITH_MSN
     
    157153#ifdef WITH_TWITTER
    158154        twitter_initmodule();
    159 #endif
    160        
    161 #ifdef WITH_PURPLE
    162         purple_initmodule();
    163155#endif
    164156
  • protocols/nogaim.h

    rae3dc99 rf1b7711  
    4545#include "proxy.h"
    4646#include "query.h"
    47 #include "md5.h"
    48 #include "ft.h"
    4947
    5048#define BUDDY_ALIAS_MAXLEN 388   /* because MSN names can be 387 characters */
     
    134132         * - The user sees this name ie. when imcb_log() is used. */
    135133        const char *name;
    136         void *data;
    137134
    138135        /* Added this one to be able to add per-account settings, don't think
     
    231228        void (* auth_allow)     (struct im_connection *, const char *who);
    232229        void (* auth_deny)      (struct im_connection *, const char *who);
    233 
    234         /* Incoming transfer request */
    235         void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle );
    236230};
    237231
  • protocols/oscar/oscar.c

    rae3dc99 rf1b7711  
    291291        odata = (struct oscar_data *)ic->proto_data;
    292292
    293         if (condition & B_EV_IO_READ) {
     293        if (condition & GAIM_INPUT_READ) {
    294294                if (aim_get_command(odata->sess, conn) >= 0) {
    295295                        aim_rxdispatch(odata->sess);
     
    363363
    364364        aim_conn_completeconnect(sess, conn);
    365         ic->inpa = b_input_add(conn->fd, B_EV_IO_READ,
     365        ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    366366                        oscar_callback, conn);
    367367       
     
    493493
    494494        aim_conn_completeconnect(sess, bosconn);
    495         ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ,
     495        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    496496                        oscar_callback, bosconn);
    497497        imcb_log(ic, _("Connection established, cookie sent"));
     
    669669        if (pos->modname)
    670670                g_free(pos->modname);
    671         pos->inpa = b_input_add(pos->fd, B_EV_IO_READ, damn_you, pos);
     671        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    672672        return FALSE;
    673673}
     
    838838
    839839        aim_conn_completeconnect(sess, tstconn);
    840         odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ,
     840        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    841841                                        oscar_callback, tstconn);
    842842       
     
    866866
    867867        aim_conn_completeconnect(sess, tstconn);
    868         odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ,
     868        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    869869                                oscar_callback, tstconn);
    870870       
     
    902902        aim_conn_completeconnect(sess, ccon->conn);
    903903        ccon->inpa = b_input_add(tstconn->fd,
    904                         B_EV_IO_READ,
     904                        GAIM_INPUT_READ,
    905905                        oscar_callback, tstconn);
    906906        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
  • protocols/yahoo/yahoo.c

    rae3dc99 rf1b7711  
    681681               
    682682                inp->d = d;
    683                 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 );
    684684        }
    685685        else if( cond == YAHOO_INPUT_WRITE )
     
    692692               
    693693                inp->d = d;
    694                 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 );
    695695        }
    696696        else
  • root_commands.c

    rae3dc99 rf1b7711  
    11541154        {
    11551155                irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
    1156         }
    1157 }
    1158 
    1159 static void cmd_transfer( irc_t *irc, char **cmd )
    1160 {
    1161         GSList *files = irc->file_transfers;
    1162         enum { LIST, REJECT, CANCEL };
    1163         int subcmd = LIST;
    1164         int fid;
    1165 
    1166         if( !files )
    1167         {
    1168                 irc_usermsg( irc, "No pending transfers" );
    1169                 return;
    1170         }
    1171 
    1172         if( cmd[1] && ( strcmp( cmd[1], "reject" ) == 0 ) )
    1173         {
    1174                 subcmd = REJECT;
    1175         }
    1176         else if( cmd[1] && ( strcmp( cmd[1], "cancel" ) == 0 ) &&
    1177                  cmd[2] && ( sscanf( cmd[2], "%d", &fid ) == 1 ) )
    1178         {
    1179                 subcmd = CANCEL;
    1180         }
    1181 
    1182         for( ; files; files = g_slist_next( files ) )
    1183         {
    1184                 file_transfer_t *file = files->data;
    1185                
    1186                 switch( subcmd ) {
    1187                 case LIST:
    1188                         if ( file->status == FT_STATUS_LISTENING )
    1189                                 irc_usermsg( irc,
    1190                                         "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);
    1191                         else
    1192                         {
    1193                                 int kb_per_s = 0;
    1194                                 time_t diff = time( NULL ) - file->started ? : 1;
    1195                                 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )
    1196                                         kb_per_s = file->bytes_transferred / 1024 / diff;
    1197                                        
    1198                                 irc_usermsg( irc,
    1199                                         "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,
    1200                                         file->bytes_transferred/1024, file->file_size/1024, kb_per_s);
    1201                         }
    1202                         break;
    1203                 case REJECT:
    1204                         if( file->status == FT_STATUS_LISTENING )
    1205                         {
    1206                                 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );
    1207                                 imcb_file_canceled( file, "Denied by user" );
    1208                         }
    1209                         break;
    1210                 case CANCEL:
    1211                         if( file->local_id == fid )
    1212                         {
    1213                                 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );
    1214                                 imcb_file_canceled( file, "Canceled by user" );
    1215                         }
    1216                         break;
    1217                 }
    12181156        }
    12191157}
     
    12401178        { "join_chat",      2, cmd_join_chat,      0 },
    12411179        { "chat",           1, cmd_chat,           0 },
    1242         { "transfer",       0, cmd_transfer,       0 },
    12431180        { NULL }
    12441181};
  • set.c

    rae3dc99 rf1b7711  
    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

    rae3dc99 rf1b7711  
    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... */
  • unix.c

    rae3dc99 rf1b7711  
    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 )
     
    126116                        setuid( pw->pw_uid );
    127117                }
     118        }
     119
     120        global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
     121        if( global.storage == NULL )
     122        {
     123                log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage );
     124                return( 1 );
    128125        }
    129126       
     
    145142        if( !getuid() || !geteuid() )
    146143                log_message( LOGLVL_WARNING, "BitlBee is running with root privileges. Why?" );
     144        if( help_init( &global.help, global.helpfile ) == NULL )
     145                log_message( LOGLVL_WARNING, "Error opening helpfile %s.", HELP_FILE );
    147146       
    148147        b_main_run();
Note: See TracChangeset for help on using the changeset viewer.