Changes in / [eb6df6a:00540d4]


Ignore:
Files:
3 deleted
40 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    reb6df6a r00540d4  
    1111# Program variables
    1212objects = 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
    13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h otr.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
     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
     
    2020OUTFILE=bitlbee.exe
    2121else
    22 objects += unix.o conf.o log.o otr.o
     22objects += unix.o conf.o log.o
    2323OUTFILE=bitlbee
    2424endif
     
    9494        mkdir -p $(DESTDIR)$(ETCDIR)
    9595        install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
    96         install -m 0644 welcome.txt $(DESTDIR)$(ETCDIR)/welcome.txt
    9796        install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
    9897
    9998uninstall-etc:
    10099        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
    101         rm -f $(DESTDIR)$(ETCDIR)/welcome.txt
    102100        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
    103101        -rmdir $(DESTDIR)$(ETCDIR)
  • bitlbee.conf

    reb6df6a r00540d4  
    8585# MotdFile = /etc/bitlbee/motd.txt
    8686
    87 ## WelcomeFile
    88 ##
    89 ## Specify an alternative file for the welcome message displayed when joining the
    90 ## control channel. Default value depends on the --etcdir argument to configure.
    91 ##
    92 # WelcomeFile = /etc/bitlbee/welcome.txt
    93 
    9487## ConfigDir
    9588##
  • bitlbee.h

    reb6df6a r00540d4  
    3030#define _GNU_SOURCE /* Stupid GNU :-P */
    3131#endif
    32 
    33 /* Depend on Windows 2000 for now since we need getaddrinfo() */
    34 #define _WIN32_WINNT 0x0501
    3532
    3633/* Depend on Windows 2000 for now since we need getaddrinfo() */
     
    144141#include "misc.h"
    145142#include "proxy.h"
    146 #include "otr.h"
    147143
    148144typedef struct global {
     
    156152        char *helpfile;
    157153        int restart;
    158         OtrlMessageAppOps otr_ops;   /* collects interface functions required by OTR */
    159154} global_t;
    160155
  • conf.c

    reb6df6a r00540d4  
    6060        conf->pidfile = g_strdup( PIDFILE );
    6161        conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
    62         conf->welcomefile = g_strdup( ETCDIR "/welcome.txt" );
    6362        conf->ping_interval = 180;
    6463        conf->ping_timeout = 300;
     
    259258                                conf->motdfile = g_strdup( ini->value );
    260259                        }
    261                         else if( g_strcasecmp( ini->key, "welcomefile" ) == 0 )
    262                         {
    263                                 g_free( conf->welcomefile );
    264                                 conf->welcomefile = g_strdup( ini->value );
    265                         }
    266260                        else if( g_strcasecmp( ini->key, "account_storage" ) == 0 )
    267261                        {
  • conf.h

    reb6df6a r00540d4  
    4545        char *pidfile;
    4646        char *motdfile;
    47         char *welcomefile;
    4847        char *primary_storage;
    4948        char **migrate_storage;
  • configure

    reb6df6a r00540d4  
    3232gcov=0
    3333plugins=1
    34 otr=auto
    3534
    3635events=glib
     
    7473--gcov=0/1      Disable/enable test coverage reporting  $gcov
    7574--plugins=0/1   Disable/enable plugins support          $plugins
    76 --otr=0/1       Disable/enable OTR encryption support   $otr
    7775
    7876--events=...    Event handler (glib, libevent)          $events
     
    454452fi
    455453
    456 otrprefix=""
    457 for i in / /usr /usr/local; do
    458         if [ -f ${i}/lib/libotr.a ]; then
    459                 otrprefix=${i}
    460                 break
    461         fi
    462 done
    463 if [ "$otr" = "auto" ]; then
    464         if [ -n "$otrprefix" ]; then
    465                 otr=1
    466         else
    467                 otr=0
    468         fi
    469 fi
    470 if [ "$otr" = 1 ]; then
    471         echo '#define WITH_OTR' >> config.h
    472         echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
    473         echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
    474 else
    475         echo '#undef WITH_OTR' >> config.h
    476 fi
    477 
    478454if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then
    479455        echo
     
    630606fi
    631607
    632 if [ "$otr" = "1" ]; then
    633         echo '  Off-the-Record (OTR) Messaging enabled.'
    634 else
    635         echo '  Off-the-Record (OTR) Messaging disabled.'
    636 fi
    637 
    638608echo '  Using event handler: '$events
    639609echo '  Using SSL library: '$ssl
  • doc/README

    reb6df6a r00540d4  
    6767BitlBee's only real dependency is GLib. This is available on virtually every
    6868platform. Any recent version of GLib (2.4 or higher) will work.
    69 
    70 Off-the-Record encryption support will be included by default if the
    71 configure script finds libotr in one of the usual places. You can pass
    72 --otr=1 or --otr=0 to force it on or off, respectively.
    7369
    7470These days, MSN Messenger clients have to connect to the MS Passport servers
     
    147143
    148144
    149 A NOTE ON PASSWORD ENCRYPTION
    150 =============================
     145A NOTE ON ENCRYPTION
     146====================
    151147
    152148There used to be a note here about the simple obfuscation method used to
  • doc/user-guide/commands.xml

    reb6df6a r00540d4  
    349349                </description>
    350350        </bitlbee-command>
    351        
    352         <bitlbee-command name="otr">
    353                 <short-description>Off-the-Record encryption control</short-description>
    354                 <syntax>otr &lt;subcommand&gt; [&lt;arguments&gt;]</syntax>
    355 
    356                 <description>
    357 
    358                         <para>
    359                                 Available subcommands: connect, disconnect, smp, trust, info, keygen, and forget. See <emphasis>help otr &lt;subcommand&gt;</emphasis> for more information.
    360                         </para>
    361 
    362                 </description>
    363                
    364                 <bitlbee-command name="connect">
    365                         <syntax>otr connect &lt;nick&gt;</syntax>
    366                        
    367                         <description>
    368                        
    369                                 <para>
    370                                         Attempts to establish an encrypted connection with the specified user by sending a magic string.
    371                                 </para>
    372                                
    373                         </description>
    374                
    375                 </bitlbee-command>
    376                
    377                 <bitlbee-command name="disconnect">
    378                         <syntax>otr disconnect &lt;nick&gt;</syntax>
    379                        
    380                         <description>
    381                        
    382                                 <para>
    383                                         Resets the connection with the specified user to cleartext.
    384                                 </para>
    385                                
    386                         </description>
    387                
    388                 </bitlbee-command>
    389                
    390                 <bitlbee-command name="smp">
    391                         <syntax>otr smp &lt;nick&gt; &lt;secret&gt;</syntax>
    392                        
    393                         <description>
    394                        
    395                                 <para>
    396                                         Attempts to authenticate the given user's active fingerprint via the Socialist Millionaires' Protocol.
    397                                 </para>
    398                                
    399                                 <para>
    400                                         If an SMP challenge has already been received from the given user, responds with the specified secret. Otherwise, a challenge for the secret will be sent. If the protocol succeeds (i.e. both parties gave the same secret), the fingerprint will be trusted.
    401                                 </para>
    402                                
    403                         </description>
    404                
    405                 </bitlbee-command>
    406                
    407                 <bitlbee-command name="trust">
    408                         <syntax>otr trust &lt;nick&gt; &lt;fp1&gt; &lt;fp2&gt; &lt;fp3&gt; &lt;fp4&gt; &lt;fp5&gt;</syntax>
    409                        
    410                         <description>
    411                        
    412                                 <para>
    413                                         Manually affirms trust in the specified fingerprint, given as five blocks of precisely eight (hexadecimal) digits each.
    414                                 </para>
    415                                
    416                         </description>
    417                
    418                 </bitlbee-command>
    419                
    420                 <bitlbee-command name="info">
    421                         <syntax>otr info</syntax>
    422                         <syntax>otr info &lt;nick&gt;</syntax>
    423                        
    424                         <description>
    425                        
    426                                 <para>
    427                                         Shows information about the OTR state. The first form lists our private keys and current OTR contexts. The second form displays information about the connection with a given user, including the list of their known fingerprints.
    428                                 </para>
    429                                
    430                         </description>
    431                
    432                 </bitlbee-command>
    433                
    434                 <bitlbee-command name="keygen">
    435                         <syntax>otr keygen &lt;account-no&gt;</syntax>
    436                        
    437                         <description>
    438                        
    439                                 <para>
    440                                         Generates a new OTR private key for the given account.
    441                                 </para>
    442                                
    443                         </description>
    444                
    445                 </bitlbee-command>
    446                
    447                 <bitlbee-command name="forget">
    448                         <syntax>otr forget &lt;thing&gt; &lt;arguments&gt;</syntax>
    449                        
    450                         <description>
    451                        
    452                                 <para>
    453                                         Forgets some part of our OTR userstate. Available things: fingerprint, context, and key. See <emphasis>help otr forget &lt;thing&gt;</emphasis> for more information.
    454                                 </para>
    455                        
    456                         </description>
    457                        
    458                         <bitlbee-command name="fingerprint">
    459                                 <syntax>otr forget fingerprint &lt;nick&gt; &lt;fingerprint&gt;</syntax>
    460                                
    461                                 <description>
    462                                
    463                                         <para>
    464                                                 Drops the specified fingerprint from the given user's OTR connection context. It is allowed to specify only a (unique) prefix of the desired fingerprint.
    465                                         </para>
    466                                        
    467                                 </description>
    468                                
    469                         </bitlbee-command>
    470                                
    471                         <bitlbee-command name="context">
    472                                 <syntax>otr forget context &lt;nick&gt;</syntax>
    473                                
    474                                 <description>
    475                                
    476                                         <para>
    477                                                 Forgets the entire OTR context associated with the given user. This includes current message and protocol states, as well as any fingerprints for that user.
    478                                         </para>
    479                                        
    480                                 </description>
    481                                
    482                         </bitlbee-command>
    483 
    484                         <bitlbee-command name="key">
    485                                 <syntax>otr forget key &lt;fingerprint&gt;</syntax>
    486                                
    487                                 <description>
    488                                
    489                                         <para>
    490                                                 Forgets an OTR private key matching the specified fingerprint. It is allowed to specify only a (unique) prefix of the fingerprint.
    491                                         </para>
    492                                        
    493                                 </description>
    494                                
    495                         </bitlbee-command>
    496                
    497                 </bitlbee-command>
    498                
    499         </bitlbee-command>
    500351
    501352        <bitlbee-command name="set">
     
    700551        </bitlbee-setting>
    701552
    702         <bitlbee-setting name="color_encrypted" type="boolean" scope="global">
    703                 <default>true</default>
    704 
    705                 <description>
    706                         <para>
    707                                 If set to true, BitlBee will color incoming encrypted messages according to their fingerprint trust level: untrusted=red, trusted=green.
    708                         </para>
    709                 </description>
    710         </bitlbee-setting>
    711 
    712553        <bitlbee-setting name="control_channel" type="string" scope="global">
    713554                <default>&amp;bitlbee</default>
     
    796637        </bitlbee-setting>
    797638
    798         <bitlbee-setting name="halfop_buddies" type="string" scope="global">
    799                 <default>encrypted</default>
    800                 <possible-values>encrypted, trusted, notaway, online, false</possible-values>
    801 
    802                 <description>
    803                         <para>
    804                                 Specifies under which circumstances BitlBee should give the "halfop" mode flag (+h) to buddies.
    805                         </para>
    806                        
    807                         <para>
    808                                 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. On "online", the flag is set whenever the user is online; only meaningful in conjunction with "show_offline".
    809                         </para>
    810                 </description>
    811         </bitlbee-setting>
    812 
    813639        <bitlbee-setting name="ignore_auth_requests" type="boolean" scope="account">
    814640                <default>false</default>
     
    819645                        </para>
    820646                </description>
     647
    821648        </bitlbee-setting>
    822649
     
    852679                </description>
    853680
    854         </bitlbee-setting>
    855 
    856         <bitlbee-setting name="op_buddies" type="string" scope="global">
    857                 <default>trusted</default>
    858                 <possible-values>encrypted, trusted, notaway, online, false</possible-values>
    859 
    860                 <description>
    861                         <para>
    862                                 Specifies under which circumstances BitlBee should give the "op" mode flag (+o) to buddies.
    863                         </para>
    864                        
    865                         <para>
    866                                 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. On "online", the flag is set whenever the user is online; only meaningful in conjunction with "show_offline".
    867                         </para>
    868                 </description>
    869 
    870         </bitlbee-setting>
    871 
    872         <bitlbee-setting name="op_root" type="bool" scope="global">
    873                 <default>true</default>
    874 
    875                 <description>
    876                         <para>
    877                                 Some people prefer themself and root to have operator status in &amp;bitlbee, other people don't. You can set the desired state for root using this setting.
    878                         </para>
    879                 </description>
    880         </bitlbee-setting>
    881 
    882         <bitlbee-setting name="op_user" type="bool" scope="global">
    883                 <default>true</default>
    884 
    885                 <description>
    886                         <para>
    887                                 Some people prefer themself and root to have operator status in &amp;bitlbee, other people don't. You can set the desired state for yourself using this setting.
    888                         </para>
    889                 </description>
    890         </bitlbee-setting>
    891 
    892         <bitlbee-setting name="otr_policy" type="string" scope="global">
    893                 <default>opportunistic</default>
    894                 <possible-values>never, opportunistic, manual, always</possible-values>
    895 
    896                 <description>
    897                         <para>
    898                                 This setting controls the policy for establishing Off-the-Record connections.
    899                         </para>
    900                         <para>
    901                                 A value of "never" effectively disables the OTR subsystem. In "opportunistic" mode, a magic whitespace pattern will be appended to the first message sent to any user. If the peer is also running opportunistic OTR, an encrypted connection will be set up automatically. On "manual", on the other hand, OTR connections must be established explicitly using <emphasis>otr connect</emphasis>. Finally, the setting "always" enforces encrypted communication by causing BitlBee to refuse to send any cleartext messages at all.
    902                         </para>
    903                 </description>
    904681        </bitlbee-setting>
    905682
     
    936713                        </para>
    937714                </description>
     715
    938716        </bitlbee-setting>
    939717
     
    1121899                <description>
    1122900                        <para>
    1123                                 If enabled causes BitlBee to also show offline users in Channel. You may want to adjust the settings "voice_buddies", "halfop_buddies" and "op_buddies" according to your liking. A reasonable candidate is "voice_buddies=online", "halfop_buddies=false", "op_buddies=notaway".
    1124                         </para>
    1125                         <para>
    1126                                 This option takes effect as soon as you reconnect.
     901                                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.
    1127902                        </para>
    1128903                </description>
     
    12591034                        <para>
    12601035                                You can change this setting to make BitlBee present itself as a different client, so that you can still connect to these servers.
    1261                         </para>
    1262                 </description>
    1263         </bitlbee-setting>
    1264 
    1265         <bitlbee-setting name="voice_buddies" type="string" scope="global">
    1266                 <default>notaway</default>
    1267                 <possible-values>encrypted, trusted, notaway, online, false</possible-values>
    1268 
    1269                 <description>
    1270                         <para>
    1271                                 Specifies under which circumstances BitlBee should give the "voice" mode flag (+v) to buddies.
    1272                         </para>
    1273                        
    1274                         <para>
    1275                                 If "false", the flag is never set. On "notaway", the flag is removed for users marked as "away" and set for all others. On "encrypted", the flag is set for users with whom we have an encrypted connection. On "trusted", it is set only for encrypted connections using a trusted key. On "online", the flag is set whenever the user is online; only meaningful in conjunction with "show_offline".
    12761036                        </para>
    12771037                </description>
  • ipc.c

    reb6df6a r00540d4  
    3333
    3434GSList *child_list = NULL;
    35 static char *statefile = NULL;
    3635
    3736static void ipc_master_cmd_client( irc_t *data, char **cmd )
     
    6362}
    6463
     64static void ipc_master_cmd_deaf( irc_t *data, char **cmd )
     65{
     66        if( global.conf->runmode == RUNMODE_DAEMON )
     67        {
     68                b_event_remove( global.listen_watch_source_id );
     69                close( global.listen_socket );
     70               
     71                global.listen_socket = global.listen_watch_source_id = -1;
     72       
     73                ipc_to_children_str( "OPERMSG :Closed listening socket, waiting "
     74                                     "for all users to disconnect." );
     75        }
     76        else
     77        {
     78                ipc_to_children_str( "OPERMSG :The DEAF command only works in "
     79                                     "normal daemon mode. Try DIE instead." );
     80        }
     81}
     82
    6583void ipc_master_cmd_rehash( irc_t *data, char **cmd )
    6684{
     
    98116        { "hello",      0, ipc_master_cmd_client,     0 },
    99117        { "die",        0, ipc_master_cmd_die,        0 },
     118        { "deaf",       0, ipc_master_cmd_deaf,       0 },
    100119        { "wallops",    1, NULL,                      IPC_CMD_TO_CHILDREN },
    101120        { "wall",       1, NULL,                      IPC_CMD_TO_CHILDREN },
     
    441460}
    442461
     462#ifndef _WIN32
    443463char *ipc_master_save_state()
    444464{
     
    481501}
    482502
    483 void ipc_master_set_statefile( char *fn )
    484 {
    485         statefile = g_strdup( fn );
    486 }
    487 
    488503
    489504static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond )
     
    506521}
    507522
    508 #ifndef _WIN32
    509523int ipc_master_listen_socket()
    510524{
     
    543557}
    544558#else
     559int ipc_master_listen_socket()
     560{
    545561        /* FIXME: Open named pipe \\.\BITLBEE */
     562        return 0;
     563}
    546564#endif
    547565
    548 int ipc_master_load_state()
     566int ipc_master_load_state( char *statefile )
    549567{
    550568        struct bitlbee_child *child;
     
    554572        if( statefile == NULL )
    555573                return 0;
     574       
    556575        fp = fopen( statefile, "r" );
    557576        unlink( statefile );    /* Why do it later? :-) */
  • ipc.h

    reb6df6a r00540d4  
    5858
    5959char *ipc_master_save_state();
    60 void ipc_master_set_statefile( char *fn );
    61 int ipc_master_load_state();
     60int ipc_master_load_state( char *statefile );
    6261int ipc_master_listen_socket();
    6362
  • irc.c

    reb6df6a r00540d4  
    2929#include "crypting.h"
    3030#include "ipc.h"
    31 #include <sys/types.h>
    32 #include <sys/wait.h>
    3331
    3432static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
    35 static void irc_welcome( irc_t* irc );
    3633
    3734GSList *irc_connection_list = NULL;
     
    180177
    181178        irc_connection_list = g_slist_append( irc_connection_list, irc );
    182 
    183179       
    184180        s = set_add( &irc->set, "away", NULL,  set_eval_away_status, irc );
    185181        s->flags |= SET_NULL_OK;
     182        s = set_add( &irc->set, "away_devoice", "true",  set_eval_away_devoice, irc );
    186183        s = set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc );
    187184        s = set_add( &irc->set, "auto_reconnect", "true", set_eval_bool, irc );
     
    190187        s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc );
    191188        s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc );
    192         s = set_add( &irc->set, "color_encrypted", "true", set_eval_bool, irc );
    193189        s = set_add( &irc->set, "control_channel", irc->channel, set_eval_control_channel, irc );
    194190        s = set_add( &irc->set, "debug", "false", set_eval_bool, irc );
     
    197193        s = set_add( &irc->set, "display_timestamps", "true", set_eval_bool, irc );
    198194        s = set_add( &irc->set, "handle_unknown", "root", NULL, irc );
    199         s = set_add( &irc->set, "halfop_buddies", "encrypted", set_eval_halfop_buddies, irc );
    200195        s = set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc );
    201         s = set_add( &irc->set, "op_buddies", "trusted", set_eval_op_buddies, irc );
    202         s = set_add( &irc->set, "op_root", "true", set_eval_op_root, irc );
    203         s = set_add( &irc->set, "otr_policy", "oppurtunistic", set_eval_otr_policy, irc );
     196        s = set_add( &irc->set, "ops", "both", set_eval_ops, irc );
    204197        s = set_add( &irc->set, "password", NULL, set_eval_password, irc );
    205198        s->flags |= SET_NULL_OK;
     
    210203        s = set_add( &irc->set, "show_offline", "false", set_eval_bool, irc );
    211204        s = set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc );
     205        s = set_add( &irc->set, "status", NULL,  set_eval_away_status, irc );
     206        s->flags |= SET_NULL_OK;
    212207        s = set_add( &irc->set, "strip_html", "true", NULL, irc );
    213208        s = set_add( &irc->set, "timezone", "local", set_eval_timezone, irc );
    214209        s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc );
    215210        s = set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc );
    216         s = set_add( &irc->set, "voice_buddies", "notaway", set_eval_voice_buddies, irc);
    217211       
    218212        conf_loaddefaults( irc );
    219 
    220         irc->otr = otr_new();
    221 
     213       
    222214        /* Evaluator sets the iconv/oconv structures. */
    223215        set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) );
     
    371363       
    372364        g_free( irc->last_target );
    373 
    374         otr_free(irc->otr);
    375365       
    376366        g_free( irc );
    377 
     367       
    378368        if( global.conf->runmode == RUNMODE_INETD ||
    379369            global.conf->runmode == RUNMODE_FORKDAEMON ||
     
    744734}
    745735
    746 const char *user_mode_prefix( irc_t *irc, user_t *u )
    747 {
    748         static char op[] = "@";
    749         static char halfop[] = "%";
    750         static char voice[] = "+";
    751         static char none[] = "";
    752 
    753         int or = set_getbool(&irc->set, "op_root");
    754         int ou = set_getbool(&irc->set, "op_user");
    755         char *ob = set_getstr(&irc->set, "op_buddies");
    756         char *hb = set_getstr(&irc->set, "halfop_buddies");
    757         char *vb = set_getstr(&irc->set, "voice_buddies");
    758 
    759         if( (!strcmp(u->nick, irc->mynick) && or) ||
    760             (!strcmp(u->nick, irc->nick) && ou) ||
    761         (!u->away && !strcmp(ob, "notaway")) ||
    762         (u->encrypted && !strcmp(ob, "encrypted")) ||
    763         (u->encrypted>1 && !strcmp(ob, "trusted"))
    764       )
    765                 return op;
    766         else if( (!u->away && !strcmp(hb, "notaway")) ||
    767              (u->encrypted && !strcmp(hb, "encrypted")) ||
    768              (u->encrypted>1 && !strcmp(hb, "trusted"))
    769                )
    770                 return halfop;
    771         else if( (!u->away && !strcmp(vb, "notaway")) ||
    772              (u->encrypted && !strcmp(vb, "encrypted")) ||
    773              (u->encrypted>1 && !strcmp(vb, "trusted"))
    774                )
    775                 return voice;
    776         else
    777                 return none;
    778 }
    779                        
    780736void irc_names( irc_t *irc, char *channel )
    781737{
     
    783739        char namelist[385] = "";
    784740        struct groupchat *c = NULL;
     741        char *ops = set_getstr( &irc->set, "ops" );
    785742       
    786743        /* RFCs say there is no error reply allowed on NAMES, so when the
     
    797754                        }
    798755                       
    799                         strcat( namelist, user_mode_prefix(irc, u) );
     756                        if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) )
     757                                strcat( namelist, "+" );
     758                        else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||
     759                                 ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) )
     760                                strcat( namelist, "@" );
     761                       
    800762                        strcat( namelist, u->nick );
    801763                        strcat( namelist, " " );
     
    808770                /* root and the user aren't in the channel userlist but should
    809771                   show up in /NAMES, so list them first: */
    810                 sprintf( namelist, "%s%s %s%s ", set_getbool(&irc->set, "op_root") ? "@" : "", irc->mynick,
    811                                                  set_getbool(&irc->set, "op_user") ? "@" : "", irc->nick );
     772                sprintf( namelist, "%s%s %s%s ", strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->mynick,
     773                                                 strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->nick );
    812774               
    813775                for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->ic, l->data ) ) )
     
    819781                        }
    820782                       
    821                         strcat( namelist, user_mode_prefix(irc, u) );
    822783                        strcat( namelist, u->nick );
    823784                        strcat( namelist, " " );
     
    861822        irc_reply( irc,   3, ":%s", IRCD_INFO );
    862823        irc_reply( irc,   4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES );
    863         irc_reply( irc,   5, "PREFIX=(ohv)@%%+ CHANTYPES=%s CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee "
     824        irc_reply( irc,   5, "PREFIX=(ov)@+ CHANTYPES=%s CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee "
    864825                             "CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server",
    865826                             CTYPES, CMODES, MAX_NICK_LENGTH - 1 );
     
    867828        irc->umode[0] = '\0';
    868829        irc_umode_set( irc, "+" UMODE, 1 );
    869 u = user_add( irc, irc->mynick );
     830
     831        u = user_add( irc, irc->mynick );
    870832        u->host = g_strdup( irc->myhost );
    871833        u->realname = g_strdup( ROOT_FN );
     
    889851        irc_spawn( irc, u );
    890852       
    891         irc_welcome( irc );
     853        irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n"
     854                          "If you've never used BitlBee before, please do read the help "
     855                          "information using the \x02help\x02 command. Lots of FAQs are "
     856                          "answered there.\n"
     857                          "If you already have an account on this server, just use the "
     858                          "\x02identify\x02 command to identify yourself." );
    892859       
    893860        if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
     
    904871                root_command( irc, send_cmd );
    905872                g_free( send_cmd[1] );
    906         }
    907 }
    908 
    909 static void irc_welcome( irc_t *irc )
    910 {
    911         FILE *f;
    912        
    913         f = fopen( global.conf->welcomefile, "r" );
    914         if( !f )
    915         {
    916                 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n"
    917                                   "If you've never used BitlBee before, please do read the help "
    918                                   "information using the \x02help\x02 command. Lots of FAQs are "
    919                                   "answered there.\n"
    920                                   "OTR users please note: Private key files are owned by the user "
    921                                   "BitlBee is running as.\n"
    922                                   "If you already have an account on this server, just use the "
    923                                   "\x02identify\x02 command to identify yourself." );
    924         }
    925         else
    926         {
    927                 char linebuf[380];
    928                
    929                 while( fgets( linebuf, 380, f ) )
    930                 {
    931                         irc_usermsg( irc, linebuf );
    932                 }
    933                
    934                 fclose( f );
    935873        }
    936874}
  • irc.h

    reb6df6a r00540d4  
    2727#define _IRC_H
    2828
    29 #include "otr.h"
    30 
    3129#define IRC_MAX_LINE 512
    32 #define IRC_MAX_ARGS 16
     30#define IRC_MAX_ARGS 8
    3331
    3432#define IRC_LOGIN_TIMEOUT 60
     
    9694        gint w_watch_source_id;
    9795        gint ping_source_id;
    98        
    99         otr_t *otr;            /* OTR state and book keeping */
    10096} irc_t;
    10197
  • irc_commands.c

    reb6df6a r00540d4  
    614614        { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },
    615615        { "die",         0, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
     616        { "deaf",        0, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
    616617        { "wallops",     1, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
    617618        { "wall",        1, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
  • lib/misc.c

    reb6df6a r00540d4  
    157157        char *s = out, *cs;
    158158        int i, matched;
    159         int taglen;
    160159       
    161160        memset( out, 0, sizeof( out ) );
     
    174173                                in ++;
    175174                       
    176                         taglen = in-cs-1;   /* not <0 because the above loop runs at least once */
    177175                        if( *in )
    178176                        {
    179                                 if( g_strncasecmp( cs+1, "b", taglen) == 0 )
    180                                         *(s++) = '\x02';
    181                                 else if( g_strncasecmp( cs+1, "/b", taglen) == 0 )
    182                                         *(s++) = '\x02';
    183                                 else if( g_strncasecmp( cs+1, "i", taglen) == 0 )
    184                                         *(s++) = '\x1f';
    185                                 else if( g_strncasecmp( cs+1, "/i", taglen) == 0 )
    186                                         *(s++) = '\x1f';
    187                                 else if( g_strncasecmp( cs+1, "br", 2) == 0 )
     177                                if( g_strncasecmp( cs+1, "br", 2) == 0 )
    188178                                        *(s++) = '\n';
    189179                                in ++;
  • lib/ssl_bogus.c

    reb6df6a r00540d4  
    2727
    2828int ssl_errno;
    29 
    30 void ssl_init( void )
    31 {
    32 }
    3329
    3430void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    7066        return 0;
    7167}
    72 
    73 int ssl_pending( void *conn )
    74 {
    75         return 0;
    76 }
  • lib/ssl_client.h

    reb6df6a r00540d4  
    4747
    4848
    49 /* Perform any global initialization the SSL library might need. */
    50 G_MODULE_EXPORT void ssl_init( void );
    51 
    5249/* Connect to host:port, call the given function when the connection is
    5350   ready to be used for SSL traffic. This is all done asynchronously, no
  • lib/ssl_gnutls.c

    reb6df6a r00540d4  
    6060static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    6161
    62 
    63 void ssl_init( void )
    64 {
    65         gnutls_global_init();
    66         initialized = TRUE;
    67         atexit( gnutls_global_deinit );
    68 }
    6962
    7063void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    129122        if( !initialized )
    130123        {
    131                 ssl_init();
     124                gnutls_global_init();
     125                initialized = TRUE;
     126                atexit( gnutls_global_deinit );
    132127        }
    133128       
  • lib/ssl_nss.c

    reb6df6a r00540d4  
    9191
    9292
    93 void ssl_init( void )
    94 {
    95         PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
    96         NSS_NoDB_Init(NULL);
    97         NSS_SetDomesticPolicy();
    98         initialized = TRUE;
    99 }
    100 
    10193void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    10294{
     
    115107        if( !initialized )
    116108        {
    117                 ssl_init();
     109                PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
     110                NSS_NoDB_Init(NULL);
     111                NSS_SetDomesticPolicy();
    118112        }
    119113
  • lib/ssl_openssl.c

    reb6df6a r00540d4  
    5656static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    5757
    58 
    59 void ssl_init( void )
    60 {
    61         initialized = TRUE;
    62         SSLeay_add_ssl_algorithms();
    63 }
    6458
    6559void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    121115        if( !initialized )
    122116        {
    123                 ssl_init();
     117                initialized = TRUE;
     118                SSLeay_add_ssl_algorithms();
    124119        }
    125120       
  • log.c

    reb6df6a r00540d4  
    3030static log_t logoutput;
    3131
    32 static void log_null(int level, const char *logmessage);
    33 static void log_irc(int level, const char *logmessage);
    34 static void log_syslog(int level, const char *logmessage);
    35 static void log_console(int level, const char *logmessage);
     32static void log_null(int level, char *logmessage);
     33static void log_irc(int level, char *logmessage);
     34static void log_syslog(int level, char *logmessage);
     35static void log_console(int level, char *logmessage);
    3636
    3737void log_init(void) {
     
    9797}
    9898
    99 void log_message(int level, const char *message, ... ) {
     99void log_message(int level, char *message, ... ) {
    100100
    101101        va_list ap;
     
    122122}
    123123
    124 void log_error(const char *functionname) {
     124void log_error(char *functionname) {
    125125        log_message(LOGLVL_ERROR, "%s: %s", functionname, strerror(errno));
    126126       
     
    128128}
    129129
    130 static void log_null(int level, const char *message) {
     130static void log_null(int level, char *message) {
    131131        return;
    132132}
    133133
    134 static void log_irc(int level, const char *message) {
     134static void log_irc(int level, char *message) {
    135135        if(level == LOGLVL_ERROR)
    136136                irc_write_all(1, "ERROR :Error: %s", message);
     
    147147}
    148148
    149 static void log_syslog(int level, const char *message) {
     149static void log_syslog(int level, char *message) {
    150150        if(level == LOGLVL_ERROR)
    151151                syslog(LOG_ERR, "%s", message);
     
    161161}
    162162
    163 static void log_console(int level, const char *message) {
     163static void log_console(int level, char *message) {
    164164        if(level == LOGLVL_ERROR)
    165165                fprintf(stderr, "Error: %s\n", message);
  • log.h

    reb6df6a r00540d4  
    4444
    4545typedef struct log_t {
    46         void (*error)(int level, const char *logmessage);
    47         void (*warning)(int level, const char *logmessage);
    48         void (*informational)(int level, const char *logmessage);
     46        void (*error)(int level, char *logmessage);
     47        void (*warning)(int level, char *logmessage);
     48        void (*informational)(int level, char *logmessage);
    4949#ifdef DEBUG
    50         void (*debug)(int level, const char *logmessage);
     50        void (*debug)(int level, char *logmessage);
    5151#endif
    5252} log_t;
     
    5454void log_init(void);
    5555void log_link(int level, int output);
    56 void log_message(int level, const char *message, ...) G_GNUC_PRINTF( 2, 3 );
    57 void log_error(const char *functionname);
     56void log_message(int level, char *message, ...) G_GNUC_PRINTF( 2, 3 );
     57void log_error(char *functionname);
    5858
    5959#endif
  • protocols/jabber/jabber.c

    reb6df6a r00540d4  
    531531       
    532532        ret->name = "jabber";
    533     ret->mms = 0;                        /* no limit */
    534533        ret->login = jabber_login;
    535534        ret->init = jabber_init;
  • protocols/msn/msn.c

    reb6df6a r00540d4  
    307307       
    308308        ret->name = "msn";
    309     ret->mms = 1409;         /* this guess taken from libotr UPGRADING file */
    310309        ret->login = msn_login;
    311310        ret->init = msn_init;
  • protocols/msn/ns.c

    reb6df6a r00540d4  
    271271                if( num_parts == 5 )
    272272                {
     273                        int i, groupcount;
     274                       
     275                        groupcount = atoi( cmd[4] );
     276                        if( groupcount > 0 )
     277                        {
     278                                /* valgrind says this is leaking memory, I'm guessing
     279                                   that this happens during server redirects. */
     280                                if( md->grouplist )
     281                                {
     282                                        for( i = 0; i < md->groupcount; i ++ )
     283                                                g_free( md->grouplist[i] );
     284                                        g_free( md->grouplist );
     285                                }
     286                               
     287                                md->groupcount = groupcount;
     288                                md->grouplist = g_new0( char *, md->groupcount );
     289                        }
     290                       
    273291                        md->buddycount = atoi( cmd[3] );
    274                         md->groupcount = atoi( cmd[4] );
    275                         if( md->groupcount > 0 )
    276                                 md->grouplist = g_new0( char *, md->groupcount );
    277                        
    278292                        if( !*cmd[3] || md->buddycount == 0 )
    279293                                msn_logged_in( ic );
  • protocols/nogaim.c

    reb6df6a r00540d4  
    725725        }
    726726       
    727         /* LISPy... */
    728         if( ( u->online ) &&                                            /* Don't touch offline people */
    729             ( ( u->online != oo ) ||                                    /* Do joining people */
    730               ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* Do people changing state */
     727        /* early if-clause for show_offline even if there is some redundant code here because this isn't LISP but C ;) */
     728        if( set_getbool( &ic->irc->set, "show_offline" ) && set_getbool( &ic->irc->set, "away_devoice" ) )
    731729        {
    732730                char *from;
     
    742740                }
    743741
    744                 if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "online")) {
    745                         irc_write( ic->irc, ":%s MODE %s +v %s", from, ic->irc->channel, u->nick );
    746                 }
    747                 if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "online")) {
    748                         irc_write( ic->irc, ":%s MODE %s +h %s", from, ic->irc->channel, u->nick );
    749                 }
    750                 if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "online")) {
    751                         irc_write( ic->irc, ":%s MODE %s +o %s", from, ic->irc->channel, u->nick );
    752                 }
    753 
    754                 if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) {
     742                /* if we use show_offline, we op online users, voice away users, and devoice/deop offline users */
     743                if( flags & OPT_LOGGED_IN )
     744                {
     745                        /* user is "online" (either really online or away) */
     746                        irc_write( ic->irc, ":%s MODE %s %cv%co %s %s", from, ic->irc->channel,
     747                                                                  u->away?'+':'-', u->away?'-':'+', u->nick, u->nick );
     748                }
     749                else
     750                {
     751                        /* user is offline */
     752                        irc_write( ic->irc, ":%s MODE %s -vo %s %s", from, ic->irc->channel, u->nick, u->nick );
     753                }
     754        }
     755        else
     756        {
     757                /* LISPy... */
     758                if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
     759                    ( u->online ) &&                                            /* Don't touch offline people */
     760                    ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
     761                      ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
     762                {
     763                        char *from;
     764
     765                        if( set_getbool( &ic->irc->set, "simulate_netsplit" ) )
     766                        {
     767                                from = g_strdup( ic->irc->myhost );
     768                        }
     769                        else
     770                        {
     771                                from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
     772                                                                    ic->irc->myhost );
     773                        }
    755774                        irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    756                                                                  u->away?'-':'+', u->nick );
    757                 }
    758                 if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "notaway")) {
    759                         irc_write( ic->irc, ":%s MODE %s %ch %s", from, ic->irc->channel,
    760                                                                  u->away?'-':'+', u->nick );
    761                 }
    762                 if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "notaway")) {
    763                         irc_write( ic->irc, ":%s MODE %s %co %s", from, ic->irc->channel,
    764                                                                  u->away?'-':'+', u->nick );
    765                 }
    766 
    767                 g_free( from );
     775                                                                  u->away?'-':'+', u->nick );
     776                        g_free( from );
     777                }
    768778        }
    769779}
     
    774784        char *wrapped, *ts = NULL;
    775785        user_t *u;
    776 
    777         /* pass the message through OTR */
    778         msg = otr_handle_message(ic, handle, msg);
    779         if(!msg) {
    780                 /* this was an internal OTR protocol message */
    781                 return;
    782         }
    783 
     786       
    784787        u = user_findhandle( ic, handle );
     788       
    785789        if( !u )
    786790        {
     
    792796                                imcb_log( ic, "Ignoring message from unknown handle %s", handle );
    793797                       
    794                         g_free(msg);
    795798                        return;
    796799                }
     
    826829        {
    827830                char *new = g_strconcat( ts, msg, NULL );
    828                 g_free( msg );
    829                 msg = new;
     831                g_free( ts );
     832                ts = msg = new;
    830833        }
    831834       
     
    833836        irc_msgfrom( irc, u->nick, wrapped );
    834837        g_free( wrapped );
    835         g_free( msg );
    836838        g_free( ts );
    837839}
     
    11101112/* Misc. BitlBee stuff which shouldn't really be here */
    11111113
     1114char *set_eval_away_devoice( set_t *set, char *value )
     1115{
     1116        irc_t *irc = set->data;
     1117        int st;
     1118       
     1119        if( !is_bool( value ) )
     1120                return SET_INVALID;
     1121       
     1122        st = bool2int( value );
     1123       
     1124        /* Horror.... */
     1125       
     1126        if( st != set_getbool( &irc->set, "away_devoice" ) )
     1127        {
     1128                char list[80] = "";
     1129                user_t *u = irc->users;
     1130                int i = 0, count = 0;
     1131                char pm;
     1132                char v[80];
     1133               
     1134                if( st )
     1135                        pm = '+';
     1136                else
     1137                        pm = '-';
     1138               
     1139                while( u )
     1140                {
     1141                        if( u->ic && u->online && !u->away )
     1142                        {
     1143                                if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
     1144                                {
     1145                                        for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
     1146                                        irc_write( irc, ":%s MODE %s %c%s%s",
     1147                                                   irc->myhost,
     1148                                                   irc->channel, pm, v, list );
     1149                                       
     1150                                        *list = 0;
     1151                                        count = 0;
     1152                                }
     1153                               
     1154                                sprintf( list + strlen( list ), " %s", u->nick );
     1155                                count ++;
     1156                        }
     1157                        u = u->next;
     1158                }
     1159               
     1160                /* $v = 'v' x $i */
     1161                for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
     1162                irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost,
     1163                                                            irc->channel, pm, v, list );
     1164        }
     1165       
     1166        return value;
     1167}
     1168
    11121169char *set_eval_timezone( set_t *set, char *value )
    11131170{
     
    12121269                msg = buf;
    12131270        }
    1214 
    1215         /* if compiled without otr support, this just calls the prpl buddy_msg */
    1216         st = otr_send_message(ic, handle, msg, flags);
    1217        
    1218         g_free(buf);
     1271       
     1272        st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags );
     1273        g_free( buf );
     1274       
    12191275        return st;
    12201276}
  • protocols/nogaim.h

    reb6df6a r00540d4  
    5959#define OPT_TYPING      0x00000100 /* Some pieces of code make assumptions */
    6060#define OPT_THINKING    0x00000200 /* about these values... Stupid me! */
    61 #define OPT_NOOTR       0x00001000 /* protocol not suitable for OTR */
    6261
    6362/* ok. now the fun begins. first we create a connection structure */
     
    133132         * - The user sees this name ie. when imcb_log() is used. */
    134133        const char *name;
    135         /* Maximum Message Size of this protocol.
    136          * - Introduced for OTR, in order to fragment large protocol messages.
    137          * - 0 means "unlimited". */
    138         unsigned int mms;
    139134
    140135        /* Added this one to be able to add per-account settings, don't think
     
    331326/* Misc. stuff */
    332327char *set_eval_timezone( set_t *set, char *value );
     328char *set_eval_away_devoice( set_t *set, char *value );
    333329gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
    334330void cancel_auto_reconnect( struct account *a );
  • protocols/oscar/oscar.c

    reb6df6a r00540d4  
    25542554        struct prpl *ret = g_new0(struct prpl, 1);
    25552555        ret->name = "oscar";
    2556     ret->mms = 2343;       /* this guess taken from libotr UPGRADING file */
    25572556        ret->away_states = oscar_away_states;
    25582557        ret->init = oscar_init;
  • protocols/twitter/twitter.c

    reb6df6a r00540d4  
    376376        struct prpl *ret = g_new0(struct prpl, 1);
    377377       
    378         ret->options = OPT_NOOTR;
    379378        ret->name = "twitter";
    380379        ret->login = twitter_login;
  • protocols/yahoo/libyahoo2.c

    reb6df6a r00540d4  
    6969#ifdef __MINGW32__
    7070# include <winsock2.h>
    71 # define write(a,b,c) send(a,b,c,0)
    72 # define read(a,b,c)  recv(a,b,c,0)
    7371#endif
    7472
  • protocols/yahoo/yahoo.c

    reb6df6a r00540d4  
    355355        struct prpl *ret = g_new0(struct prpl, 1);
    356356        ret->name = "yahoo";
    357     ret->mms = 832;           /* this guess taken from libotr UPGRADING file */
    358357        ret->init = byahoo_init;
    359358       
  • protocols/yahoo/yahoo_httplib.c

    reb6df6a r00540d4  
    5151#ifdef __MINGW32__
    5252# include <winsock2.h>
    53 # define write(a,b,c) send(a,b,c,0)
    54 # define read(a,b,c)  recv(a,b,c,0)
    5553# define snprintf _snprintf
    5654#endif
  • query.c

    reb6df6a r00540d4  
    103103        int count = 0;
    104104       
    105         if(!ic)
    106                 return;
    107        
    108105        q = irc->queries;
    109106        def = query_default( irc );
     
    148145                else
    149146                        irc_usermsg( irc, "Accepted: %s", q->question );
    150                 if( q->yes )
    151                         q->yes( q->data );
     147                q->yes( q->data );
    152148        }
    153149        else
     
    157153                else
    158154                        irc_usermsg( irc, "Rejected: %s", q->question );
    159                 if( q->no )
    160                         q->no( q->data );
     155                q->no( q->data );
    161156        }
    162157        q->data = NULL;
  • root_commands.c

    reb6df6a r00540d4  
    2929#include "bitlbee.h"
    3030#include "help.h"
    31 #include "otr.h"
    3231#include "chat.h"
    3332
     
    415414               
    416415                irc_usermsg( irc, "Account successfully added" );
    417                
    418                 if(otr_check_for_key(a)) {
    419                         irc_usermsg(irc, "otr: you will be notified when it completes");
    420                 }
    421416        }
    422417        else if( g_strcasecmp( cmd[1], "del" ) == 0 )
     
    11821177        { "qlist",          0, cmd_qlist,          0 },
    11831178        { "join_chat",      2, cmd_join_chat,      0 },
    1184         { "otr",            1, cmd_otr,            0 },
    11851179        { "chat",           1, cmd_chat,           0 },
    11861180        { NULL }
  • set.c

    reb6df6a r00540d4  
    225225}
    226226
    227 char* set_eval_op_root( set_t *set, char* value )
     227char *set_eval_ops( set_t *set, char *value )
    228228{
    229229        irc_t *irc = set->data;
    230         char* ret = set_eval_bool(set, value);
    231         int b = bool2int(ret);
    232 
    233         irc_write( irc, ":%s!%s@%s MODE %s %s %s", irc->mynick, irc->mynick, irc->myhost,
    234                                                irc->channel, b?"+o":"-o", irc->mynick);
    235 
    236         return ret;
    237 }
    238 
    239 char* set_eval_op_user( set_t *set, char* value )
    240 {
    241         irc_t *irc = set->data;
    242         char* ret = set_eval_bool(set, value);
    243         int b = bool2int(ret);
    244 
    245         irc_write( irc, ":%s!%s@%s MODE %s %s %s", irc->mynick, irc->mynick, irc->myhost,
    246                                                irc->channel, b?"+o":"-o", irc->nick);
    247 
    248         return ret;
    249 }
    250 
    251 /* generalized version of set_eval_op/voice_buddies */
    252 char *set_eval_mode_buddies( set_t *set, char *value, char modeflag )
    253 {
    254         irc_t *irc = set->data;
    255         char op[64], deop[64];
    256         int nop=0, ndeop=0;
    257         user_t *u;
    258         int mode;
    259        
    260         if(!strcmp(value, "false"))
    261                 mode=0;
    262         else if(!strcmp(value, "encrypted"))
    263                 mode=1;
    264         else if(!strcmp(value, "trusted"))
    265                 mode=2;
    266         else if(!strcmp(value, "notaway"))
    267                 mode=3;
     230       
     231        if( g_strcasecmp( value, "user" ) == 0 )
     232                irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost,
     233                                                              irc->channel, "+o-o", irc->nick, irc->mynick );
     234        else if( g_strcasecmp( value, "root" ) == 0 )
     235                irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost,
     236                                                              irc->channel, "-o+o", irc->nick, irc->mynick );
     237        else if( g_strcasecmp( value, "both" ) == 0 )
     238                irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost,
     239                                                              irc->channel, "+oo", irc->nick, irc->mynick );
     240        else if( g_strcasecmp( value, "none" ) == 0 )
     241                irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost,
     242                                                              irc->channel, "-oo", irc->nick, irc->mynick );
    268243        else
    269244                return SET_INVALID;
    270 
    271         /* sorry for calling them op/deop - too lazy for search+replace :P */
    272         op[0]='\0';
    273         deop[0]='\0';
    274         for(u=irc->users; u; u=u->next) {
    275                 /* we're only concerned with online buddies */
    276                 if(!u->ic || !u->online)
    277                         continue;
    278 
    279                 /* just in case... */
    280                 if(strlen(u->nick) >= 64)
    281                         continue;
    282                
    283                 /* dump out ops/deops when the corresponding name list fills up */
    284                 if(strlen(op)+strlen(u->nick)+2 > 64) {
    285                         char *flags = g_strnfill(nop, modeflag);
    286                         irc_write( irc, ":%s!%s@%s MODE %s +%s%s", irc->mynick, irc->mynick, irc->myhost,
    287                                                                irc->channel, flags, op );
    288                     op[0]='\0';
    289             nop=0;
    290                     g_free(flags);
    291                 }
    292                 if(strlen(deop)+strlen(u->nick)+2 > 64) {
    293                         char *flags = g_strnfill(ndeop, modeflag);
    294                         irc_write( irc, ":%s!%s@%s MODE %s -%s%s", irc->mynick, irc->mynick, irc->myhost,
    295                                                                irc->channel, flags, deop );
    296                     deop[0]='\0';
    297             ndeop=0;
    298                     g_free(flags);
    299                 }
    300                
    301                 switch(mode) {
    302                 /* "false" */
    303                 case 0:
    304                         g_strlcat(deop, " ", 64);
    305                         g_strlcat(deop, u->nick, 64);
    306                         ndeop++;
    307                         break;
    308                 /* "encrypted" */
    309                 case 1:
    310                         if(u->encrypted) {
    311                                 g_strlcat(op, " ", 64);
    312                                 g_strlcat(op, u->nick, 64);
    313                                 nop++;
    314                         } else {
    315                                 g_strlcat(deop, " ", 64);
    316                                 g_strlcat(deop, u->nick, 64);
    317                                 ndeop++;
    318                         }
    319                         break;
    320                 /* "trusted" */
    321                 case 2:
    322                         if(u->encrypted > 1) {
    323                                 g_strlcat(op, " ", 64);
    324                                 g_strlcat(op, u->nick, 64);
    325                                 nop++;
    326                         } else {
    327                                 g_strlcat(deop, " ", 64);
    328                                 g_strlcat(deop, u->nick, 64);
    329                                 ndeop++;
    330                         }
    331                         break;
    332                 /* "notaway" */
    333                 case 3:
    334                         if(u->away) {
    335                                 g_strlcat(deop, " ", 64);
    336                                 g_strlcat(deop, u->nick, 64);
    337                                 ndeop++;
    338                         } else {
    339                                 g_strlcat(op, " ", 64);
    340                                 g_strlcat(op, u->nick, 64);
    341                                 nop++;
    342                         }
    343                 }
    344         }
    345         /* dump anything left in op/deop lists */
    346         if(*op) {
    347                 char *flags = g_strnfill(nop, modeflag);
    348                 irc_write( irc, ":%s!%s@%s MODE %s +%s%s", irc->mynick, irc->mynick, irc->myhost,
    349                                                                irc->channel, flags, op );
    350                 g_free(flags);
    351         }
    352         if(*deop) {
    353                 char *flags = g_strnfill(ndeop, modeflag);
    354                 irc_write( irc, ":%s!%s@%s MODE %s -%s%s", irc->mynick, irc->mynick, irc->myhost,
    355                                                    irc->channel, flags, deop );
    356         g_free(flags);
    357     }
    358 
     245       
    359246        return value;
    360247}
    361 
    362 char *set_eval_op_buddies( set_t *set, char *value )
    363 {
    364         return set_eval_mode_buddies(set, value, 'o');
    365 }
    366 
    367 char *set_eval_halfop_buddies( set_t *set, char *value )
    368 {
    369         return set_eval_mode_buddies(set, value, 'h');
    370 }
    371 
    372 char *set_eval_voice_buddies( set_t *set, char *value )
    373 {
    374         return set_eval_mode_buddies(set, value, 'v');
    375 }
    376 
    377 /* possible values: never, opportunistic, manual, always */
    378 char *set_eval_otr_policy( set_t *set, char *value )
    379 {
    380         if ( !strcmp(value, "never") )
    381                 return value;
    382         if ( !strcmp(value, "opportunistic") )
    383                 return value;
    384         if ( !strcmp(value, "manual") )
    385                 return value;
    386         if ( !strcmp(value, "always") )
    387                 return value;
    388         return NULL;
    389 }
    390 
  • set.h

    reb6df6a r00540d4  
    100100/* Some not very generic evaluators that really shouldn't be here... */
    101101char *set_eval_to_char( set_t *set, char *value );
    102 char *set_eval_op_root( set_t *set, char *value );
    103 char *set_eval_op_user( set_t *set, char *value );
    104 char *set_eval_op_buddies( set_t *set, char *value );
    105 char *set_eval_halfop_buddies( set_t *set, char *value );
    106 char *set_eval_voice_buddies( set_t *set, char *value );
    107 char *set_eval_otr_policy( set_t *set, char *value );
     102char *set_eval_ops( set_t *set, char *value );
    108103
    109104#endif /* __SET_H__ */
  • sock.h

    reb6df6a r00540d4  
    1616#else
    1717# include <winsock2.h>
    18 # ifndef _MSC_VER
    19 #  include <ws2tcpip.h>
    20 # endif
     18# include <ws2tcpip.h>
    2119# if !defined(BITLBEE_CORE) && defined(_MSC_VER)
    2220#   pragma comment(lib,"bitlbee.lib")
    2321# endif
    2422# include <io.h>
    25 # define read(a,b,c) recv(a,b,c,0)
    26 # define write(a,b,c) send(a,b,c,0)
    27 # define umask _umask
    28 # define mode_t int
    2923# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
    3024# define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); }
  • storage.c

    reb6df6a r00540d4  
    2929#include "bitlbee.h"
    3030#include "crypting.h"
    31 #include "otr.h"
    3231
    3332extern storage_t storage_text;
     
    117116
    118117                status = st->load(irc, password);
    119                 if (status == STORAGE_OK) {
    120                         otr_load(irc);
     118                if (status == STORAGE_OK)
    121119                        return status;
    122                 }
     120               
    123121                if (status != STORAGE_NO_SUCH_USER)
    124122                        return status;
     
    141139                return STORAGE_NO_SUCH_USER;
    142140        }
    143 
    144         otr_save(irc);
     141       
    145142        st = ((storage_t *)global.storage->data)->save(irc, overwrite);
    146143       
     
    168165                        ret = status;
    169166        }
    170         if (ret == STORAGE_OK) {
    171                 otr_remove(nick);
    172         }
    173167       
    174168        return ret;
     
    184178        storage_t *primary_storage = gl->data;
    185179        irc_t *irc;
    186        
     180
    187181        /* First, try to rename in the current write backend, assuming onick
    188182         * is stored there */
    189183        status = primary_storage->rename(onick, nnick, password);
    190         if (status != STORAGE_NO_SUCH_USER) {
    191                 otr_rename(onick, nnick);
     184        if (status != STORAGE_NO_SUCH_USER)
    192185                return status;
    193         }
    194186
    195187        /* Try to load from a migration backend and save to the current backend.
     
    215207
    216208        storage_remove(onick, password);
    217         otr_rename(onick, nnick);
    218209
    219210        return STORAGE_OK;
  • storage_text.c

    reb6df6a r00540d4  
    2727#include "bitlbee.h"
    2828#include "crypting.h"
     29#ifdef _WIN32
     30# define umask _umask
     31# define mode_t int
     32#endif
     33
     34#ifndef F_OK
     35#define F_OK 0
     36#endif
    2937
    3038static void text_init (void)
  • unix.c

    reb6df6a r00540d4  
    2929#include "base64.h"
    3030#include "commands.h"
    31 #include "crypting.h"
    32 #include "otr.h"
    3331#include "protocols/nogaim.h"
    3432#include "help.h"
    3533#include "ipc.h"
    36 #include "lib/ssl_client.h"
    3734#include "md5.h"
    3835#include "misc.h"
     
    6663        b_main_init();
    6764        nogaim_init();
    68         /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt
    69            has a process-global config state whose initialization happpens
    70            twice if libotr and gnutls are used together. libotr installs custom
    71            memory management functions for libgcrypt while our gnutls module
    72            uses the defaults. Therefore we initialize OTR after SSL. *sigh* */
    73         ssl_init();
    74         otr_init();
    7565       
    7666        srand( time( NULL ) ^ getpid() );
  • user.h

    reb6df6a r00540d4  
    3838        char is_private;
    3939        char online;
    40         char encrypted;
    4140       
    4241        char *handle;
Note: See TracChangeset for help on using the changeset viewer.