Changeset eded1f7


Ignore:
Timestamp:
2007-12-18T23:59:35Z (16 years ago)
Author:
kenobi <kenobi@…>
Branches:
master
Children:
2379566
Parents:
dc0ba9c
Message:

Merged in 280..288 from upstream (e.g. PING)

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • account.c

    rdc0ba9c reded1f7  
    9595                g_free( acc->server );
    9696                if( *value )
     97                {
    9798                        acc->server = g_strdup( value );
     99                        return value;
     100                }
    98101                else
     102                {
    99103                        acc->server = NULL;
    100                 return value;
     104                        return g_strdup( set->def );
     105                }
    101106        }
    102107        else if( strcmp( set->key, "auto_connect" ) == 0 )
  • doc/CREDITS

    rdc0ba9c reded1f7  
    5555- Greg (gropeep.org), for updating the Yahoo! module to fix some issues
    5656  that were there for quite some time already.
     57- misc@mandriva.org for lots of Jabber contributions.
    5758
    5859- And all other users who help us by sending useful bug reports, positive
  • doc/user-guide/commands.xml

    rdc0ba9c reded1f7  
    1717
    1818                <bitlbee-command name="add">
    19                         <syntax>account add &lt;protocol&gt; &lt;username&gt; &lt;password&gt; [&lt;server&gt;]</syntax>
     19                        <syntax>account add &lt;protocol&gt; &lt;username&gt; &lt;password&gt;</syntax>
    2020
    2121                        <description>
     
    2626                       
    2727                        <bitlbee-command name="jabber">
    28                                 <syntax>account add jabber &lt;handle@server.tld&gt; &lt;password&gt; [&lt;servertag&gt;]</syntax>
     28                                <syntax>account add jabber &lt;handle@server.tld&gt; &lt;password&gt;</syntax>
    2929
    3030                                <description>
     
    5050                       
    5151                        <bitlbee-command name="oscar">
    52                                 <syntax>account add oscar &lt;handle&gt; &lt;password&gt; [&lt;servername&gt;]</syntax>
     52                                <syntax>account add oscar &lt;handle&gt; &lt;password&gt;</syntax>
    5353
    5454                                <description>
    5555                                        <para>
    56                                                 Specifying a server is required for OSCAR, since OSCAR can be used for both ICQ- and AIM-connections. Although these days it's supposed to be possible to connect to ICQ via AIM-servers and vice versa, we like to stick with this separation for now. For ICQ connections, the servername is <emphasis>login.icq.com</emphasis>, for AIM connections it's <emphasis>login.oscar.aol.com</emphasis>.
     56                                                OSCAR is the protocol used to connect to AIM and/or ICQ. The servers will automatically detect if you're using a numeric or non-numeric username so there's no need to tell which network you want to connect to.
    5757                                        </para>
    5858                                </description>
    5959
    6060                                <ircexample>
    61                                         <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw login.icq.com</ircline>
     61                                        <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw</ircline>
    6262                                        <ircline nick="root">Account successfully added</ircline>
    6363                                </ircexample>
     
    595595                <description>
    596596                        <para>
    597                                 Can be set for Jabber- and OSCAR-connections. For OSCAR, this must be set to <emphasis>login.icq.com</emphasis> if it's an ICQ connection, or <emphasis>login.oscar.aol.com</emphasis> if it's an AIM connection. For Jabber, you have to set this if the servername isn't equal to the part after the @ in the Jabber handle.
     597                                Can be set for Jabber- and OSCAR-connections. For Jabber, you might have to set this if the servername isn't equal to the part after the @ in the Jabber handle. For OSCAR this shouldn't be necessary anymore in recent BitlBee versions.
    598598                        </para>
    599599                </description>
  • doc/user-guide/quickstart.xml

    rdc0ba9c reded1f7  
    3838
    3939<ircexample>
    40         <ircline nick="you">account add oscar 72696705 QuickStart login.icq.com</ircline>
     40        <ircline nick="you">account add jabber bitlbee@jabber.org QuickStart</ircline>
    4141        <ircline nick="root">Account successfully added</ircline>
    4242</ircexample>
    4343
    4444<para>
    45 Other available IM protocols are jabber, msn, and yahoo. Oscar is the protocol used by ICQ and AOL. For oscar, you need to specify the IM-server as a fourth argument (for msn and yahoo there is no fourth argument). For AOL Instant Messenger, the server name is <emphasis>login.oscar.aol.com</emphasis>. For ICQ, the server name is <emphasis>login.icq.com</emphasis>.
     45Other available IM protocols are msn, oscar, and yahoo. Oscar is the protocol used by ICQ and AOL.
    4646</para>
    4747
  • irc_commands.c

    rdc0ba9c reded1f7  
    207207                if( c->ic && c->ic->acc->prpl->chat_invite )
    208208                {
    209                         c->ic->acc->prpl->chat_invite( c, "", u->handle );
     209                        c->ic->acc->prpl->chat_invite( c, u->handle, NULL );
    210210                        irc_reply( irc, 341, "%s %s", nick, channel );
    211211                        return;
  • lib/misc.c

    rdc0ba9c reded1f7  
    4444#include <resolv.h>
    4545#endif
     46
     47#include "ssl_client.h"
    4648
    4749void strip_linefeed(gchar *text)
     
    591593        return g_string_free( ret, FALSE );
    592594}
     595
     596gboolean ssl_sockerr_again( void *ssl )
     597{
     598        if( ssl )
     599                return ssl_errno == SSL_AGAIN;
     600        else
     601                return sockerr_again();
     602}
  • lib/misc.h

    rdc0ba9c reded1f7  
    6666G_MODULE_EXPORT char *word_wrap( char *msg, int line_len );
    6767
     68G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl );
     69
    6870#endif
  • lib/ssl_gnutls.c

    rdc0ba9c reded1f7  
    223223        closesocket( conn->fd );
    224224       
    225         gnutls_deinit( conn->session );
    226         gnutls_certificate_free_credentials( conn->xcred );
     225        if( conn->session )
     226                gnutls_deinit( conn->session );
     227        if( conn->xcred )
     228                gnutls_certificate_free_credentials( conn->xcred );
    227229        g_free( conn );
    228230}
  • nick.c

    rdc0ba9c reded1f7  
    154154   With one difference, we allow dashes. */
    155155
    156 static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^-_|";
    157 static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~-_\\";
    158 
    159 void nick_strip( char * nick )
     156static char *nick_lc_chars = "0123456789abcdefghijklmnopqrstuvwxyz{}^`-_|";
     157static char *nick_uc_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]~`-_\\";
     158
     159void nick_strip( char *nick )
    160160{
    161161        int i, j;
     
    170170                }
    171171        }
     172        if( isdigit( nick[0] ) )
     173        {
     174                char *orig;
     175               
     176                orig = g_strdup( nick );
     177                g_snprintf( nick, MAX_NICK_LENGTH, "_%s", orig );
     178                g_free( orig );
     179                j ++;
     180        }
    172181        while( j <= MAX_NICK_LENGTH )
    173182                nick[j++] = '\0';
     
    178187        const char *s;
    179188       
    180         /* Empty/long nicks are not allowed */
    181         if( !*nick || strlen( nick ) > MAX_NICK_LENGTH )
     189        /* Empty/long nicks are not allowed, nor numbers at [0] */
     190        if( !*nick || isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH )
    182191                return( 0 );
    183192       
  • protocols/jabber/conference.c

    rdc0ba9c reded1f7  
    174174       
    175175        return 1;
     176}
     177
     178void jabber_chat_invite( struct groupchat *c, char *who, char *message )
     179{
     180        struct xt_node *node;
     181        struct im_connection *ic = c->ic;
     182        struct jabber_chat *jc = c->data;
     183
     184        node = xt_new_node( "reason", message, NULL );
     185
     186        node = xt_new_node( "invite", NULL, node );
     187        xt_add_attr( node, "to", who );
     188
     189        node = xt_new_node( "x", NULL, node );
     190        xt_add_attr( node, "xmlns", XMLNS_MUC_USER );
     191       
     192        node = jabber_make_packet( "message", NULL, jc->name, node );
     193
     194        jabber_write_packet( ic, node );
     195
     196        xt_free_node( node );
    176197}
    177198
  • protocols/jabber/io.c

    rdc0ba9c reded1f7  
    120120                return TRUE;
    121121        }
    122         else if( st == 0 || ( st < 0 && !sockerr_again() ) )
     122        else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
    123123        {
    124124                /* Set fd to -1 to make sure we won't write to it anymore. */
     
    231231                }
    232232        }
    233         else if( st == 0 || ( st < 0 && !sockerr_again() ) )
     233        else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
    234234        {
    235235                closesocket( jd->fd );
  • protocols/jabber/iq.c

    rdc0ba9c reded1f7  
    5050        else if( strcmp( type, "get" ) == 0 )
    5151        {
    52                 if( !( c = xt_find_node( node->children, "query" ) ) ||
     52                if( !( ( c = xt_find_node( node->children, "query" ) ) ||
     53                       ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */
    5354                    !( s = xt_find_attr( c, "xmlns" ) ) )
    5455                {
     
    8182                        xt_add_child( reply, xt_new_node( "tz", buf, NULL ) );
    8283                }
     84                else if( strcmp( s, XMLNS_PING ) == 0 )
     85                {
     86                        xt_free_node( reply );
     87                        reply = jabber_make_packet( "iq", "result", xt_find_attr( node, "from" ), NULL );
     88                        if( ( s = xt_find_attr( node, "id" ) ) )
     89                                xt_add_attr( reply, "id", s );
     90                        pack = 0;
     91                }
    8392                else if( strcmp( s, XMLNS_DISCO_INFO ) == 0 )
    8493                {
     
    8796                                                   XMLNS_CHATSTATES,
    8897                                                   XMLNS_MUC,
     98                                                   XMLNS_PING,
    8999                                                   XMLNS_SI,
    90100                                                   XMLNS_BYTESTREAMS,
  • protocols/jabber/jabber.c

    rdc0ba9c reded1f7  
    423423}
    424424
     425static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg )
     426{
     427        struct jabber_chat *jc = c->data;
     428        gchar *msg_alt = NULL;
     429
     430        if( msg == NULL )
     431                msg_alt = g_strdup_printf( "%s invited you to %s", c->ic->acc->user, jc->name );
     432       
     433        if( c && who )
     434                jabber_chat_invite( c, who, msg ? msg : msg_alt );
     435       
     436        g_free( msg_alt );
     437}
     438
    425439static void jabber_keepalive( struct im_connection *ic )
    426440{
     
    494508        ret->chat_msg = jabber_chat_msg_;
    495509        ret->chat_topic = jabber_chat_topic_;
    496 //      ret->chat_invite = jabber_chat_invite;
     510        ret->chat_invite = jabber_chat_invite_;
    497511        ret->chat_leave = jabber_chat_leave_;
    498512        ret->chat_join = jabber_chat_join_;
  • protocols/jabber/jabber.h

    rdc0ba9c reded1f7  
    189189#define XMLNS_VERSION      "jabber:iq:version"                                   /* XEP-0092 */
    190190#define XMLNS_TIME         "jabber:iq:time"                                      /* XEP-0090 */
     191#define XMLNS_PING         "urn:xmpp:ping"                                       /* XEP-0199 */
    191192#define XMLNS_VCARD        "vcard-temp"                                          /* XEP-0054 */
    192193#define XMLNS_DELAY        "jabber:x:delay"                                      /* XEP-0091 */
     
    293294void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
    294295void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
     296void jabber_chat_invite( struct groupchat *c, char *who, char *message );
    295297
    296298#endif
  • protocols/msn/msn.c

    rdc0ba9c reded1f7  
    241241}
    242242
    243 static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
     243static void msn_chat_invite( struct groupchat *c, char *who, char *message )
    244244{
    245245        struct msn_switchboard *sb = msn_sb_by_chat( c );
  • protocols/oscar/aim.h

    rdc0ba9c reded1f7  
    9494 *
    9595 */
    96 #define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
     96#define AIM_DEFAULT_LOGIN_SERVER "login.messaging.aol.com"
    9797#define AIM_LOGIN_PORT 5190
    9898
  • protocols/oscar/oscar.c

    rdc0ba9c reded1f7  
    341341        set_t *s;
    342342       
    343         s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
     343        s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );
    344344        s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
    345345       
     
    356356        struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
    357357
    358         if (isdigit(acc->user[0])) {
    359                 odata->icq = TRUE;
    360                 /* This is odd but it's necessary for a proper do_import and do_export.
    361                    We don't do those anymore, but let's stick with it, just in case
    362                    it accidentally fixes something else too... </bitlbee> */
    363                 /* ic->acc->pass[8] = 0;
    364                    Not touching this anymore now that it belongs to account_t!
    365                    Let's hope nothing will break. ;-) */
    366         } else {
     358        if (!isdigit(acc->user[0])) {
    367359                ic->flags |= OPT_DOES_HTML;
    368360        }
     
    385377        }
    386378       
    387         if (acc->server == NULL) {
    388                 imcb_error(ic, "No servername specified");
    389                 imc_logout(ic, FALSE);
    390                 return;
    391         }
    392        
    393         if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
    394             g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
    395                 imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
    396         }
    397        
    398379        imcb_log(ic, _("Signon: %s"), ic->acc->user);
    399380
     
    402383
    403384        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    404         conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
     385        conn->fd = proxy_connect(set_getstr(&acc->set, "server"),
     386                                 AIM_LOGIN_PORT, oscar_login_connect, ic);
    405387        if (conn->fd < 0) {
    406388                imcb_error(ic, _("Couldn't connect to host"));
     
    25092491}
    25102492
    2511 void oscar_chat_invite(struct groupchat *c, char *message, char *who)
     2493void oscar_chat_invite(struct groupchat *c, char *who, char *message)
    25122494{
    25132495        struct im_connection *ic = c->ic;
  • protocols/yahoo/yahoo.c

    rdc0ba9c reded1f7  
    306306}
    307307
    308 static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who )
     308static void byahoo_chat_invite( struct groupchat *c, char *who, char *msg )
    309309{
    310310        struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
  • root_commands.c

    rdc0ba9c reded1f7  
    199199                break;
    200200        default:
    201                 irc_usermsg( irc, "Error: '%d'", status );
     201                irc_usermsg( irc, "Error: `%d'", status );
    202202                break;
    203203        }
     
    234234                a = account_add( irc, prpl, cmd[3], cmd[4] );
    235235                if( cmd[5] )
     236                {
     237                        irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' "
     238                                          "is now deprecated. Use `account set' instead." );
    236239                        set_setstr( &a->set, "server", cmd[5] );
     240                }
    237241               
    238242                irc_usermsg( irc, "Account successfully added" );
     
    317321                        else
    318322                        {
    319                                 irc_usermsg( irc, "No accounts known. Use 'account add' to add one." );
     323                                irc_usermsg( irc, "No accounts known. Use `account add' to add one." );
    320324                        }
    321325                }
     
    403407                        }
    404408                       
    405                         if( ( strcmp( cmd[3], "=" ) ) == 0 && cmd[4] )
    406                                 irc_usermsg( irc, "Warning: Correct syntax: \002account set <variable> <value>\002 (without =)" );
    407                         else if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 )
     409                        if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 )
    408410                                set_reset( &a->set, set_name );
    409411                        else
     
    745747static void cmd_set( irc_t *irc, char **cmd )
    746748{
    747         char *set_name = NULL;
     749        char *set_name = cmd[1];
    748750       
    749751        if( cmd[1] && cmd[2] )
    750752        {
    751                 if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] )
    752                 {
    753                         irc_usermsg( irc, "Warning: Correct syntax: \002set <variable> <value>\002 (without =)" );
    754                         return;
    755                 }
    756                 else if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 )
     753                if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 )
    757754                {
    758755                        set_reset( &irc->set, cmd[2] );
     
    762759                {
    763760                        set_setstr( &irc->set, cmd[1], cmd[2] );
    764                         set_name = cmd[1];
    765761                }
    766762        }
  • tests/check_nick.c

    rdc0ba9c reded1f7  
    1515                "thisisave:ryveryveryverylongnick",
    1616                "t::::est",
     17                "test123",
     18                "123test",
     19                "123",
    1720                NULL };
    1821        const char *expected[] = { "test", "test", "test",
     
    2023                "thisisaveryveryveryveryl",
    2124                "test",
     25                "test123",
     26                "_123test",
     27                "_123",
    2228                NULL };
    2329
     
    3541START_TEST(test_nick_ok_ok)
    3642{
    37         const char *nicks[] = { "foo", "bar", "bla[", "blie]",
    38                                     "BreEZaH", "\\od^~", NULL };
     43        const char *nicks[] = { "foo", "bar123", "bla[", "blie]", "BreEZaH",
     44                                "\\od^~", "_123", "_123test", NULL };
    3945        int i;
    4046
     
    4955{
    5056        const char *nicks[] = { "thisisaveryveryveryveryveryveryverylongnick",
    51                                     "\nillegalchar", "", "nick%", NULL };
     57                                    "\nillegalchar", "", "nick%", "123test", NULL };
    5258        int i;
    5359
Note: See TracChangeset for help on using the changeset viewer.