Changeset 7a9d968


Ignore:
Timestamp:
2018-03-10T11:30:39Z (2 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
5447c59
Parents:
3f44e43 (diff), 4a9c6b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into HEAD

Files:
5 added
17 deleted
67 edited

Legend:

Unmodified
Added
Removed
  • .travis.yml

    r3f44e43 r7a9d968  
    1 sudo: false
     1dist: precise
    22language: c
    33
     
    3131    - libpam0g-dev
    3232    - libldap2-dev
     33    - fakeroot
     34    - debhelper
     35    - devscripts
    3336  coverity_scan:
    3437    project:
  • Makefile

    r3f44e43 r7a9d968  
    9494        mkdir -p $(DESTDIR)$(SBINDIR)
    9595        $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
     96ifdef IMPLIB
     97        # import library for cygwin
     98        mkdir -p $(DESTDIR)$(LIBDIR)
     99        $(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(LIBDIR)/$(IMPLIB)
     100endif
    96101
    97102uninstall-bin:
    98103        rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
     104ifdef IMPLIB
     105        rm -f $(DESTDIR)$(LIBDIR)/$(IMPLIB)
     106endif
    99107
    100108install-dev:
     
    163171
    164172$(subdirs):
    165         @$(MAKE) -C $@ $(MAKECMDGOALS)
     173        $(MAKE) -C $@ $(MAKECMDGOALS)
    166174
    167175$(OTR_PI): %.so: $(_SRCDIR_)%.c
    168176        @echo '*' Building plugin $@
    169         @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
     177        $(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
    170178
    171179$(SKYPE_PI): $(_SRCDIR_)protocols/skype/skype.c
    172180        @echo '*' Building plugin skype
    173         @$(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@
     181        $(VERBOSE) $(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@
    174182
    175183$(objects): %.o: $(_SRCDIR_)%.c
    176184        @echo '*' Compiling $<
    177         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     185        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    178186
    179187$(objects): Makefile Makefile.settings config.h
     
    181189$(OUTFILE): $(objects) $(subdirs)
    182190        @echo '*' Linking $(OUTFILE)
    183         @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
    184 ifndef DEBUG
     191        $(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
     192ifneq ($(firstword $(STRIP)), \#)
    185193        @echo '*' Stripping $(OUTFILE)
    186         @-$(STRIP) $(OUTFILE)
     194        $(VERBOSE) -$(STRIP) $(OUTFILE)
    187195endif
    188196
  • bitlbee.h

    r3f44e43 r7a9d968  
    3636
    3737#define PACKAGE "BitlBee"
    38 #define BITLBEE_VERSION "3.4.2"
     38#define BITLBEE_VERSION "3.5.1"
    3939#define VERSION BITLBEE_VERSION
    4040#define BITLBEE_VER(a, b, c) (((a) << 16) + ((b) << 8) + (c))
    41 #define BITLBEE_VERSION_CODE BITLBEE_VER(3, 4, 2)
     41#define BITLBEE_VERSION_CODE BITLBEE_VER(3, 5, 1)
    4242#define BITLBEE_ABI_VERSION_CODE 1
    4343
  • configure

    r3f44e43 r7a9d968  
    1515datadir='$prefix/share/bitlbee/'
    1616config='/var/lib/bitlbee/'
     17libdir='$prefix/lib/'
    1718plugindir='$prefix/lib/bitlbee/'
    1819rpcplugindir='$plugindir/rpc/'
     
    4142rpc=1
    4243
     44verbose=0
    4345doc=1
    4446debug=0
    45 strip=1
     47strip=0
    4648gcov=0
    4749asan=0
     
    129131--config=...                                            $config
    130132
     133--verbose=0/1   Disable/enable verbose build            $verbose
     134
    131135--msn=0/1       Disable/enable MSN part                 $msn
    132136--jabber=0/1    Disable/enable Jabber part              $jabber
     
    174178datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g')
    175179config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g')
     180libdir=$(eval echo "$libdir/" | sed 's/\/\{1,\}/\//g')
    176181plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
    177182rpcplugindir=$(eval echo "$rpcplugindir/" | sed 's/\/\{1,\}/\//g')
     
    199204RPCPLUGINDIR=$rpcplugindir
    200205CONFIG=$config
     206LIBDIR=$libdir
    201207INCLUDEDIR=$includedir
    202208PCDIR=$pcdir
     
    248254#define PLUGINDIR "$plugindir"
    249255#define RPCPLUGINDIR "$rpcplugindir"
     256#define DATADIR "$datadir"
    250257#define PIDFILE "$pidfile"
    251258#define IPCSOCKET "$ipcsocket"
     
    296303fi
    297304
     305if [ "$verbose" = "0" ]; then
     306        echo 'VERBOSE=@' >> Makefile.settings
     307else
     308        echo 'VERBOSE=' >> Makefile.settings
     309fi
     310
     311cat <<EOF >>Makefile.settings
     312
     313# Enable/disable output verbosity
     314ifdef V
     315ifeq (\$(V),1)
     316        VERBOSE=
     317else
     318        VERBOSE=@
     319endif
     320endif
     321
     322EOF
     323
    298324if [ "$debug" = "1" ]; then
    299325        echo 'DEBUG=1' >> Makefile.settings
    300326        CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
    301327else
    302         [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
     328        [ -z "$CFLAGS" ] && CFLAGS="-g -O2 -fno-strict-aliasing"
    303329fi
    304330
     
    764790if [ "$doc" = "1" ]; then
    765791        # check this here just in case someone tries to install it in python2.4...
    766         if ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
     792        if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
    767793                echo
    768794                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
     
    797823fi
    798824
     825pkgconfiglibs=''
     826case "$arch" in
     827CYGWIN* )
     828        pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined'
     829esac
     830
    799831cat <<EOF >bitlbee.pc
    800832prefix=$prefix
     
    802834plugindir=$plugindir
    803835rpcplugindir=$rpcplugindir
     836libdir=$libdir
     837datadir=$datadir
    804838
    805839Name: bitlbee
     
    807841Requires: glib-2.0
    808842Version: $BITLBEE_VERSION
    809 Libs:
     843Libs: $pkgconfiglibs
    810844Cflags: -I\${includedir}
    811845
     
    925959;;
    926960CYGWIN* )
     961        echo 'EFLAGS+=-Wl,--export-all,--out-implib,libbitlbee.dll.a' >> Makefile.settings
     962        echo 'IMPLIB=libbitlbee.dll.a' >> Makefile.settings
    927963;;
    928964Windows )
  • dcc.c

    r3f44e43 r7a9d968  
    9292        struct sockaddr_storage saddr;
    9393        char *errmsg;
    94         char host[HOST_NAME_MAX];
     94        char host[NI_MAXHOST];
    9595        char port[6];
    9696
  • debian/README.Debian

    r3f44e43 r7a9d968  
    1                    *** NEWS (Version 1.2 and later) ***
    2 
    3 Starting from version 1.2, BitlBee has a forking daemon mode. The Debian
    4 package now uses this mode by default, instead of inetd mode. If you don't
    5 want to use this, you can disable the init scripts (best way to do this is
    6 by editing /etc/default/bitlbee) and restore the inetd.conf entry. This
    7 should be necessary only once, it won't be touched during upgrades.
    8 
    9 Another important change in BitlBee 1.2 is the file format used for your
    10 personal settings. Everything's now saved in a single .xml (per account,
    11 of course) file instead of $nick.accounts and $nick.nicks. One advantage
    12 of this new format is that the passwords are actually encrypted instead of
    13 just vaguely obfuscated. BitlBee can still read the old files, and will
    14 save things in the new format when you save/disconnect. After that, you
    15 can safely remove the old-style files (this is recommended).
    16 
    17 I tried making this transition (the new file format but especially, in this
    18 case, the inetd->forkdaemon mode change) as smooth as possible, but I'm
    19 aware that many BitlBee users will have their own hacks already to run the
    20 program. I hope the package won't break any of this for anyone. 1.2-2
    21 should fix at least some of the issues.
    22 
    23 ---------------------------------------------------------------------------
    24 
    25 Debconf should have asked you on what port you want BitlBee to run. If it
    26 did not, the port number should be 6667 or 6668. (6668 if you already got
    27 something running at 6667)
    28 
    29 Fire up your favourite IRC client and connect to localhost:6667 (or 6668),
     1Fire up your favourite IRC client and connect to localhost:6667,
    302and read the documentation (type help for a list of commands).
    313
  • debian/bitlbee-common.init

    r3f44e43 r7a9d968  
    2323[ -x $DAEMON ] || exit 0
    2424
    25 # Default value
    26 BITLBEE_PORT=6667
    2725BITLBEE_OPTS=-F
    28 
    29 # Read config file if it is present.
    30 if [ -r /etc/default/$NAME ]; then
    31         . /etc/default/$NAME
    32 fi
    3326
    3427
     
    4235       
    4336        start-stop-daemon --start --quiet --pidfile $PIDFILE \
    44                 --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS
     37                --exec $DAEMON -- -P $PIDFILE $BITLBEE_OPTS
    4538}
    4639
     
    5649case "$1" in
    5750  start)
    58         [ "$BITLBEE_DISABLED" = "1" ] && exit 0
    59 
    6051        echo -n "Starting $DESC: $NAME"
    6152        d_start
  • debian/bitlbee-common.postinst

    r3f44e43 r7a9d968  
    33set -e
    44
    5 . /usr/share/debconf/confmodule
    6 
    7 db_get bitlbee/serveport
    8 PORT="$RET"
    9 
    105CONFDIR=/var/lib/bitlbee/
    116
    12 ## Load default option. Don't want to put this in debconf (yet?)
    13 BITLBEE_OPTS=-F
    14 BITLBEE_DISABLED=0
    15 BITLBEE_UPGRADE_DONT_RESTART=0
    16 [ -r /etc/default/bitlbee ] && . /etc/default/bitlbee
    17 
    18 if [ "$BITLBEE_DISABLED" = "0" ] && which update-inetd > /dev/null 2> /dev/null &&
    19    ( expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null ); then
    20         ## Make sure the inetd entry is gone (can still be there from a
    21         ## previous version.
    22         update-inetd --remove '.*/usr/sbin/bitlbee'
    23         if grep -q /usr/sbin/bitlbee /etc/inetd.conf 2> /dev/null; then
    24                 # Thanks for breaking update-inetd! (bugs.debian.org/311111)
    25                 # I hope that it works at least with xinetd, because this
    26                 # emergency hack doesn't:
    27                 perl -pi -e 's:^[^#].*/usr/sbin/bitlbee$:## Now using daemon mode\: # $&:' /etc/inetd.conf
    28                 killall -HUP inetd || true
    29         fi
    30 fi
    31 
    32 cat<<EOF>/etc/default/bitlbee
     7if [ -e /etc/default/bitlbee ]; then
     8   cat <<EOF >/etc/default/bitlbee
    339## /etc/default/bitlbee: Auto-generated/updated script.
    3410##
    35 ## If running in (fork)daemon mode, listen on this TCP port.
    36 BITLBEE_PORT="$PORT"
    37 
    38 ## Use single-process or forking daemon mode? Can't be changed from debconf,
    39 ## but maintainer scripts will save your changes here.
    40 BITLBEE_OPTS="$BITLBEE_OPTS"
    41 
    42 ## In case you want to stick with inetd mode (or if you just want to disable
    43 ## the init scripts for some other reason), you can disable the init script
    44 ## here. (Just set it to 1)
    45 BITLBEE_DISABLED=$BITLBEE_DISABLED
    46 
    47 ## As a server operator, you can use the RESTART command to restart only the
    48 ## master process while keeping all the child processes and their IPC
    49 ## connections. By enabling this, the maintainer scripts won't restart
    50 ## BitlBee during upgrades so you can restart the master process by hand.
    51 BITLBEE_UPGRADE_DONT_RESTART=$BITLBEE_UPGRADE_DONT_RESTART
     11## This file is deprecated and no longer used.
     12## Please edit /etc/bitlbee/bitlbee.conf instead
    5213EOF
    5314
    54 ## Bye-bye DebConf, we don't need you anymore.
    55 db_stop
     15fi
    5616
    5717## Restore the helpfile in case we weren't upgrading but just reconfiguring:
     
    6424fi
    6525
    66 if [ "$BITLBEE_UPGRADE_DONT_RESTART" != "1" -a  -n "$2" -a -x "/etc/init.d/bitlbee" ]; then
     26if [ -n "$2" -a -x "/etc/init.d/bitlbee" ]; then
    6727        invoke-rc.d bitlbee restart
    6828fi
     
    7131if [ -d $CONFDIR ] && chown -R bitlbee: $CONFDIR; then
    7232        echo 'BitlBee (probably) already installed, skipping user/configdir installation'
    73         exit 0
     33else
     34        adduser --system --group --disabled-login --disabled-password --home /var/lib/bitlbee/ bitlbee
    7435fi
    7536
    76 adduser --system --group --disabled-login --disabled-password --home /var/lib/bitlbee/ bitlbee
    7737chmod 700 /var/lib/bitlbee/
    7838
  • debian/bitlbee-common.postrm

    r3f44e43 r7a9d968  
    55if [ "$1" = "purge" ]; then
    66        rm -f /etc/default/bitlbee
    7         deluser --system bitlbee || true
     7        deluser --system bitlbee > /dev/null || true
    88        rm -rf /var/lib/bitlbee ## deluser doesn't seem to do this for homedirs in /var
    99fi
  • debian/changelog

    r3f44e43 r7a9d968  
     1bitlbee (3.5-2) unstable; urgency=medium
     2
     3  * TFW you find out the corrected fix diff posted on #821967 was still the
     4    broken one and you end up doing your third upload in a weekend. :-(
     5    Obviously build-* targets shouldn't call into binary-*, as that one
     6    starts requiring root. This broke builds on buildd's.
     7  * Now contains the same fix like 3.4.2-1.1, which as it turns out 3.5-1.1
     8    did not. (Closes: #853017)
     9
     10 -- Wilmer van der Gaast <wilmer@gaast.net>  Sat, 28 Jan 2017 21:06:27 +0000
     11
     12bitlbee (3.5-1.1) unstable; urgency=medium
     13
     14  [ dequis ]
     15  * Merge back changes from 3.4.2-1.1 (Closes: #852897)
     16
     17 -- dequis <dx@dxzone.com.ar>  Thu, 26 Jan 2017 21:39:24 -0300
     18
     19bitlbee (3.5-1) unstable; urgency=medium
     20
     21  [ Jochen Sprickerhof ]
     22  * Drop dependency on net-tools
     23
     24  [ dequis ]
     25  * Use dh_systemd
     26  * Drop support for /etc/default/bitlbee
     27  * Drop debconf and its translations (only used to ask for the port)
     28  * Add preinst script for a smoother transition to systemd units
     29  * Ignore the stdout of deluser, fixes postrm error exit code
     30  * Remove some mentions of yahoo in control and copyright
     31  * Remove outdated stuff from README.debian
     32
     33  [ Wilmer van der Gaast ]
     34  * New upstream release.
     35
     36 -- Wilmer van der Gaast <wilmer@gaast.net>  Tue, 24 Jan 2017 22:21:33 +0000
     37
     38bitlbee (3.4.2-1.1) unstable; urgency=medium
     39
     40  * Non-maintainer upload.
     41  * Adding build-{arch,indep} targets. (Closes: #821967)
     42  * Added python to build depends.
     43
     44 -- Michael Lustfield <michael@lustfield.net>  Mon, 18 Jul 2016 01:02:17 -0700
     45
    146bitlbee (3.4.2-1) unstable; urgency=medium
    247
  • debian/control

    r3f44e43 r7a9d968  
    55Uploaders: Jelmer Vernooij <jelmer@debian.org>
    66Standards-Version: 3.9.8
    7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls28-dev | libgnutls-dev | gnutls-dev, po-debconf, libpurple-dev, libotr5-dev, debhelper (>= 6.0.7~), dh-systemd (>= 1.5) | debhelper (<< 9.20131227)
     7Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls28-dev | libgnutls-dev | gnutls-dev, po-debconf, libpurple-dev, libotr5-dev, debhelper (>= 6.0.7~), dh-systemd (>= 1.5) | debhelper (<< 9.20131227), python
    88Homepage: http://www.bitlbee.org/
    99Vcs-Git: https://github.com/bitlbee/bitlbee
     
    1717Description: IRC to other chat networks gateway (default version)
    1818 This program can be used as an IRC server which forwards everything you
    19  say to people on other chat networks: Jabber (which includes Google Talk
    20  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     19 say to people on other chat networks: Jabber (which includes Google
     20 Talk), ICQ, AIM, MSN and Twitter.
    2121
    2222Package: bitlbee-libpurple
     
    2727Description: IRC to other chat networks gateway (using libpurple)
    2828 This program can be used as an IRC server which forwards everything you
    29  say to people on other chat networks: Jabber (which includes Google Talk
    30  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     29 say to people on other chat networks: Jabber (which includes Google
     30 Talk), ICQ, AIM, MSN and Twitter.
    3131 .
    3232 This package contains a version of BitlBee that uses the libpurple instant
     
    3939Package: bitlbee-common
    4040Architecture: all
    41 Depends: ${misc:Depends}, net-tools, adduser
     41Depends: ${misc:Depends}, adduser
    4242Replaces: bitlbee
    4343Description: IRC to other chat networks gateway (common files/docs)
    4444 This program can be used as an IRC server which forwards everything you
    45  say to people on other chat networks: Jabber (which includes Google Talk
    46  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     45 say to people on other chat networks: Jabber (which includes Google
     46 Talk), ICQ, AIM, MSN and Twitter.
    4747 .
    4848 This package contains common files (mostly documentation) for bitlbee and
     
    5454Description: IRC to other chat networks gateway (dev files)
    5555 This program can be used as an IRC server which forwards everything you
    56  say to people on other chat networks: Jabber (which includes Google Talk
    57  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     56 say to people on other chat networks: Jabber (which includes Google
     57 Talk), ICQ, AIM, MSN and Twitter.
    5858 .
    5959 This package holds development stuff for compiling plug-ins.
     
    6464Description: IRC to other chat networks gateway (OTR plugin)
    6565 This program can be used as an IRC server which forwards everything you
    66  say to people on other chat networks: Jabber (which includes Google Talk
    67  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     66 say to people on other chat networks: Jabber (which includes Google
     67 Talk), ICQ, AIM, MSN and Twitter.
    6868 .
    6969 This package contains a plugin that adds support for Off-The-Record
     
    7676Description: IRC to other chat networks gateway (Skype plugin)
    7777 This program can be used as an IRC server which forwards everything you
    78  say to people on other chat networks: Jabber (which includes Google Talk
    79  and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net.
     78 say to people on other chat networks: Jabber (which includes Google
     79 Talk), ICQ, AIM, MSN and Twitter.
    8080 .
    8181 This package contains a plugin that adds support for the Skype IM network.
  • debian/copyright

    r3f44e43 r7a9d968  
    1111
    1212Bits of third party code, also (L)GPLed:
    13 * protocols/yahoo/ is libyahoo2 <http://libyahoo2.sf.net/>.
    1413* Some parts (though there is very little left at this point) are borrowed
    1514  from Gaim (version 0.58), now known as Pidgin <http://www.pidgin.im/>.
     
    1817* lib/json.[ch] is from <https://github.com/udp/json-parser> and licensed
    1918  under the modified BSD license.
     19* lib/canohost.[ch] is from OpenSSH and licenced under the BSD-3-clause
     20  licence.
    2021
    2122
  • debian/rules

    r3f44e43 r7a9d968  
    4141
    4242HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | grep -c "ok installed")
     43
     44# No difference at the build stage so just call main build target.
     45# (Well indep could be docs-only but we prebuild them plus it's really
     46# not that much work.)
     47build-arch build-indep: build
    4348
    4449build: build-stamp
     
    115120        dh_installdebconf
    116121ifeq ($(HAS_DH_SYSTEMD),1)
    117         dh_systemd_enable
     122        dh_systemd_enable --no-enable bitlbee.socket
     123        dh_systemd_enable bitlbee.service
    118124        dh_installinit --init-script=bitlbee
    119125        dh_systemd_start
  • doc/CHANGES

    r3f44e43 r7a9d968  
    33
    44https://github.com/bitlbee/bitlbee/commits/master
     5
     6Version 3.5.1:
     7
     8- purple:
     9  * Fix crash on file transfer requests from unknown contacts. This was the
     10    result of an incomplete fix in the previous release and may result in
     11    remote DoS. Read the full security advisory at:
     12    https://bugs.bitlbee.org/ticket/1282
     13- After some investigation we decided to reclassify a crash fix from the
     14  previous release as a security issue. Read the full security advisory at:
     15  https://bugs.bitlbee.org/ticket/1281
     16- Included help.txt in the release tarball, which was missing in the previous
     17  release and resulted in adding python as a build dependency. The release
     18  tarball of 3.5.1 does not require python.
     19
     20Finished 30 Jan 2017
     21
     22Version 3.5:
     23
     24- ui:
     25  * "chat list": shows a list of existing server-side chatrooms. With some
     26    protocols, this is often the only way to add new channels.
     27    See 'help chat list' for details. (jgeboski)
     28  * "plugins": lists the installed plugins and their versions (jgeboski)
     29  * Add 'nick_lowercase' and 'nick_underscores' settings.
     30  * "handle_unknown" can be set per-account, not just globally
     31
     32- jabber:
     33  * Add "always_use_nicks" channel setting, for non-anonymous MUCs (trac #415)
     34    See 'help set always_use_nicks' for possible side effects.
     35  * Properly handle rejected file transfers
     36  * Don't send parts in a chat if someone is still connected from other devices
     37  * hipchat: support personal oauth tokens (manually generated ones)
     38
     39- twitter:
     40  * Hide muted tweets / no-retweets, add mute/unmute commands (Flexo)
     41  * Show full version of extended tweets (with slightly more than 140 chars)
     42
     43- purple:
     44  * Support setting chat room topics (EionRobb)
     45  * Support for extra groupchat settings. Shows an error if any required
     46    ones are missing. Look for purple_ prefixed settings in "chan #... set"
     47  * SIPE: persistent chats can be joined now, thanks to the "chat list" command
     48    and the above ("purple_uri" channel setting)
     49  * Fix a file transfer crash bug (Mainly affected telegram)
     50  * Honor protocol flag to not require a password (used in hangouts, telegram)
     51  * Set the contacts' nicks to the %full_name for a few whitelisted protocols
     52    (hangouts, funyahoo, icq, line)
     53  * LINE: added a hack to save its auth token, to avoid re-auth every time
     54  * Show self-messages in groupchat backlogs (before join)
     55
     56- yahoo:
     57  * Removed because they killed their old protocol on a two month notice.
     58    Use EionRobb's funyahoo purple plugin, or better yet, don't use yahoo.
     59
     60- Stuff for enterprise deployments (all done by Sevas)
     61  * Locked down accounts, useful when pregenerating user config files. An
     62    account that is marked with the locked="true" attribute can't be removed
     63    and its username/password can't be changed.
     64  * Locked down settings. Same as above, but for individual account settings.
     65  * AllowAccountAdd setting in bitlbee.conf, to disable adding new accounts.
     66  * PAM and LDAP authentication backends (not compiled by default)
     67
     68- For packagers:
     69  * Enabled debug symbols in non-debug builds, disabled stripping by default.
     70    This is closer to the default behavior of autotools, and --debug=1 is mostly
     71    to set the DEBUG macro and disable optimization.
     72
     73- For plugin devs:
     74  * Plugins should now include an "init_plugin_info" function which will be used
     75    for ABI version checking in the future. It's optional for now, but will be
     76    enforced later. See the commit log of d28fe1c for details. (jgeboski)
     77
     78Finished 8 Jan 2017
    579
    680Version 3.4.2:
  • doc/README

    r3f44e43 r7a9d968  
    161161file COPYING for this license.
    162162
    163 The Yahoo! library used by BitlBee is libyahoo2 <http://libyahoo2.sf.net/>,
    164 also licensed under the GPL.
    165 
    166163
    167164        BitlBee - An IRC to other chat networks gateway
  • doc/bitlbee.8

    r3f44e43 r7a9d968  
    3939networks and acts as a gateway. Users can connect to the server
    4040with any normal IRC client and see their 'buddy list' in
    41 &bitlbee. It currently supports Oscar (AIM and ICQ),
    42 MSN, Jabber, Yahoo! and Twitter.
     41&bitlbee.
    4342
    4443\fBbitlbee\fP should be called by
  • doc/user-guide/Installation.xml

    r3f44e43 r7a9d968  
    3636settings and buddy information. <filename>/var/lib/bitlbee/</filename>
    3737is the default value.</para></listitem>
    38 <listitem><para>msn, jabber, oscar, yahoo - By default, support for all
     38<listitem><para>msn, jabber, oscar, twitter - By default, support for all
    3939these IM-protocols (OSCAR is the protocol used by both ICQ and AIM) will
    4040be compiled in. To make the binary a bit smaller, you can use these options
  • doc/user-guide/Makefile

    r3f44e43 r7a9d968  
    3535        xsltproc --xinclude --output $@ docbook.xsl $<
    3636
    37 help.txt: $(_SRCDIR_)help.xml $(_SRCDIR_)commands.xml $(_SRCDIR_)misc.xml $(_SRCDIR_)quickstart.xml
     37help.txt: $(_SRCDIR_)help.xml $(_SRCDIR_)commands.xml $(_SRCDIR_)misc.xml $(_SRCDIR_)quickstart.xml $(_SRCDIR_)twitter.xml
    3838        $(PYTHON) $(_SRCDIR_)genhelp.py $< $@
    3939
  • doc/user-guide/commands.xml

    r3f44e43 r7a9d968  
    2121                        <description>
    2222                                <para>
    23                                         Adds an account on the given server with the specified protocol, username and password to the account list. Supported protocols right now are: Jabber, MSN, OSCAR (AIM/ICQ), Yahoo and Twitter. For more information about adding an account, see <emphasis>help account add &lt;protocol&gt;</emphasis>.
     23                                        Adds an account on the given server with the specified protocol, username and password to the account list. For a list of supported protocols, use the <emphasis>plugins</emphasis> command. For more information about adding an account, see <emphasis>help account add &lt;protocol&gt;</emphasis>.
    2424                                </para>
    2525
     
    184184        <bitlbee-command name="channel">
    185185                <short-description>Channel list maintenance</short-description>
    186                 <syntax>channel [&lt;account id&gt;] &lt;action&gt; [&lt;arguments&gt;]</syntax>
     186                <syntax>channel [&lt;channel id&gt;] &lt;action&gt; [&lt;arguments&gt;]</syntax>
    187187
    188188                <description>
     
    277277                        <description>
    278278                                <para>
    279                                         List existing chatrooms provided by an account. BitlBee needs this to propogate an internal list of chats. The existing chat can then be added with <emphasis>chat add</emphasis>, using the number in the index column after a "!" as a shortcut.
     279                                        List existing named chatrooms provided by an account. Chats from this list can be referenced from <emphasis>chat add</emphasis> by using the number in the index column after a "!" as a shortcut.
     280                                </para>
     281
     282                                <para>
     283                                        The server parameter is optional and currently only used by jabber.
    280284                                </para>
    281285                        </description>
     
    338342                <description>
    339343                        <para>
    340                                 Requests IM-network-specific information about the specified user. The amount of information you'll get differs per protocol. For some protocols (ATM Yahoo! and MSN) it'll give you an URL which you can visit with a normal web browser to get the information.
     344                                Requests IM-network-specific information about the specified user. The amount of information you'll get differs per protocol. For some protocols it'll give you an URL which you can visit with a normal web browser to get the information.
    341345                        </para>
    342346                </description>
     
    887891                <description>
    888892                        <para>
    889                                 With this setting enabled, you can use some commands in your Twitter channel/query. The commands are simple and not documented in too much detail:
    890                         </para>
    891 
    892                         <variablelist>
    893                                 <varlistentry><term>undo #[&lt;id&gt;]</term><listitem><para>Delete your last Tweet (or one with the given ID)</para></listitem></varlistentry>
    894                                 <varlistentry><term>rt &lt;screenname|#id&gt;</term><listitem><para>Retweet someone's last Tweet (or one with the given ID)</para></listitem></varlistentry>
    895                                 <varlistentry><term>reply &lt;screenname|#id&gt;</term><listitem><para>Reply to a Tweet (with a reply-to reference)</para></listitem></varlistentry>
    896                                 <varlistentry><term>rawreply &lt;screenname|#id&gt;</term><listitem><para>Reply to a Tweet (with no reply-to reference)</para></listitem></varlistentry>
    897                                 <varlistentry><term>report &lt;screenname|#id&gt;</term><listitem><para>Report the given user (or the user who posted the tweet with the given ID) for sending spam. This will also block them.</para></listitem></varlistentry>
    898                                 <varlistentry><term>follow &lt;screenname&gt;</term><listitem><para>Start following a person</para></listitem></varlistentry>
    899                                 <varlistentry><term>unfollow &lt;screenname&gt;</term><listitem><para>Stop following a person</para></listitem></varlistentry>
    900                                 <varlistentry><term>favourite &lt;screenname|#id&gt;</term><listitem><para>Favo<emphasis>u</emphasis>rite the given user's most recent tweet, or the given tweet ID.</para></listitem></varlistentry>
    901                                 <varlistentry><term>post &lt;message&gt;</term><listitem><para>Post a tweet</para></listitem></varlistentry>
    902                                 <varlistentry><term>url &lt;screenname|#id&gt;</term><listitem><para>Show URL for a tweet to open it in a browser (and see context)</para></listitem></varlistentry>
    903                         </variablelist>
    904 
    905                         <para>
    906                                 Anything that doesn't look like a command will be treated as a tweet. Watch out for typos, or to avoid this behaviour, you can set this setting to <emphasis>strict</emphasis>, which causes the <emphasis>post</emphasis> command to become mandatory for posting a tweet.
     893                                With this setting enabled, you can use some commands in your Twitter channel/query. See <emphasis>help twitter</emphasis> for the list of extra commands available.
    907894                        </para>
    908895                </description>
     
    1004991        </bitlbee-setting>
    1005992
    1006         <bitlbee-setting name="handle_unknown" type="string" scope="global">
     993        <bitlbee-setting name="handle_unknown" type="string" scope="account,global">
    1007994                <default>add_channel</default>
    1008                 <possible-values>root, add, add_private, add_channel, ignore</possible-values>
    1009 
    1010                 <description>
    1011                         <para>
    1012                                 By default, messages from people who aren't in your contact list are shown in a control channel instead of as a private message.
     995                <possible-values>add_private, add_channel, ignore</possible-values>
     996
     997                <description>
     998                        <para>
     999                                By default, messages from people who aren't in your contact list are shown in a control channel (add_channel) instead of as a private message (add_private)
    10131000                        </para>
    10141001
    10151002                        <para>
    10161003                                If you prefer to ignore messages from people you don't know, you can set this one to "ignore". "add_private" and "add_channel" are like add, but you can use them to make messages from unknown buddies appear in the channel instead of a query window.
     1004                        </para>
     1005
     1006                        <para>
     1007                                This can be set to individual accounts, which is useful to only ignore accounts that are targeted by spammers, without missing messages from legitimate unknown contacts in others. Note that incoming add requests are visible regardless of this setting.
    10171008                        </para>
    10181009
     
    10371028        </bitlbee-setting>
    10381029
    1039         <bitlbee-setting name="lcnicks" type="boolean" scope="global">
    1040                 <default>true</default>
    1041 
    1042                 <description>
    1043                         <para>
    1044                                 Hereby you can change whether you want all lower case nick names or leave the case as it intended by your peer.
    1045                         </para>
    1046                 </description>
    1047 
    1048         </bitlbee-setting>
    1049 
    10501030        <bitlbee-setting name="local_display_name" type="boolean" scope="account">
    10511031                <default>false</default>
     
    10641044                <description>
    10651045                        <para>
    1066                                 Some protocols (MSN, Yahoo!, GTalk) can notify via IM about new e-mail. Since most people use their Hotmail/Yahoo! addresses as a spam-box, this is disabled default. If you want these notifications, you can enable this setting.
     1046                                Some protocols can notify via IM about new e-mail. If you want these notifications, you can enable this setting.
    10671047                        </para>
    10681048                </description>
     
    12121192                        </para>
    12131193                </description>
     1194        </bitlbee-setting>
     1195
     1196        <bitlbee-setting name="nick_lowercase" type="boolean" scope="global">
     1197                <default>true</default>
     1198
     1199                <description>
     1200                        <para>
     1201                                If enabled, all nicknames are turned into lower case.
     1202                        </para>
     1203
     1204                        <para>
     1205                                See also the <emphasis>nick_underscores</emphasis> setting. This setting was previously known as <emphasis>lcnicks</emphasis>.
     1206                        </para>
     1207                </description>
     1208
     1209        </bitlbee-setting>
     1210
     1211        <bitlbee-setting name="nick_underscores" type="boolean" scope="global">
     1212                <default>true</default>
     1213
     1214                <description>
     1215                        <para>
     1216                                If enabled, spaces in nicknames are turned into underscores instead of being stripped.
     1217                        </para>
     1218
     1219                        <para>
     1220                                See also the <emphasis>nick_lowercase</emphasis> setting.
     1221                        </para>
     1222                </description>
     1223
    12141224        </bitlbee-setting>
    12151225
     
    18501860        <bitlbee-command name="plugins">
    18511861                <short-description>List all the external plugins and protocols</short-description>
    1852                 <syntax>plugins</syntax>
     1862                <syntax>plugins [info &lt;name&gt;]</syntax>
    18531863
    18541864                <description>
    18551865                        <para>
    18561866                                This gives you a list of all the external plugins and protocols.
     1867                        </para>
     1868
     1869                        <para>
     1870                                Use the <emphasis>info</emphasis> subcommand to get more details about a plugin.
    18571871                        </para>
    18581872                </description>
  • doc/user-guide/genhelp.py

    r3f44e43 r7a9d968  
    7373
    7474def process_file(filename, parent=None):
    75     tree = ET.parse(open(filename)).getroot()
     75    try:
     76        tree = ET.parse(open(filename)).getroot()
     77    except:
     78        sys.stderr.write("\nException while processing %s\n" % filename)
     79        raise
    7680    fix_tree(tree)
    7781    return parse_tag(tree, parent)
  • doc/user-guide/help.xml

    r3f44e43 r7a9d968  
    1818  <varlistentry><term>groupchats</term><listitem><para>How to work with groupchats on BitlBee</para></listitem></varlistentry>
    1919  <varlistentry><term>nick_changes</term><listitem><para>Changing your nickname without losing any settings</para></listitem></varlistentry>
    20   <varlistentry><term>smileys</term><listitem><para>A summary of some non-standard smileys you might find and fail to understand</para></listitem></varlistentry>
     20  <varlistentry><term>identify_methods</term><listitem><para>A list of ways to (auto-)identify to your account</para></listitem></varlistentry>
    2121</variablelist>
    2222
     
    4949  <varlistentry><term>groupchats</term><listitem><para>How to work with groupchats on BitlBee</para></listitem></varlistentry>
    5050  <varlistentry><term>nick_changes</term><listitem><para>Changing your nickname without losing any settings</para></listitem></varlistentry>
    51   <varlistentry><term>smileys</term><listitem><para>A summary of some non-standard smileys you might find and fail to understand</para></listitem></varlistentry>
     51  <varlistentry><term>identify_methods</term><listitem><para>A list of ways to (auto-)identify to your account</para></listitem></varlistentry>
    5252</variablelist>
    5353
     
    6060<xi:include href="quickstart.xml"/>
    6161<xi:include href="commands.xml"/>
     62<xi:include href="twitter.xml"/>
    6263<xi:include href="misc.xml"/>
    6364
  • doc/user-guide/misc.xml

    r3f44e43 r7a9d968  
    7777
    7878<para>
    79 Some protocols (like Jabber) also support named groupchats. BitlBee now supports these too. You can use the <emphasis>chat add</emphasis> command to join them. See <emphasis>help chat add</emphasis> for more information.
    80 </para>
    81 
     79Some protocols (like Jabber) also support named groupchats. BitlBee supports these too. You can use the <emphasis>chat add</emphasis> command to join them. See <emphasis>help chat add</emphasis> for more information.
     80</para>
     81
     82<para>
     83If you don't know the name of a named groupchat, you can try the <emphasis>chat list</emphasis> command to get a list of chatrooms from a server. See <emphasis>help chat list</emphasis> for usage instructions.
     84</para>
    8285</sect1>
    8386
     
    265268everything in the handle up to the first @.
    266269</para>
     270
     271</sect1>
     272
     273<sect1 id="identify_methods">
     274<title>Identifying to your BitlBee account</title>
     275
     276<para>There are several methods to identify (log in) to your registered BitlBee account. All of these are equivalent:</para>
     277
     278<variablelist>
     279        <varlistentry>
     280                <term>The 'identify' command</term>
     281                <listitem><para>sent to &amp;bitlbee or root. See <emphasis>help identify</emphasis> for details.</para></listitem>
     282        </varlistentry>
     283        <varlistentry>
     284                <term>/msg nickserv identify</term>
     285                <listitem><para>Same as above, but sent to NickServ. Useful with some auto-identify scripts.</para></listitem>
     286        </varlistentry>
     287        <varlistentry>
     288                <term>/nickserv or /ns</term>
     289                <listitem><para>Same as above, but using the command aliases to NickServ.</para></listitem>
     290        </varlistentry>
     291        <varlistentry>
     292                <term>Server password</term>
     293                <listitem><para>A field in the server connection settings of your irc client.</para></listitem>
     294        </varlistentry>
     295        <varlistentry>
     296                <term>SASL PLAIN</term>
     297                <listitem><para>A newer method, good choice if your client supports it. (Note: "SASL" is <emphasis>not</emphasis> related to "SSL")</para></listitem>
     298        </varlistentry>
     299</variablelist>
     300
     301<para>To configure your client to auto-identify, the last two methods are recommended. SASL if you have it, but server password is often the easiest.</para>
     302
     303<para>Note: If you changed bitlbee.conf to have <emphasis>AuthMode = Closed</emphasis>, server password will be used for that instead. If you have never heard of that setting before, you can ignore it and just use it.</para>
    267304
    268305</sect1>
     
    462499</sect1>
    463500
     501<sect1 id="whatsnew030500">
     502<title>New stuff in BitlBee 3.5</title>
     503
     504<simplelist>
     505        <member>New commands: <emphasis>chat list</emphasis> and <emphasis>plugins</emphasis>. New settings: <emphasis>nick_lowercase</emphasis>, <emphasis>nick_underscores</emphasis></member>
     506        <member><emphasis>twitter:</emphasis> Hide muted tweets / no-retweets, add mute/unmute commands. Show full version of extended tweets.</member>
     507        <member><emphasis>jabber:</emphasis> <emphasis>always_use_nicks</emphasis> channel setting. Don't send parts in a chat if someone is still connected from other devices. Personal oauth token login for hipchat.</member>
     508        <member><emphasis>purple:</emphasis> Setting /topic. Fixes for SIPE and LINE. Don't ask for password if not needed (hangouts, telegram). Set nicks to %full_name for a few protocols (hangouts, funyahoo, icq, line)</member>
     509</simplelist>
     510
     511<para>
     512See the full changelog for details!
     513</para>
     514
     515</sect1>
     516
    464517</chapter>
  • doc/user-guide/quickstart.xml

    r3f44e43 r7a9d968  
    33
    44<para>
    5 Welcome to BitlBee, your IRC gateway to ICQ, MSN, AOL, Jabber, Yahoo! and Twitter.
     5Welcome to BitlBee, your IRC gateway to other instant messaging protocols.
    66</para>
    77
     
    4343
    4444<para>
    45 Other available IM protocols are msn, oscar, yahoo and twitter. OSCAR is the protocol used by ICQ and AOL. For more information about the <emphasis>account add</emphasis> command, see <emphasis>help account add</emphasis>.
     45Other built-in IM protocols include msn, oscar and twitter. OSCAR is the protocol used by ICQ and AOL. Some protocols may be available as plugins that you can install, such as facebook, steam, discord and omegle. And you can get even more protocols by using the libpurple variant of BitlBee.
     46</para>
     47
     48<para>
     49For a list of currently supported protocols, use the <emphasis>plugins</emphasis> command. For more information about the <emphasis>account add</emphasis> command, see <emphasis>help account add</emphasis>.
    4650</para>
    4751
     
    136140
    137141<para>
    138 If you're still looking for something, please visit us in #bitlbee on the OFTC network (you can connect via irc.bitlbee.org), or mail us your problem/suggestion. Good luck and enjoy the Bee!
     142If you're still looking for something, please visit us in #bitlbee on the OFTC network (irc.oftc.net). Good luck and enjoy the Bee!
    139143</para>
    140144
  • doc/user-guide/user-guide.xml

    r3f44e43 r7a9d968  
    3737  <xi:include href="quickstart.xml"/>
    3838  <xi:include href="commands.xml"/>
     39  <xi:include href="twitter.xml"/>
    3940  <xi:include href="misc.xml"/>
    4041
  • init/bitlbee.service.in

    r3f44e43 r7a9d968  
    11[Unit]
    22Description=BitlBee IRC/IM gateway
    3 After=syslog.target
    43
    54[Service]
  • init/bitlbee@.service.in

    r3f44e43 r7a9d968  
    11[Unit]
    22Description=BitlBee Per-Connection Server
    3 After=syslog.target
    43
    54[Service]
    65ExecStart=@sbindir@bitlbee -I
    76StandardInput=socket
     7StandardError=syslog
    88User=bitlbee
  • ipc.c

    r3f44e43 r7a9d968  
    898898        strcpy(un_addr.sun_path, IPCSOCKET);
    899899
    900         serversock = socket(AF_UNIX, SOCK_STREAM, PF_UNIX);
     900        serversock = socket(AF_UNIX, SOCK_STREAM, 0);
    901901
    902902        if (serversock == -1) {
  • irc.c

    r3f44e43 r7a9d968  
    2525
    2626#include "bitlbee.h"
     27#include "canohost.h"
    2728#include "ipc.h"
    2829#include "dcc.h"
     
    4142{
    4243        irc_t *irc;
    43         struct sockaddr_storage sock;
    44         socklen_t socklen = sizeof(sock);
    45         char *host = NULL, *myhost = NULL;
    4644        irc_user_t *iu;
    4745        GSList *l;
     
    6462        irc->iconv = (GIConv) - 1;
    6563        irc->oconv = (GIConv) - 1;
    66 
    67         if (global.conf->hostname) {
    68                 myhost = g_strdup(global.conf->hostname);
    69         } else if (getsockname(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
    70                 char buf[NI_MAXHOST + 1];
    71 
    72                 if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
    73                                 NI_MAXHOST, NULL, 0, 0) == 0) {
    74                         myhost = g_strdup(ipv6_unwrap(buf));
    75                 }
    76         }
    77 
    78         if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
    79                 char buf[NI_MAXHOST + 1];
    80 
    81                 if (getnameinfo((struct sockaddr *) &sock, socklen, buf,
    82                                 NI_MAXHOST, NULL, 0, 0) == 0) {
    83                         host = g_strdup(ipv6_unwrap(buf));
    84                 }
    85         }
    86 
    87         if (host == NULL) {
    88                 host = g_strdup("localhost.localdomain");
    89         }
    90         if (myhost == NULL) {
    91                 myhost = g_strdup("localhost.localdomain");
    92         }
    9364
    9465        if (global.conf->ping_interval > 0 && global.conf->ping_timeout > 0) {
     
    11384        s = set_add(&b->set, "last_version", "0", NULL, irc);
    11485        s->flags |= SET_HIDDEN;
    115         s = set_add(&b->set, "lcnicks", "true", set_eval_bool, irc);
    11686        s = set_add(&b->set, "nick_format", "%-@nick", NULL, irc);
     87        s = set_add(&b->set, "nick_lowercase", "false", set_eval_bool, irc);
     88        s = set_add(&b->set, "nick_underscores", "false", set_eval_bool, irc);
    11789        s = set_add(&b->set, "offline_user_quits", "true", set_eval_bool, irc);
    11890        s = set_add(&b->set, "ops", "both", set_eval_irc_channel_ops, irc);
     
    137109
    138110        irc->root = iu = irc_user_new(irc, ROOT_NICK);
    139         iu->host = g_strdup(myhost);
    140111        iu->fullname = g_strdup(ROOT_FN);
    141112        iu->f = &irc_user_root_funcs;
    142113
    143114        iu = irc_user_new(irc, NS_NICK);
    144         iu->host = g_strdup(myhost);
    145115        iu->fullname = g_strdup(ROOT_FN);
    146116        iu->f = &irc_user_root_funcs;
    147117
    148118        irc->user = g_new0(irc_user_t, 1);
    149         irc->user->host = g_strdup(host);
     119       
     120        irc_set_hosts(irc, NULL, 0);
    150121
    151122        conf_loaddefaults(irc);
     
    163134        }
    164135
    165         g_free(myhost);
    166         g_free(host);
    167 
    168136        /* libpurple doesn't like fork()s after initializing itself, so this
    169137           is the right moment to initialize it. */
     
    185153
    186154        return irc;
     155}
     156
     157void irc_set_hosts(irc_t *irc, const struct sockaddr *remote_addr, const socklen_t remote_addrlen)
     158{
     159        struct sockaddr_storage sock;
     160        socklen_t socklen = sizeof(sock);
     161        char *host = NULL, *myhost = NULL;
     162        struct irc_user *iu;
     163
     164        if (global.conf->hostname) {
     165                myhost = g_strdup(global.conf->hostname);
     166        } else if (getsockname(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
     167                myhost = reverse_lookup((struct sockaddr*) &sock, socklen);
     168        }
     169
     170        if (remote_addrlen > 0) {
     171                host = reverse_lookup(remote_addr, remote_addrlen);
     172        } else if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) == 0) {
     173                host = reverse_lookup((struct sockaddr*) &sock, socklen);
     174        }
     175
     176        if (myhost == NULL) {
     177                myhost = g_strdup("localhost.localdomain");
     178        }
     179        if (host == NULL) {
     180                host = g_strdup("localhost.localdomain");
     181        }
     182       
     183        if (irc->root->host != irc->root->nick) {
     184                g_free(irc->root->host);
     185        }
     186        irc->root->host = g_strdup(myhost);
     187        if ((iu = irc_user_by_name(irc, NS_NICK))) {
     188                if (iu->host != iu->nick) {
     189                        g_free(iu->host);
     190                }
     191                iu->host = g_strdup(myhost);
     192        }
     193       
     194        if (irc->user->host != irc->user->nick) {
     195                g_free(irc->user->host);
     196        }
     197        irc->user->host = g_strdup(host);
     198
     199        g_free(myhost);
     200        g_free(host);
    187201}
    188202
  • irc.h

    r3f44e43 r7a9d968  
    2626#ifndef _IRC_H
    2727#define _IRC_H
     28
     29#include <sys/socket.h>
    2830
    2931#define IRC_MAX_LINE 512
     
    271273
    272274irc_t *irc_new(int fd);
     275void irc_set_hosts(irc_t *irc, const struct sockaddr *remote_addr, const socklen_t remote_addrlen);
    273276void irc_abort(irc_t *irc, int immed, char *format, ...) G_GNUC_PRINTF(3, 4);
    274277void irc_free(irc_t *irc);
  • irc_channel.c

    r3f44e43 r7a9d968  
    638638        irc_channel_name_strip(name);
    639639
    640         if (set_getbool(&irc->b->set, "lcnicks")) {
     640        if (set_getbool(&irc->b->set, "nick_lowercase")) {
    641641                nick_lc(irc, name + 1);
    642642        }
  • irc_commands.c

    r3f44e43 r7a9d968  
    2626#define BITLBEE_CORE
    2727#include "bitlbee.h"
     28#include "canohost.h"
    2829#include "help.h"
    2930#include "ipc.h"
     
    5758                irc_check_login(irc);
    5859        }
     60}
     61
     62/* http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
     63
     64   This isn't actually IRC, it's used by for example stunnel4 to indicate
     65   the origin of the secured counterpart of the connection. It'll go wrong
     66   with arguments starting with : like for example "::1" but I guess I'm
     67   okay with that. */
     68static void irc_cmd_proxy(irc_t *irc, char **cmd)
     69{
     70        struct addrinfo hints, *ai;
     71        struct sockaddr_storage sock;
     72        socklen_t socklen = sizeof(sock);
     73
     74        if (getpeername(irc->fd, (struct sockaddr*) &sock, &socklen) != 0) {
     75                return;
     76        }
     77
     78        ipv64_normalise_mapped(&sock, &socklen);
     79
     80        /* Only accept PROXY "command" on localhost sockets. */
     81        if (!((sock.ss_family == AF_INET &&
     82               ntohl(((struct sockaddr_in*)&sock)->sin_addr.s_addr) == INADDR_LOOPBACK) ||
     83              (sock.ss_family == AF_INET6 &&
     84               IN6_IS_ADDR_LOOPBACK(&((struct sockaddr_in6*)&sock)->sin6_addr)))) {
     85                return;
     86        }
     87
     88        /* And only once. Do this with a pretty dumb regex-match for
     89           now, maybe better to use some sort of flag.. */
     90        if (!g_regex_match_simple("^(ip6-)?localhost(.(localdomain.?)?)?$", irc->user->host, 0, 0)) {
     91                return;
     92        }
     93       
     94        memset(&hints, 0, sizeof(hints));
     95        hints.ai_flags = AI_NUMERICHOST;
     96        if (getaddrinfo(cmd[2], NULL, &hints, &ai) != 0) {
     97                return;
     98        }
     99       
     100        irc_set_hosts(irc, ai->ai_addr, ai->ai_addrlen);
     101        freeaddrinfo(ai);
    59102}
    60103
     
    808851        { "cap",         1, irc_cmd_cap,         0 },
    809852        { "pass",        1, irc_cmd_pass,        0 },
     853        { "proxy",       5, irc_cmd_proxy,       IRC_CMD_PRE_LOGIN },
    810854        { "user",        4, irc_cmd_user,        IRC_CMD_PRE_LOGIN },
    811855        { "nick",        1, irc_cmd_nick,        0 },
  • irc_im.c

    r3f44e43 r7a9d968  
    8989
    9090        if (bu->flags & BEE_USER_LOCAL) {
    91                 char *s = set_getstr(&bee->set, "handle_unknown");
    92 
    93                 if (strcmp(s, "add_private") == 0) {
     91                char *s = set_getstr(&bu->ic->acc->set, "handle_unknown") ? :
     92                          set_getstr(&bee->set, "handle_unknown");
     93
     94                if (g_strcasecmp(s, "add_private") == 0) {
    9495                        iu->last_channel = NULL;
    95                 } else if (strcmp(s, "add_channel") == 0) {
     96                } else if (g_strcasecmp(s, "add_channel") == 0) {
    9697                        iu->last_channel = irc->default_channel;
    9798                }
     
    634635        }
    635636
    636         if (ic->flags & IRC_CHANNEL_JOINED) {
    637                 irc_channel_printf(ic, "Cleaning up channel, bye!");
    638         }
    639 
    640637        ic->data = NULL;
    641638        c->ui_data = NULL;
  • lib/Makefile

    r3f44e43 r7a9d968  
    1313
    1414# [SH] Program variables
    15 objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o oauth2.o parson.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o
     15objects = arc.o base64.o canohost.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o oauth2.o parson.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o ns_parse.o
    1616
    1717LFLAGS += -r
     
    3636lib.o: $(objects) $(subdirs)
    3737        @echo '*' Linking lib.o
    38         @$(LD) $(LFLAGS) $(objects) -o lib.o
     38        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o lib.o
    3939
    4040$(objects): ../Makefile.settings Makefile
     
    4242$(objects): %.o: $(_SRCDIR_)%.c
    4343        @echo '*' Compiling $<
    44         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     44        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4545
    4646-include .depend/*.d
  • lib/ftutil.c

    r3f44e43 r7a9d968  
    4242        struct addrinfo hints, *rp;
    4343        socklen_t ssize = sizeof(struct sockaddr_storage);
    44         struct sockaddr_storage saddrs, *saddr = &saddrs;
     44        struct sockaddr_storage saddrs = {0}, *saddr = &saddrs;
    4545        static char errmsg[1024];
    4646        char *ftlisten = global.conf->ft_listen;
     
    6363                        if (for_bitlbee_client) {
    6464                                *scolon = '\0';
    65                                 strncpy(host, ftlisten, HOST_NAME_MAX);
     65                                strncpy(host, ftlisten, NI_MAXHOST);
    6666                                *scolon = ';';
    6767                        } else {
    68                                 strncpy(host, scolon + 1, HOST_NAME_MAX);
     68                                strncpy(host, scolon + 1, NI_MAXHOST);
    6969                        }
    7070                } else {
    71                         strncpy(host, ftlisten, HOST_NAME_MAX);
     71                        strncpy(host, ftlisten, NI_MAXHOST);
    7272                }
    7373
     
    7878        } else if (copy_fd >= 0 && getsockname(copy_fd, (struct sockaddr*) &saddrs, &ssize) == 0 &&
    7979                   (saddrs.ss_family == AF_INET || saddrs.ss_family == AF_INET6) &&
    80                    getnameinfo((struct sockaddr*) &saddrs, ssize, host, HOST_NAME_MAX,
     80                   getnameinfo((struct sockaddr*) &saddrs, ssize, host, NI_MAXHOST,
    8181                               NULL, 0, NI_NUMERICHOST) == 0) {
    8282                /* We just took our local address on copy_fd, which is likely to be a
     
    8484                   most sensible we can get easily. */
    8585        } else {
    86                 ASSERTSOCKOP(gethostname(host, HOST_NAME_MAX + 1), "gethostname()");
     86                ASSERTSOCKOP(gethostname(host, NI_MAXHOST), "gethostname()");
    8787        }
    8888
     
    109109                       ( void * ) &(( struct sockaddr_in * ) saddr)->sin_addr.s_addr :
    110110                       ( void * ) &(( struct sockaddr_in6 * ) saddr)->sin6_addr.s6_addr,
    111                        host, HOST_NAME_MAX)) {
     111                       host, NI_MAXHOST)) {
    112112                strcpy(errmsg, "inet_ntop failed on listening socket");
    113113                return -1;
     
    128128
    129129        /* I hate static-length strings.. */
    130         host[HOST_NAME_MAX - 1] = '\0';
     130        host[NI_MAXHOST - 1] = '\0';
    131131        port[5] = '\0';
    132132
  • lib/ftutil.h

    r3f44e43 r7a9d968  
    2626#endif
    2727
    28 /* Some ifdefs for ulibc and apparently also BSD (Thanks to Whoopie) */
    29 #ifndef HOST_NAME_MAX
    30 #include <sys/param.h>
    31 #ifdef MAXHOSTNAMELEN
    32 #define HOST_NAME_MAX MAXHOSTNAMELEN
    33 #else
    34 #define HOST_NAME_MAX 255
    35 #endif
    36 #endif
    37 
    3828/* This function should be used with care. host should be AT LEAST a
    39    char[HOST_NAME_MAX+1] and port AT LEAST a char[6]. */
     29   char[NI_MAXHOST+1] and port AT LEAST a char[6]. */
    4030int ft_listen(struct sockaddr_storage *saddr_ptr, char *host, char *port, int copy_fd, int for_bitlbee_client,
    4131              char **errptr);
  • lib/misc.c

    r3f44e43 r7a9d968  
    1 /********************************************************************\
     1  /********************************************************************\
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
     
    335335}
    336336
    337 /* Wrap an IPv4 address into IPv6 space. Not thread-safe... */
    338 char *ipv6_wrap(char *src)
    339 {
    340         static char dst[64];
    341         int i;
    342 
    343         for (i = 0; src[i]; i++) {
    344                 if ((src[i] < '0' || src[i] > '9') && src[i] != '.') {
    345                         break;
    346                 }
    347         }
    348 
    349         /* Hmm, it's not even an IP... */
    350         if (src[i]) {
    351                 return src;
    352         }
    353 
    354         g_snprintf(dst, sizeof(dst), "::ffff:%s", src);
    355 
    356         return dst;
    357 }
    358 
    359 /* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */
    360 char *ipv6_unwrap(char *src)
    361 {
    362         int i;
    363 
    364         if (g_strncasecmp(src, "::ffff:", 7) != 0) {
    365                 return src;
    366         }
    367 
    368         for (i = 7; src[i]; i++) {
    369                 if ((src[i] < '0' || src[i] > '9') && src[i] != '.') {
    370                         break;
    371                 }
    372         }
    373 
    374         /* Hmm, it's not even an IP... */
    375         if (src[i]) {
    376                 return src;
    377         }
    378 
    379         return (src + 7);
    380 }
    381 
    382337/* Convert from one charset to another.
    383338
  • lib/misc.h

    r3f44e43 r7a9d968  
    2929#include <gmodule.h>
    3030#include <time.h>
     31#include <sys/socket.h>
    3132
    3233struct ns_srv_reply {
     
    130131G_MODULE_EXPORT void http_encode(char *s);
    131132
    132 G_MODULE_EXPORT char *ipv6_wrap(char *src);
    133 G_MODULE_EXPORT char *ipv6_unwrap(char *src);
    134 
    135133G_MODULE_EXPORT signed int do_iconv(char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf);
    136134
  • nick.c

    r3f44e43 r7a9d968  
    9494
    9595                nick_strip(irc, nick);
    96                 if (set_getbool(&bu->bee->set, "lcnicks")) {
     96                if (set_getbool(&bu->bee->set, "nick_lowercase")) {
    9797                        nick_lc(irc, nick);
    9898                }
     
    215215        if (ok && rets && *rets) {
    216216                nick_strip(irc, rets);
     217
     218                if (set_getbool(&bu->bee->set, "nick_lowercase")) {
     219                        nick_lc(irc, rets);
     220                }
     221
    217222                truncate_utf8(rets, MAX_NICK_LENGTH);
    218223                return rets;
     
    288293{
    289294        int len = 0;
     295        gboolean nick_underscores = irc ? set_getbool(&irc->b->set, "nick_underscores") : FALSE;
    290296
    291297        if (irc && (irc->status & IRC_UTF8_NICKS)) {
     
    297303                        n = g_utf8_find_next_char(p, NULL);
    298304
    299                         if ((c < 0x7f && !(strchr(nick_lc_chars, c) ||
    300                                            strchr(nick_uc_chars, c))) ||
     305                        if (nick_underscores && c == ' ') {
     306                                *p = '_';
     307                                p = n;
     308                        } else if ((c < 0x7f && !(strchr(nick_lc_chars, c) ||
     309                                                  strchr(nick_uc_chars, c))) ||
    301310                            !g_unichar_isgraph(c)) {
    302311                                strcpy(tmp, n);
     
    313322
    314323                for (i = len = 0; nick[i] && len < MAX_NICK_LENGTH; i++) {
    315                         if (strchr(nick_lc_chars, nick[i]) ||
     324                        if (nick_underscores && nick[i] == ' ') {
     325                                nick[len] = '_';
     326                                len++;
     327                        } else if (strchr(nick_lc_chars, nick[i]) ||
    316328                            strchr(nick_uc_chars, nick[i])) {
    317329                                nick[len] = nick[i];
  • otr.c

    r3f44e43 r7a9d968  
    878878        case OTRL_SMPEVENT_ASK_FOR_SECRET:
    879879                irc_rootmsg(irc, "smp: initiated by %s"
    880                             " - respond with \x02otr smp %s <secret>\x02",
     880                            " - respond with \x02otr smp %s \"<secret>\"\x02",
    881881                            u->nick, u->nick);
    882882                break;
     
    884884                irc_rootmsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,
    885885                            question);
    886                 irc_rootmsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",
     886                irc_rootmsg(irc, "smp: respond with \x02otr smp %s \"<answer>\"\x02",
    887887                            u->nick);
    888888                break;
     
    15141514                        }
    15151515                }
    1516                 assert(l != NULL);  /* a match should always be found */
     1516                g_return_val_if_fail(l, NULL);
    15171517                if (!l) {
    15181518                        return NULL;
  • protocols/Makefile

    r3f44e43 r7a9d968  
    4343
    4444$(subdirs):
    45         @$(MAKE) -C $@ $(MAKECMDGOALS)
     45        $(MAKE) -C $@ $(MAKECMDGOALS)
    4646
    4747### MAIN PROGRAM
     
    4949protocols.o: $(objects) $(subdirs)
    5050        @echo '*' Linking protocols.o
    51         @$(LD) $(LFLAGS) $(objects) $(subdirobjs) -o protocols.o
     51        $(VERBOSE) $(LD) $(LFLAGS) $(objects) $(subdirobjs) -o protocols.o
    5252
    5353$(objects): ../Makefile.settings Makefile
     
    5555$(objects): %.o: $(_SRCDIR_)%.c
    5656        @echo '*' Compiling $<
    57         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     57        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    5858
    5959-include .depend/*.d
  • protocols/account.c

    r3f44e43 r7a9d968  
    5555
    5656        s = set_add(&a->set, "auto_reconnect", "true", set_eval_bool, a);
     57
     58        s = set_add(&a->set, "handle_unknown", NULL, NULL, a);
     59        s->flags |= SET_NULL_OK;
    5760
    5861        s = set_add(&a->set, "nick_format", NULL, NULL, a);
  • protocols/bee_user.c

    r3f44e43 r7a9d968  
    170170
    171171        if (!(bu = bee_user_by_handle(bee, ic, handle))) {
    172                 if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "add") == 0) {
     172                char *h = set_getstr(&ic->acc->set, "handle_unknown") ? :
     173                          set_getstr(&ic->bee->set, "handle_unknown");
     174
     175                if (g_strncasecmp(h, "add", 3) == 0) {
    173176                        bu = bee_user_new(bee, ic, handle, BEE_USER_LOCAL);
    174177                } else {
    175                         if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "ignore") != 0) {
     178                        if (g_strcasecmp(h, "ignore") != 0) {
    176179                                imcb_log(ic, "imcb_buddy_status() for unknown handle %s:\n"
    177180                                         "flags = %d, state = %s, message = %s", handle, flags,
     
    255258
    256259        if (!bu && !(ic->flags & OPT_LOGGING_OUT)) {
    257                 char *h = set_getstr(&bee->set, "handle_unknown");
     260                char *h = set_getstr(&ic->acc->set, "handle_unknown") ? :
     261                          set_getstr(&ic->bee->set, "handle_unknown");
    258262
    259263                if (g_strcasecmp(h, "ignore") == 0) {
  • protocols/jabber/Makefile

    r3f44e43 r7a9d968  
    3838$(objects): %.o: $(_SRCDIR_)%.c
    3939        @echo '*' Compiling $<
    40         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     40        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4141
    4242jabber_mod.o: $(objects)
    4343        @echo '*' Linking jabber_mod.o
    44         @$(LD) $(LFLAGS) $(objects) -o jabber_mod.o
     44        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o jabber_mod.o
    4545
    4646-include .depend/*.d
  • protocols/jabber/conference.c

    r3f44e43 r7a9d968  
    167167        jabber_buddy_remove_bare(c->ic, jc->name);
    168168
     169        g_free(jc->last_sent_message);
    169170        g_free(jc->my_full_jid);
    170171        g_free(jc->name);
     
    187188
    188189        jabber_cache_add(ic, node, jabber_chat_self_message);
     190
     191        g_free(jc->last_sent_message);
     192        jc->last_sent_message = g_strdup(message);
    189193
    190194        return !jabber_write_packet(ic, node);
     
    325329                        }
    326330                        bud->flags |= JBFLAG_IS_ANONYMOUS;
     331                } else if (bud == jc->me) {
     332                        g_free(bud->ext_jid);
     333                        bud->ext_jid = g_strdup(jd->me);
    327334                }
    328335
     
    347354                }
    348355
     356                imcb_chat_add_buddy(chat, bud->ext_jid);
     357
    349358                if (bud != jc->me && (jc->flags & JCFLAG_ALWAYS_USE_NICKS) && !(bud->flags & JBFLAG_IS_ANONYMOUS)) {
    350359                        imcb_buddy_nick_change(ic, bud->ext_jid, bud->resource);
    351360                }
    352361
    353                 imcb_chat_add_buddy(chat, bud->ext_jid);
    354362                if (s) {
    355363                        *s = '/';
     
    494502                imcb_chat_log(chat, "From conference server: %s", body->text);
    495503                return;
    496         } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me &&
    497                    (jabber_cache_handle_packet(ic, node) == XT_ABORT)) {
    498                 /* Self message marked by this bitlbee, don't show it */
    499                 return;
     504        } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me) {
     505                if (jabber_cache_handle_packet(ic, node) == XT_ABORT) {
     506                        /* Self message marked by this bitlbee, don't show it */
     507                        return;
     508                } else if (xt_find_attr(node, "id") == NULL &&
     509                           g_strcmp0(body->text, jc->last_sent_message) == 0) {
     510                        /* Some misbehaving servers (like slack) eat the ids and echo anyway.
     511                         * Try to detect those cases by comparing against the last sent message. */
     512                        return;
     513                }
    500514        }
    501515
  • protocols/jabber/jabber.h

    r3f44e43 r7a9d968  
    161161        struct jabber_buddy *me;
    162162        char *invite;
     163        char *last_sent_message;
    163164};
    164165
  • protocols/jabber/s5bytestream.c

    r3f44e43 r7a9d968  
    500500        case BS_PHASE_REPLY:
    501501        {
    502                 struct socks5_message socks5_reply;
     502                struct socks5_message socks5_reply = {0};
    503503                int ret;
    504504
     
    888888        char *proxy, *next, *errmsg = NULL;
    889889        char port[6];
    890         char host[HOST_NAME_MAX + 1];
     890        char host[NI_MAXHOST + 1];
    891891        jabber_streamhost_t *sh, *sh2;
    892892        GSList *streamhosts = jd->streamhosts;
     
    10461046                        unsigned char nmethods;
    10471047                        unsigned char method;
    1048                 } socks5_hello;
     1048                } socks5_hello = {0};
    10491049
    10501050                if (!(ret = jabber_bs_peek(bt, &socks5_hello, sizeof(socks5_hello)))) {
     
    10911091        case BS_PHASE_REQUEST:
    10921092        {
    1093                 struct socks5_message socks5_connect;
     1093                struct socks5_message socks5_connect = {0};
    10941094                int msgsize = sizeof(struct socks5_message);
    10951095                int ret;
  • protocols/msn/Makefile

    r3f44e43 r7a9d968  
    3838$(objects): %.o: $(_SRCDIR_)%.c
    3939        @echo '*' Compiling $<
    40         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     40        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4141
    4242msn_mod.o: $(objects)
    4343        @echo '*' Linking msn_mod.o
    44         @$(LD) $(LFLAGS) $(objects) -o msn_mod.o
     44        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o msn_mod.o
    4545
    4646-include .depend/*.d
  • protocols/msn/msn_util.c

    r3f44e43 r7a9d968  
    180180        if (getenv("BITLBEE_DEBUG")) {
    181181                fprintf(stderr, "\n\x1b[92m<<< ");
    182                 write(2, bytes , st);
     182                fwrite(bytes, st, 1, stderr);
    183183                fprintf(stderr, "\x1b[97m");
    184184        }
  • protocols/msn/soap.c

    r3f44e43 r7a9d968  
    213213        if (headers) {
    214214                if ((s = strstr(headers, "\r\n\r\n"))) {
    215                         write(2, headers, s - headers + 4);
     215                        fwrite(headers, s - headers + 4, 1, stderr);
    216216                } else {
    217                         write(2, headers, strlen(headers));
     217                        fwrite(headers, strlen(headers), 1, stderr);
    218218                }
    219219        }
  • protocols/nogaim.c

    r3f44e43 r7a9d968  
    5050}
    5151
     52/* semi-private */
     53gboolean plugin_info_validate(struct plugin_info *info, const char *path)
     54{
     55        GList *l;
     56        gboolean loaded = FALSE;
     57
     58        if (!path) {
     59                path = "(null)";
     60        }
     61
     62        if (info->abiver != BITLBEE_ABI_VERSION_CODE) {
     63                log_message(LOGLVL_ERROR,
     64                            "`%s' uses ABI %u but %u is required\n",
     65                            path, info->abiver,
     66                            BITLBEE_ABI_VERSION_CODE);
     67                return FALSE;
     68        }
     69
     70        if (!info->name || !info->version) {
     71                log_message(LOGLVL_ERROR,
     72                            "Name or version missing from the "
     73                            "plugin info in `%s'\n", path);
     74                return FALSE;
     75        }
     76
     77        for (l = plugins; l; l = l->next) {
     78                struct plugin_info *i = l->data;
     79
     80                if (g_strcasecmp(i->name, info->name) == 0) {
     81                        loaded = TRUE;
     82                        break;
     83                }
     84        }
     85
     86        if (loaded) {
     87                log_message(LOGLVL_WARNING,
     88                            "%s plugin already loaded\n",
     89                            info->name);
     90                return FALSE;
     91        }
     92
     93        return TRUE;
     94}
     95
     96/* semi-private */
     97gboolean plugin_info_add(struct plugin_info *info)
     98{
     99        plugins = g_list_insert_sorted_with_data(plugins, info, pluginscmp, NULL);
     100        return TRUE;
     101}
     102
    52103gboolean load_plugin(char *path)
    53104{
    54         GList *l;
    55         struct plugin_info *i;
    56         struct plugin_info *info;
     105        struct plugin_info *info = NULL;
    57106        struct plugin_info * (*info_function) (void) = NULL;
    58107        void (*init_function) (void);
    59108
    60109        GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY);
    61         gboolean loaded = FALSE;
    62110
    63111        if (!mod) {
     
    69117                info = info_function();
    70118
    71                 if (info->abiver != BITLBEE_ABI_VERSION_CODE) {
    72                         log_message(LOGLVL_ERROR,
    73                                     "`%s' uses ABI %u but %u is required\n",
    74                                     path, info->abiver,
    75                                     BITLBEE_ABI_VERSION_CODE);
    76                         g_module_close(mod);
    77                         return FALSE;
    78                 }
    79 
    80                 if (!info->name || !info->version) {
    81                         log_message(LOGLVL_ERROR,
    82                                     "Name or version missing from the "
    83                                     "plugin info in `%s'\n", path);
    84                         g_module_close(mod);
    85                         return FALSE;
    86                 }
    87 
    88                 for (l = plugins; l; l = l->next) {
    89                         i = l->data;
    90 
    91                         if (g_strcasecmp(i->name, info->name) == 0) {
    92                                 loaded = TRUE;
    93                                 break;
    94                         }
    95                 }
    96 
    97                 if (loaded) {
    98                         log_message(LOGLVL_WARNING,
    99                                     "%s plugin already loaded\n",
    100                                     info->name);
     119                if (!plugin_info_validate(info, path)) {
    101120                        g_module_close(mod);
    102121                        return FALSE;
     
    113132
    114133        if (info_function) {
    115                 plugins = g_list_insert_sorted_with_data(plugins, info,
    116                                                          pluginscmp, NULL);
     134                plugin_info_add(info);
    117135        }
    118136
     
    797815                msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL;
    798816                away = imc_away_state_find(m, away, &msg) ? :
    799                        (imc_away_state_find(m, "away", &msg) ? : m->data);
     817                       (imc_away_state_find(m, "away", NULL) ? : m->data);
    800818        } else if (ic->acc->flags & ACC_FLAG_STATUS_MESSAGE) {
    801819                away = NULL;
     
    831849                           contains no data unless it adds something to what
    832850                           we have in state already. */
    833                         if (strlen(m->data) == strlen(away)) {
     851                        if (message && strlen(m->data) == strlen(away)) {
    834852                                *message = NULL;
    835853                        }
     
    857875                        for (m = gcm; m; m = m->next) {
    858876                                if (g_strcasecmp(imc_away_alias_list[i][j], m->data) == 0) {
    859                                         if (!keep_message) {
     877                                        if (!keep_message && message) {
    860878                                                *message = NULL;
    861879                                        }
  • protocols/oscar/Makefile

    r3f44e43 r7a9d968  
    3939$(objects): %.o: $(_SRCDIR_)%.c
    4040        @echo '*' Compiling $<
    41         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     41        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4242
    4343oscar_mod.o: $(objects)
    4444        @echo '*' Linking oscar_mod.o
    45         @$(LD) $(LFLAGS) $(objects) -o oscar_mod.o
     45        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o oscar_mod.o
    4646
    4747-include .depend/*.d
  • protocols/oscar/rxhandlers.c

    r3f44e43 r7a9d968  
    235235        struct aim_rxcblist_s *newcb;
    236236
    237         if (!conn) {
    238                 return -1;
    239         }
    240 
    241         if (checkdisallowed(family, type)) {
    242                 g_assert(0);
    243                 return -1;
    244         }
     237        g_return_val_if_fail(conn, -1);
     238        g_return_val_if_fail(!checkdisallowed(family, type), -1);
    245239
    246240        if (!(newcb = (struct aim_rxcblist_s *) g_new0(struct aim_rxcblist_s, 1))) {
  • protocols/purple/Makefile

    r3f44e43 r7a9d968  
    3939$(objects): %.o: $(_SRCDIR_)%.c
    4040        @echo '*' Compiling $<
    41         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     41        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4242
    4343purple_mod.o: $(objects)
    4444        @echo '*' Linking purple_mod.o
    45         @$(LD) $(LFLAGS) $(objects) -o purple_mod.o
     45        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o purple_mod.o
    4646
    4747-include .depend/*.d
  • protocols/purple/bpurple.h

    r3f44e43 r7a9d968  
    66
    77#define PURPLE_REQUEST_HANDLE "purple_request"
     8
     9#define PURPLE_OPT_SHOULD_SET_NICK 1
    810
    911struct purple_data
     
    1517    char *chat_list_server;
    1618    GSList *filetransfers;
     19
     20    int flags;
    1721};
    1822
  • protocols/purple/ft.c

    r3f44e43 r7a9d968  
    146146           remove the evil cast below. */
    147147        px->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);
     148
     149        if (!px->ft) {
     150                return FALSE;
     151        }
    148152        px->ft->data = px;
    149153
  • protocols/purple/purple.c

    r3f44e43 r7a9d968  
    114114}
    115115
     116static gboolean purple_account_should_set_nick(account_t *acc)
     117{
     118        /* whitelist of protocols that tend to have numeric or meaningless usernames, and should
     119         * always offer the 'alias' as a nick.  this is just so that users don't have to do
     120         * 'account whatever set nick_format %full_name'
     121         */
     122        char *whitelist[] = {
     123                "prpl-hangouts",
     124                "prpl-eionrobb-funyahoo-plusplus",
     125                "prpl-icq",
     126                "prpl-line",
     127                NULL,
     128        };
     129        char **p;
     130
     131        for (p = whitelist; *p; p++) {
     132                if (g_strcmp0(acc->prpl->data, *p) == 0) {
     133                        return TRUE;
     134                }
     135        }
     136
     137        return FALSE;
     138}
     139
    116140static void purple_init(account_t *acc)
    117141{
     
    281305        }
    282306
     307        if (g_strcmp0(prpl->info->id, "prpl-line") == 0) {
     308                s = set_add(&acc->set, "line-auth-token", NULL, NULL, acc);
     309                s->flags |= SET_HIDDEN;
     310        }
     311
    283312        /* Go through all away states to figure out if away/status messages
    284313           are possible. */
     
    344373                purple_account_set_check_mail(pa, set_getbool(&acc->set, "mail_notifications"));
    345374        }
     375
     376        if (g_strcmp0(prpl->info->id, "prpl-line") == 0) {
     377                const char *name = "line-auth-token";
     378                purple_account_set_string(pa, name, set_getstr(&acc->set, name));
     379        }
    346380}
    347381
     
    372406        purple_account_set_password(pd->account, acc->pass);
    373407        purple_sync_settings(acc, pd->account);
     408
     409        if (purple_account_should_set_nick(acc)) {
     410                pd->flags = PURPLE_OPT_SHOULD_SET_NICK;
     411        }
    374412
    375413        purple_account_set_enabled(pd->account, "BitlBee", TRUE);
     
    741779        struct groupchat *gc;
    742780        GList *info, *l;
     781        GString *missing_settings = NULL;
    743782
    744783        if (!pi->chat_info || !pi->chat_info_defaults ||
     
    766805                } else if (strcmp(pce->identifier, "passwd") == 0) {
    767806                        g_hash_table_replace(chat_hash, "passwd", g_strdup(password));
     807                } else {
     808                        char *key, *value;
     809
     810                        key = g_strdup_printf("purple_%s", pce->identifier);
     811                        str_reject_chars(key, " -", '_');
     812
     813                        if ((value = set_getstr(sets, key))) {
     814                                /* sync from bitlbee to the prpl */
     815                                g_hash_table_replace(chat_hash, (char *) pce->identifier, g_strdup(value));
     816                        } else if ((value = g_hash_table_lookup(chat_hash, pce->identifier))) {
     817                                /* if the bitlbee one was empty, sync from prpl to bitlbee */
     818                                set_setstr(sets, key, value);
     819                        }
     820
     821                        g_free(key);
     822                }
     823
     824                if (pce->required && !g_hash_table_lookup(chat_hash, pce->identifier)) {
     825                        if (!missing_settings) {
     826                                missing_settings = g_string_sized_new(32);
     827                        }
     828                        g_string_append_printf(missing_settings, "%s, ", pce->identifier);
    768829                }
    769830
     
    772833
    773834        g_list_free(info);
     835
     836        if (missing_settings) {
     837                /* remove the ", " from the end */
     838                g_string_truncate(missing_settings, missing_settings->len - 2);
     839
     840                imcb_error(ic, "Can't join %s. The following settings are required: %s", room, missing_settings->str);
     841
     842                g_string_free(missing_settings, TRUE);
     843                g_hash_table_destroy(chat_hash);
     844                return NULL;
     845        }
    774846
    775847        /* do this before serv_join_chat to handle cases where prplcb_conv_new is called immediately (not async) */
     
    806878                purple_roomlist_ref(list);
    807879        }
     880}
     881
     882/* handles either prpl->chat_(add|free)_settings depending on the value of 'add' */
     883static void purple_chat_update_settings(account_t *acc, set_t **head, gboolean add)
     884{
     885        PurplePlugin *prpl = purple_plugins_find_with_id((char *) acc->prpl->data);
     886        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
     887        GList *info, *l;
     888
     889        if (!pi->chat_info || !pi->chat_info_defaults) {
     890                return;
     891        }
     892
     893        /* hack / leap of faith: pass a NULL here because we don't have a connection yet.
     894         * i reviewed all the built-in prpls and a bunch of third-party ones and none
     895         * of them seem to need this parameter at all, so... i hope it never crashes */
     896        info = pi->chat_info(NULL);
     897
     898        for (l = info; l; l = l->next) {
     899                struct proto_chat_entry *pce = l->data;
     900                char *key;
     901
     902                if (strcmp(pce->identifier, "handle") == 0 ||
     903                    strcmp(pce->identifier, "password") == 0 ||
     904                    strcmp(pce->identifier, "passwd") == 0) {
     905                        /* skip these, they are handled above */
     906                        g_free(pce);
     907                        continue;
     908                }
     909
     910                key = g_strdup_printf("purple_%s", pce->identifier);
     911                str_reject_chars(key, " -", '_');
     912
     913                if (add) {
     914                        set_add(head, key, NULL, NULL, NULL);
     915                } else {
     916                        set_del(head, key);
     917                }
     918
     919                g_free(key);
     920                g_free(pce);
     921        }
     922
     923        g_list_free(NULL);
     924        g_list_free(info);
     925}
     926
     927static void purple_chat_add_settings(account_t *acc, set_t **head)
     928{
     929        purple_chat_update_settings(acc, head, TRUE);
     930}
     931
     932static void purple_chat_free_settings(account_t *acc, set_t **head)
     933{
     934        purple_chat_update_settings(acc, head, FALSE);
    808935}
    809936
     
    844971{
    845972        struct im_connection *ic = purple_ic_by_gc(gc);
    846         const char *dn;
     973        struct purple_data *pd = ic->proto_data;
     974        const char *dn, *token;
    847975        set_t *s;
    848976
     
    857985        // user list needs to be requested for Gadu-Gadu
    858986        purple_gg_buddylist_import(gc);
     987
     988        /* more awful hacks, because clearly we didn't have enough of those */
     989        if ((s = set_find(&ic->acc->set, "line-auth-token")) &&
     990            (token = purple_account_get_string(pd->account, "line-auth-token", NULL))) {
     991                g_free(s->value);
     992                s->value = g_strdup(token);
     993        }
    859994
    860995        ic->flags |= OPT_DOES_HTML;
     
    9081043                PurpleGroup *group = purple_buddy_get_group(bud);
    9091044                struct im_connection *ic = purple_ic_by_pa(bud->account);
     1045                struct purple_data *pd = ic->proto_data;
    9101046                PurpleStatus *as;
    9111047                int flags = 0;
     1048                char *alias = NULL;
    9121049
    9131050                if (ic == NULL) {
     
    9151052                }
    9161053
    917                 if (bud->server_alias) {
    918                         imcb_rename_buddy(ic, bud->name, bud->server_alias);
    919                 } else if (bud->alias) {
    920                         imcb_rename_buddy(ic, bud->name, bud->alias);
     1054                alias = bud->server_alias ? : bud->alias;
     1055
     1056                if (alias) {
     1057                        imcb_rename_buddy(ic, bud->name, alias);
     1058                        if (pd->flags & PURPLE_OPT_SHOULD_SET_NICK) {
     1059                                imcb_buddy_nick_change(ic, bud->name, alias);
     1060                        }
    9211061                }
    9221062
     
    10621202}
    10631203
    1064 /* Handles write_im and write_chat. Removes echoes of locally sent messages */
     1204/* Handles write_im and write_chat. Removes echoes of locally sent messages.
     1205 *
     1206 * PURPLE_MESSAGE_DELAYED is used for chat backlogs - if a message has both
     1207 * that flag and _SEND, it's a self-message from before joining the channel.
     1208 * Those are safe to display. The rest (with just _SEND) may be echoes. */
    10651209static void prplcb_conv_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime)
    10661210{
    1067         if (!(flags & PURPLE_MESSAGE_SEND)) {
    1068                 handle_conv_msg(conv, who, message, 0, mtime);
     1211        if ((!(flags & PURPLE_MESSAGE_SEND)) || (flags & PURPLE_MESSAGE_DELAYED)) {
     1212                handle_conv_msg(conv, who, message, (flags & PURPLE_MESSAGE_SEND) ? OPT_SELFMESSAGE : 0, mtime);
    10691213        }
    10701214}
     
    13921536}
    13931537
     1538static char *prplcb_roomlist_get_room_name(PurpleRoomlist *list, PurpleRoomlistRoom *room)
     1539{
     1540        struct im_connection *ic = purple_ic_by_pa(list->account);
     1541        struct purple_data *pd = ic->proto_data;
     1542        PurplePlugin *prpl = purple_plugins_find_with_id(pd->account->protocol_id);
     1543        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
     1544
     1545        if (pi && pi->roomlist_room_serialize) {
     1546                return pi->roomlist_room_serialize(room);
     1547        } else {
     1548                return g_strdup(purple_roomlist_room_get_name(room));
     1549        }
     1550}
     1551
    13941552static void prplcb_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room)
    13951553{
    13961554        bee_chat_info_t *ci;
    1397         const char *title;
     1555        char *title;
    13981556        const char *topic;
    13991557        GList *fields;
     
    14011559
    14021560        fields = purple_roomlist_room_get_fields(room);
    1403         title = purple_roomlist_room_get_name(room);
     1561        title = prplcb_roomlist_get_room_name(list, room);
    14041562
    14051563        if (rld->topic >= 0) {
     
    14101568
    14111569        ci = g_new(bee_chat_info_t, 1);
    1412         ci->title = g_strdup(title);
     1570        ci->title = title;
    14131571        ci->topic = g_strdup(topic);
    14141572        rld->chats = g_slist_prepend(rld->chats, ci);
     
    16321790}
    16331791
     1792/* borrowing this semi-private function
     1793 * TODO: figure out a better interface later (famous last words) */
     1794gboolean plugin_info_add(struct plugin_info *info);
     1795
    16341796void purple_initmodule()
    16351797{
     
    16381800        GString *help;
    16391801        char *dir;
     1802        gboolean debug_enabled = !!getenv("BITLBEE_DEBUG");
    16401803
    16411804        if (purple_get_core() != NULL) {
     
    16451808        }
    16461809
    1647         g_assert((int) B_EV_IO_READ == (int) PURPLE_INPUT_READ);
    1648         g_assert((int) B_EV_IO_WRITE == (int) PURPLE_INPUT_WRITE);
     1810        g_return_if_fail((int) B_EV_IO_READ == (int) PURPLE_INPUT_READ);
     1811        g_return_if_fail((int) B_EV_IO_WRITE == (int) PURPLE_INPUT_WRITE);
    16491812
    16501813        dir = g_strdup_printf("%s/purple", global.conf->configdir);
     
    16561819        g_free(dir);
    16571820
    1658         purple_debug_set_enabled(FALSE);
     1821        purple_debug_set_enabled(debug_enabled);
    16591822        purple_core_set_ui_ops(&bee_core_uiops);
    16601823        purple_eventloop_set_ui_ops(&glib_eventloops);
     
    16641827                abort();
    16651828        }
     1829        purple_debug_set_enabled(FALSE);
    16661830
    16671831        if (proxytype != PROXY_NONE) {
     
    17221886        funcs.chat_join = purple_chat_join;
    17231887        funcs.chat_list = purple_chat_list;
     1888        funcs.chat_add_settings = purple_chat_add_settings;
     1889        funcs.chat_free_settings = purple_chat_free_settings;
    17241890        funcs.transfer_request = purple_transfer_request;
    17251891
     
    17321898                PurplePluginProtocolInfo *pi = prot->info->extra_info;
    17331899                struct prpl *ret;
     1900                struct plugin_info *info;
    17341901
    17351902                /* If we already have this one (as a native module), don't
     
    17661933                        register_protocol(ret);
    17671934                }
     1935
     1936                info = g_new0(struct plugin_info, 1);
     1937                info->abiver = BITLBEE_ABI_VERSION_CODE;
     1938                info->name = ret->name;
     1939                info->version = prot->info->version;
     1940                info->description = prot->info->description;
     1941                info->author = prot->info->author;
     1942                info->url = prot->info->homepage;
     1943
     1944                plugin_info_add(info);
    17681945        }
    17691946
  • protocols/twitter/Makefile

    r3f44e43 r7a9d968  
    3838$(objects): %.o: $(_SRCDIR_)%.c
    3939        @echo '*' Compiling $<
    40         @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
     40        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
    4141
    4242twitter_mod.o: $(objects)
    4343        @echo '*' Linking twitter_mod.o
    44         @$(LD) $(LFLAGS) $(objects) -o twitter_mod.o
     44        $(VERBOSE) $(LD) $(LFLAGS) $(objects) -o twitter_mod.o
    4545       
    4646-include .depend/*.d
  • protocols/twitter/twitter.c

    r3f44e43 r7a9d968  
    576576        s->flags |= SET_HIDDEN | SET_NOSAVE;
    577577
     578        s = set_add(&acc->set, "in_korea", "false", set_eval_bool, acc);
     579        s->flags |= SET_HIDDEN;
     580
    578581        if (strcmp(acc->prpl->name, "twitter") == 0) {
    579582                s = set_add(&acc->set, "stream", "true", set_eval_bool, acc);
  • protocols/twitter/twitter_lib.c

    r3f44e43 r7a9d968  
    239239        if ((ret = json_parse_string(req->reply_body)) == NULL) {
    240240                imcb_error(ic, "Could not retrieve %s: %s",
    241                            path, "XML parse error");
     241                           path, "JSON parse error");
    242242        }
    243243        return ret;
     
    310310
    311311                txl->list = g_slist_prepend(txl->list,
    312                                             g_strdup_printf("%lld", id));
     312                                            g_strdup_printf("%" PRIu64, id);
    313313        }
    314314
     
    443443        txl = g_new0(struct twitter_xml_list, 1);
    444444        txl->list = td->noretweets_ids;
    445        
     445
    446446        // Process the retweet ids
    447447        txl->type = TXL_ID;
     
    452452                        jint id = json_array_get_integer(arr, i);
    453453                        txl->list = g_slist_prepend(txl->list,
    454                                                     g_strdup_printf("%lld", id));
     454                                                    g_strdup_printf("%" PRId64, id));
    455455                }
    456456        }
     
    713713                return;
    714714        if ((quoted = json_object_get_object(node, "quoted_status"))) {
    715                 /* New "retweets with comments" feature. Note that this info
    716                  * seems to be included in the streaming API only! Grab the
     715                /* New "retweets with comments" feature. Grab the
    717716                 * full message and try to insert it when we run into the
    718717                 * Tweet entity. */
     
    755754                        char *pos, *new;
    756755
    757                         if (!kort || !disp || !(pos = strstr(*text, kort))) {
     756                        /* Skip if a required field is missing, if the t.co URL is not in fact
     757                           in the Tweet at all, or if the full-ish one *is* in it already
     758                           (dupes appear, especially in streaming API). */
     759                        if (!kort || !disp || !(pos = strstr(*text, kort)) || strstr(*text, disp)) {
    758760                                continue;
    759761                        }
     
    980982                return;
    981983        }
    982        
     984
    983985        /* Check this is not a tweet that should be muted */
    984986        uid_str = g_strdup_printf("%" G_GUINT64_FORMAT, status->user->uid);
     
    16911693        };
    16921694
     1695        if (set_getbool(&ic->acc->set, "in_korea") && !in_reply_to) {
     1696                g_free(args[3]);
     1697                args[2] = "place_id";
     1698                args[3] = g_strdup("c999e6a453e9ef72");
     1699                in_reply_to = 1;
     1700        }
     1701
    16931702        twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1,
    16941703                     args, in_reply_to ? 4 : 2);
  • root_commands.c

    r3f44e43 r7a9d968  
    10721072                format = "%s\t%s\t%s";
    10731073        } else {
    1074                 format = "%-16.16s  %-40.40s  %s";
     1074                format = "%-24.24s  %-40.40s  %s";
    10751075        }
    10761076
     
    11721172}
    11731173
     1174static void cmd_plugins_info(irc_t *irc, char **cmd)
     1175{
     1176        GList *l;
     1177        struct plugin_info *info;
     1178
     1179        MIN_ARGS(2);
     1180
     1181        for (l = get_plugins(); l; l = l->next) {
     1182                info = l->data;
     1183                if (g_strcasecmp(cmd[2], info->name) == 0) {
     1184                        break;
     1185                }
     1186        }
     1187
     1188        if (!l) {
     1189                return;
     1190        }
     1191
     1192        irc_rootmsg(irc, "%s:", info->name);
     1193        irc_rootmsg(irc, "  Version: %s", info->version);
     1194
     1195        if (info->description) {
     1196                irc_rootmsg(irc, "  Description: %s", info->description);
     1197        }
     1198
     1199        if (info->author) {
     1200                irc_rootmsg(irc, "  Author: %s", info->author);
     1201        }
     1202
     1203        if (info->url) {
     1204                irc_rootmsg(irc, "  URL: %s", info->url);
     1205        }
     1206}
     1207
    11741208static void cmd_plugins(irc_t *irc, char **cmd)
    11751209{
    11761210        GList *prpls;
    11771211        GString *gstr;
     1212
     1213        if (cmd[1] && g_strcasecmp(cmd[1], "info") == 0) {
     1214                cmd_plugins_info(irc, cmd);
     1215                return;
     1216        }
    11781217
    11791218#ifdef WITH_PLUGINS
    11801219        GList *l;
    11811220        struct plugin_info *info;
     1221        char *format;
     1222
     1223        if (strchr(irc->umode, 'b') != NULL) {
     1224                format = "%s\t%s";
     1225        } else {
     1226                format = "%-30s  %s";
     1227        }
     1228
     1229        irc_rootmsg(irc, format, "Plugin", "Version");
    11821230
    11831231        for (l = get_plugins(); l; l = l->next) {
     1232                char *c;
    11841233                info = l->data;
    1185                 irc_rootmsg(irc, "%s:", info->name);
    1186                 irc_rootmsg(irc, "  Version: %s", info->version);
    1187 
    1188                 if (info->description) {
    1189                         irc_rootmsg(irc, "  Description: %s", info->description);
    1190                 }
    1191 
    1192                 if (info->author) {
    1193                         irc_rootmsg(irc, "  Author: %s", info->author);
    1194                 }
    1195 
    1196                 if (info->url) {
    1197                         irc_rootmsg(irc, "  URL: %s", info->url);
    1198                 }
    1199 
    1200                 irc_rootmsg(irc, "");
     1234
     1235                /* some purple plugins like to include several versions separated by newlines... */
     1236                if ((c = strchr(info->version, '\n'))) {
     1237                        char *version = g_strndup(info->version, c - info->version);
     1238                        irc_rootmsg(irc, format, info->name, version);
     1239                        g_free(version);
     1240                } else {
     1241                        irc_rootmsg(irc, format, info->name, info->version);
     1242                }
    12011243        }
    12021244#endif
     1245
     1246        irc_rootmsg(irc, "");
    12031247
    12041248        gstr = g_string_new(NULL);
     
    13461390        } else if (g_strcasecmp(cmd[1], "set") == 0 ||
    13471391                   g_strcasecmp(cmd[1], "del") == 0) {
    1348                 irc_rootmsg(irc,
    1349                             "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command.");
    1350                 cmd_channel(irc, cmd);
     1392                irc_rootmsg(irc, "Unknown command: chat %s. Did you mean \002channel %s\002?", cmd[1], cmd[1]);
    13511393        } else {
    13521394                irc_rootmsg(irc,
     
    14061448                topic = ci->topic ? ci->topic : "";
    14071449
    1408                 padded = str_pad_and_truncate(ci->title, title_len, "[...]");
     1450                padded = str_pad_and_truncate(ci->title ? ci->title : "", title_len, "[...]");
    14091451                irc_rootmsg(irc, iformat, ++i, padded, topic);
    14101452                g_free(padded);
  • set.c

    r3f44e43 r7a9d968  
    165165        /* If there's a default setting and it's equal to what we're trying to
    166166           set, stick with s->value = NULL. Otherwise, remember the setting. */
    167         if (!s->def || (strcmp(nv, s->def) != 0)) {
     167        if (!s->def || (g_strcmp0(nv, s->def) != 0)) {
    168168                s->value = g_strdup(nv);
    169169        }
  • storage.c

    r3f44e43 r7a9d968  
    7474
    7575        storage = storage_init_single(primary);
    76         if (storage == NULL && storage->save == NULL) {
     76        if (storage == NULL || storage->save == NULL) {
    7777                return NULL;
    7878        }
  • storage_xml.c

    r3f44e43 r7a9d968  
    290290        }
    291291
     292        handle_settings(node, &xd->irc->b->set);
     293
    292294        if (xt_handle(xp, NULL, 1) == XT_HANDLED) {
    293295                ret = STORAGE_OK;
    294296        }
    295 
    296         handle_settings(node, &xd->irc->b->set);
    297297
    298298error:
  • tests/Makefile

    r3f44e43 r7a9d968  
    2121check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o
    2222        @echo '*' Linking $@
    23         @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
     23        $(VERBOSE) $(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
    2424
    2525%.o: $(_SRCDIR_)%.c
    2626        @echo '*' Compiling $<
    27         @$(CC) -c $(CFLAGS) $< -o $@
     27        $(VERBOSE) $(CC) -c $(CFLAGS) $< -o $@
  • tests/check.c

    r3f44e43 r7a9d968  
    1414        int sock[2];
    1515
    16         if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, sock) < 0) {
     16        if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) < 0) {
    1717                perror("socketpair");
    1818                return FALSE;
  • tests/check_jabber_util.c

    r3f44e43 r7a9d968  
    3737        fail_unless(jabber_buddy_by_jid(ic, "wilmer@GAAST.NET/BitlBee", GET_BUDDY_CREAT) == budw1);
    3838
    39         fail_unless(jabber_buddy_by_jid(ic, "wilmer@gaast.net", GET_BUDDY_EXACT));
     39        fail_unless(jabber_buddy_by_jid(ic, "wilmer@gaast.net", GET_BUDDY_EXACT) != NULL);
    4040        fail_unless(jabber_buddy_by_jid(ic, "WILMER@gaast.net", 0) == budw3);
    4141
     
    8383        fail_if(jabber_buddy_remove(ic, "nekkid@lamejab.net/Illegal"));
    8484        fail_unless(jabber_buddy_remove(ic, "nekkid@lamejab.net"));
    85         fail_if(jabber_buddy_by_jid(ic, "nekkid@lamejab.net", 0));
     85        fail_if(jabber_buddy_by_jid(ic, "nekkid@lamejab.net", 0) != NULL);
    8686
    8787        /* Fixing a bug in this branch that caused information to get lost when
  • unix.c

    r3f44e43 r7a9d968  
    147147                struct passwd *pw = NULL;
    148148                pw = getpwnam(global.conf->user);
    149                 if (pw) {
    150                         initgroups(global.conf->user, pw->pw_gid);
    151                         setgid(pw->pw_gid);
    152                         setuid(pw->pw_uid);
    153                 } else {
    154                         log_message(LOGLVL_WARNING, "Failed to look up user %s.", global.conf->user);
     149                if (!pw) {
     150                        log_message(LOGLVL_ERROR, "Failed to look up user %s.", global.conf->user);
     151
     152                } else if (initgroups(global.conf->user, pw->pw_gid) != 0) {
     153                        log_message(LOGLVL_ERROR, "initgroups: %s.", strerror(errno));
     154
     155                } else if (setgid(pw->pw_gid) != 0) {
     156                        log_message(LOGLVL_ERROR, "setgid(%d): %s.", pw->pw_gid, strerror(errno));
     157
     158                } else if (setuid(pw->pw_uid) != 0) {
     159                        log_message(LOGLVL_ERROR, "setuid(%d): %s.", pw->pw_uid, strerror(errno));
    155160                }
    156161        }
     
    281286static void sighandler_shutdown(int signal)
    282287{
     288        int unused G_GNUC_UNUSED;
    283289        /* Write a single null byte to the pipe, just to send a message to the main loop.
    284290         * This gets handled by bitlbee_shutdown (the b_input_add callback for this pipe) */
    285         write(shutdown_pipe.fd[1], "", 1);
     291        unused = write(shutdown_pipe.fd[1], "", 1);
    286292}
    287293
     
    292298{
    293299        GSList *l;
     300        int unused G_GNUC_UNUSED;
    294301        const char *message = "ERROR :BitlBee crashed! (SIGSEGV received)\r\n";
    295302        int len = strlen(message);
     
    298305                irc_t *irc = l->data;
    299306                sock_make_blocking(irc->fd);
    300                 write(irc->fd, message, len);
     307                unused = write(irc->fd, message, len);
    301308        }
    302309
Note: See TracChangeset for help on using the changeset viewer.