Changes in / [2379566:de03374]


Ignore:
Files:
5 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r2379566 rde03374  
    1010
    1111# Program variables
    12 objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o dcc.o
    13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h dcc.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h protocols/ft.h
     12objects = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o user.o
     13headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h
    1414subdirs = lib protocols
    1515
  • account.c

    r2379566 rde03374  
    9595                g_free( acc->server );
    9696                if( *value )
    97                 {
    9897                        acc->server = g_strdup( value );
    99                         return value;
    100                 }
    10198                else
    102                 {
    10399                        acc->server = NULL;
    104                         return g_strdup( set->def );
    105                 }
     100                return value;
    106101        }
    107102        else if( strcmp( set->key, "auto_connect" ) == 0 )
  • conf.c

    r2379566 rde03374  
    6464        conf->ping_timeout = 300;
    6565        conf->user = NULL;
    66         conf->max_filetransfer_size = G_MAXUINT;
    6766        proxytype = 0;
    6867       
  • conf.h

    r2379566 rde03374  
    5050        int ping_timeout;
    5151        char *user;
    52         size_t max_filetransfer_size;
    5352} conf_t;
    5453
  • doc/CREDITS

    r2379566 rde03374  
    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.
    5857
    5958- And all other users who help us by sending useful bug reports, positive
  • doc/user-guide/commands.xml

    r2379566 rde03374  
    1717
    1818                <bitlbee-command name="add">
    19                         <syntax>account add &lt;protocol&gt; &lt;username&gt; &lt;password&gt;</syntax>
     19                        <syntax>account add &lt;protocol&gt; &lt;username&gt; &lt;password&gt; [&lt;server&gt;]</syntax>
    2020
    2121                        <description>
     
    2626                       
    2727                        <bitlbee-command name="jabber">
    28                                 <syntax>account add jabber &lt;handle@server.tld&gt; &lt;password&gt;</syntax>
     28                                <syntax>account add jabber &lt;handle@server.tld&gt; &lt;password&gt; [&lt;servertag&gt;]</syntax>
    2929
    3030                                <description>
     
    5050                       
    5151                        <bitlbee-command name="oscar">
    52                                 <syntax>account add oscar &lt;handle&gt; &lt;password&gt;</syntax>
     52                                <syntax>account add oscar &lt;handle&gt; &lt;password&gt; [&lt;servername&gt;]</syntax>
    5353
    5454                                <description>
    5555                                        <para>
    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.
     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>.
    5757                                        </para>
    5858                                </description>
    5959
    6060                                <ircexample>
    61                                         <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw</ircline>
     61                                        <ircline nick="wilmer">account add oscar 72696705 hobbelmeeuw login.icq.com</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 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.
     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.
    598598                        </para>
    599599                </description>
     
    861861
    862862        </bitlbee-command>
    863        
    864         <bitlbee-command name="transfers">
    865                 <short-description>Monitor, cancel, or reject file transfers</short-description>
    866                 <syntax>transfers [&lt;cancel&gt; id | &lt;reject&gt;]</syntax>
    867                
    868                 <description>
    869                         <para>
    870                                 Without parameters the currently pending file transfers and their status will be listed. Available actions are <emphasis>cancel</emphasis> and <emphasis>reject</emphasis>. See <emphasis>help transfers &lt;action&gt;</emphasis> for more information.
    871                         </para>
    872 
    873                         <ircexample>
    874                                 <ircline nick="ulim">transfers</ircline>
    875                         </ircexample>
    876                 </description>
    877                
    878                 <bitlbee-command name="cancel">
    879                         <short-description>Cancels the file transfer with the given id</short-description>
    880                         <syntax>transfers &lt;cancel&gt; id</syntax>
    881 
    882                         <description>
    883                                 <para>Cancels the file transfer with the given id</para>
    884                         </description>
    885 
    886                         <ircexample>
    887                                 <ircline nick="ulim">transfers cancel 1</ircline>
    888                                 <ircline nick="root">Canceling file transfer for test</ircline>
    889                         </ircexample>
    890                 </bitlbee-command>
    891 
    892                 <bitlbee-command name="reject">
    893                         <short-description>Rejects all incoming transfers</short-description>
    894                         <syntax>transfers &lt;reject&gt;</syntax>
    895 
    896                         <description>
    897                                 <para>Rejects all incoming (not already transferring) file transfers. Since you probably have only one incoming transfer at a time, no id is neccessary. Or is it?</para>
    898                         </description>
    899 
    900                         <ircexample>
    901                                 <ircline nick="ulim">transfers reject</ircline>
    902                         </ircexample>
    903                 </bitlbee-command>
    904         </bitlbee-command>
    905        
    906863</chapter>
  • doc/user-guide/quickstart.xml

    r2379566 rde03374  
    3838
    3939<ircexample>
    40         <ircline nick="you">account add jabber bitlbee@jabber.org QuickStart</ircline>
     40        <ircline nick="you">account add oscar 72696705 QuickStart login.icq.com</ircline>
    4141        <ircline nick="root">Account successfully added</ircline>
    4242</ircexample>
    4343
    4444<para>
    45 Other available IM protocols are msn, oscar, and yahoo. Oscar is the protocol used by ICQ and AOL.
     45Other 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>.
    4646</para>
    4747
  • irc.c

    r2379566 rde03374  
    2828#include "crypting.h"
    2929#include "ipc.h"
    30 #include "dcc.h"
    31 
    32 #include <regex.h>
    33 #include <netinet/in.h>
    3430
    3531static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
     
    996992                        return( 1 );
    997993                }
    998                 else if( g_strncasecmp( s + 1, "DCC", 3 ) == 0 )
    999                 {
    1000                         if( u && u->ic && u->ic->acc->prpl->transfer_request )
    1001                         {
    1002                                 file_transfer_t *ft = dcc_request( u->ic, s + 5 );
    1003                                 if ( ft )
    1004                                         u->ic->acc->prpl->transfer_request( u->ic, ft, u->handle );
    1005                         }
    1006                         return( 1 );
    1007                 }               
    1008994                else
    1009995                {
    1010                         irc_usermsg( irc, "Supported CTCPs are ACTION, VERSION, PING, TYPING, DCC" );
     996                        irc_usermsg( irc, "Non-ACTION CTCP's aren't supported" );
    1011997                        return( 0 );
    1012998                }
  • irc.h

    r2379566 rde03374  
    8484        struct query *queries;
    8585        struct account *accounts;
    86         GSList *file_transfers;
    8786       
    8887        struct __USER *users;
  • irc_commands.c

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

    r2379566 rde03374  
    4444#include <resolv.h>
    4545#endif
    46 
    47 #include "ssl_client.h"
    4846
    4947void strip_linefeed(gchar *text)
     
    593591        return g_string_free( ret, FALSE );
    594592}
    595 
    596 gboolean 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

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

    r2379566 rde03374  
    223223        closesocket( conn->fd );
    224224       
    225         if( conn->session )
    226                 gnutls_deinit( conn->session );
    227         if( conn->xcred )
    228                 gnutls_certificate_free_credentials( conn->xcred );
     225        gnutls_deinit( conn->session );
     226        gnutls_certificate_free_credentials( conn->xcred );
    229227        g_free( conn );
    230228}
  • nick.c

    r2379566 rde03374  
    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         }
    181172        while( j <= MAX_NICK_LENGTH )
    182173                nick[j++] = '\0';
     
    187178        const char *s;
    188179       
    189         /* Empty/long nicks are not allowed, nor numbers at [0] */
    190         if( !*nick || isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH )
     180        /* Empty/long nicks are not allowed */
     181        if( !*nick || strlen( nick ) > MAX_NICK_LENGTH )
    191182                return( 0 );
    192183       
  • protocols/jabber/Makefile

    r2379566 rde03374  
    1010
    1111# [SH] Program variables
    12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o si.o s5bytestream.o
     12objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o
    1313
    1414CFLAGS += -Wall
  • protocols/jabber/conference.c

    r2379566 rde03374  
    174174       
    175175        return 1;
    176 }
    177 
    178 void 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 );
    197176}
    198177
  • protocols/jabber/io.c

    r2379566 rde03374  
    120120                return TRUE;
    121121        }
    122         else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
     122        else if( st == 0 || ( st < 0 && !sockerr_again() ) )
    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 && !ssl_sockerr_again( jd->ssl ) ) )
     233        else if( st == 0 || ( st < 0 && !sockerr_again() ) )
    234234        {
    235235                closesocket( jd->fd );
  • protocols/jabber/iq.c

    r2379566 rde03374  
    5050        else if( strcmp( type, "get" ) == 0 )
    5151        {
    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/> ????? */
     52                if( !( c = xt_find_node( node->children, "query" ) ) ||
    5453                    !( s = xt_find_attr( c, "xmlns" ) ) )
    5554                {
     
    8281                        xt_add_child( reply, xt_new_node( "tz", buf, NULL ) );
    8382                }
    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                 }
    92                 else if( strcmp( s, XMLNS_DISCO_INFO ) == 0 )
     83                else if( strcmp( s, XMLNS_DISCOVER ) == 0 )
    9384                {
    9485                        const char *features[] = { XMLNS_VERSION,
     
    9687                                                   XMLNS_CHATSTATES,
    9788                                                   XMLNS_MUC,
    98                                                    XMLNS_PING,
    99                                                    XMLNS_SI,
    100                                                    XMLNS_BYTESTREAMS,
    101                                                    XMLNS_FILETRANSFER,
    10289                                                   NULL };
    10390                        const char **f;
     
    119106                {
    120107                        xt_free_node( reply );
    121                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
     108                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
    122109                        pack = 0;
    123110                }
     
    125112        else if( strcmp( type, "set" ) == 0 )
    126113        {
    127                 if(  ( c = xt_find_node( node->children, "si" ) ) &&
    128                      ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) )
    129                 {
    130                         return jabber_si_handle_request( ic, node, c );
    131                 } else if( !( c = xt_find_node( node->children, "query" ) ) ||
     114                if( !( c = xt_find_node( node->children, "query" ) ) ||
    132115                    !( s = xt_find_attr( c, "xmlns" ) ) )
    133116                {
    134117                        imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
    135118                        return XT_HANDLED;
    136                 } else if( strcmp( s, XMLNS_ROSTER ) == 0 )
    137                 {
     119                }
     120               
    138121                /* This is a roster push. XMPP servers send this when someone
    139122                   was added to (or removed from) the buddy list. AFAIK they're
    140123                   sent even if we added this buddy in our own session. */
     124                if( strcmp( s, XMLNS_ROSTER ) == 0 )
     125                {
    141126                        int bare_len = strlen( ic->acc->user );
    142127                       
     
    155140                               
    156141                                xt_free_node( reply );
    157                                 reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL );
     142                                reply = jabber_make_error_packet( node, "not-allowed", "cancel" );
    158143                                pack = 0;
    159144                        }
    160                 } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 )
    161                 {
    162                         /* Bytestream Request (stage 2 of file transfer) */
    163                         return jabber_bs_recv_request( ic, node, c );
    164                 } else
     145                }
     146                else
    165147                {
    166148                        xt_free_node( reply );
    167                         reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
     149                        reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
    168150                        pack = 0;
    169151                }
     
    575557        return st;
    576558}
    577 
    578 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    579 
    580 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid )
    581 {
    582         struct xt_node *node, *query;
    583         struct jabber_buddy *bud;
    584        
    585         if( ( bud = jabber_buddy_by_jid( ic, bare_jid , 0 ) ) == NULL )
    586         {
    587                 /* Who cares about the unknown... */
    588                 imcb_log( ic, "Couldnt find the man: %s", bare_jid);
    589                 return 0;
    590         }
    591        
    592         if( bud->features ) /* been here already */
    593                 return XT_HANDLED;
    594        
    595         node = xt_new_node( "query", NULL, NULL );
    596         xt_add_attr( node, "xmlns", XMLNS_DISCO_INFO );
    597        
    598         if( !( query = jabber_make_packet( "iq", "get", bare_jid, node ) ) )
    599         {
    600                 imcb_log( ic, "WARNING: Couldn't generate feature query" );
    601                 xt_free_node( node );
    602         }
    603 
    604         jabber_cache_add( ic, query, jabber_iq_parse_features );
    605 
    606         return jabber_write_packet( ic, query );
    607 }
    608 
    609 xt_status jabber_iq_parse_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
    610 {
    611         struct xt_node *c;
    612         struct jabber_buddy *bud;
    613         char *feature;
    614 
    615         if( !( c = xt_find_node( node->children, "query" ) ) ||
    616             !( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 ) )
    617         {
    618                 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" );
    619                 return XT_HANDLED;
    620         }
    621         if( ( bud = jabber_buddy_by_jid( ic, xt_find_attr( node, "from") , 0 ) ) == NULL )
    622         {
    623                 /* Who cares about the unknown... */
    624                 imcb_log( ic, "Couldnt find the man: %s", xt_find_attr( node, "from"));
    625                 return 0;
    626         }
    627        
    628         c = c->children;
    629         while( ( c = xt_find_node( c, "feature" ) ) ) {
    630                 feature = xt_find_attr( c, "var" );
    631                 bud->features = g_slist_append(bud->features, g_strdup(feature) );
    632                 c = c->next;
    633         }
    634 
    635         return XT_HANDLED;
    636 }
    637 
    638 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    639 
    640 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns )
    641 {
    642         struct xt_node *node, *query;
    643         struct jabber_data *jd = ic->proto_data;
    644        
    645         node = xt_new_node( "query", NULL, NULL );
    646         xt_add_attr( node, "xmlns", xmlns );
    647        
    648         if( !( query = jabber_make_packet( "iq", "get", jid, node ) ) )
    649         {
    650                 imcb_log( ic, "WARNING: Couldn't generate server query" );
    651                 xt_free_node( node );
    652         }
    653 
    654         jd->have_streamhosts--;
    655         jabber_cache_add( ic, query, jabber_iq_parse_server_features );
    656 
    657         return jabber_write_packet( ic, query );
    658 }
    659 
    660 /*
    661  * Query the server for "items", query each "item" for identities, query each "item" that's a proxy for it's bytestream info
    662  */
    663 xt_status jabber_iq_parse_server_features( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
    664 {
    665         struct xt_node *c;
    666         struct jabber_data *jd = ic->proto_data;
    667 
    668         if( !( c = xt_find_node( node->children, "query" ) ) ||
    669             !xt_find_attr( node, "from" ) )
    670         {
    671                 imcb_log( ic, "WARNING: Received incomplete IQ-result packet for discover" );
    672                 return XT_HANDLED;
    673         }
    674 
    675         jd->have_streamhosts++;
    676 
    677         if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_ITEMS ) == 0 )
    678         {
    679                 char *item, *itemjid;
    680 
    681                 /* answer from server */
    682        
    683                 c = c->children;
    684                 while( ( c = xt_find_node( c, "item" ) ) )
    685                 {
    686                         item = xt_find_attr( c, "name" );
    687                         itemjid = xt_find_attr( c, "jid" );
    688 
    689                         jabber_iq_query_server( ic, itemjid, XMLNS_DISCO_INFO );
    690 
    691                         c = c->next;
    692                 }
    693         } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_DISCO_INFO ) == 0 )
    694         {
    695                 char *category, *type;
    696 
    697                 /* answer from potential proxy */
    698 
    699                 c = c->children;
    700                 while( ( c = xt_find_node( c, "identity" ) ) )
    701                 {
    702                         category = xt_find_attr( c, "category" );
    703                         type = xt_find_attr( c, "type" );
    704 
    705                         if( type && ( strcmp( type, "bytestreams" ) == 0 ) &&
    706                             category && ( strcmp( category, "proxy" ) == 0 ) )
    707                                 jabber_iq_query_server( ic, xt_find_attr( node, "from" ), XMLNS_BYTESTREAMS );
    708 
    709                         c = c->next;
    710                 }
    711         } else if( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_BYTESTREAMS ) == 0 )
    712         {
    713                 char *host, *jid;
    714                 int port;
    715 
    716                 /* answer from proxy */
    717 
    718                 if( ( c = xt_find_node( c->children, "streamhost" ) ) &&
    719                     ( host = xt_find_attr( c, "host" ) ) &&
    720                     ( port = atoi( xt_find_attr( c, "port" ) ) ) &&
    721                     ( jid = xt_find_attr( c, "jid" ) ) )
    722                 {
    723                         jabber_streamhost_t *sh = g_new0( jabber_streamhost_t, 1 );
    724                         sh->jid = g_strdup( jid );
    725                         sh->host = g_strdup( host );
    726                         sprintf( sh->port, "%u", port );
    727 
    728                         imcb_log( ic, "Proxy found: jid %s host %s port %u", jid, host, port );
    729                         jd->streamhosts = g_slist_append( jd->streamhosts, sh );
    730                 }
    731         }
    732 
    733         if( jd->have_streamhosts == 0 )
    734                 jd->have_streamhosts++;
    735         return XT_HANDLED;
    736 }
  • protocols/jabber/jabber.c

    r2379566 rde03374  
    427427}
    428428
    429 static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg )
    430 {
    431         struct jabber_chat *jc = c->data;
    432         gchar *msg_alt = NULL;
    433 
    434         if( msg == NULL )
    435                 msg_alt = g_strdup_printf( "%s invited you to %s", c->ic->acc->user, jc->name );
    436        
    437         if( c && who )
    438                 jabber_chat_invite( c, who, msg ? msg : msg_alt );
    439        
    440         g_free( msg_alt );
    441 }
    442 
    443429static void jabber_keepalive( struct im_connection *ic )
    444430{
     
    512498        ret->chat_msg = jabber_chat_msg_;
    513499        ret->chat_topic = jabber_chat_topic_;
    514         ret->chat_invite = jabber_chat_invite_;
     500//      ret->chat_invite = jabber_chat_invite;
    515501        ret->chat_leave = jabber_chat_leave_;
    516502        ret->chat_join = jabber_chat_join_;
     
    518504        ret->send_typing = jabber_send_typing;
    519505        ret->handle_cmp = g_strcasecmp;
    520         ret->transfer_request = jabber_si_transfer_request;
    521506
    522507        register_protocol( ret );
  • protocols/jabber/jabber.h

    r2379566 rde03374  
    5757} jabber_buddy_flags_t;
    5858
    59 /* Stores a streamhost's(a.k.a. proxy) data */
    60 typedef struct
    61 {
    62         char *jid;
    63         char *host;
    64         char port[6];
    65 } jabber_streamhost_t;
    66 
    6759struct jabber_data
    6860{
     
    8981        GHashTable *node_cache;
    9082        GHashTable *buddies;
    91 
    92         GSList *filetransfers;
    93         GSList *streamhosts;
    94         int have_streamhosts;
    9583};
    9684
     
    121109        struct jabber_away_state *away_state;
    122110        char *away_message;
    123         GSList *features;
    124111       
    125112        time_t last_act;
     
    135122        char *my_full_jid; /* Separate copy because of case sensitivity. */
    136123        struct jabber_buddy *me;
    137 };
    138 
    139 struct jabber_transfer
    140 {
    141         /* bitlbee's handle for this transfer */
    142         file_transfer_t *ft;
    143 
    144         /* the stream's private handle */
    145         gpointer streamhandle;
    146 
    147         struct im_connection *ic;
    148 
    149         int watch_in;
    150         int watch_out;
    151 
    152         char *ini_jid;
    153         char *tgt_jid;
    154         char *iq_id;
    155         char *sid;
    156         int accepted;
    157 
    158         size_t bytesread, byteswritten;
    159         int fd;
    160         struct sockaddr_storage saddr;
    161124};
    162125
     
    186149
    187150/* Some supported extensions/legacy stuff */
    188 #define XMLNS_AUTH         "jabber:iq:auth"                                      /* XEP-0078 */
    189 #define XMLNS_VERSION      "jabber:iq:version"                                   /* XEP-0092 */
    190 #define XMLNS_TIME         "jabber:iq:time"                                      /* XEP-0090 */
    191 #define XMLNS_PING         "urn:xmpp:ping"                                       /* XEP-0199 */
    192 #define XMLNS_VCARD        "vcard-temp"                                          /* XEP-0054 */
    193 #define XMLNS_DELAY        "jabber:x:delay"                                      /* XEP-0091 */
    194 #define XMLNS_XDATA        "jabber:x:data"                                       /* XEP-0004 */
    195 #define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"               /* XEP-0085 */
    196 #define XMLNS_DISCO_INFO   "http://jabber.org/protocol/disco#info"               /* XEP-0030 */
    197 #define XMLNS_DISCO_ITEMS  "http://jabber.org/protocol/disco#items"              /* XEP-0030 */
    198 #define XMLNS_MUC          "http://jabber.org/protocol/muc"                      /* XEP-0045 */
    199 #define XMLNS_MUC_USER     "http://jabber.org/protocol/muc#user"                 /* XEP-0045 */
    200 #define XMLNS_FEATURE      "http://jabber.org/protocol/feature-neg"              /* XEP-0020 */
    201 #define XMLNS_SI           "http://jabber.org/protocol/si"                       /* XEP-0095 */
    202 #define XMLNS_FILETRANSFER "http://jabber.org/protocol/si/profile/file-transfer" /* XEP-0096 */
    203 #define XMLNS_BYTESTREAMS  "http://jabber.org/protocol/bytestreams"              /* XEP-0065 */
    204 #define XMLNS_IBB          "http://jabber.org/protocol/ibb"                      /* XEP-0047 */
     151#define XMLNS_AUTH         "jabber:iq:auth"                     /* XEP-0078 */
     152#define XMLNS_VERSION      "jabber:iq:version"                  /* XEP-0092 */
     153#define XMLNS_TIME         "jabber:iq:time"                     /* XEP-0090 */
     154#define XMLNS_VCARD        "vcard-temp"                         /* XEP-0054 */
     155#define XMLNS_DELAY        "jabber:x:delay"                     /* XEP-0091 */
     156#define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"  /* 0085 */
     157#define XMLNS_DISCOVER     "http://jabber.org/protocol/disco#info"  /* 0030 */
     158#define XMLNS_MUC          "http://jabber.org/protocol/muc"     /* XEP-0045 */
     159#define XMLNS_MUC_USER     "http://jabber.org/protocol/muc#user"/* XEP-0045 */
    205160
    206161/* iq.c */
     
    212167int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name );
    213168int jabber_remove_from_roster( struct im_connection *ic, char *handle );
    214 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid );
    215 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns );
    216 
    217 /* si.c */
    218 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode );
    219 void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );
    220 void jabber_si_free_transfer( file_transfer_t *ft);
    221 
    222 /* s5bytestream.c */
    223 int jabber_bs_recv_request( struct im_connection *ic, struct xt_node *node, struct xt_node *qnode);
    224 gboolean jabber_bs_send_start( struct jabber_transfer *tf );
    225 gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int len );
    226169
    227170/* message.c */
     
    237180char *set_eval_tls( set_t *set, char *value );
    238181struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
    239 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code );
     182struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );
    240183void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func );
    241184struct xt_node *jabber_cache_get( struct im_connection *ic, char *id );
     
    294237void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
    295238void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
    296 void jabber_chat_invite( struct groupchat *c, char *who, char *message );
    297239
    298240#endif
  • protocols/jabber/jabber_util.c

    r2379566 rde03374  
    9797}
    9898
    99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code )
     99struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )
    100100{
    101101        struct xt_node *node, *c;
     
    109109        c = xt_new_node( "error", NULL, c );
    110110        xt_add_attr( c, "type", err_type );
    111        
    112         /* Add the error code, if present */
    113         if (err_code)
    114                 xt_add_attr( c, "code", err_code );
    115111       
    116112        /* To make the actual error packet, we copy the original packet and
     
    295291        new = g_new( char, len + 1 );
    296292        for( i = 0; i < len; i ++ )
    297         {
    298                 /* don't normalize the resource */
    299                 if( orig[i] == '/' )
    300                         break;
    301293                new[i] = tolower( orig[i] );
    302         }
    303         for( ; i < len; i ++ )
    304                 new[i] = orig[i];
    305294       
    306295        new[i] = 0;
  • protocols/msn/msn.c

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

    r2379566 rde03374  
    4343#include "proxy.h"
    4444#include "md5.h"
    45 #include "ft.h"
    4645
    4746#define BUF_LEN MSG_LEN
     
    229228         * - Most protocols will just want to set this to g_strcasecmp().*/
    230229        int (* handle_cmp) (const char *who1, const char *who2);
    231 
    232         /* Incoming transfer request */
    233         void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle );
    234230};
    235231
  • protocols/oscar/aim.h

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

    r2379566 rde03374  
    341341        set_t *s;
    342342       
    343         s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );
     343        s = set_add( &acc->set, "server", NULL, 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])) {
     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 {
    359367                ic->flags |= OPT_DOES_HTML;
    360368        }
     
    377385        }
    378386       
     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       
    379398        imcb_log(ic, _("Signon: %s"), ic->acc->user);
    380399
     
    383402
    384403        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    385         conn->fd = proxy_connect(set_getstr(&acc->set, "server"),
    386                                  AIM_LOGIN_PORT, oscar_login_connect, ic);
     404        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
    387405        if (conn->fd < 0) {
    388406                imcb_error(ic, _("Couldn't connect to host"));
     
    24912509}
    24922510
    2493 void oscar_chat_invite(struct groupchat *c, char *who, char *message)
     2511void oscar_chat_invite(struct groupchat *c, char *message, char *who)
    24942512{
    24952513        struct im_connection *ic = c->ic;
  • protocols/yahoo/yahoo.c

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

    r2379566 rde03374  
    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." );
    239236                        set_setstr( &a->set, "server", cmd[5] );
    240                 }
    241237               
    242238                irc_usermsg( irc, "Account successfully added" );
     
    321317                        else
    322318                        {
    323                                 irc_usermsg( irc, "No accounts known. Use `account add' to add one." );
     319                                irc_usermsg( irc, "No accounts known. Use 'account add' to add one." );
    324320                        }
    325321                }
     
    407403                        }
    408404                       
    409                         if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 )
     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 )
    410408                                set_reset( &a->set, set_name );
    411409                        else
     
    747745static void cmd_set( irc_t *irc, char **cmd )
    748746{
    749         char *set_name = cmd[1];
     747        char *set_name = NULL;
    750748       
    751749        if( cmd[1] && cmd[2] )
    752750        {
    753                 if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 )
     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 )
    754757                {
    755758                        set_reset( &irc->set, cmd[2] );
     
    759762                {
    760763                        set_setstr( &irc->set, cmd[1], cmd[2] );
     764                        set_name = cmd[1];
    761765                }
    762766        }
     
    968972                irc_usermsg( irc, "Tried to join chat, not sure if this was successful" );
    969973                g_free( channel );
    970         }
    971 }
    972 
    973 static void cmd_transfers( irc_t *irc, char **cmd )
    974 {
    975         GSList *files = irc->file_transfers;
    976         enum { LIST, REJECT, CANCEL };
    977         int subcmd = LIST;
    978         int fid;
    979 
    980         if( !files )
    981         {
    982                 irc_usermsg( irc, "No pending transfers" );
    983                 return;
    984         }
    985 
    986         if( cmd[1] &&
    987             ( strcmp( cmd[1], "reject" ) == 0 ) )
    988         {
    989                 subcmd = REJECT;
    990         }
    991         else if( cmd[1] &&
    992                  ( strcmp( cmd[1], "cancel" ) == 0 ) &&
    993                  cmd[2] &&
    994                  ( fid = atoi( cmd[2] ) ) )
    995         {
    996                 subcmd = CANCEL;
    997         }
    998 
    999         for( ; files; files = g_slist_next( files ) )
    1000         {
    1001                 file_transfer_t *file = files->data;
    1002                
    1003                 switch( subcmd ) {
    1004                 case LIST:
    1005                         if ( file->status == FT_STATUS_LISTENING )
    1006                                 irc_usermsg( irc,
    1007                                         "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);
    1008                         else
    1009                         {
    1010                                 int kb_per_s = 0;
    1011                                 time_t diff = time( NULL ) - file->started;
    1012                                 if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )
    1013                                         kb_per_s = file->bytes_transferred / 1024 / diff;
    1014                                        
    1015                                 irc_usermsg( irc,
    1016                                         "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,
    1017                                         file->bytes_transferred/1024, file->file_size/1024, kb_per_s);
    1018                         }
    1019                         break;
    1020                 case REJECT:
    1021                         if( file->status == FT_STATUS_LISTENING )
    1022                         {
    1023                                 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );
    1024                                 imcb_file_canceled( file, "Denied by user" );
    1025                         }
    1026                         break;
    1027                 case CANCEL:
    1028                         if( file->local_id == fid )
    1029                         {
    1030                                 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );
    1031                                 imcb_file_canceled( file, "Canceled by user" );
    1032                         }
    1033                         break;
    1034                 }
    1035974        }
    1036975}
     
    1056995        { "qlist",          0, cmd_qlist,          0 },
    1057996        { "join_chat",      2, cmd_join_chat,      0 },
    1058         { "transfers",      0, cmd_transfers,      0 },
    1059997        { NULL }
    1060998};
  • tests/check_nick.c

    r2379566 rde03374  
    1515                "thisisave:ryveryveryverylongnick",
    1616                "t::::est",
    17                 "test123",
    18                 "123test",
    19                 "123",
    2017                NULL };
    2118        const char *expected[] = { "test", "test", "test",
     
    2320                "thisisaveryveryveryveryl",
    2421                "test",
    25                 "test123",
    26                 "_123test",
    27                 "_123",
    2822                NULL };
    2923
     
    4135START_TEST(test_nick_ok_ok)
    4236{
    43         const char *nicks[] = { "foo", "bar123", "bla[", "blie]", "BreEZaH",
    44                                 "\\od^~", "_123", "_123test", NULL };
     37        const char *nicks[] = { "foo", "bar", "bla[", "blie]",
     38                                    "BreEZaH", "\\od^~", NULL };
    4539        int i;
    4640
     
    5549{
    5650        const char *nicks[] = { "thisisaveryveryveryveryveryveryverylongnick",
    57                                     "\nillegalchar", "", "nick%", "123test", NULL };
     51                                    "\nillegalchar", "", "nick%", NULL };
    5852        int i;
    5953
Note: See TracChangeset for help on using the changeset viewer.