Changes in / [b135438:c1ede6e8]
- Files:
-
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
rb135438 rc1ede6e8 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
rb135438 rc1ede6e8 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 ); -
bitlbee.c
rb135438 rc1ede6e8 236 236 } 237 237 238 /* DO NOT USE THIS FUNCTION IN NEW CODE. This239 * function is here merely because the save/load code still uses240 * 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 253 238 int bitlbee_load( irc_t *irc, char* password ) 254 239 { 255 240 char s[512]; 256 241 char *line; 257 char proto[20];242 int proto; 258 243 char nick[MAX_NICK_LENGTH+1]; 259 244 FILE *fp; … … 290 275 fp = fopen( s, "r" ); 291 276 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 { 306 279 http_decode( s ); 307 nick_set( irc, s, pr pl, nick );280 nick_set( irc, s, proto, nick ); 308 281 } 309 282 fclose( fp ); … … 360 333 s[169] = 0; /* Prevent any overflow (169 ~ 512 / 3) */ 361 334 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 ); 363 336 if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 ) 364 337 { … … 402 375 for( a = irc->accounts; a; a = a->next ) 403 376 { 404 if( !strcmp( a->prpl->name, "oscar" ))377 if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC ) 405 378 g_snprintf( s, sizeof( s ), "account add oscar \"%s\" \"%s\" %s", a->user, a->pass, a->server ); 406 379 else 407 380 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 : "" ); 409 382 410 383 line = obfucrypt( irc, s ); -
commands.c
rb135438 rc1ede6e8 184 184 if( g_strcasecmp( cmd[1], "add" ) == 0 ) 185 185 { 186 struct prpl *prpl;186 int prot; 187 187 188 188 if( cmd[2] == NULL || cmd[3] == NULL || cmd[4] == NULL ) … … 192 192 } 193 193 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 ) ) 197 199 { 198 200 irc_usermsg( irc, "Unknown protocol" ); … … 200 202 } 201 203 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] ); 203 211 204 212 if( cmd[5] ) … … 244 252 con = ""; 245 253 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 ); 247 258 248 259 i ++; … … 361 372 else 362 373 { 363 nick_set( irc, cmd[2], a->gc->pr pl, cmd[3] );374 nick_set( irc, cmd[2], a->gc->protocol, cmd[3] ); 364 375 } 365 376 } … … 442 453 else if( u->send_handler == buddy_send_handler ) 443 454 { 444 nick_set( irc, u->handle, u->gc->pr pl, cmd[2] );455 nick_set( irc, u->handle, u->gc->protocol, cmd[2] ); 445 456 } 446 457 … … 653 664 if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away ) 654 665 { 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] ); 656 667 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Online" ); 657 668 n_online ++; … … 660 671 if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away ) 661 672 { 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] ); 663 674 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, u->away ); 664 675 n_away ++; … … 667 678 if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online ) 668 679 { 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] ); 670 681 irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Offline" ); 671 682 n_offline ++; … … 773 784 for( n = gc->irc->nicks; n; n = n->next ) 774 785 { 775 if( n->proto == gc->pr pl && !user_findhandle( gc, n->handle ) )786 if( n->proto == gc->protocol && !user_findhandle( gc, n->handle ) ) 776 787 { 777 788 gc->prpl->add_buddy( gc, n->handle ); -
configure
rb135438 rc1ede6e8 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 … … 75 73 datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` 76 74 config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` 77 plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`78 75 79 76 cat<<EOF>Makefile.settings … … 84 81 MANDIR=$mandir 85 82 DATADIR=$datadir 86 PLUGINDIR=$plugindir87 83 CONFIG=$config 88 84 … … 105 101 #define ETCDIR "$etcdir" 106 102 #define VARDIR "$datadir" 107 #define PLUGINDIR "$plugindir"108 103 #define ARCH "$arch" 109 104 #define CPU "$cpu" … … 146 141 if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then 147 142 cat<<EOF>>Makefile.settings 148 EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0`149 CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0`143 EFLAGS+=`pkg-config --libs glib-2.0` 144 CFLAGS+=`pkg-config --cflags glib-2.0` 150 145 EOF 151 146 echo '#define GLIB2' >> config.h -
irc.c
rb135438 rc1ede6e8 1153 1153 if( u->gc ) 1154 1154 irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->user->username, 1155 *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", u->gc->prpl->name);1155 *u->gc->user->proto_opt[0] ? u->gc->user->proto_opt[0] : "", proto_name[u->gc->user->protocol] ); 1156 1156 else 1157 1157 irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO ); -
nick.c
rb135438 rc1ede6e8 27 27 #include "bitlbee.h" 28 28 29 void nick_set( irc_t *irc, char *handle, struct prpl *proto, char *nick )29 void nick_set( irc_t *irc, char *handle, int proto, char *nick ) 30 30 { 31 31 nick_t *m = NULL, *n = irc->nicks; … … 56 56 } 57 57 58 char *nick_get( irc_t *irc, char *handle, struct prpl *proto, const char *realname )58 char *nick_get( irc_t *irc, char *handle, int proto, const char *realname ) 59 59 { 60 60 static char nick[MAX_NICK_LENGTH+1]; -
nick.h
rb135438 rc1ede6e8 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, char *handle, struct prpl *proto, char *nick );35 char *nick_get( irc_t *irc, char *handle, struct prpl *proto, const char *realname );34 void nick_set( irc_t *irc, char *handle, int proto, char *nick ); 35 char *nick_get( irc_t *irc, char *handle, int proto, const char *realname ); 36 36 void nick_del( irc_t *irc, char *nick ); 37 37 void nick_strip( char *nick ); -
protocols/jabber/jabber.c
rb135438 rc1ede6e8 157 157 #define JCS_CLOSED 3 /* closed */ 158 158 159 160 static char *jabber_name() 161 { 162 return "Jabber"; 163 } 159 164 160 165 #define STATE_EVT(arg) if(gjc->on_state) { (gjc->on_state)(gjc, (arg) ); } … … 2408 2413 } 2409 2414 2410 2411 void jabber_init() 2412 { 2413 struct prpl *ret = g_new0(struct prpl, 1); 2414 2415 static struct prpl *my_protocol = NULL; 2416 2417 void jabber_init(struct prpl *ret) 2418 { 2415 2419 /* the NULL's aren't required but they're nice to have */ 2416 ret->name = "jabber"; 2420 ret->protocol = PROTO_JABBER; 2421 ret->name = jabber_name; 2417 2422 ret->away_states = jabber_away_states; 2418 2423 ret->actions = jabber_actions; … … 2437 2442 ret->group_buddy = jabber_group_change; 2438 2443 2439 register_protocol (ret);2440 } 2444 my_protocol = ret; 2445 } -
protocols/msn/msn.c
rb135438 rc1ede6e8 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; … … 398 399 ret->send_typing = msn_send_typing; 399 400 400 register_protocol(ret);401 } 401 my_protocol = ret; 402 } -
protocols/nogaim.c
rb135438 rc1ede6e8 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 gboolean load_plugin(char *path)58 {59 void (*init_function) (void);60 61 GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY);62 63 if(!mod) {64 log_message(LOGLVL_ERROR, "Can't find `%s', not loading", path);65 return FALSE;66 }67 68 if(!g_module_symbol(mod,"init_plugin",(gpointer *) &init_function)) {69 log_message(LOGLVL_WARNING, "Can't find function `init_plugin' in `%s'\n", path);70 return FALSE;71 }72 73 init_function();74 75 return TRUE;76 }77 60 78 61 /* nogaim.c */ 79 62 80 GList *protocols = NULL;81 82 void register_protocol (struct prpl *p)83 {84 protocols = g_list_append(protocols, p);85 }86 87 88 struct prpl *find_protocol(const char *name)89 {90 GList *gl;91 for (gl = protocols; gl; gl = gl->next)92 {93 struct prpl *proto = gl->data;94 if(!g_strcasecmp(proto->name, name))95 return proto;96 }97 return NULL;98 }99 100 /* nogaim.c */101 63 void nogaim_init() 102 64 { 103 GDir *dir; 104 GError *error = NULL; 105 65 proto_prpl[PROTO_MSN] = g_new0 ( struct prpl, 1 ); 106 66 #ifdef WITH_MSN 107 extern void msn_init(); 108 msn_init(); 67 msn_init( proto_prpl[PROTO_MSN] ); 109 68 #endif 110 69 70 proto_prpl[PROTO_OSCAR] = g_new0( struct prpl, 1 ); 111 71 #ifdef WITH_OSCAR 112 extern void oscar_init(); 113 oscar_init(); 72 oscar_init( proto_prpl[PROTO_OSCAR] ); 114 73 #endif 115 74 75 proto_prpl[PROTO_YAHOO] = g_new0( struct prpl, 1 ); 116 76 #ifdef WITH_YAHOO 117 extern void byahoo_init(); 118 byahoo_init(); 77 byahoo_init( proto_prpl[PROTO_YAHOO] ); 119 78 #endif 120 79 80 proto_prpl[PROTO_JABBER] = g_new0( struct prpl, 1 ); 121 81 #ifdef WITH_JABBER 122 extern void jabber_init(); 123 jabber_init(); 82 jabber_init( proto_prpl[PROTO_JABBER] ); 124 83 #endif 125 126 dir = g_dir_open(PLUGINDIR, 0, &error);127 128 if (dir) {129 const gchar *entry;130 char *path;131 132 while ((entry = g_dir_read_name(dir))) {133 path = g_build_filename(PLUGINDIR, entry, NULL);134 if(!path) {135 log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);136 continue;137 }138 139 load_plugin(path);140 141 g_free(path);142 }143 144 g_dir_close(dir);145 }146 84 } 147 85 … … 184 122 gc->prpl->set_away( gc, s, away ); 185 123 if( set_getint( gc->irc, "debug" ) ) 186 irc_usermsg( gc->irc, "Setting away state for %s to %s", gc->prpl->name, s );124 irc_usermsg( gc->irc, "Setting away state for %s to %s", proto_name[gc->protocol], s ); 187 125 } 188 126 else … … 230 168 way for now because I don't want to touch the Gaim code too much since 231 169 it's not going to be here for too long anymore. */ 232 int handle_cmp( char *a, char *b, struct prpl *protocol )233 { 234 if( !strcmp(protocol->name, "oscar"))170 int handle_cmp( char *a, char *b, int protocol ) 171 { 172 if( protocol == PROTO_TOC || protocol == PROTO_ICQ ) 235 173 { 236 174 /* AIM, being teh evil, thinks it's cool that users can put … … 272 210 gc = g_new0( struct gaim_connection, 1 ); 273 211 274 gc->prpl = user->prpl; 212 gc->protocol = user->protocol; 213 gc->prpl = proto_prpl[gc->protocol]; 275 214 g_snprintf( gc->username, sizeof( gc->username ), "%s", user->username ); 276 215 g_snprintf( gc->password, sizeof( gc->password ), "%s", user->password ); … … 315 254 void set_login_progress( struct gaim_connection *gc, int step, char *msg ) 316 255 { 317 irc_usermsg( gc->irc, "%s(%s) - Logging in: %s", gc->prpl->name, gc->username, msg );256 irc_usermsg( gc->irc, "%s(%s) - Logging in: %s", proto_name[gc->protocol], gc->username, msg ); 318 257 } 319 258 … … 321 260 void hide_login_progress( struct gaim_connection *gc, char *msg ) 322 261 { 323 irc_usermsg( gc->irc, "%s(%s) - Login error: %s", gc->prpl->name, gc->username, msg );262 irc_usermsg( gc->irc, "%s(%s) - Login error: %s", proto_name[gc->protocol], gc->username, msg ); 324 263 } 325 264 … … 327 266 void hide_login_progress_error( struct gaim_connection *gc, char *msg ) 328 267 { 329 irc_usermsg( gc->irc, "%s(%s) - Logged out: %s", gc->prpl->name, gc->username, msg );268 irc_usermsg( gc->irc, "%s(%s) - Logged out: %s", proto_name[gc->protocol], gc->username, msg ); 330 269 } 331 270 … … 350 289 strip_html( msg ); 351 290 352 irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, msg );291 irc_usermsg( gc->irc, "%s(%s) - %s", proto_name[gc->protocol], gc->username, msg ); 353 292 } 354 293 … … 375 314 u = user_find( gc->irc, gc->irc->nick ); 376 315 377 irc_usermsg( gc->irc, "%s(%s) - Logged in", gc->prpl->name, gc->username );316 irc_usermsg( gc->irc, "%s(%s) - Logged in", proto_name[gc->protocol], gc->username ); 378 317 379 318 gc->keepalive = g_timeout_add( 60000, send_keepalive, gc ); … … 382 321 if( u && u->away ) proto_away( gc, u->away ); 383 322 384 if( !strcmp(gc->prpl->name, "icq"))323 if( gc->protocol == PROTO_ICQ ) 385 324 { 386 325 for( u = gc->irc->users; u; u = u->next ) … … 422 361 account_t *a; 423 362 424 irc_usermsg( gc->irc, "%s(%s) - Signing off..", gc->prpl->name, gc->username );363 irc_usermsg( gc->irc, "%s(%s) - Signing off..", proto_name[gc->protocol], gc->username ); 425 364 426 365 gaim_input_remove( gc->keepalive ); … … 454 393 { 455 394 int delay = set_getint( irc, "auto_reconnect_delay" ); 456 irc_usermsg( gc->irc, "%s(%s) - Reconnecting in %d seconds..", gc->prpl->name, gc->username, delay);395 irc_usermsg( gc->irc, "%s(%s) - Reconnecting in %d seconds..", proto_name[gc->protocol], gc->username, delay); 457 396 458 397 a->reconnect = 1; … … 468 407 void do_error_dialog( struct gaim_connection *gc, char *msg, char *title ) 469 408 { 470 irc_usermsg( gc->irc, "%s(%s) - Error: %s", gc->prpl->name, gc->username, msg );409 irc_usermsg( gc->irc, "%s(%s) - Error: %s", proto_name[gc->protocol], gc->username, msg ); 471 410 } 472 411 … … 510 449 511 450 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 512 strcpy( nick, nick_get( gc->irc, handle, gc->pr pl, realname ) );451 strcpy( nick, nick_get( gc->irc, handle, gc->protocol, realname ) ); 513 452 514 453 u = user_add( gc->irc, nick ); … … 534 473 else 535 474 { 536 u->host = g_strdup( gc->user->prpl->name);475 u->host = g_strdup( proto_name[gc->user->protocol] ); 537 476 u->user = g_strdup( handle ); 538 477 } … … 628 567 if( set_getint( gc->irc, "debug" ) || g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "ignore" ) != 0 ) 629 568 { 630 irc_usermsg( gc->irc, "serv_got_update() for handle %s on connection %s(%s):", handle, gc->prpl->name, gc->username );569 irc_usermsg( gc->irc, "serv_got_update() for handle %s on connection %s(%s):", handle, proto_name[gc->protocol], gc->username ); 631 570 irc_usermsg( gc->irc, "loggedin = %d, type = %d", loggedin, type ); 632 571 } … … 663 602 } 664 603 665 if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) )604 if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_OSCAR || gc->protocol == PROTO_TOC ) ) 666 605 { 667 606 u->away = g_strdup( "Away" ); 668 607 } 669 else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber")) )608 else if( ( type & UC_UNAVAILABLE ) && ( gc->protocol == PROTO_JABBER ) ) 670 609 { 671 610 if( type & UC_DND ) … … 709 648 { 710 649 if( set_getint( irc, "debug" ) ) 711 irc_usermsg( irc, "Ignoring message from unknown handle %s on connection %s(%s)", handle, gc->prpl->name, gc->username );650 irc_usermsg( irc, "Ignoring message from unknown handle %s on connection %s(%s)", handle, proto_name[gc->protocol], gc->username ); 712 651 713 652 return; … … 731 670 else 732 671 { 733 irc_usermsg( irc, "Message from unknown handle %s on connection %s(%s):", handle, gc->prpl->name, gc->username );672 irc_usermsg( irc, "Message from unknown handle %s on connection %s(%s):", handle, proto_name[gc->protocol], gc->username ); 734 673 u = user_find( irc, irc->mynick ); 735 674 } … … 897 836 898 837 /* It might be yourself! */ 899 if( handle_cmp ( handle, b->gc->user->username, b->gc->pr pl ) == 0 )838 if( handle_cmp ( handle, b->gc->user->username, b->gc->protocol ) == 0 ) 900 839 { 901 840 u = user_find( b->gc->irc, b->gc->irc->nick ); -
protocols/nogaim.h
rb135438 rc1ede6e8 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 */ … … 160 161 }; 161 162 162 struct ft163 {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_request174 {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 181 163 struct prpl { 164 int protocol; 182 165 int options; 183 c onst char *name;166 char *(* name)(); 184 167 185 168 /* for ICQ and Yahoo, who have off/on per-conversation options */ … … 234 217 void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group); 235 218 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 241 219 void (* buddy_free) (struct buddy *); 242 220 243 221 char *(* get_status_string) (struct gaim_connection *gc, int stat); 244 222 }; 223 224 #define PROTO_TOC 0 225 #define PROTO_OSCAR 1 226 #define PROTO_YAHOO 2 227 #define PROTO_ICQ 3 228 #define PROTO_MSN 4 229 #define PROTO_IRC 5 230 #define PROTO_FTP 6 231 #define PROTO_VGATE 7 232 #define PROTO_JABBER 8 233 #define PROTO_NAPSTER 9 234 #define PROTO_ZEPHYR 10 235 #define PROTO_GADUGADU 11 236 #define PROTO_MAX 16 237 238 extern char proto_name[PROTO_MAX][8]; 245 239 246 240 #define UC_UNAVAILABLE 1 … … 253 247 254 248 G_MODULE_EXPORT GSList *get_connections(); 255 G_MODULE_EXPORT struct prpl *find_protocol(const char *name); 256 G_MODULE_EXPORT void register_protocol(struct prpl *); 249 extern struct prpl *proto_prpl[16]; 257 250 258 251 /* nogaim.c */ … … 266 259 int proto_away( struct gaim_connection *gc, char *away ); 267 260 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); 268 int handle_cmp( char *a, char *b, struct prpl *protocol );261 int handle_cmp( char *a, char *b, int protocol ); 269 262 270 263 gboolean auto_reconnect( gpointer data ); … … 325 318 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value); 326 319 327 /* file transfers */ 328 G_MODULE_EXPORT void ft_progress( struct ft *, int); 329 G_MODULE_EXPORT void ft_incoming( struct ft_request * ); 330 G_MODULE_EXPORT void ft_accepted( struct ft_request *, struct ft *); 331 G_MODULE_EXPORT void ft_denied( struct ft_request *, const char *reason); 320 #ifdef WITH_MSN 321 /* msn.c */ 322 G_MODULE_EXPORT void msn_init( struct prpl *ret ); 323 #endif 324 325 #ifdef WITH_OSCAR 326 /* oscar.c */ 327 G_MODULE_EXPORT void oscar_init( struct prpl *ret ); 328 #endif 329 330 #ifdef WITH_JABBER 331 /* jabber.c */ 332 G_MODULE_EXPORT void jabber_init( struct prpl *ret ); 333 #endif 334 335 #ifdef WITH_YAHOO 336 /* yahoo.c */ 337 G_MODULE_EXPORT void byahoo_init( struct prpl *ret ); 338 #endif 332 339 333 340 /* prefs.c */ -
protocols/oscar/oscar.c
rb135438 rc1ede6e8 364 364 odata->icq = TRUE; 365 365 /* this is odd but it's necessary for a proper do_import and do_export */ 366 gc->protocol = PROTO_ICQ; 366 367 gc->password[8] = 0; 367 368 } else { 369 gc->protocol = PROTO_TOC; 368 370 gc->flags |= OPT_CONN_HTML; 369 371 } … … 2465 2467 } 2466 2468 2467 void oscar_init() 2468 { 2469 struct prpl *ret = g_new0(struct prpl, 1); 2470 ret-> name = "oscar";2469 static struct prpl *my_protocol = NULL; 2470 2471 void oscar_init(struct prpl *ret) { 2472 ret->protocol = PROTO_OSCAR; 2471 2473 ret->away_states = oscar_away_states; 2472 2474 ret->login = oscar_login; … … 2486 2488 ret->get_status_string = oscar_get_status_string; 2487 2489 2488 register_protocol(ret);2489 } 2490 my_protocol = ret; 2491 } -
protocols/proxy.c
rb135438 rc1ede6e8 50 50 #define GAIM_ERR_COND (G_IO_HUP | G_IO_ERR | G_IO_NVAL) 51 51 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 52 62 char proxyhost[128] = ""; 53 63 int proxyport = 0; -
protocols/yahoo/yahoo.c
rb135438 rc1ede6e8 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; … … 412 418 ret->chat_open = byahoo_chat_open; 413 419 414 register_protocol(ret);420 my_protocol = ret; 415 421 } 416 422 … … 426 432 yd = gc->proto_data; 427 433 428 if( !strcmp(gc->prpl->name, "yahoo")&& yd->y2_id == id )434 if( gc->protocol == PROTO_YAHOO && yd->y2_id == id ) 429 435 return( gc ); 430 436 } -
query.c
rb135438 rc1ede6e8 149 149 { 150 150 if( q->gc ) 151 irc_usermsg( irc, "Question on %s connection (handle %s):", q->gc->prpl->name, q->gc->username );151 irc_usermsg( irc, "Question on %s connection (handle %s):", proto_name[q->gc->protocol], q->gc->username ); 152 152 else 153 153 irc_usermsg( irc, "Question:" ); -
unix.c
rb135438 rc1ede6e8 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
rb135438 rc1ede6e8 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 -
user.c
rb135438 rc1ede6e8 146 146 while( u ) 147 147 { 148 if( u->gc == gc && u->handle && handle_cmp( u->handle, handle, gc->pr pl) == 0 )148 if( u->gc == gc && u->handle && handle_cmp( u->handle, handle, gc->protocol ) == 0 ) 149 149 break; 150 150 u = u->next;
Note: See TracChangeset
for help on using the changeset viewer.