Changes in / [ac55e50:f712188]


Ignore:
Files:
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • account.c

    rac55e50 rf712188  
    2828#include "account.h"
    2929
    30 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )
     30account_t *account_add( irc_t *irc, int protocol, char *user, char *pass )
    3131{
    3232        account_t *a;
     
    4242        }
    4343       
    44         a->prpl = prpl;
     44        a->protocol = protocol;
    4545        a->user = g_strdup( user );
    4646        a->pass = g_strdup( pass );
     
    6666        for( a = irc->accounts; a; a = a->next )
    6767        {
    68                 if( g_strcasecmp( id, a->prpl->name ) == 0 )
     68                if( g_strcasecmp( id, proto_name[a->protocol] ) == 0 )
    6969                {
    7070                        if( !ret )
     
    124124        }
    125125       
    126         if (a->prpl == NULL )
     126        if( proto_prpl[a->protocol]->login == NULL )
    127127        {
    128                 irc_usermsg( irc, "Support for protocol %s is not included in this BitlBee", a->prpl->name );
     128                irc_usermsg( irc, "Support for protocol %s is not included in this BitlBee", proto_name[a->protocol] );
    129129                return;
    130130        }
     
    134134        u = g_new0 ( struct aim_user, 1 );
    135135        u->irc = irc;
    136         u->prpl = a->prpl;
     136        u->protocol = a->protocol;
    137137        strncpy( u->username, a->user, sizeof( u->username ) - 1 );
    138138        strncpy( u->password, a->pass, sizeof( u->password ) - 1 );
     
    142142        a->reconnect = 0;
    143143       
    144         a->prpl->login( u );
     144        proto_prpl[a->protocol]->login( u );
    145145}
    146146
  • account.h

    rac55e50 rf712188  
    2929typedef struct account
    3030{
    31         struct prpl *prpl;
     31        int protocol;
    3232        char *user;
    3333        char *pass;
     
    4141} account_t;
    4242
    43 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass );
     43account_t *account_add( irc_t *irc, int protocol, char *user, char *pass );
    4444account_t *account_get( irc_t *irc, char *id );
    4545void account_del( irc_t *irc, account_t *acc );
  • bitlbee.c

    rac55e50 rf712188  
    236236}
    237237
    238 /* DO NOT USE THIS FUNCTION IN NEW CODE. This
    239  * function is here merely because the save/load code still uses
    240  * ids rather then names */
    241 struct prpl *find_protocol_by_id(int id)
    242 {
    243         switch (id) {
    244         case 1: return find_protocol("oscar");
    245         case 4: return find_protocol("msn");
    246         case 2: return find_protocol("yahoo");
    247         case 8: return find_protocol("jabber");
    248         default: break;
    249         }
    250         return NULL;
    251 }
    252 
    253238int bitlbee_load( irc_t *irc, char* password )
    254239{
    255240        char s[512];
    256241        char *line;
    257         char proto[20];
     242        int proto;
    258243        char nick[MAX_NICK_LENGTH+1];
    259244        FILE *fp;
     
    290275        fp = fopen( s, "r" );
    291276        if( !fp ) return( 0 );
    292         while( fscanf( fp, "%s %s %s", s, proto, nick ) > 0 )
    293         {
    294                 struct prpl *prpl;
    295 
    296                 prpl = find_protocol(proto);
    297 
    298                 /* Older files saved the protocol number rather then the protocol name */
    299                 if (!prpl && atoi(proto)) {
    300                         prpl = find_protocol_by_id(atoi(proto));
    301                 }
    302 
    303                 if (!prpl)
    304                         continue;
    305 
     277        while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 )
     278        {
    306279                http_decode( s );
    307                 nick_set( irc, s, prpl, nick );
     280                nick_set( irc, s, proto, nick );
    308281        }
    309282        fclose( fp );
     
    360333                s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */
    361334                http_encode( s );
    362                 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %s %s", n->proto->name, n->nick );
     335                g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", n->proto, n->nick );
    363336                if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 )
    364337                {
     
    402375        for( a = irc->accounts; a; a = a->next )
    403376        {
    404                 if( !strcmp( a->prpl->name, "oscar" ) )
     377                if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC )
    405378                        g_snprintf( s, sizeof( s ), "account add oscar \"%s\" \"%s\" %s", a->user, a->pass, a->server );
    406379                else
    407380                        g_snprintf( s, sizeof( s ), "account add %s \"%s\" \"%s\" \"%s\"",
    408                                     a->prpl->name, a->user, a->pass, a->server ? a->server : "" );
     381                                    proto_name[a->protocol], a->user, a->pass, a->server ? a->server : "" );
    409382               
    410383                line = obfucrypt( irc, s );
  • commands.c

    rac55e50 rf712188  
    184184        if( g_strcasecmp( cmd[1], "add" ) == 0 )
    185185        {
    186                 struct prpl *prpl;
     186                int prot;
    187187               
    188188                if( cmd[2] == NULL || cmd[3] == NULL || cmd[4] == NULL )
     
    192192                }
    193193               
    194                 prpl = find_protocol(cmd[2]);
    195                
    196                 if( prpl == NULL )
     194                for( prot = 0; prot < PROTO_MAX; prot ++ )
     195                        if( proto_name[prot] && *proto_name[prot] && g_strcasecmp( proto_name[prot], cmd[2] ) == 0 )
     196                                break;
     197               
     198                if( ( prot == PROTO_MAX ) || ( proto_prpl[prot] == NULL ) )
    197199                {
    198200                        irc_usermsg( irc, "Unknown protocol" );
     
    200202                }
    201203
    202                 a = account_add( irc, prpl, cmd[3], cmd[4] );
     204                if( prot == PROTO_OSCAR && cmd[5] == NULL )
     205                {
     206                        irc_usermsg( irc, "Not enough parameters" );
     207                        return( 0 );
     208                }
     209               
     210                a = account_add( irc, prot, cmd[3], cmd[4] );
    203211               
    204212                if( cmd[5] )
     
    244252                                con = "";
    245253                       
    246                         irc_usermsg( irc, "%2d. %s, %s%s", i, a->prpl->name, a->user, con );
     254                        if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC )
     255                                irc_usermsg( irc, "%2d. OSCAR, %s on %s%s", i, a->user, a->server, con );
     256                        else
     257                                irc_usermsg( irc, "%2d. %s, %s%s", i, proto_name[a->protocol], a->user, con );
    247258                       
    248259                        i ++;
     
    361372                else
    362373                {
    363                         nick_set( irc, cmd[2], a->gc->prpl, cmd[3] );
     374                        nick_set( irc, cmd[2], a->gc->protocol, cmd[3] );
    364375                }
    365376        }
     
    442453        else if( u->send_handler == buddy_send_handler )
    443454        {
    444                 nick_set( irc, u->handle, u->gc->prpl, cmd[2] );
     455                nick_set( irc, u->handle, u->gc->protocol, cmd[2] );
    445456        }
    446457       
     
    653664        if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
    654665        {
    655                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     666                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
    656667                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Online" );
    657668                n_online ++;
     
    660671        if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
    661672        {
    662                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     673                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
    663674                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, u->away );
    664675                n_away ++;
     
    667678        if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
    668679        {
    669                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     680                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
    670681                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Offline" );
    671682                n_offline ++;
     
    728739        for( num = 0; q; q = q->next, num ++ )
    729740                if( q->gc ) /* Not necessary yet, but it might come later */
    730                         irc_usermsg( irc, "%d, %s(%s): %s", num, q->gc->prpl->name, q->gc->username, q->question );
     741                        irc_usermsg( irc, "%d, %s(%s): %s", num, proto_name[q->gc->protocol], q->gc->username, q->question );
    731742                else
    732743                        irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
     
    776787        for( n = gc->irc->nicks; n; n = n->next )
    777788        {
    778                 if( n->proto == gc->prpl && !user_findhandle( gc, n->handle ) )
     789                if( n->proto == gc->protocol && !user_findhandle( gc, n->handle ) )
    779790                {
    780791                        gc->prpl->add_buddy( gc, n->handle );
  • configure

    rac55e50 rf712188  
    1414datadir='$prefix/share/bitlbee/'
    1515config='/var/lib/bitlbee/'
    16 plugindir='$prefix/lib/bitlbee'
    1716
    1817msn=1
     
    4645--mandir=...                                            $mandir
    4746--datadir=...                                           $datadir
    48 --plugindir=...                                         $plugindir
    4947--config=...                                            $config
    5048
     
    7573datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
    7674config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
    77 plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
    7875
    7976cat<<EOF>Makefile.settings
     
    8481MANDIR=$mandir
    8582DATADIR=$datadir
    86 PLUGINDIR=$plugindir
    8783CONFIG=$config
    8884
     
    105101#define ETCDIR "$etcdir"
    106102#define VARDIR "$datadir"
    107 #define PLUGINDIR "$plugindir"
    108103#define ARCH "$arch"
    109104#define CPU "$cpu"
     
    148143if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then
    149144        cat<<EOF>>Makefile.settings
    150 EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0`
    151 CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0`
     145EFLAGS+=`pkg-config --libs glib-2.0`
     146CFLAGS+=`pkg-config --cflags glib-2.0`
    152147EOF
    153148        echo '#define GLIB2' >> config.h
  • irc.c

    rac55e50 rf712188  
    11651165                if( u->gc )
    11661166                        irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->user->username,
    1167                                    *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", u->gc->prpl->name );
     1167                                   *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", proto_name[u->gc->user->protocol] );
    11681168                else
    11691169                        irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO );
  • nick.c

    rac55e50 rf712188  
    2727#include "bitlbee.h"
    2828
    29 void nick_set( irc_t *irc, char *handle, struct prpl *proto, char *nick )
     29void nick_set( irc_t *irc, char *handle, int proto, char *nick )
    3030{
    3131        nick_t *m = NULL, *n = irc->nicks;
     
    5656}
    5757
    58 char *nick_get( irc_t *irc, char *handle, struct prpl *proto, const char *realname )
     58char *nick_get( irc_t *irc, char *handle, int proto, const char *realname )
    5959{
    6060        static char nick[MAX_NICK_LENGTH+1];
  • nick.h

    rac55e50 rf712188  
    2727{
    2828        char *handle;
    29         struct prpl *proto;
     29        int proto;
    3030        char *nick;
    3131        struct __NICK *next;
    3232} nick_t;
    3333
    34 void nick_set( irc_t *irc, char *handle, struct prpl *proto, char *nick );
    35 char *nick_get( irc_t *irc, char *handle, struct prpl *proto, const char *realname );
     34void nick_set( irc_t *irc, char *handle, int proto, char *nick );
     35char *nick_get( irc_t *irc, char *handle, int proto, const char *realname );
    3636void nick_del( irc_t *irc, char *nick );
    3737void nick_strip( char *nick );
  • protocols/jabber/jabber.c

    rac55e50 rf712188  
    157157#define JCS_CLOSED  3   /* closed */
    158158
     159
     160static char *jabber_name()
     161{
     162        return "Jabber";
     163}
    159164
    160165#define STATE_EVT(arg) if(gjc->on_state) { (gjc->on_state)(gjc, (arg) ); }
     
    23602365}
    23612366
    2362 
    2363 void jabber_init()
    2364 {
    2365         struct prpl *ret = g_new0(struct prpl, 1);
    2366 
     2367static struct prpl *my_protocol = NULL;
     2368
     2369void jabber_init(struct prpl *ret)
     2370{
    23672371        /* the NULL's aren't required but they're nice to have */
    2368         ret->name = "jabber";
     2372        ret->protocol = PROTO_JABBER;
     2373        ret->name = jabber_name;
    23692374        ret->away_states = jabber_away_states;
    23702375        ret->actions = jabber_actions;
     
    23902395        ret->cmp_buddynames = g_strcasecmp;
    23912396
    2392         register_protocol (ret);
    2393 }
     2397        my_protocol = ret;
     2398}
  • protocols/msn/msn.c

    rac55e50 rf712188  
    2626#include "nogaim.h"
    2727#include "msn.h"
     28
     29static struct prpl *my_protocol = NULL;
    2830
    2931static void msn_login( struct aim_user *acct )
     
    373375}
    374376
    375 void msn_init()
    376 {
    377         struct prpl *ret = g_new0(struct prpl, 1);
    378         ret->name = "msn";
     377void msn_init(struct prpl *ret)
     378{
     379        ret->protocol = PROTO_MSN;
    379380        ret->login = msn_login;
    380381        ret->close = msn_close;
     
    399400        ret->cmp_buddynames = g_strcasecmp;
    400401
    401         register_protocol(ret);
    402 }
     402        my_protocol = ret;
     403}
  • protocols/nogaim.c

    rac55e50 rf712188  
    3939#include <iconv.h>
    4040
     41struct prpl *proto_prpl[PROTO_MAX];
     42char proto_name[PROTO_MAX][8] = { "TOC", "OSCAR", "YAHOO", "ICQ", "MSN", "", "", "", "JABBER", "", "", "", "", "", "", "" };
     43
    4144static char *proto_away_alias[7][5] =
    4245{
     
    5558GSList *connections;
    5659
    57 #ifdef WITH_PLUGINS
    58 gboolean load_plugin(char *path)
    59 {
    60         void (*init_function) (void);
    61        
    62         GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY);
    63 
    64         if(!mod) {
    65                 log_message(LOGLVL_ERROR, "Can't find `%s', not loading", path);
    66                 return FALSE;
    67         }
    68 
    69         if(!g_module_symbol(mod,"init_plugin",(gpointer *) &init_function)) {
    70                 log_message(LOGLVL_WARNING, "Can't find function `init_plugin' in `%s'\n", path);
    71                 return FALSE;
    72         }
    73 
    74         init_function();
    75 
    76         return TRUE;
    77 }
    78 
    79 void load_plugins(void)
    80 {
    81         GDir *dir;
    82         GError *error = NULL;
    83 
    84         dir = g_dir_open(PLUGINDIR, 0, &error);
    85 
    86         if (dir) {
    87                 const gchar *entry;
    88                 char *path;
    89 
    90                 while ((entry = g_dir_read_name(dir))) {
    91                         path = g_build_filename(PLUGINDIR, entry, NULL);
    92                         if(!path) {
    93                                 log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);
    94                                 continue;
    95                         }
    96 
    97                         load_plugin(path);
    98 
    99                         g_free(path);
    100                 }
    101 
    102                 g_dir_close(dir);
    103         }
    104 }
     60
     61/* nogaim.c */
     62
     63void nogaim_init()
     64{
     65        proto_prpl[PROTO_MSN] = g_new0 ( struct prpl, 1 );
     66#ifdef WITH_MSN
     67        msn_init( proto_prpl[PROTO_MSN] );
    10568#endif
    10669
    107 /* nogaim.c */
    108 
    109 GList *protocols = NULL;
    110  
    111 void register_protocol (struct prpl *p)
    112 {
    113         protocols = g_list_append(protocols, p);
    114 }
    115 
    116  
    117 struct prpl *find_protocol(const char *name)
    118 {
    119         GList *gl;
    120         for (gl = protocols; gl; gl = gl->next)
    121         {
    122                 struct prpl *proto = gl->data;
    123                 if(!g_strcasecmp(proto->name, name))
    124                         return proto;
    125         }
    126         return NULL;
    127 }
    128 
    129 /* nogaim.c */
    130 void nogaim_init()
    131 {
    132         extern void msn_init();
    133         extern void oscar_init();
    134         extern void byahoo_init();
    135         extern void jabber_init();
    136 
    137 #ifdef WITH_MSN
    138         msn_init();
     70        proto_prpl[PROTO_OSCAR] = g_new0( struct prpl, 1 );
     71#ifdef WITH_OSCAR
     72        oscar_init( proto_prpl[PROTO_OSCAR] );
    13973#endif
    140 
    141 #ifdef WITH_OSCAR
    142         oscar_init();
     74       
     75        proto_prpl[PROTO_YAHOO] = g_new0( struct prpl, 1 );
     76#ifdef WITH_YAHOO
     77        byahoo_init( proto_prpl[PROTO_YAHOO] );
    14378#endif
    14479       
    145 #ifdef WITH_YAHOO
    146         byahoo_init();
    147 #endif
    148        
     80        proto_prpl[PROTO_JABBER] = g_new0( struct prpl, 1 );
    14981#ifdef WITH_JABBER
    150         jabber_init();
    151 #endif
    152 
    153 #ifdef WITH_PLUGINS
    154         load_plugins();
     82        jabber_init( proto_prpl[PROTO_JABBER] );
    15583#endif
    15684}
     
    244172        gc = g_new0( struct gaim_connection, 1 );
    245173       
    246         gc->prpl = user->prpl;
     174        gc->protocol = user->protocol;
     175        gc->prpl = proto_prpl[gc->protocol];
    247176        g_snprintf( gc->username, sizeof( gc->username ), "%s", user->username );
    248177        g_snprintf( gc->password, sizeof( gc->password ), "%s", user->password );
     
    325254        /* Try to find a different connection on the same protocol. */
    326255        for( a = gc->irc->accounts; a; a = a->next )
    327                 if( a->prpl == gc->prpl && a->gc != gc )
     256                if( proto_prpl[a->protocol] == gc->prpl && a->gc != gc )
    328257                        break;
    329258       
    330259        /* If we found one, add the screenname to the acc_id. */
    331260        if( a )
    332                 g_snprintf( acc_id, 32, "%s(%s)", gc->prpl->name, gc->username );
     261                g_snprintf( acc_id, 32, "%s(%s)", proto_name[gc->protocol], gc->username );
    333262        else
    334                 g_snprintf( acc_id, 32, "%s", gc->prpl->name );
     263                g_snprintf( acc_id, 32, "%s", proto_name[gc->protocol] );
    335264       
    336265        irc_usermsg( gc->irc, "%s - %s", acc_id, msg );
     
    366295        if( u && u->away ) proto_away( gc, u->away );
    367296       
    368         if( !strcmp(gc->prpl->name, "icq") )
     297        if( gc->protocol == PROTO_ICQ )
    369298        {
    370299                for( u = gc->irc->users; u; u = u->next )
     
    494423       
    495424        memset( nick, 0, MAX_NICK_LENGTH + 1 );
    496         strcpy( nick, nick_get( gc->irc, handle, gc->prpl, realname ) );
     425        strcpy( nick, nick_get( gc->irc, handle, gc->protocol, realname ) );
    497426       
    498427        u = user_add( gc->irc, nick );
     
    518447        else
    519448        {
    520                 u->host = g_strdup( gc->user->prpl->name );
     449                u->host = g_strdup( proto_name[gc->user->protocol] );
    521450                u->user = g_strdup( handle );
    522451        }
     
    647576        }
    648577       
    649         if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) )
     578        if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_OSCAR || gc->protocol == PROTO_TOC ) )
    650579        {
    651580                u->away = g_strdup( "Away" );
    652581        }
    653         else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber") ) )
     582        else if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_JABBER ) )
    654583        {
    655584                if( type & UC_DND )
  • protocols/nogaim.h

    rac55e50 rf712188  
    7272        /* we need to do either oscar or TOC */
    7373        /* we make this as an int in case if we want to add more protocols later */
     74        int protocol;
    7475        struct prpl *prpl;
    7576        guint32 flags;
     
    151152        char user_info[2048];
    152153        int options;
    153         struct prpl *prpl;
     154        int protocol;
    154155        /* prpls can use this to save information about the user,
    155156         * like which server to connect to, etc */
     
    160161};
    161162
    162 struct ft
    163 {
    164         const char *filename;
    165        
    166         /* Total number of bytes in file */
    167         size_t total_bytes;
    168        
    169         /* Current number of bytes received */
    170         size_t cur_bytes;
    171 };
    172 
    173 struct ft_request
    174 {
    175         const char *filename;
    176         struct gaim_connection *gc;
    177 };
    178 
    179 typedef void (*ft_recv_handler) (struct ft *, void *data, size_t len);
    180 
    181163struct prpl {
     164        int protocol;
    182165        int options;
    183         const char *name;
     166        char *(* name)();
    184167
    185168        /* for ICQ and Yahoo, who have off/on per-conversation options */
     
    234217        void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
    235218
    236         /* file transfers */
    237         struct ft_send_req *(* req_send_file) (struct gaim_connection *, const char *file);
    238         void (* send_file_part) (struct gaim_connection *, struct ft*, void *data, size_t length);
    239         void (* accept_recv_file) (struct gaim_connection *, struct ft*, ft_recv_handler);
    240 
    241219        void (* buddy_free)     (struct buddy *);
    242220
     
    245223        int (* cmp_buddynames) (const char *who1, const char *who2);
    246224};
     225
     226#define PROTO_TOC       0
     227#define PROTO_OSCAR     1
     228#define PROTO_YAHOO     2
     229#define PROTO_ICQ       3
     230#define PROTO_MSN       4
     231#define PROTO_IRC       5
     232#define PROTO_FTP       6
     233#define PROTO_VGATE     7
     234#define PROTO_JABBER    8
     235#define PROTO_NAPSTER   9
     236#define PROTO_ZEPHYR    10
     237#define PROTO_GADUGADU  11
     238#define PROTO_MAX       16
     239
     240extern char proto_name[PROTO_MAX][8];
    247241
    248242#define UC_UNAVAILABLE  1
     
    255249
    256250G_MODULE_EXPORT GSList *get_connections();
    257 G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
    258 G_MODULE_EXPORT void register_protocol(struct prpl *);
     251extern struct prpl *proto_prpl[16];
    259252
    260253/* nogaim.c */
     
    326319G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);
    327320
    328 /* file transfers */
    329 G_MODULE_EXPORT void ft_progress( struct ft *, int);
    330 G_MODULE_EXPORT void ft_incoming( struct ft_request * );
    331 G_MODULE_EXPORT void ft_accepted( struct ft_request *, struct ft *);
    332 G_MODULE_EXPORT void ft_denied( struct ft_request *, const char *reason);
     321#ifdef WITH_MSN
     322/* msn.c */
     323G_MODULE_EXPORT void msn_init( struct prpl *ret );
     324#endif
     325
     326#ifdef WITH_OSCAR
     327/* oscar.c */
     328G_MODULE_EXPORT void oscar_init( struct prpl *ret );
     329#endif
     330
     331#ifdef WITH_JABBER
     332/* jabber.c */
     333G_MODULE_EXPORT void jabber_init( struct prpl *ret );
     334#endif
     335
     336#ifdef WITH_YAHOO
     337/* yahoo.c */
     338G_MODULE_EXPORT void byahoo_init( struct prpl *ret );
     339#endif
    333340
    334341/* prefs.c */
  • protocols/oscar/oscar.c

    rac55e50 rf712188  
    358358                odata->icq = TRUE;
    359359                /* this is odd but it's necessary for a proper do_import and do_export */
     360                gc->protocol = PROTO_ICQ;
    360361                gc->password[8] = 0;
    361362        } else {
     363                gc->protocol = PROTO_TOC;
    362364                gc->flags |= OPT_CONN_HTML;
    363365        }
     
    24822484}
    24832485
    2484 void oscar_init()
    2485 {
    2486         struct prpl *ret = g_new0(struct prpl, 1);
    2487         ret->name = "oscar";
     2486static struct prpl *my_protocol = NULL;
     2487
     2488void oscar_init(struct prpl *ret) {
     2489        ret->protocol = PROTO_OSCAR;
    24882490        ret->away_states = oscar_away_states;
    24892491        ret->login = oscar_login;
     
    25032505        ret->cmp_buddynames = aim_sncmp;
    25042506        ret->get_status_string = oscar_get_status_string;
     2507
    25052508        ret->send_typing = oscar_send_typing;
    25062509
    2507         register_protocol(ret);
    2508 }
     2510        my_protocol = ret;
     2511}
  • protocols/proxy.c

    rac55e50 rf712188  
    5050#define GAIM_ERR_COND   (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
    5151
     52/*FIXME*               
     53        #ifndef _WIN32
     54                if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
     55                        closesocket(fd);
     56                        g_free(phb);
     57                        return -1;
     58                }
     59                fcntl(fd, F_SETFL, 0);
     60#endif*/
     61
    5262char proxyhost[128] = "";
    5363int proxyport = 0;
  • protocols/yahoo/yahoo.c

    rac55e50 rf712188  
    6464};
    6565
     66static char *yahoo_name()
     67{
     68        return "Yahoo";
     69}
     70
     71static struct prpl *my_protocol = NULL;
    6672static GSList *byahoo_inputs = NULL;
    6773static int byahoo_chat_id = 0;
     
    390396}
    391397
    392 void byahoo_init( )
    393 {
    394         struct prpl *ret = g_new0(struct prpl, 1);
    395         ret->name = "yahoo";
     398void byahoo_init( struct prpl *ret )
     399{
     400        ret->protocol = PROTO_YAHOO;
     401        ret->name = yahoo_name;
    396402       
    397403        ret->login = byahoo_login;
    398404        ret->close = byahoo_close;
    399405        ret->send_im = byahoo_send_im;
     406        ret->send_typing = byahoo_send_typing;
    400407        ret->get_info = byahoo_get_info;
    401408        ret->away_states = byahoo_away_states;
     
    405412        ret->remove_buddy = byahoo_remove_buddy;
    406413        ret->get_status_string = byahoo_get_status_string;
    407         ret->send_typing = byahoo_send_typing;
    408414       
    409415        ret->chat_send = byahoo_chat_send;
     
    413419        ret->cmp_buddynames = g_strcasecmp;
    414420       
    415         register_protocol(ret);
     421        my_protocol = ret;
    416422}
    417423
     
    427433                yd = gc->proto_data;
    428434               
    429                 if( !strcmp(gc->prpl->name, "yahoo") && yd->y2_id == id )
     435                if( gc->protocol == PROTO_YAHOO && yd->y2_id == id )
    430436                        return( gc );
    431437        }
  • unix.c

    rac55e50 rf712188  
    4747       
    4848        log_init( );
    49 
    50         nogaim_init();
    51 
     49        nogaim_init( );
     50       
    5251        CONF_FILE = g_strdup( CONF_FILE_DEF );
    5352       
  • url.h

    rac55e50 rf712188  
    2626#include "bitlbee.h"
    2727
    28 #define PROTO_FTP               1
    29 #define PROTO_HTTP              2
     28#define PROTO_HTTP      2
    3029#define PROTO_SOCKS4    3
    3130#define PROTO_SOCKS5    4
Note: See TracChangeset for help on using the changeset viewer.