Changeset 81ee561


Ignore:
Timestamp:
2010-03-20T18:03:18Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
85693e6
Parents:
3330468 (diff), 0baed0d (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:

Merging head. Most changes are not so relevant because they're to IM
modules.

Files:
1 added
28 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    r3330468 r81ee561  
    109109                chdir( "/" );
    110110               
    111                 i = close( 0 ) == 0;
    112                 i += close( 1 ) == 0;
    113                 i += close( 2 ) == 0;
    114                 /* To avoid that something important ends up on one of those
    115                    fd's, open them for something bogus. Otherwise RESTART
    116                    may cause troubles. */
    117                 while( i > 0 )
    118                 {
    119                         open( "/dev/null", O_WRONLY );
    120                         i --;
    121                 }
     111                if( getenv( "_BITLBEE_RESTART_STATE" ) == NULL )
     112                        for( i = 0; i < 3; i ++ )
     113                                if( close( i ) == 0 )
     114                                {
     115                                        /* Keep something bogus on those fd's just in case. */
     116                                        open( "/dev/null", O_WRONLY );
     117                                }
    122118        }
    123119#endif
  • bitlbee.h

    r3330468 r81ee561  
    163163
    164164char *set_eval_root_nick( set_t *set, char *new_nick );
     165char *set_eval_control_channel( set_t *set, char *new_name );
    165166
    166167extern global_t global;
  • configure

    r3330468 r81ee561  
    2020ipcsocket='/var/run/bitlbee.sock'
    2121pcdir='$prefix/lib/pkgconfig'
    22 systemlibdirs="/lib /usr/lib /usr/local/lib"
     22systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64"
    2323
    2424msn=1
     
    159159
    160160echo CFLAGS=$CFLAGS >> Makefile.settings
    161 echo CFLAGS+=-I`pwd` -iquote`pwd`/lib -iquote`pwd`/protocols -I. >> Makefile.settings
     161echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
    162162
    163163echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
     
    298298detect_resolv_dynamic()
    299299{
    300         echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -lresolv >/dev/null 2>/dev/null
     300        TMPFILE=$(mktemp)
     301        ret=1
     302        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null
    301303        if [ "$?" = "0" ]; then
    302304                echo 'EFLAGS+=-lresolv' >> Makefile.settings
    303                 return 0
    304         fi
    305 
    306         return 1
     305                ret=0
     306        fi
     307
     308        rm -f $TMPFILE
     309        return $ret
    307310}
    308311
    309312detect_resolv_static()
    310313{
     314        TMPFILE=$(mktemp)
     315        ret=1
    311316        for i in $systemlibdirs; do
    312317                if [ -f $i/libresolv.a ]; then
    313                         echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
     318                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
    314319                        if [ "$?" = "0" ]; then
    315320                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
    316                                 return 0
     321                                ret=0
    317322                        fi
    318323                fi
    319324        done
    320325
    321         return 1
     326        rm -f $TMPFILE
     327        return $ret
    322328}
    323329
  • debian/bitlbee.init

    r3330468 r81ee561  
    4141        chown bitlbee: /var/run/bitlbee.pid
    4242       
    43         # Clean up after the bug between 1.2-5 and 1.2.1-2 where BitlBee ran
    44         # as root. (#494656 and #495877) Fixing this in the postinst script
    45         # is not enough since the user will restart his BitlBee after up-
    46         # grading the package, and the BitlBee running as root will then
    47         # save its settings, re-setting ownership of the file to root.
    48         # TODO: Remove this after a few revisions.
    49         find /var/lib/bitlbee -uid 0 -name '*.xml' -exec chown bitlbee: {} \;
    50 
    51         start-stop-daemon --start --quiet \
     43        start-stop-daemon --start --quiet --pidfile $PIDFILE \
    5244                --exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS
    5345}
  • debian/changelog

    r3330468 r81ee561  
     1bitlbee (1.2.5-1) unstable; urgency=low
     2
     3  * New upstream version.
     4  * Fixed issues with server-side MSN nickname corruption. (Closes: #538756)
     5  * Debconf translation fixes/additions. (Closes: #541754, #563504)
     6
     7 -- Wilmer van der Gaast <wilmer@gaast.net>  Wed, 17 Mar 2010 14:59:27 +0000
     8
     9bitlbee (1.2.4-2) unstable; urgency=low
     10
     11  * Merging in some changes from bzr-head:
     12  * Use libresolv.so where possible. (Closes: #551775)
     13  * Some include file changes that make the bitlbee-dev package useful again.
     14
     15 -- Wilmer van der Gaast <wilmer@gaast.net>  Thu, 19 Nov 2009 23:02:43 +0000
     16
     17bitlbee (1.2.4-1) unstable; urgency=low
     18
     19  * New upstream version.
     20  * Fixed issues with Yahoo! (Closes: #536178)
     21
     22 -- Wilmer van der Gaast <wilmer@gaast.net>  Sat, 17 Oct 2009 18:12:45 +0100
     23
     24bitlbee (1.2.3-2) unstable; urgency=low
     25
     26  * Fixed bitblee typo in prerm (introduced by NMU 1.2.1-1.1).
     27    (Closes: #531287)
     28  * Fixed bitlbee.deb dep in bitlbee-dev to deal with binary NMUs.
     29    (Closes: #531219)
     30  * Fixed free port detection code in debian/config which was a bit limited
     31    and also buggy.
     32  * Removing code that edits bitlbee.conf from postinst (and chown code in
     33    the init script), it's not really necessary anymore; bitlbee may only
     34    still run as root if the admin doesn't read conffile diffs.
     35    (Closes: #514572)
     36  * No longer overwriting port number info in /etc/default/bitlbee with
     37    what's in debconf. (Closes: #514148)
     38  * Added notes about the above two changes to bitlbee.conf.
     39
     40 -- Wilmer van der Gaast <wilmer@gaast.net>  Sun, 07 Jun 2009 21:17:39 +0100
     41
     42bitlbee (1.2.3-1) unstable; urgency=critical
     43
     44  * New upstream version.
     45  * Fixes another account hijacking issue. (Closes: #498159)
     46  * Restored --pidfile argument to start-stop-daemon, otherwise the init
     47    script fails to restart BitlBee when users are connected.
     48
     49 -- Wilmer van der Gaast <wilmer@gaast.net>  Sun, 07 Sep 2008 18:53:04 +0100
     50
    151bitlbee (1.2.2-1) unstable; urgency=critical
    252
  • debian/config

    r3330468 r81ee561  
    22
    33. /usr/share/debconf/confmodule
     4[ -f /etc/default/bitlbee ] && . /etc/default/bitlbee
    45
    56db_title BitlBee
    67
    7 db_get bitlbee/serveport
    8 if [ "$RET" = "stillhavetoask" ]; then
    9         if netstat -ltn | grep ':6667' 2> /dev/null > /dev/null; then
    10                 port=6668;
    11         else
    12                 port=6667;
     8if [ -n "$BITLBEE_PORT" ]; then
     9        db_set bitlbee/serveport "$BITLBEE_PORT"
     10else
     11        db_get bitlbee/serveport
     12        if [ "$RET" = "stillhavetoask" ]; then
     13                listens=$(netstat -ltn | awk '{print $4}')
     14                for port in 6667 6666 6668 6669; do
     15                        if [ $(expr "$listens " : ".*:$port\s") = "0" ]; then
     16                                break
     17                        fi
     18                done
     19                db_set bitlbee/serveport $port;
    1320        fi
    14         db_set bitlbee/serveport $port;
    1521fi
    1622
  • debian/control

    r3330468 r81ee561  
    1919Package: bitlbee-dev
    2020Architecture: all
    21 Depends: bitlbee (= ${binary:Version})
     21Depends: bitlbee (>= ${source:Version}), bitlbee (<< ${source:Version}.1~)
    2222Description: An IRC to other chat networks gateway
    2323 This program can be used as an IRC server which forwards everything you
  • debian/patches/bitlbee.conf.diff

    r3330468 r81ee561  
    1 === modified file 'bitlbee.conf'
    2 --- debian/bitlbee/etc/bitlbee/bitlbee.conf     2008-08-26 22:33:54 +0000
    3 +++ debian/bitlbee/etc/bitlbee/bitlbee.conf     2008-08-27 23:18:13 +0000
    4 @@ -23,7 +23,7 @@
     1--- debian/bitlbee/etc/bitlbee/bitlbee.conf     2009-06-01 00:20:24.000000000 +0100
     2+++ debian/bitlbee/etc/bitlbee/bitlbee.conf     2009-06-07 21:16:19.000000000 +0100
     3@@ -23,13 +23,18 @@
    54 ## If BitlBee is started by root as a daemon, it can drop root privileges,
    65 ## and change to the specified user.
    76 ##
    87-# User = bitlbee
     8+## DEBIAN NOTE: Without this, BitlBee will run as root!
     9+##
    910+User = bitlbee
    1011 
    1112 ## DaemonPort/DaemonInterface:
    1213 ##
    13 
     14 ## For daemon mode, you can specify on what interface and port the daemon
     15 ## should be listening for connections.
     16 ##
     17+## DEBIAN NOTE: The init script passes the -p flag to use the port number
     18+## set using debconf, this overrides the DaemonPort setting here.
     19+##
     20 # DaemonInterface = 0.0.0.0
     21 # DaemonPort = 6667
     22 
  • debian/po/POTFILES.in

    r3330468 r81ee561  
    1 [type: gettext/rfc822deb] bitlbee.templates.master
     1[type: gettext/rfc822deb] templates
  • debian/postinst

    r3330468 r81ee561  
    3333## /etc/default/bitlbee: Auto-generated/updated script.
    3434##
    35 ## Don't edit this line, use dpkg-reconfigure bitlbee
     35## If running in (fork)daemon mode, listen on this TCP port.
    3636BITLBEE_PORT="$PORT"
    3737
     
    6161        else
    6262                mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt
    63         fi
    64 fi
    65 
    66 if ! grep -qi '^User *= *' /etc/bitlbee/bitlbee.conf; then
    67         echo 'Updating configuration file, enabling User-setting...'
    68         if ! sed -i -e 's/# *User *= *.*/User = bitlbee/i' /etc/bitlbee/bitlbee.conf; then
    69                 echo 'Failed! BitlBee may run as root now, please check your configs.'
    7063        fi
    7164fi
  • debian/prerm

    r3330468 r81ee561  
    1111else
    1212        if which invoke-rc.d >/dev/null 2>&1; then
    13                 invoke-rc.d bitblee stop || exit 0
     13                invoke-rc.d bitlbee stop || exit 0
    1414        else
    1515                /etc/init.d/bitlbee stop || exit 0
  • doc/CHANGES

    r3330468 r81ee561  
    1010  relevant functions available in the dynamic version.
    1111- Improved away state code and added the ability to set (non-away) status
    12   messages using "set status" (also possible per account).
     12  messages using "set status" (also possible per account) and see them in
     13  blist and /whois output.
    1314- Added a post-1.2 equivalent of encode/decode to quickly encrypt/decrypt
    1415  passwords in a way that BitlBee can read them.
     
    1819  detect cases where auto reconnect should be avoided (i.e. concurrent
    1920  logins).
     21- Changed the default resource_select setting which should reduce message
     22  routing issues on Jabber (i.e. messages going someone's phone instead of
     23  the main client).
     24
     25Fixed 17 Mar 2010
    2026
    2127Version 1.2.4:
  • doc/user-guide/commands.xml

    r3330468 r81ee561  
    511511        </bitlbee-setting>
    512512
     513        <bitlbee-setting name="control_channel" type="string" scope="global">
     514                <default>&amp;bitlbee</default>
     515
     516                <description>
     517                        <para>
     518                                Normally the control channel where you can see all your contacts is called "&amp;bitlbee". If you don't like this name, you can rename it to anything else using the <emphasis>rename</emphasis> command, or by changing this setting.
     519                        </para>
     520                </description>
     521        </bitlbee-setting>
     522
    513523        <bitlbee-setting name="debug" type="boolean" scope="global">
    514524                <default>false</default>
     
    716726
    717727        <bitlbee-setting name="resource_select" type="string" scope="account">
    718                 <default>priority</default>
     728                <default>activity</default>
    719729                <possible-values>priority, activity</possible-values>
    720730
  • irc.c

    r3330468 r81ee561  
    171171        s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc );
    172172        s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc );
     173        s = set_add( &irc->set, "control_channel", irc->channel, set_eval_control_channel, irc );
    173174        s = set_add( &irc->set, "debug", "false", set_eval_bool, irc );
    174175        s = set_add( &irc->set, "default_target", "root", NULL, irc );
  • irc_commands.c

    r3330468 r81ee561  
    497497                else if( u->away )
    498498                        irc_reply( irc, 301, "%s :%s", u->nick, u->away );
     499                if( u->status_msg )
     500                        irc_reply( irc, 333, "%s :Status: %s", u->nick, u->status_msg );
    499501               
    500502                irc_reply( irc, 318, "%s :End of /WHOIS list", nick );
  • protocols/jabber/io.c

    r3330468 r81ee561  
    380380                jd->flags |= JFLAG_WANT_SESSION;
    381381       
    382         /* This flag is already set if we authenticated via SASL, so now
    383            we can resume the session in the new stream, if we don't have
    384            to bind/initialize the session. */
    385         if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
    386         {
    387                 if( !jabber_get_roster( ic ) )
    388                         return XT_ABORT;
    389         }
    390         else if( jd->flags & JFLAG_AUTHENTICATED )
    391         {
     382        if( jd->flags & JFLAG_AUTHENTICATED )
    392383                return jabber_pkt_bind_sess( ic, NULL, NULL );
    393         }
    394384       
    395385        return XT_HANDLED;
  • protocols/jabber/iq.c

    r3330468 r81ee561  
    307307                    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
    308308                        imcb_log( ic, "Server changed session resource string to `%s'", s + 1 );
    309                
    310                 jd->flags &= ~JFLAG_WANT_BIND;
    311         }
    312         else if( node && ( c = xt_find_node( node->children, "session" ) ) )
    313         {
    314                 jd->flags &= ~JFLAG_WANT_SESSION;
    315309        }
    316310       
     
    319313                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
    320314                xt_add_attr( reply, "xmlns", XMLNS_BIND );
     315                jd->flags &= ~JFLAG_WANT_BIND;
    321316        }
    322317        else if( jd->flags & JFLAG_WANT_SESSION )
     
    324319                reply = xt_new_node( "session", NULL, NULL );
    325320                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
     321                jd->flags &= ~JFLAG_WANT_SESSION;
    326322        }
    327323       
  • protocols/jabber/jabber.c

    r3330468 r81ee561  
    5858        char str[16];
    5959       
     60        s = set_add( &acc->set, "activity_timeout", "600", set_eval_int, acc );
     61       
    6062        g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] );
    6163        s = set_add( &acc->set, "port", str, set_eval_int, acc );
     
    6769        s->flags |= ACC_SET_OFFLINE_ONLY;
    6870       
    69         s = set_add( &acc->set, "resource_select", "priority", NULL, acc );
     71        s = set_add( &acc->set, "resource_select", "activity", NULL, acc );
    7072       
    7173        s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
     
    307309                bud = jabber_buddy_by_ext_jid( ic, who, 0 );
    308310        else
    309                 bud = jabber_buddy_by_jid( ic, who, 0 );
     311                bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_BARE_OK );
    310312       
    311313        node = xt_new_node( "body", message, NULL );
     
    352354static void jabber_get_info( struct im_connection *ic, char *who )
    353355{
    354         struct jabber_data *jd = ic->proto_data;
    355356        struct jabber_buddy *bud;
    356357       
    357         if( strchr( who, '/' ) )
    358                 bud = jabber_buddy_by_jid( ic, who, 0 );
    359         else
    360         {
    361                 char *s = jabber_normalize( who );
    362                 bud = g_hash_table_lookup( jd->buddies, s );
    363                 g_free( s );
    364         }
     358        bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_FIRST );
    365359       
    366360        while( bud )
  • protocols/jabber/jabber.h

    r3330468 r81ee561  
    108108};
    109109
     110/* Somewhat messy data structure: We have a hash table with the bare JID as
     111   the key and the head of a struct jabber_buddy list as the value. The head
     112   is always a bare JID. If the JID has other resources (often the case,
     113   except for some transports that don't support multiple resources), those
     114   follow. In that case, the bare JID at the beginning doesn't actually
     115   refer to a real session and should only be used for operations that
     116   support incomplete JIDs. */
    110117struct jabber_buddy
    111118{
     
    121128        char *away_message;
    122129       
    123         time_t last_act;
     130        time_t last_msg;
    124131        jabber_buddy_flags_t flags;
    125132       
     
    209216        GET_BUDDY_EXACT = 2,    /* Get an exact match (only makes sense with bare JIDs). */
    210217        GET_BUDDY_FIRST = 4,    /* No selection, simply get the first resource for this JID. */
     218        GET_BUDDY_BARE = 8,     /* Get the bare version of the JID (possibly inexistent). */
     219        GET_BUDDY_BARE_OK = 16, /* Allow returning a bare JID if that seems better. */
    211220} get_buddy_flags_t;
    212221
  • protocols/jabber/jabber_util.c

    r3330468 r81ee561  
    44*  Jabber module - Misc. stuff                                              *
    55*                                                                           *
    6 *  Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net>                   *
     6*  Copyright 2006-2010 Wilmer van der Gaast <wilmer@gaast.net>             
    77*                                                                           *
    88*  This program is free software; you can redistribute it and/or modify     *
     
    345345        if( ( bud = g_hash_table_lookup( jd->buddies, full_jid ) ) )
    346346        {
     347                /* The first entry is always a bare JID. If there are more, we
     348                   should ignore the first one here. */
     349                if( bud->next )
     350                        bud = bud->next;
     351               
    347352                /* If this is a transport buddy or whatever, it can't have more
    348353                   than one instance, so this is always wrong: */
     
    379384        else
    380385        {
    381                 /* Keep in mind that full_jid currently isn't really
    382                    a full JID... */
    383                 new->bare_jid = g_strdup( full_jid );
     386                new->full_jid = new->bare_jid = g_strdup( full_jid );
    384387                g_hash_table_insert( jd->buddies, new->bare_jid, new );
     388               
     389                if( s )
     390                {
     391                        new->next = g_new0( struct jabber_buddy, 1 );
     392                        new->next->bare_jid = new->bare_jid;
     393                        new = new->next;
     394                }
    385395        }
    386396       
     
    408418{
    409419        struct jabber_data *jd = ic->proto_data;
    410         struct jabber_buddy *bud;
     420        struct jabber_buddy *bud, *head;
    411421        char *s, *jid;
    412422       
     
    420430                if( ( bud = g_hash_table_lookup( jd->buddies, jid ) ) )
    421431                {
     432                        bare_exists = 1;
     433                       
     434                        if( bud->next )
     435                                bud = bud->next;
     436                       
    422437                        /* Just return the first one for this bare JID. */
    423438                        if( flags & GET_BUDDY_FIRST )
     
    441456                                        break;
    442457                }
    443                 else
    444                 {
    445                         /* This variable tells the if down here that the bare
    446                            JID already exists and we should feel free to add
    447                            more resources, if the caller asked for that. */
    448                         bare_exists = 1;
    449                 }
    450458               
    451459                if( bud == NULL && ( flags & GET_BUDDY_CREAT ) &&
    452                     ( !bare_exists || imcb_find_buddy( ic, jid ) ) )
     460                    ( bare_exists || imcb_find_buddy( ic, jid ) ) )
    453461                {
    454462                        *s = '/';
     
    464472                char *set;
    465473               
    466                 bud = g_hash_table_lookup( jd->buddies, jid );
     474                head = g_hash_table_lookup( jd->buddies, jid );
     475                bud = ( head && head->next ) ? head->next : head;
    467476               
    468477                g_free( jid );
     
    481490                        /* Looks like the caller doesn't care about details. */
    482491                        return bud;
     492                else if( flags & GET_BUDDY_BARE )
     493                        return head;
    483494               
    484495                best_prio = best_time = bud;
     
    487498                        if( bud->priority > best_prio->priority )
    488499                                best_prio = bud;
    489                         if( bud->last_act > best_time->last_act )
     500                        if( bud->last_msg > best_time->last_msg )
    490501                                best_time = bud;
    491502                }
     
    493504                if( ( set = set_getstr( &ic->acc->set, "resource_select" ) ) == NULL )
    494505                        return NULL;
    495                 else if( strcmp( set, "activity" ) == 0 )
     506                else if( strcmp( set, "priority" ) == 0 )
     507                        return best_prio;
     508                else if( flags & GET_BUDDY_BARE_OK ) /* && strcmp( set, "activity" ) == 0 */
     509                {
     510                        if( best_time->last_msg + set_getint( &ic->acc->set, "activity_timeout" ) >= time( NULL ) )
     511                                return best_time;
     512                        else
     513                                return head;
     514                }
     515                else
    496516                        return best_time;
    497                 else /* if( strcmp( set, "priority" ) == 0 ) */
    498                         return best_prio;
    499517        }
    500518}
     
    538556{
    539557        struct jabber_data *jd = ic->proto_data;
    540         struct jabber_buddy *bud, *prev, *bi;
     558        struct jabber_buddy *bud, *prev = NULL, *bi;
    541559        char *s, *full_jid;
    542560       
     
    548566        if( ( bud = g_hash_table_lookup( jd->buddies, full_jid ) ) )
    549567        {
     568                if( bud->next )
     569                        bud = (prev=bud)->next;
     570               
    550571                /* If there's only one item in the list (and if the resource
    551572                   matches), removing it is simple. (And the hash reference
     
    555576                      ( bud->resource && s && strcmp( bud->resource, s + 1 ) == 0 ) ) )
    556577                {
    557                         g_hash_table_remove( jd->buddies, bud->bare_jid );
    558                         g_free( bud->bare_jid );
    559                         g_free( bud->ext_jid );
    560                         g_free( bud->full_jid );
    561                         g_free( bud->away_message );
    562                         g_free( bud );
    563                        
    564                         g_free( full_jid );
    565                        
    566                         return 1;
     578                        return jabber_buddy_remove_bare( ic, full_jid );
    567579                }
    568580                else if( s == NULL || bud->resource == NULL )
     
    575587                else
    576588                {
    577                         for( bi = bud, prev = NULL; bi; bi = (prev=bi)->next )
     589                        for( bi = bud; bi; bi = (prev=bi)->next )
    578590                                if( strcmp( bi->resource, s + 1 ) == 0 )
    579591                                        break;
     
    586598                                        prev->next = bi->next;
    587599                                else
    588                                         /* The hash table should point at the second
    589                                            item, because we're removing the first. */
     600                                        /* Don't think this should ever happen anymore. */
    590601                                        g_hash_table_replace( jd->buddies, bi->bare_jid, bi->next );
    591602                               
  • protocols/jabber/message.c

    r3330468 r81ee561  
    7171                        if( bud )
    7272                        {
    73                                 bud->last_act = time( NULL );
     73                                bud->last_msg = time( NULL );
    7474                                from = bud->ext_jid ? : bud->bare_jid;
    7575                        }
  • protocols/jabber/presence.c

    r3330468 r81ee561  
    6868                {
    6969                        bud->away_state = NULL;
    70                         /* Let's only set last_act if there's *no* away state,
    71                            since it could be some auto-away thingy. */
    72                         bud->last_act = time( NULL );
    7370                }
    7471               
  • protocols/nogaim.c

    r3330468 r81ee561  
    655655        oo = u->online;
    656656       
    657         if( u->away )
    658         {
    659                 g_free( u->away );
    660                 u->away = NULL;
    661         }
     657        g_free( u->away );
     658        g_free( u->status_msg );
     659        u->away = u->status_msg = NULL;
    662660       
    663661        if( ( flags & OPT_LOGGED_IN ) && !u->online )
     
    697695                }
    698696        }
    699         /* else waste_any_state_information_for_now(); */
     697        else
     698        {
     699                u->status_msg = g_strdup( message );
     700        }
    700701       
    701702        /* LISPy... */
  • protocols/yahoo/libyahoo2.c

    r3330468 r81ee561  
    13441344                case 301:       /* End buddy */
    13451345                        if (!strcmp(pair->value, "315") && u) {
    1346                                 users = y_list_prepend(users, u);
     1346                                /* Sometimes user info comes in an odd format with no
     1347                                   "begin buddy" but *with* an "end buddy". Don't add
     1348                                   it twice. */
     1349                                if (!y_list_find(users, u))
     1350                                        users = y_list_prepend(users, u);
    13471351                                u = yd->half_user = NULL;
    13481352                        }
  • protocols/yahoo/yahoo.c

    r3330468 r81ee561  
    227227                        yd->current_status = YAHOO_STATUS_CUSTOM;
    228228        }
    229         else if( state )
     229        else if( msg )
    230230                yd->current_status = YAHOO_STATUS_CUSTOM;
    231231        else
  • root_commands.c

    r3330468 r81ee561  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    654654                irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] );
    655655        }
     656        else if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
     657        {
     658                if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) )
     659                {
     660                        u = user_find( irc, irc->nick );
     661                       
     662                        irc_part( irc, u, irc->channel );
     663                        g_free( irc->channel );
     664                        irc->channel = g_strdup( cmd[2] );
     665                        irc_join( irc, u, irc->channel );
     666                       
     667                        if( strcmp( cmd[0], "set_rename" ) != 0 )
     668                                set_setstr( &irc->set, "control_channel", cmd[2] );
     669                }
     670        }
    656671        else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) )
    657672        {
     
    701716       
    702717        return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID;
     718}
     719
     720char *set_eval_control_channel( set_t *set, char *new_name )
     721{
     722        irc_t *irc = set->data;
     723       
     724        if( strcmp( irc->channel, new_name ) != 0 )
     725        {
     726                char *cmd[] = { "set_rename", irc->channel, new_name, NULL };
     727               
     728                cmd_rename( irc, cmd );
     729        }
     730       
     731        return strcmp( irc->channel, new_name ) == 0 ? new_name : SET_INVALID;
    703732}
    704733
     
    914943                online = 1;
    915944        else
    916                 online =  away = 1;
     945                online = away = 1;
    917946       
    918947        if( strchr( irc->umode, 'b' ) != NULL )
     
    927956                if( online == 1 )
    928957                {
     958                        char st[256] = "Online";
     959                       
     960                        if( u->status_msg )
     961                                g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg );
     962                       
    929963                        g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user );
    930                         irc_usermsg( irc, format, u->nick, s, "Online" );
     964                        irc_usermsg( irc, format, u->nick, s, st );
    931965                }
    932966               
  • tests/check_jabber_util.c

    r3330468 r81ee561  
    1414       
    1515        budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" );
    16         budw1->last_act = time( NULL ) - 100;
     16        budw1->last_msg = time( NULL ) - 100;
    1717        budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" );
    1818        budw2->priority = 2;
    19         budw2->last_act = time( NULL );
     19        budw2->last_msg = time( NULL );
    2020        budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" );
    21         budw3->last_act = time( NULL ) - 200;
     21        budw3->last_msg = time( NULL ) - 200;
    2222        budw3->priority = 4;
    2323        /* TODO(wilmer): Shouldn't this just return budw3? */
     
    6060        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) );
    6161        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) );
    62         fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
     62       
     63        /* Test activity_timeout and GET_BUDDY_BARE_OK. */
     64        fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) == budw1 );
     65        budw1->last_msg -= 50;
     66        fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) ) != NULL );
     67        fail_unless( strcmp( bud->full_jid, "wilmer@gaast.net" ) == 0 );
    6368       
    6469        fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
    6570        fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
    6671       
     72        fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
     73        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/bitlbee" ) );
     74        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/BitlBee" ) );
     75        fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) );
     76       
    6777        /* Check if remove_bare() indeed gets rid of all. */
     78        /* disable this one for now.
    6879        fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) );
    6980        fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) );
     81        */
    7082
    7183        fail_if( jabber_buddy_remove( ic, "nekkid@lamejab.net/Illegal" ) );
    7284        fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) );
    7385        fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) );
     86       
     87        /* Fixing a bug in this branch that caused information to get lost when
     88           removing the first full JID from a list. */
     89        jabber_buddy_add( ic, "bugtest@google.com/A" );
     90        jabber_buddy_add( ic, "bugtest@google.com/B" );
     91        jabber_buddy_add( ic, "bugtest@google.com/C" );
     92        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) );
     93        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) );
     94        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) );
    7495}
    7596
     
    85106        jd->buddies = g_hash_table_new( g_str_hash, g_str_equal );
    86107        set_add( &ic->acc->set, "resource_select", "priority", NULL, ic->acc );
     108        set_add( &ic->acc->set, "activity_timeout", "120", NULL, ic->acc );
    87109       
    88110        suite_add_tcase (s, tc_core);
  • user.h

    r3330468 r81ee561  
    3434       
    3535        char *away;
     36        char *status_msg; /* Non-IRC extension, but nice on IM. */
    3637       
    3738        char is_private;
Note: See TracChangeset for help on using the changeset viewer.