Changes in / [6a78c0e:6738a67]


Ignore:
Files:
3 added
32 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r6a78c0e r6738a67  
    1111# Program variables
    1212objects = account.o bitlbee.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 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 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
    1414subdirs = lib protocols
    1515
     
    2020OUTFILE=bitlbee.exe
    2121else
    22 objects += unix.o conf.o log.o
     22objects += unix.o conf.o log.o otr.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
    9697        install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
    9798
    9899uninstall-etc:
    99100        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
     101        rm -f $(DESTDIR)$(ETCDIR)/welcome.txt
    100102        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
    101103        -rmdir $(DESTDIR)$(ETCDIR)
  • bitlbee.conf

    r6a78c0e r6738a67  
    8686# MotdFile = /etc/bitlbee/motd.txt
    8787
     88## WelcomeFile
     89##
     90## Specify an alternative file for the welcome message displayed when joining the
     91## control channel. Default value depends on the --etcdir argument to configure.
     92##
     93# WelcomeFile = /etc/bitlbee/welcome.txt
     94
    8895## ConfigDir
    8996##
  • bitlbee.h

    r6a78c0e r6738a67  
    137137#include "misc.h"
    138138#include "proxy.h"
     139#include "otr.h"
    139140
    140141typedef struct global {
     
    148149        char *helpfile;
    149150        int restart;
     151        OtrlMessageAppOps otr_ops;   /* collects interface functions required by OTR */
    150152} global_t;
    151153
  • conf.c

    r6a78c0e r6738a67  
    6060        conf->pidfile = g_strdup( PIDFILE );
    6161        conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
     62        conf->welcomefile = g_strdup( ETCDIR "/welcome.txt" );
    6263        conf->ping_interval = 180;
    6364        conf->ping_timeout = 300;
     
    241242                                g_free( conf->motdfile );
    242243                                conf->motdfile = g_strdup( ini->value );
     244                        }
     245                        else if( g_strcasecmp( ini->key, "welcomefile" ) == 0 )
     246                        {
     247                                g_free( conf->welcomefile );
     248                                conf->welcomefile = g_strdup( ini->value );
    243249                        }
    244250                        else if( g_strcasecmp( ini->key, "account_storage" ) == 0 )
  • conf.h

    r6a78c0e r6738a67  
    4545        char *pidfile;
    4646        char *motdfile;
     47        char *welcomefile;
    4748        char *primary_storage;
    4849        char **migrate_storage;
  • configure

    r6a78c0e r6738a67  
    3131gcov=0
    3232plugins=1
     33otr=auto
    3334
    3435events=glib
     
    7172--gcov=0/1      Disable/enable test coverage reporting  $gcov
    7273--plugins=0/1   Disable/enable plugins support          $plugins
     74--otr=0/1/auto  Disable/enable OTR encryption support   $otr
    7375
    7476--events=...    Event handler (glib, libevent)          $events
     
    411413fi
    412414
     415otrprefix=""
     416for i in / /usr /usr/local; do
     417        if [ -f ${i}/lib/libotr.a ]; then
     418                otrprefix=${i}
     419                break
     420        fi
     421done
     422if [ "$otr" = "auto" ]; then
     423        if [ -n "$otrprefix" ]; then
     424                otr=1
     425        else
     426                otr=0
     427        fi
     428fi
     429if [ "$otr" = 1 ]; then
     430        echo '#define WITH_OTR' >> config.h
     431        echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
     432        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
     433else
     434        echo '#undef WITH_OTR' >> config.h
     435fi
     436
    413437echo
    414438if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
     
    536560fi
    537561
     562if [ "$otr" = "1" ]; then
     563        echo '  Off-the-Record (OTR) Messaging enabled.'
     564else
     565        echo '  Off-the-Record (OTR) Messaging disabled.'
     566fi
     567
    538568echo '  Using event handler: '$events
    539569echo '  Using SSL library: '$ssl
  • doc/README

    r6a78c0e r6738a67  
    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
     70Off-the-Record encryption support will be included by default if the
     71configure 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.
    6973
    7074These days, MSN Messenger clients have to connect to the MS Passport servers
     
    143147
    144148
    145 A NOTE ON ENCRYPTION
    146 ====================
     149A NOTE ON PASSWORD ENCRYPTION
     150=============================
    147151
    148152There used to be a note here about the simple obfuscation method used to
  • doc/user-guide/commands.xml

    r6a78c0e r6738a67  
    240240                </description>
    241241        </bitlbee-command>
     242       
     243        <bitlbee-command name="otr">
     244                <short-description>Off-the-Record encryption control</short-description>
     245                <syntax>otr &lt;subcommand&gt; [&lt;arguments&gt;]</syntax>
     246
     247                <description>
     248
     249                        <para>
     250                                Available subcommands: connect, disconnect, smp, trust, info, keygen, and forget. See <emphasis>help otr &lt;subcommand&gt;</emphasis> for more information.
     251                        </para>
     252
     253                </description>
     254               
     255                <bitlbee-command name="connect">
     256                        <syntax>otr connect &lt;nick&gt;</syntax>
     257                       
     258                        <description>
     259                       
     260                                <para>
     261                                        Attempts to establish an encrypted connection with the specified user by sending a magic string.
     262                                </para>
     263                               
     264                        </description>
     265               
     266                </bitlbee-command>
     267               
     268                <bitlbee-command name="disconnect">
     269                        <syntax>otr disconnect &lt;nick&gt;</syntax>
     270                       
     271                        <description>
     272                       
     273                                <para>
     274                                        Resets the connection with the specified user to cleartext.
     275                                </para>
     276                               
     277                        </description>
     278               
     279                </bitlbee-command>
     280               
     281                <bitlbee-command name="smp">
     282                        <syntax>otr smp &lt;nick&gt; &lt;secret&gt;</syntax>
     283                       
     284                        <description>
     285                       
     286                                <para>
     287                                        Attempts to authenticate the given user's active fingerprint via the Socialist Millionaires' Protocol.
     288                                </para>
     289                               
     290                                <para>
     291                                        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.
     292                                </para>
     293                               
     294                        </description>
     295               
     296                </bitlbee-command>
     297               
     298                <bitlbee-command name="trust">
     299                        <syntax>otr trust &lt;nick&gt; &lt;fp1&gt; &lt;fp2&gt; &lt;fp3&gt; &lt;fp4&gt; &lt;fp5&gt;</syntax>
     300                       
     301                        <description>
     302                       
     303                                <para>
     304                                        Manually affirms trust in the specified fingerprint, given as five blocks of precisely eight (hexadecimal) digits each.
     305                                </para>
     306                               
     307                        </description>
     308               
     309                </bitlbee-command>
     310               
     311                <bitlbee-command name="info">
     312                        <syntax>otr info</syntax>
     313                        <syntax>otr info &lt;nick&gt;</syntax>
     314                       
     315                        <description>
     316                       
     317                                <para>
     318                                        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.
     319                                </para>
     320                               
     321                        </description>
     322               
     323                </bitlbee-command>
     324               
     325                <bitlbee-command name="keygen">
     326                        <syntax>otr keygen &lt;account-no&gt;</syntax>
     327                       
     328                        <description>
     329                       
     330                                <para>
     331                                        Generates a new OTR private key for the given account.
     332                                </para>
     333                               
     334                        </description>
     335               
     336                </bitlbee-command>
     337               
     338                <bitlbee-command name="forget">
     339                        <syntax>otr forget &lt;thing&gt; &lt;arguments&gt;</syntax>
     340                       
     341                        <description>
     342                       
     343                                <para>
     344                                        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.
     345                                </para>
     346                       
     347                        </description>
     348                       
     349                        <bitlbee-command name="fingerprint">
     350                                <syntax>otr forget fingerprint &lt;nick&gt; &lt;fingerprint&gt;</syntax>
     351                               
     352                                <description>
     353                               
     354                                        <para>
     355                                                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.
     356                                        </para>
     357                                       
     358                                </description>
     359                               
     360                        </bitlbee-command>
     361                               
     362                        <bitlbee-command name="context">
     363                                <syntax>otr forget context &lt;nick&gt;</syntax>
     364                               
     365                                <description>
     366                               
     367                                        <para>
     368                                                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.
     369                                        </para>
     370                                       
     371                                </description>
     372                               
     373                        </bitlbee-command>
     374
     375                        <bitlbee-command name="key">
     376                                <syntax>otr forget key &lt;fingerprint&gt;</syntax>
     377                               
     378                                <description>
     379                               
     380                                        <para>
     381                                                Forgets an OTR private key matching the specified fingerprint. It is allowed to specify only a (unique) prefix of the fingerprint.
     382                                        </para>
     383                                       
     384                                </description>
     385                               
     386                        </bitlbee-command>
     387               
     388                </bitlbee-command>
     389               
     390        </bitlbee-command>
    242391
    243392        <bitlbee-command name="set">
     
    394543        </bitlbee-setting>
    395544
     545        <bitlbee-setting name="color_encrypted" type="boolean" scope="global">
     546                <default>true</default>
     547
     548                <description>
     549                        <para>
     550                                If set to true, BitlBee will color incoming encrypted messages according to their fingerprint trust level: untrusted=red, trusted=green.
     551                        </para>
     552                </description>
     553
     554        </bitlbee-setting>
     555
    396556        <bitlbee-setting name="debug" type="boolean" scope="global">
    397557                <default>false</default>
     
    460620        </bitlbee-setting>
    461621
     622        <bitlbee-setting name="halfop_buddies" type="string" scope="global">
     623                <default>encrypted</default>
     624                <possible-values>encrypted, trusted, notaway, false</possible-values>
     625
     626                <description>
     627                        <para>
     628                                Specifies under which circumstances BitlBee should give the "halfop" mode flag (+h) to buddies.
     629                        </para>
     630                       
     631                        <para>
     632                                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.
     633                        </para>
     634                </description>
     635
     636        </bitlbee-setting>
     637
    462638        <bitlbee-setting name="lcnicks" type="boolean" scope="global">
    463639                <default>true</default>
     
    482658        </bitlbee-setting>
    483659
    484         <bitlbee-setting name="ops" type="string" scope="global">
    485                 <default>both</default>
    486                 <possible-values>both, root, user, none</possible-values>
    487 
    488                 <description>
    489                         <para>
    490                                 Some people prefer themself and root to have operator status in &amp;bitlbee, other people don't. You can change these states using this setting.
    491                         </para>
    492 
    493                         <para>
    494                                 The value "both" means both user and root get ops. "root" means, well, just root. "user" means just the user. "none" means nobody will get operator status.
     660        <bitlbee-setting name="op_buddies" type="string" scope="global">
     661                <default>trusted</default>
     662                <possible-values>encrypted, trusted, notaway, false</possible-values>
     663
     664                <description>
     665                        <para>
     666                                Specifies under which circumstances BitlBee should give the "op" mode flag (+o) to buddies.
     667                        </para>
     668                       
     669                        <para>
     670                                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.
     671                        </para>
     672                </description>
     673
     674        </bitlbee-setting>
     675
     676        <bitlbee-setting name="op_root" type="bool" scope="global">
     677                <default>true</default>
     678
     679                <description>
     680                        <para>
     681                                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.
     682                        </para>
     683                </description>
     684        </bitlbee-setting>
     685
     686        <bitlbee-setting name="op_user" type="bool" scope="global">
     687                <default>true</default>
     688
     689                <description>
     690                        <para>
     691                                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.
     692                        </para>
     693                </description>
     694        </bitlbee-setting>
     695
     696        <bitlbee-setting name="otr_policy" type="string" scope="global">
     697                <default>opportunistic</default>
     698                <possible-values>never, opportunistic, manual, always</possible-values>
     699
     700                <description>
     701                        <para>
     702                                This setting controls the policy for establishing Off-the-Record connections.
     703                        </para>
     704                        <para>
     705                                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.
    495706                        </para>
    496707                </description>
     
    686897                        </para>
    687898                </description>
     899        </bitlbee-setting>
     900
     901        <bitlbee-setting name="voice_buddies" type="string" scope="global">
     902                <default>trusted</default>
     903                <possible-values>encrypted, trusted, notaway, false</possible-values>
     904
     905                <description>
     906                        <para>
     907                                Specifies under which circumstances BitlBee should give the "voice" mode flag (+v) to buddies.
     908                        </para>
     909                       
     910                        <para>
     911                                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.
     912                        </para>
     913                </description>
     914
    688915        </bitlbee-setting>
    689916
  • irc.c

    r6a78c0e r6738a67  
    2929#include "crypting.h"
    3030#include "ipc.h"
     31#include <sys/types.h>
     32#include <sys/wait.h>
    3133
    3234static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
     35static void irc_welcome( irc_t *irc );
    3336
    3437GSList *irc_connection_list = NULL;
     
    135138
    136139        irc_connection_list = g_slist_append( irc_connection_list, irc );
    137        
    138         set_add( &irc->set, "away_devoice", "true",  set_eval_away_devoice, irc );
     140
    139141        set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc );
    140142        set_add( &irc->set, "auto_reconnect", "false", set_eval_bool, irc );
     
    143145        set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc );
    144146        set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc );
     147        set_add( &irc->set, "color_encrypted", "true", set_eval_bool, irc );
    145148        set_add( &irc->set, "debug", "false", set_eval_bool, irc );
    146149        set_add( &irc->set, "default_target", "root", NULL, irc );
    147150        set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc );
    148151        set_add( &irc->set, "handle_unknown", "root", NULL, irc );
     152        set_add( &irc->set, "halfop_buddies", "encrypted", set_eval_halfop_buddies, irc );
    149153        set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc );
    150         set_add( &irc->set, "ops", "both", set_eval_ops, irc );
     154        set_add( &irc->set, "op_buddies", "trusted", set_eval_op_buddies, irc );
     155        set_add( &irc->set, "op_root", "true", set_eval_op_root, irc );
     156        set_add( &irc->set, "op_user", "true", set_eval_op_user, irc );
     157        set_add( &irc->set, "otr_policy", "opportunistic", set_eval_otr_policy, irc );
    151158        set_add( &irc->set, "password", NULL, passchange, irc );
    152159        set_add( &irc->set, "private", "true", set_eval_bool, irc );
     
    158165        set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc );
    159166        set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc );
     167        set_add( &irc->set, "voice_buddies", "notaway",  set_eval_voice_buddies, irc );
    160168       
    161169        conf_loaddefaults( irc );
     170
     171        irc->otr = otr_new();
    162172       
    163173        /* Evaluator sets the iconv/oconv structures. */
     
    312322       
    313323        g_free( irc->last_target );
     324       
     325        otr_free(irc->otr);
    314326       
    315327        g_free( irc );
     
    685697}
    686698
     699const char *user_mode_prefix( irc_t *irc, user_t *u )
     700{
     701        static char op[] = "@";
     702        static char halfop[] = "%";
     703        static char voice[] = "+";
     704        static char none[] = "";
     705
     706        int or = set_getbool(&irc->set, "op_root");
     707        int ou = set_getbool(&irc->set, "op_user");
     708        char *ob = set_getstr(&irc->set, "op_buddies");
     709        char *hb = set_getstr(&irc->set, "halfop_buddies");
     710        char *vb = set_getstr(&irc->set, "voice_buddies");
     711
     712        if( (!strcmp(u->nick, irc->mynick) && or) ||
     713            (!strcmp(u->nick, irc->nick) && ou) ||
     714        (!u->away && !strcmp(ob, "notaway")) ||
     715        (u->encrypted && !strcmp(ob, "encrypted")) ||
     716        (u->encrypted>1 && !strcmp(ob, "trusted"))
     717      )
     718                return op;
     719        else if( (!u->away && !strcmp(hb, "notaway")) ||
     720             (u->encrypted && !strcmp(hb, "encrypted")) ||
     721             (u->encrypted>1 && !strcmp(hb, "trusted"))
     722               )
     723                return halfop;
     724        else if( (!u->away && !strcmp(vb, "notaway")) ||
     725             (u->encrypted && !strcmp(vb, "encrypted")) ||
     726             (u->encrypted>1 && !strcmp(vb, "trusted"))
     727               )
     728                return voice;
     729        else
     730                return none;
     731}
     732                       
    687733void irc_names( irc_t *irc, char *channel )
    688734{
     
    690736        char namelist[385] = "";
    691737        struct groupchat *c = NULL;
    692         char *ops = set_getstr( &irc->set, "ops" );
    693738       
    694739        /* RFCs say there is no error reply allowed on NAMES, so when the
     
    705750                        }
    706751                       
    707                         if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) )
    708                                 strcat( namelist, "+" );
    709                         else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||
    710                                  ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) )
    711                                 strcat( namelist, "@" );
    712                        
     752                        strcat( namelist, user_mode_prefix(irc, u) );
    713753                        strcat( namelist, u->nick );
    714754                        strcat( namelist, " " );
     
    721761                /* root and the user aren't in the channel userlist but should
    722762                   show up in /NAMES, so list them first: */
    723                 sprintf( namelist, "%s%s %s%s ", strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->mynick,
    724                                                  strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->nick );
     763                sprintf( namelist, "%s%s %s%s ", set_getbool(&irc->set, "op_root") ? "@" : "", irc->mynick,
     764                                                 set_getbool(&irc->set, "op_user") ? "@" : "", irc->nick );
    725765               
    726766                for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->ic, l->data ) ) )
     
    732772                        }
    733773                       
     774                        strcat( namelist, user_mode_prefix(irc, u) );
    734775                        strcat( namelist, u->nick );
    735776                        strcat( namelist, " " );
     
    773814        irc_reply( irc,   3, ":%s", IRCD_INFO );
    774815        irc_reply( irc,   4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES );
    775         irc_reply( irc,   5, "PREFIX=(ov)@+ CHANTYPES=#& CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server", CMODES, MAX_NICK_LENGTH - 1 );
     816        irc_reply( irc,   5, "PREFIX=(ohv)@%%+ CHANTYPES=#& CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server", CMODES, MAX_NICK_LENGTH - 1 );
    776817        irc_motd( irc );
    777818        irc->umode[0] = '\0';
    778819        irc_umode_set( irc, "+" UMODE, 1 );
    779 
    780         u = user_add( irc, irc->mynick );
     820u = user_add( irc, irc->mynick );
    781821        u->host = g_strdup( irc->myhost );
    782822        u->realname = g_strdup( ROOT_FN );
     
    800840        irc_spawn( irc, u );
    801841       
    802         irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n"
    803                           "If you've never used BitlBee before, please do read the help "
    804                           "information using the \x02help\x02 command. Lots of FAQs are "
    805                           "answered there.\n"
    806                           "If you already have an account on this server, just use the "
    807                           "\x02identify\x02 command to identify yourself." );
     842        irc_welcome( irc );
    808843       
    809844        if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
     
    820855                root_command( irc, send_cmd );
    821856                g_free( send_cmd[1] );
     857        }
     858}
     859
     860static void irc_welcome( irc_t *irc )
     861{
     862        FILE *f;
     863       
     864        f = fopen( global.conf->welcomefile, "r" );
     865        if( !f )
     866        {
     867                irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n"
     868                                  "If you've never used BitlBee before, please do read the help "
     869                                  "information using the \x02help\x02 command. Lots of FAQs are "
     870                                  "answered there.\n"
     871                                  "OTR users please note: Private key files are owned by the user "
     872                                  "BitlBee is running as.\n"
     873                                  "If you already have an account on this server, just use the "
     874                                  "\x02identify\x02 command to identify yourself." );
     875        }
     876        else
     877        {
     878                char linebuf[380];
     879               
     880                while( fgets( linebuf, 380, f ) )
     881                {
     882                        irc_usermsg( irc, linebuf );
     883                }
     884               
     885                fclose( f );
    822886        }
    823887}
  • irc.h

    r6a78c0e r6738a67  
    2727#define _IRC_H
    2828
     29#include "otr.h"
     30
    2931#define IRC_MAX_LINE 512
    30 #define IRC_MAX_ARGS 8
     32#define IRC_MAX_ARGS 16
    3133
    3234#define IRC_LOGIN_TIMEOUT 60
     
    9799        gint w_watch_source_id;
    98100        gint ping_source_id;
     101       
     102        otr_t *otr;            /* OTR state and book keeping */
    99103} irc_t;
    100104
  • lib/misc.c

    r6a78c0e r6738a67  
    8888        { "gt",     ">" },
    8989        { "amp",    "&" },
     90        { "apos",   "'" },
    9091        { "quot",   "\"" },
    9192        { "aacute", "á" },
     
    119120        char *s = out, *cs;
    120121        int i, matched;
     122        int taglen;
    121123       
    122124        memset( out, 0, strlen( in ) + 1 );
     
    135137                                in ++;
    136138                       
     139                        taglen = in-cs-1;   /* not <0 because the above loop runs at least once */
    137140                        if( *in )
    138141                        {
    139                                 if( g_strncasecmp( cs+1, "br", 2) == 0 )
     142                                if( g_strncasecmp( cs+1, "b", taglen) == 0 )
     143                                        *(s++) = '\x02';
     144                                else if( g_strncasecmp( cs+1, "/b", taglen) == 0 )
     145                                        *(s++) = '\x02';
     146                                else if( g_strncasecmp( cs+1, "i", taglen) == 0 )
     147                                        *(s++) = '\x1f';
     148                                else if( g_strncasecmp( cs+1, "/i", taglen) == 0 )
     149                                        *(s++) = '\x1f';
     150                                else if( g_strncasecmp( cs+1, "br", 2) == 0 )
    140151                                        *(s++) = '\n';
    141152                                in ++;
  • lib/ssl_bogus.c

    r6a78c0e r6738a67  
    2727
    2828int ssl_errno;
     29
     30void ssl_init( void )
     31{
     32}
    2933
    3034void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
  • lib/ssl_client.h

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

    r6a78c0e r6738a67  
    6060static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    6161
     62
     63void ssl_init( void )
     64{
     65        gnutls_global_init();
     66        initialized = TRUE;
     67        atexit( gnutls_global_deinit );
     68}
    6269
    6370void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    122129        if( !initialized )
    123130        {
    124                 gnutls_global_init();
    125                 initialized = TRUE;
    126                 atexit( gnutls_global_deinit );
     131                ssl_init();
    127132        }
    128133       
  • lib/ssl_nss.c

    r6a78c0e r6738a67  
    9191
    9292
     93void 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
    93101void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    94102{
     
    107115        if( !initialized )
    108116        {
    109                 PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
    110                 NSS_NoDB_Init(NULL);
    111                 NSS_SetDomesticPolicy();
     117                ssl_init();
    112118        }
    113119
  • lib/ssl_openssl.c

    r6a78c0e r6738a67  
    5656static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
    5757
     58
     59void ssl_init( void )
     60{
     61        initialized = TRUE;
     62        SSLeay_add_ssl_algorithms();
     63}
    5864
    5965void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     
    115121        if( !initialized )
    116122        {
    117                 initialized = TRUE;
    118                 SSLeay_add_ssl_algorithms();
     123                ssl_init();
    119124        }
    120125       
  • log.c

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

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

    r6a78c0e r6738a67  
    528528       
    529529        ret->name = "jabber";
     530    ret->mms = 0;                        /* no limit */
    530531        ret->login = jabber_login;
    531532        ret->init = jabber_init;
  • protocols/msn/msn.c

    r6a78c0e r6738a67  
    372372       
    373373        ret->name = "msn";
     374    ret->mms = 1409;         /* this guess taken from libotr UPGRADING file */
    374375        ret->login = msn_login;
    375376        ret->init = msn_init;
  • protocols/nogaim.c

    r6a78c0e r6738a67  
    606606       
    607607        /* LISPy... */
    608         if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    609             ( u->online ) &&                                            /* Don't touch offline people */
    610             ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    611               ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
     608        if( ( u->online ) &&                                            /* Don't touch offline people */
     609            ( ( ( u->online != oo ) && !u->away ) ||                    /* Do joining people */
     610              ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* Do people changing state */
    612611        {
    613612                char *from;
     
    622621                                                            ic->irc->myhost );
    623622                }
    624                 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    625                                                           u->away?'-':'+', u->nick );
     623                if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) {
     624                        irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
     625                                                                 u->away?'-':'+', u->nick );
     626                }
     627                if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "notaway")) {
     628                        irc_write( ic->irc, ":%s MODE %s %ch %s", from, ic->irc->channel,
     629                                                                 u->away?'-':'+', u->nick );
     630                }
     631                if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "notaway")) {
     632                        irc_write( ic->irc, ":%s MODE %s %co %s", from, ic->irc->channel,
     633                                                                 u->away?'-':'+', u->nick );
     634                }
    626635                g_free( from );
    627636        }
     
    633642        char *wrapped;
    634643        user_t *u;
    635        
     644
     645        /* pass the message through OTR */
     646        msg = otr_handle_message(ic, handle, msg);
     647        if(!msg) {
     648                /* this was an internal OTR protocol message */
     649                return;
     650        }
     651
    636652        u = user_findhandle( ic, handle );
    637        
    638653        if( !u )
    639654        {
     
    645660                                imcb_log( ic, "Ignoring message from unknown handle %s", handle );
    646661                       
     662                        g_free(msg);
    647663                        return;
    648664                }
     
    677693        irc_msgfrom( irc, u->nick, wrapped );
    678694        g_free( wrapped );
     695        g_free( msg );
    679696}
    680697
     
    917934
    918935
    919 /* Misc. BitlBee stuff which shouldn't really be here */
    920 
    921 char *set_eval_away_devoice( set_t *set, char *value )
    922 {
    923         irc_t *irc = set->data;
    924         int st;
    925        
    926         if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) )
    927                 st = 1;
    928         else if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) )
    929                 st = 0;
    930         else if( sscanf( value, "%d", &st ) != 1 )
    931                 return( NULL );
    932        
    933         st = st != 0;
    934        
    935         /* Horror.... */
    936        
    937         if( st != set_getbool( &irc->set, "away_devoice" ) )
    938         {
    939                 char list[80] = "";
    940                 user_t *u = irc->users;
    941                 int i = 0, count = 0;
    942                 char pm;
    943                 char v[80];
    944                
    945                 if( st )
    946                         pm = '+';
    947                 else
    948                         pm = '-';
    949                
    950                 while( u )
    951                 {
    952                         if( u->ic && u->online && !u->away )
    953                         {
    954                                 if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
    955                                 {
    956                                         for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
    957                                         irc_write( irc, ":%s MODE %s %c%s%s",
    958                                                    irc->myhost,
    959                                                    irc->channel, pm, v, list );
    960                                        
    961                                         *list = 0;
    962                                         count = 0;
    963                                 }
    964                                
    965                                 sprintf( list + strlen( list ), " %s", u->nick );
    966                                 count ++;
    967                         }
    968                         u = u->next;
    969                 }
    970                
    971                 /* $v = 'v' x $i */
    972                 for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
    973                 irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost,
    974                                                             irc->channel, pm, v, list );
    975         }
    976        
    977         return( set_eval_bool( set, value ) );
    978 }
    979 
    980 
    981 
    982 
    983936/* The plan is to not allow straight calls to prpl functions anymore, but do
    984937   them all from some wrappers. We'll start to define some down here: */
     
    994947                msg = buf;
    995948        }
    996        
    997         st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags );
    998         g_free( buf );
    999        
     949
     950        /* if compiled without otr support, this just calls the prpl buddy_msg */
     951        st = otr_send_message(ic, handle, msg, flags);
     952       
     953        g_free(buf);
    1000954        return st;
    1001955}
  • protocols/nogaim.h

    r6a78c0e r6738a67  
    132132         * - The user sees this name ie. when imcb_log() is used. */
    133133        const char *name;
     134    /* Maximum Message Size of this protocol.
     135     * - Introduced for OTR, in order to fragment large protocol messages.
     136     * - 0 means "unlimited". */
     137    unsigned int mms;
    134138
    135139        /* Added this one to be able to add per-account settings, don't think
     
    313317
    314318/* Misc. stuff */
    315 char *set_eval_away_devoice( set_t *set, char *value );
    316319gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
    317320void cancel_auto_reconnect( struct account *a );
  • protocols/oscar/oscar.c

    r6a78c0e r6738a67  
    26432643        struct prpl *ret = g_new0(struct prpl, 1);
    26442644        ret->name = "oscar";
     2645    ret->mms = 2343;       /* this guess taken from libotr UPGRADING file */
    26452646        ret->away_states = oscar_away_states;
    26462647        ret->init = oscar_init;
  • protocols/yahoo/yahoo.c

    r6a78c0e r6738a67  
    351351        struct prpl *ret = g_new0(struct prpl, 1);
    352352        ret->name = "yahoo";
     353    ret->mms = 832;           /* this guess taken from libotr UPGRADING file */
    353354        ret->init = byahoo_init;
    354355       
  • query.c

    r6a78c0e r6738a67  
    103103        int count = 0;
    104104       
     105        if(!ic)
     106                return;
     107       
    105108        q = irc->queries;
    106109        def = query_default( irc );
     
    145148                else
    146149                        irc_usermsg( irc, "Accepted: %s", q->question );
    147                 q->yes( q->data );
     150                if( q->yes )
     151                        q->yes( q->data );
    148152        }
    149153        else
     
    153157                else
    154158                        irc_usermsg( irc, "Rejected: %s", q->question );
    155                 q->no( q->data );
     159                if( q->no )
     160                        q->no( q->data );
    156161        }
    157162        q->data = NULL;
  • root_commands.c

    r6a78c0e r6738a67  
    2929#include "bitlbee.h"
    3030#include "help.h"
     31#include "otr.h"
    3132
    3233#include <string.h>
     
    275276               
    276277                irc_usermsg( irc, "Account successfully added" );
     278               
     279                if(otr_check_for_key(a)) {
     280                        irc_usermsg(irc, "otr: you will be notified when it completes");
     281                }
    277282        }
    278283        else if( g_strcasecmp( cmd[1], "del" ) == 0 )
     
    10641069        { "qlist",          0, cmd_qlist,          0 },
    10651070        { "join_chat",      2, cmd_join_chat,      0 },
     1071        { "otr",            1, cmd_otr,            0 },
    10661072        { NULL }
    10671073};
  • set.c

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

    r6a78c0e r6738a67  
    9696/* Some not very generic evaluators that really shouldn't be here... */
    9797char *set_eval_to_char( set_t *set, char *value );
    98 char *set_eval_ops( set_t *set, char *value );
     98char *set_eval_op_root( set_t *set, char *value );
     99char *set_eval_op_user( set_t *set, char *value );
     100char *set_eval_op_buddies( set_t *set, char *value );
     101char *set_eval_halfop_buddies( set_t *set, char *value );
     102char *set_eval_voice_buddies( set_t *set, char *value );
     103char *set_eval_otr_policy( set_t *set, char *value );
    99104
    100105#endif /* __SET_H__ */
  • storage.c

    r6a78c0e r6738a67  
    2929#include "bitlbee.h"
    3030#include "crypting.h"
     31#include "otr.h"
    3132
    3233extern storage_t storage_text;
     
    115116                if (status == STORAGE_OK) {
    116117                        irc_setpass(irc, password);
     118                        otr_load(irc);          /* load our OTR userstate */
    117119                        return status;
    118120                }
    119121               
    120                 if (status != STORAGE_NO_SUCH_USER)
     122                if (status != STORAGE_NO_SUCH_USER) {
    121123                        return status;
     124                }
    122125        }
    123126       
     
    127130storage_status_t storage_save (irc_t *irc, int overwrite)
    128131{
    129         return ((storage_t *)global.storage->data)->save(irc, overwrite);
     132        storage_status_t st;
     133       
     134        otr_save(irc);
     135        st = ((storage_t *)global.storage->data)->save(irc, overwrite);
     136        return st;
    130137}
    131138
     
    147154                        ret = status;
    148155        }
     156        if (ret == STORAGE_OK) {
     157                otr_remove(nick);
     158        }
    149159       
    150160        return ret;
     
    157167        storage_t *primary_storage = gl->data;
    158168        irc_t *irc;
    159 
     169       
    160170        /* First, try to rename in the current write backend, assuming onick
    161171         * is stored there */
    162172        status = primary_storage->rename(onick, nnick, password);
    163         if (status != STORAGE_NO_SUCH_USER)
     173        if (status != STORAGE_NO_SUCH_USER) {
     174                otr_rename(onick, nnick);
    164175                return status;
     176        }
    165177
    166178        /* Try to load from a migration backend and save to the current backend.
     
    186198
    187199        storage_remove(onick, password);
     200        otr_rename(onick, nnick);
    188201
    189202        return STORAGE_OK;
  • unix.c

    r6a78c0e r6738a67  
    2727#include "commands.h"
    2828#include "crypting.h"
     29#include "otr.h"
    2930#include "protocols/nogaim.h"
    3031#include "help.h"
    3132#include "ipc.h"
     33#include "lib/ssl_client.h"
    3234#include <signal.h>
    3335#include <unistd.h>
     
    5456        b_main_init();
    5557        nogaim_init();
     58        /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt
     59           has a process-global config state whose initialization happpens
     60           twice if libotr and gnutls are used together. libotr installs custom
     61           memory management functions for libgcrypt while our gnutls module
     62           uses the defaults. Therefore we initialize OTR after SSL. *sigh* */
     63        ssl_init();
     64        otr_init();
    5665       
    5766        srand( time( NULL ) ^ getpid() );
  • user.c

    r6a78c0e r6738a67  
    141141}
    142142
    143 user_t *user_findhandle( struct im_connection *ic, char *handle )
     143user_t *user_findhandle( struct im_connection *ic, const char *handle )
    144144{
    145145        user_t *u;
  • user.h

    r6a78c0e r6738a67  
    3737        char is_private;
    3838        char online;
     39        char encrypted;
    3940       
    4041        char *handle;
     
    5657int user_del( irc_t *irc, char *nick );
    5758G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick );
    58 G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, char *handle );
     59G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, const char *handle );
    5960void user_rename( irc_t *irc, char *oldnick, char *newnick );
    6061
Note: See TracChangeset for help on using the changeset viewer.