Changes in / [703f0f7:22bf64e]
- Files:
-
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
r703f0f7 r22bf64e 28 28 #include "account.h" 29 29 30 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )30 account_t *account_add( irc_t *irc, int protocol, char *user, char *pass ) 31 31 { 32 32 account_t *a; … … 42 42 } 43 43 44 a->pr pl = prpl;44 a->protocol = protocol; 45 45 a->user = g_strdup( user ); 46 46 a->pass = g_strdup( pass ); … … 66 66 for( a = irc->accounts; a; a = a->next ) 67 67 { 68 if( g_strcasecmp( id, a->prpl->name) == 0 )68 if( g_strcasecmp( id, proto_name[a->protocol] ) == 0 ) 69 69 { 70 70 if( !ret ) … … 124 124 } 125 125 126 if (a->prpl== NULL )126 if( proto_prpl[a->protocol]->login == NULL ) 127 127 { 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] ); 129 129 return; 130 130 } … … 134 134 u = g_new0 ( struct aim_user, 1 ); 135 135 u->irc = irc; 136 u->pr pl = a->prpl;136 u->protocol = a->protocol; 137 137 strncpy( u->username, a->user, sizeof( u->username ) - 1 ); 138 138 strncpy( u->password, a->pass, sizeof( u->password ) - 1 ); … … 142 142 a->reconnect = 0; 143 143 144 a->prpl->login( u );144 proto_prpl[a->protocol]->login( u ); 145 145 } 146 146 -
account.h
r703f0f7 r22bf64e 29 29 typedef struct account 30 30 { 31 struct prpl *prpl;31 int protocol; 32 32 char *user; 33 33 char *pass; … … 41 41 } account_t; 42 42 43 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass );43 account_t *account_add( irc_t *irc, int protocol, char *user, char *pass ); 44 44 account_t *account_get( irc_t *irc, char *id ); 45 45 void account_del( irc_t *irc, account_t *acc ); -
commands.c
r703f0f7 r22bf64e 166 166 if( g_strcasecmp( cmd[1], "add" ) == 0 ) 167 167 { 168 struct prpl *prpl;168 int prot; 169 169 170 170 if( cmd[2] == NULL || cmd[3] == NULL || cmd[4] == NULL ) … … 174 174 } 175 175 176 prpl = find_protocol(cmd[2]); 177 178 if( prpl == NULL ) 176 for( prot = 0; prot < PROTO_MAX; prot ++ ) 177 if( proto_name[prot] && *proto_name[prot] && g_strcasecmp( proto_name[prot], cmd[2] ) == 0 ) 178 break; 179 180 if( ( prot == PROTO_MAX ) || ( proto_prpl[prot] == NULL ) ) 179 181 { 180 182 irc_usermsg( irc, "Unknown protocol" ); … … 182 184 } 183 185 184 a = account_add( irc, prpl, cmd[3], cmd[4] ); 186 if( prot == PROTO_OSCAR && cmd[5] == NULL ) 187 { 188 irc_usermsg( irc, "Not enough parameters" ); 189 return( 0 ); 190 } 191 192 a = account_add( irc, prot, cmd[3], cmd[4] ); 185 193 186 194 if( cmd[5] ) … … 226 234 con = ""; 227 235 228 irc_usermsg( irc, "%2d. %s, %s%s", i, a->prpl->name, a->user, con ); 236 if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC ) 237 irc_usermsg( irc, "%2d. OSCAR, %s on %s%s", i, a->user, a->server, con ); 238 else 239 irc_usermsg( irc, "%2d. %s, %s%s", i, proto_name[a->protocol], a->user, con ); 229 240 230 241 i ++; … … 343 354 else 344 355 { 345 nick_set( irc, cmd[2], a->gc->pr pl, cmd[3] );356 nick_set( irc, cmd[2], a->gc->protocol, cmd[3] ); 346 357 } 347 358 } … … 424 435 else if( u->send_handler == buddy_send_handler ) 425 436 { 426 nick_set( irc, u->handle, u->gc->pr pl, cmd[2] );437 nick_set( irc, u->handle, u->gc->protocol, cmd[2] ); 427 438 } 428 439 … … 635 646 if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away ) 636 647 { 637 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name);648 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] ); 638 649 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Online" ); 639 650 n_online ++; … … 642 653 if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away ) 643 654 { 644 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name);655 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] ); 645 656 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, u->away ); 646 657 n_away ++; … … 649 660 if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online ) 650 661 { 651 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name);662 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] ); 652 663 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Offline" ); 653 664 n_offline ++; … … 710 721 for( num = 0; q; q = q->next, num ++ ) 711 722 if( q->gc ) /* Not necessary yet, but it might come later */ 712 irc_usermsg( irc, "%d, %s(%s): %s", num, q->gc->prpl->name, q->gc->username, q->question );723 irc_usermsg( irc, "%d, %s(%s): %s", num, proto_name[q->gc->protocol], q->gc->username, q->question ); 713 724 else 714 725 irc_usermsg( irc, "%d, BitlBee: %s", num, q->question ); … … 758 769 for( n = gc->irc->nicks; n; n = n->next ) 759 770 { 760 if( n->proto == gc->pr pl && !user_findhandle( gc, n->handle ) )771 if( n->proto == gc->protocol && !user_findhandle( gc, n->handle ) ) 761 772 { 762 773 gc->prpl->add_buddy( gc, n->handle ); -
configure
r703f0f7 r22bf64e 14 14 datadir='$prefix/share/bitlbee/' 15 15 config='/var/lib/bitlbee/' 16 plugindir='$prefix/lib/bitlbee'17 16 18 17 msn=1 … … 46 45 --mandir=... $mandir 47 46 --datadir=... $datadir 48 --plugindir=... $plugindir49 47 --config=... $config 50 48 … … 74 72 datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` 75 73 config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` 76 plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`77 74 78 75 cat<<EOF>Makefile.settings … … 83 80 MANDIR=$mandir 84 81 DATADIR=$datadir 85 PLUGINDIR=$plugindir86 82 CONFIG=$config 87 83 … … 104 100 #define ETCDIR "$etcdir" 105 101 #define VARDIR "$datadir" 106 #define PLUGINDIR "$plugindir"107 102 #define ARCH "$arch" 108 103 #define CPU "$cpu" … … 147 142 if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then 148 143 cat<<EOF>>Makefile.settings 149 EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0`150 CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0`144 EFLAGS+=`pkg-config --libs glib-2.0` 145 CFLAGS+=`pkg-config --cflags glib-2.0` 151 146 EOF 152 147 echo '#define GLIB2' >> config.h -
irc.c
r703f0f7 r22bf64e 1186 1186 if( u->gc ) 1187 1187 irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->user->username, 1188 *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", u->gc->prpl->name);1188 *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", proto_name[u->gc->user->protocol] ); 1189 1189 else 1190 1190 irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO ); -
nick.c
r703f0f7 r22bf64e 27 27 #include "bitlbee.h" 28 28 29 void nick_set( irc_t *irc, const char *handle, struct prpl *proto, const char *nick )29 void nick_set( irc_t *irc, const char *handle, int proto, const char *nick ) 30 30 { 31 31 nick_t *m = NULL, *n = irc->nicks; … … 56 56 } 57 57 58 char *nick_get( irc_t *irc, const char *handle, struct prpl *proto, const char *realname )58 char *nick_get( irc_t *irc, const char *handle, int proto, const char *realname ) 59 59 { 60 60 static char nick[MAX_NICK_LENGTH+1]; -
nick.h
r703f0f7 r22bf64e 27 27 { 28 28 char *handle; 29 struct prpl *proto;29 int proto; 30 30 char *nick; 31 31 struct __NICK *next; 32 32 } nick_t; 33 33 34 void nick_set( irc_t *irc, const char *handle, struct prpl *proto, const char *nick );35 char *nick_get( irc_t *irc, const char *handle, struct prpl *proto, const char *realname );34 void nick_set( irc_t *irc, const char *handle, int proto, const char *nick ); 35 char *nick_get( irc_t *irc, const char *handle, int proto, const char *realname ); 36 36 void nick_del( irc_t *irc, const char *nick ); 37 37 void nick_strip( char *nick ); -
protocols/jabber/jabber.c
r703f0f7 r22bf64e 155 155 #define JCS_CLOSED 3 /* closed */ 156 156 157 158 static char *jabber_name() 159 { 160 return "Jabber"; 161 } 157 162 158 163 #define STATE_EVT(arg) if(gjc->on_state) { (gjc->on_state)(gjc, (arg) ); } … … 2363 2368 } 2364 2369 2365 2366 void jabber_init() 2367 { 2368 struct prpl *ret = g_new0(struct prpl, 1); 2369 2370 static struct prpl *my_protocol = NULL; 2371 2372 void jabber_init(struct prpl *ret) 2373 { 2370 2374 /* the NULL's aren't required but they're nice to have */ 2371 ret->name = "jabber"; 2375 ret->protocol = PROTO_JABBER; 2376 ret->name = jabber_name; 2372 2377 ret->away_states = jabber_away_states; 2373 2378 ret->actions = jabber_actions; … … 2393 2398 ret->cmp_buddynames = g_strcasecmp; 2394 2399 2395 register_protocol (ret);2396 } 2400 my_protocol = ret; 2401 } -
protocols/msn/msn.c
r703f0f7 r22bf64e 26 26 #include "nogaim.h" 27 27 #include "msn.h" 28 29 static struct prpl *my_protocol = NULL; 28 30 29 31 static void msn_login( struct aim_user *acct ) … … 373 375 } 374 376 375 void msn_init() 376 { 377 struct prpl *ret = g_new0(struct prpl, 1); 378 ret->name = "msn"; 377 void msn_init(struct prpl *ret) 378 { 379 ret->protocol = PROTO_MSN; 379 380 ret->login = msn_login; 380 381 ret->close = msn_close; … … 399 400 ret->cmp_buddynames = g_strcasecmp; 400 401 401 register_protocol(ret);402 } 402 my_protocol = ret; 403 } -
protocols/nogaim.c
r703f0f7 r22bf64e 39 39 #include <iconv.h> 40 40 41 struct prpl *proto_prpl[PROTO_MAX]; 42 char proto_name[PROTO_MAX][8] = { "TOC", "OSCAR", "YAHOO", "ICQ", "MSN", "", "", "", "JABBER", "", "", "", "", "", "", "" }; 43 41 44 static char *proto_away_alias[7][5] = 42 45 { … … 55 58 GSList *connections; 56 59 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 63 void nogaim_init() 64 { 65 proto_prpl[PROTO_MSN] = g_new0 ( struct prpl, 1 ); 66 #ifdef WITH_MSN 67 msn_init( proto_prpl[PROTO_MSN] ); 105 68 #endif 106 69 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] ); 139 73 #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] ); 143 78 #endif 144 79 145 #ifdef WITH_YAHOO 146 byahoo_init(); 147 #endif 148 80 proto_prpl[PROTO_JABBER] = g_new0( struct prpl, 1 ); 149 81 #ifdef WITH_JABBER 150 jabber_init(); 151 #endif 152 153 #ifdef WITH_PLUGINS 154 load_plugins(); 82 jabber_init( proto_prpl[PROTO_JABBER] ); 155 83 #endif 156 84 } … … 244 172 gc = g_new0( struct gaim_connection, 1 ); 245 173 246 gc->prpl = user->prpl; 174 gc->protocol = user->protocol; 175 gc->prpl = proto_prpl[gc->protocol]; 247 176 g_snprintf( gc->username, sizeof( gc->username ), "%s", user->username ); 248 177 g_snprintf( gc->password, sizeof( gc->password ), "%s", user->password ); … … 325 254 /* Try to find a different connection on the same protocol. */ 326 255 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 ) 328 257 break; 329 258 330 259 /* If we found one, add the screenname to the acc_id. */ 331 260 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 ); 333 262 else 334 g_snprintf( acc_id, 32, "%s", gc->prpl->name);263 g_snprintf( acc_id, 32, "%s", proto_name[gc->protocol] ); 335 264 336 265 irc_usermsg( gc->irc, "%s - %s", acc_id, msg ); … … 366 295 if( u && u->away ) proto_away( gc, u->away ); 367 296 368 if( !strcmp(gc->prpl->name, "icq"))297 if( gc->protocol == PROTO_ICQ ) 369 298 { 370 299 for( u = gc->irc->users; u; u = u->next ) … … 501 430 502 431 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 503 strcpy( nick, nick_get( gc->irc, handle, gc->pr pl, realname ) );432 strcpy( nick, nick_get( gc->irc, handle, gc->protocol, realname ) ); 504 433 505 434 u = user_add( gc->irc, nick ); … … 525 454 else 526 455 { 527 u->host = g_strdup( gc->user->prpl->name);456 u->host = g_strdup( proto_name[gc->user->protocol] ); 528 457 u->user = g_strdup( handle ); 529 458 } … … 654 583 } 655 584 656 if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) )585 if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_OSCAR || gc->protocol == PROTO_TOC ) ) 657 586 { 658 587 u->away = g_strdup( "Away" ); 659 588 } 660 else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber")) )589 else if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_JABBER ) ) 661 590 { 662 591 if( type & UC_DND ) -
protocols/nogaim.h
r703f0f7 r22bf64e 72 72 /* we need to do either oscar or TOC */ 73 73 /* we make this as an int in case if we want to add more protocols later */ 74 int protocol; 74 75 struct prpl *prpl; 75 76 guint32 flags; … … 151 152 char user_info[2048]; 152 153 int options; 153 struct prpl *prpl;154 int protocol; 154 155 /* prpls can use this to save information about the user, 155 156 * like which server to connect to, etc */ … … 161 162 162 163 struct prpl { 164 int protocol; 163 165 int options; 164 c onst char *name;166 char *(* name)(); 165 167 166 168 /* for ICQ and Yahoo, who have off/on per-conversation options */ … … 222 224 }; 223 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 240 extern char proto_name[PROTO_MAX][8]; 241 224 242 #define UC_UNAVAILABLE 1 225 243 … … 231 249 232 250 G_MODULE_EXPORT GSList *get_connections(); 233 G_MODULE_EXPORT struct prpl *find_protocol(const char *name); 234 G_MODULE_EXPORT void register_protocol(struct prpl *); 251 extern struct prpl *proto_prpl[16]; 235 252 236 253 /* nogaim.c */ … … 302 319 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value); 303 320 321 #ifdef WITH_MSN 322 /* msn.c */ 323 G_MODULE_EXPORT void msn_init( struct prpl *ret ); 324 #endif 325 326 #ifdef WITH_OSCAR 327 /* oscar.c */ 328 G_MODULE_EXPORT void oscar_init( struct prpl *ret ); 329 #endif 330 331 #ifdef WITH_JABBER 332 /* jabber.c */ 333 G_MODULE_EXPORT void jabber_init( struct prpl *ret ); 334 #endif 335 336 #ifdef WITH_YAHOO 337 /* yahoo.c */ 338 G_MODULE_EXPORT void byahoo_init( struct prpl *ret ); 339 #endif 340 304 341 /* prefs.c */ 305 342 G_MODULE_EXPORT void build_block_list(); -
protocols/oscar/oscar.c
r703f0f7 r22bf64e 357 357 odata->icq = TRUE; 358 358 /* this is odd but it's necessary for a proper do_import and do_export */ 359 gc->protocol = PROTO_ICQ; 359 360 gc->password[8] = 0; 360 361 } else { 362 gc->protocol = PROTO_TOC; 361 363 gc->flags |= OPT_CONN_HTML; 362 364 } … … 2632 2634 } 2633 2635 2634 void oscar_init() 2635 { 2636 struct prpl *ret = g_new0(struct prpl, 1); 2637 ret-> name = "oscar";2636 static struct prpl *my_protocol = NULL; 2637 2638 void oscar_init(struct prpl *ret) { 2639 ret->protocol = PROTO_OSCAR; 2638 2640 ret->away_states = oscar_away_states; 2639 2641 ret->login = oscar_login; … … 2657 2659 ret->cmp_buddynames = aim_sncmp; 2658 2660 ret->get_status_string = oscar_get_status_string; 2661 2659 2662 ret->send_typing = oscar_send_typing; 2660 2663 2661 register_protocol(ret);2662 } 2664 my_protocol = ret; 2665 } -
protocols/yahoo/yahoo.c
r703f0f7 r22bf64e 64 64 }; 65 65 66 static char *yahoo_name() 67 { 68 return "Yahoo"; 69 } 70 71 static struct prpl *my_protocol = NULL; 66 72 static GSList *byahoo_inputs = NULL; 67 73 static int byahoo_chat_id = 0; … … 390 396 } 391 397 392 void byahoo_init( )393 { 394 struct prpl *ret = g_new0(struct prpl, 1);395 ret->name = "yahoo";398 void byahoo_init( struct prpl *ret ) 399 { 400 ret->protocol = PROTO_YAHOO; 401 ret->name = yahoo_name; 396 402 397 403 ret->login = byahoo_login; 398 404 ret->close = byahoo_close; 399 405 ret->send_im = byahoo_send_im; 406 ret->send_typing = byahoo_send_typing; 400 407 ret->get_info = byahoo_get_info; 401 408 ret->away_states = byahoo_away_states; … … 405 412 ret->remove_buddy = byahoo_remove_buddy; 406 413 ret->get_status_string = byahoo_get_status_string; 407 ret->send_typing = byahoo_send_typing;408 414 409 415 ret->chat_send = byahoo_chat_send; … … 413 419 ret->cmp_buddynames = g_strcasecmp; 414 420 415 register_protocol(ret);421 my_protocol = ret; 416 422 } 417 423 … … 427 433 yd = gc->proto_data; 428 434 429 if( !strcmp(gc->prpl->name, "yahoo")&& yd->y2_id == id )435 if( gc->protocol == PROTO_YAHOO && yd->y2_id == id ) 430 436 return( gc ); 431 437 } -
storage_text.c
r703f0f7 r22bf64e 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 30 /* DO NOT USE THIS FUNCTION IN NEW CODE. This31 * function is here merely because the save/load code still uses32 * ids rather then names */33 static struct prpl *find_protocol_by_id(int id)34 {35 switch (id) {36 case 1: return find_protocol("oscar");37 case 4: return find_protocol("msn");38 case 2: return find_protocol("yahoo");39 case 8: return find_protocol("jabber");40 default: break;41 }42 return NULL;43 }44 45 static int find_protocol_id(const char *name)46 {47 if (!strcmp(name, "oscar")) return 1;48 if (!strcmp(name, "msn")) return 4;49 if (!strcmp(name, "yahoo")) return 2;50 if (!strcmp(name, "jabber")) return 8;51 52 return -1;53 }54 55 29 56 30 static void text_init (void) … … 105 79 while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 ) 106 80 { 107 struct prpl *prpl;108 109 prpl = find_protocol_by_id(proto);110 111 if (!prpl)112 continue;113 114 81 http_decode( s ); 115 nick_set( irc, s, pr pl, nick );82 nick_set( irc, s, proto, nick ); 116 83 } 117 84 fclose( fp ); … … 178 145 s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */ 179 146 http_encode( s ); 180 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", find_protocol_id(n->proto->name), n->nick );147 g_snprintf( s + strlen( s ), 510 - strlen( s ), " %d %s", n->proto, n->nick ); 181 148 if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 ) 182 149 { … … 220 187 for( a = irc->accounts; a; a = a->next ) 221 188 { 222 if( !strcmp(a->prpl->name, "oscar"))189 if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC ) 223 190 g_snprintf( s, sizeof( s ), "account add oscar \"%s\" \"%s\" %s", a->user, a->pass, a->server ); 224 191 else 225 192 g_snprintf( s, sizeof( s ), "account add %s \"%s\" \"%s\" \"%s\"", 226 a->prpl->name, a->user, a->pass, a->server ? a->server : "" );193 proto_name[a->protocol], a->user, a->pass, a->server ? a->server : "" ); 227 194 228 195 line = obfucrypt( s, irc->password ); -
unix.c
r703f0f7 r22bf64e 47 47 48 48 log_init( ); 49 50 nogaim_init(); 51 49 nogaim_init( ); 50 52 51 CONF_FILE = g_strdup( CONF_FILE_DEF ); 53 52 -
url.h
r703f0f7 r22bf64e 26 26 #include "bitlbee.h" 27 27 28 #define PROTO_FTP 1 29 #define PROTO_HTTP 2 28 #define PROTO_HTTP 2 30 29 #define PROTO_SOCKS4 3 31 30 #define PROTO_SOCKS5 4
Note: See TracChangeset
for help on using the changeset viewer.