Changeset e2b15bb for otr.c


Ignore:
Timestamp:
2008-02-12T00:01:35Z (16 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
0529a7f
Parents:
5f4eede
Message:
  • add global policy setting
  • add copyright and author notices to otr.h and otr.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    r5f4eede re2b15bb  
     1  /********************************************************************\
     2  * BitlBee -- An IRC to other IM-networks gateway                     *
     3  *                                                                    *
     4  * Copyright 2002-2008 Wilmer van der Gaast and others                *
     5  \********************************************************************/
     6
     7/*
     8  OTR support (cf. http://www.cypherpunks.ca/otr/)
     9  2008, Sven Moritz Hallberg <pesco@khjk.org>
     10   
     11  files used to store OTR data:
     12    <configdir>/<nick>.otr_keys
     13    <configdir>/<nick>.otr_fprints
     14   
     15  top-level todos: (search for TODO for more ;-))
     16    integrate otr_load/otr_save with existing storage backends
     17    per-account policy settings
     18    per-user policy settings
     19*/
     20
     21/*
     22  This program is free software; you can redistribute it and/or modify
     23  it under the terms of the GNU General Public License as published by
     24  the Free Software Foundation; either version 2 of the License, or
     25  (at your option) any later version.
     26
     27  This program is distributed in the hope that it will be useful,
     28  but WITHOUT ANY WARRANTY; without even the implied warranty of
     29  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     30  GNU General Public License for more details.
     31
     32  You should have received a copy of the GNU General Public License with
     33  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
     34  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
     35  Suite 330, Boston, MA  02111-1307  USA
     36*/
     37
    138#include "bitlbee.h"
    239#ifdef WITH_OTR
     
    542#include <sys/types.h>
    643#include <unistd.h>
    7 
    8 /**
    9 files used to store OTR data:
    10   $configdir/$nick.otr_keys
    11   $configdir/$nick.otr_fprints
    12  **/
    1344
    1445
     
    345376                otrl_message_free(otrmsg);
    346377        } else {
    347                 /* yeah, well, some const casts as usual... ;-) */
     378                /* note: otrl_message_sending handles policy, so that if REQUIRE_ENCRYPTION is set,
     379                   this case does not occur */
    348380                st = ic->acc->prpl->buddy_msg( ic, (char *)handle, (char *)msg, flags );
    349381        }
     
    388420OtrlPolicy op_policy(void *opdata, ConnContext *context)
    389421{
    390         /* TODO: OTR policy configurable */
     422        struct im_connection *ic = check_imc(opdata, context->accountname, context->protocol);
     423        const char *p;
     424
     425        p = set_getstr(&ic->irc->set, "otr_policy");
     426        if(!strcmp(p, "never"))
     427                return OTRL_POLICY_NEVER;
     428        if(!strcmp(p, "opportunistic"))
     429                return OTRL_POLICY_OPPORTUNISTIC;
     430        if(!strcmp(p, "manual"))
     431                return OTRL_POLICY_MANUAL;
     432        if(!strcmp(p, "always"))
     433                return OTRL_POLICY_ALWAYS;
     434       
    391435        return OTRL_POLICY_OPPORTUNISTIC;
    392436}
     
    858902                }
    859903               
     904                /* TODO: allow context specs ("user/proto/account") in 'otr forget fingerprint'? */
    860905                u = user_find(irc, args[2]);
    861906                if(!u || !u->ic) {
     
    893938                char *s;
    894939               
     940                /* TODO: allow context specs ("user/proto/account") in 'otr forget contex'? */
    895941                u = user_find(irc, args[2]);
    896942                if(!u || !u->ic) {
Note: See TracChangeset for help on using the changeset viewer.