Changeset 81e04e1
- Timestamp:
- 2010-04-01T02:32:25Z (15 years ago)
- Branches:
- master
- Children:
- d860a8d
- Parents:
- 10a96f4
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r10a96f4 r81e04e1 11 11 # Program variables 12 12 #objects = bitlbee.o chat.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) 13 objects = bitlbee.o help.o ipc.o irc.o irc_ channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o13 objects = bitlbee.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o nick.o root_commands.o set.o 14 14 headers = account.h bitlbee.h commands.h conf.h config.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/ftutil.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/ft.h protocols/nogaim.h 15 15 subdirs = lib protocols -
irc.h
r10a96f4 r81e04e1 152 152 gboolean (*privmsg)( irc_channel_t *iu, const char *msg ); 153 153 }; 154 155 #include "user.h"156 154 157 155 /* irc.c */ -
nick.c
r10a96f4 r81e04e1 78 78 79 79 nick_strip( nick ); 80 if( set_getbool( &acc-> irc->b->set, "lcnicks" ) )80 if( set_getbool( &acc->bee->set, "lcnicks" ) ) 81 81 nick_lc( nick ); 82 82 } … … 92 92 void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] ) 93 93 { 94 irc_t *irc = (irc_t*) acc->bee->ui_data; 94 95 int inf_protection = 256; 95 96 96 97 /* Now, find out if the nick is already in use at the moment, and make 97 98 subtle changes to make it unique. */ 98 while( !nick_ok( nick ) || irc_user_by_name( acc->irc, nick ) )99 while( !nick_ok( nick ) || irc_user_by_name( irc, nick ) ) 99 100 { 100 101 if( strlen( nick ) < ( MAX_NICK_LENGTH - 1 ) ) … … 112 113 int i; 113 114 114 irc_usermsg( acc->irc, "Warning: Almost had an infinite loop in nick_get()! "115 116 117 118 119 120 irc_usermsg( acc->irc, "Trying to get a sane nick for handle %s", handle );115 irc_usermsg( irc, "Warning: Almost had an infinite loop in nick_get()! " 116 "This used to be a fatal BitlBee bug, but we tried to fix it. " 117 "This message should *never* appear anymore. " 118 "If it does, please *do* send us a bug report! " 119 "Please send all the following lines in your report:" ); 120 121 irc_usermsg( irc, "Trying to get a sane nick for handle %s", handle ); 121 122 for( i = 0; i < MAX_NICK_LENGTH; i ++ ) 122 irc_usermsg( acc->irc, "Char %d: %c/%d", i, nick[i], nick[i] );123 124 irc_usermsg( acc->irc, "FAILED. Returning an insane nick now. Things might break. "125 126 123 irc_usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] ); 124 125 irc_usermsg( irc, "FAILED. Returning an insane nick now. Things might break. " 126 "Good luck, and please don't forget to paste the lines up here " 127 "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" ); 127 128 128 129 g_snprintf( nick, MAX_NICK_LENGTH + 1, "xx%x", rand() ); -
protocols/Makefile
r10a96f4 r81e04e1 10 10 11 11 # [SH] Program variables 12 #objects = account.o nogaim.o user.o 13 objects = bee.o bee_user.o nogaim.o 12 objects = account.o bee.o bee_user.o nogaim.o 14 13 15 14 -
protocols/account.c
r10a96f4 r81e04e1 29 29 #include "chat.h" 30 30 31 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )31 account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ) 32 32 { 33 33 account_t *a; 34 34 set_t *s; 35 35 36 if( irc->accounts )37 { 38 for( a = irc->accounts; a->next; a = a->next );36 if( bee->accounts ) 37 { 38 for( a = bee->accounts; a->next; a = a->next ); 39 39 a = a->next = g_new0( account_t, 1 ); 40 40 } 41 41 else 42 42 { 43 irc->accounts = a = g_new0 ( account_t, 1 );43 bee->accounts = a = g_new0 ( account_t, 1 ); 44 44 } 45 45 … … 48 48 a->pass = g_strdup( pass ); 49 49 a->auto_connect = 1; 50 a-> irc = irc;50 a->bee = bee; 51 51 52 52 s = set_add( &a->set, "auto_connect", "true", set_eval_account, a ); … … 153 153 } 154 154 155 account_t *account_get( irc_t *irc, char *id )155 account_t *account_get( bee_t *bee, char *id ) 156 156 { 157 157 account_t *a, *ret = NULL; … … 169 169 if( ( proto = find_protocol( id ) ) ) 170 170 { 171 for( a = irc->accounts; a; a = a->next )171 for( a = bee->accounts; a; a = a->next ) 172 172 if( a->prpl == proto && 173 173 a->prpl->handle_cmp( handle, a->user ) == 0 ) … … 186 186 if( sscanf( id, "%d", &nr ) == 1 && nr < 1000 ) 187 187 { 188 for( a = irc->accounts; a; a = a->next )188 for( a = bee->accounts; a; a = a->next ) 189 189 if( ( nr-- ) == 0 ) 190 190 return( a ); … … 193 193 } 194 194 195 for( a = irc->accounts; a; a = a->next )195 for( a = bee->accounts; a; a = a->next ) 196 196 { 197 197 if( g_strcasecmp( id, a->prpl->name ) == 0 ) … … 214 214 } 215 215 216 void account_del( irc_t *irc, account_t *acc )216 void account_del( bee_t *bee, account_t *acc ) 217 217 { 218 218 account_t *a, *l = NULL; … … 223 223 return; 224 224 225 for( a = irc->accounts; a; a = (l=a)->next )225 for( a = bee->accounts; a; a = (l=a)->next ) 226 226 if( a == acc ) 227 227 { … … 229 229 l->next = a->next; 230 230 else 231 irc->accounts = a->next; 232 233 for( c = irc->chatrooms; c; c = nc ) 231 bee->accounts = a->next; 232 233 /** FIXME 234 for( c = bee->chatrooms; c; c = nc ) 234 235 { 235 236 nc = c->next; 236 237 if( acc == c->acc ) 237 chat_del( irc, c );238 chat_del( bee, c ); 238 239 } 240 */ 239 241 240 242 while( a->set ) … … 254 256 } 255 257 256 void account_on( irc_t *irc, account_t *a )258 void account_on( bee_t *bee, account_t *a ) 257 259 { 258 260 if( a->ic ) … … 268 270 } 269 271 270 void account_off( irc_t *irc, account_t *a )272 void account_off( bee_t *bee, account_t *a ) 271 273 { 272 274 imc_logout( a->ic, FALSE ); … … 336 338 int account_reconnect_delay( account_t *a ) 337 339 { 338 char *setting = set_getstr( &a-> irc->b->set, "auto_reconnect_delay" );340 char *setting = set_getstr( &a->bee->set, "auto_reconnect_delay" ); 339 341 struct account_reconnect_delay p; 340 342 -
protocols/account.h
r10a96f4 r81e04e1 42 42 GHashTable *nicks; 43 43 44 struct irc *irc;44 struct bee *bee; 45 45 struct im_connection *ic; 46 46 struct account *next; 47 47 } account_t; 48 48 49 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass );50 account_t *account_get( irc_t *irc, char *id );51 void account_del( irc_t *irc, account_t *acc );52 void account_on( irc_t *irc, account_t *a );53 void account_off( irc_t *irc, account_t *a );49 account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ); 50 account_t *account_get( bee_t *bee, char *id ); 51 void account_del( bee_t *bee, account_t *acc ); 52 void account_on( bee_t *bee, account_t *a ); 53 void account_off( bee_t *bee, account_t *a ); 54 54 55 55 char *set_eval_account( set_t *set, char *value ); -
protocols/bee.c
r10a96f4 r81e04e1 24 24 void bee_free( bee_t *b ) 25 25 { 26 while( b->accounts ) 26 account_t *acc = b->accounts; 27 28 while( acc ) 27 29 { 28 account_t *acc = b->accounts->data;29 30 /*31 30 if( acc->ic ) 32 31 imc_logout( acc->ic, FALSE ); 33 32 else if( acc->reconnect ) 34 33 cancel_auto_reconnect( acc ); 35 */36 34 37 35 if( acc->ic == NULL ) 38 {} //account_del( b, acc );36 account_del( b, acc ); 39 37 else 40 38 /* Nasty hack, but account_del() doesn't work in this 41 39 case and we don't want infinite loops, do we? ;-) */ 42 b->accounts = g_slist_remove( b->accounts, acc );40 acc = acc->next; 43 41 } 44 42 45 43 while( b->set ) 46 44 set_del( &b->set, b->set->key ); 45 46 g_free( b ); 47 47 } -
protocols/bee.h
r10a96f4 r81e04e1 34 34 35 35 GSList *users; 36 GSList *accounts;36 struct account *accounts; /* TODO(wilmer): Use GSList here too? */ 37 37 38 38 const struct bee_ui_funcs *ui; … … 56 56 char *group; 57 57 58 char *away; 58 bee_user_flags_t flags; 59 char *status; 59 60 char *status_msg; 60 61 … … 67 68 gboolean (*user_new)( bee_t *bee, struct bee_user *bu ); 68 69 gboolean (*user_free)( bee_t *bee, struct bee_user *bu ); 70 gboolean (*user_status)( bee_t *bee, struct bee_user *bu, struct bee_user *old ); 69 71 } bee_ui_funcs_t; 70 72 -
protocols/bee_user.c
r10a96f4 r81e04e1 59 59 g_free( bu->fullname ); 60 60 g_free( bu->group ); 61 g_free( bu-> away);61 g_free( bu->status ); 62 62 g_free( bu->status_msg ); 63 63 -
protocols/nogaim.c
r10a96f4 r81e04e1 92 92 #endif 93 93 94 /* nogaim.c */95 96 94 GList *protocols = NULL; 97 95 … … 125 123 } 126 124 127 /* nogaim.c */128 125 void nogaim_init() 129 126 { … … 156 153 GSList *get_connections() { return connections; } 157 154 158 /* multi.c */159 160 155 struct im_connection *imcb_new( account_t *acc ) 161 156 { … … 164 159 ic = g_new0( struct im_connection, 1 ); 165 160 166 ic-> irc = acc->irc;161 ic->bee = acc->bee; 167 162 ic->acc = acc; 168 163 acc->ic = ic; … … 178 173 179 174 /* Destroy the pointer to this connection from the account list */ 180 for( a = ic-> irc->accounts; a; a = a->next )175 for( a = ic->bee->accounts; a; a = a->next ) 181 176 if( a->ic == ic ) 182 177 { … … 199 194 va_end( params ); 200 195 201 if( ( g_strcasecmp( set_getstr( &ic-> irc->b->set, "strip_html" ), "always" ) == 0 ) ||202 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic-> irc->b->set, "strip_html" ) ) )196 if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) || 197 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) ) 203 198 strip_html( text ); 204 199 205 200 /* Try to find a different connection on the same protocol. */ 206 for( a = ic-> irc->accounts; a; a = a->next )201 for( a = ic->bee->accounts; a; a = a->next ) 207 202 if( a->prpl == ic->acc->prpl && a->ic != ic ) 208 203 break; … … 210 205 /* If we found one, include the screenname in the message. */ 211 206 if( a ) 212 irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); 207 /* FIXME(wilmer): ui_log callback or so */ 208 irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); 213 209 else 214 irc_usermsg( ic-> irc, "%s - %s", ic->acc->prpl->name, text );210 irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); 215 211 216 212 g_free( text ); … … 263 259 void imcb_connected( struct im_connection *ic ) 264 260 { 265 irc_t *irc = ic->irc;266 struct chat *c;267 268 261 /* MSN servers sometimes redirect you to a different server and do 269 262 the whole login sequence again, so these "late" calls to this … … 301 294 302 295 a->reconnect = 0; 303 account_on( a-> irc, a );296 account_on( a->bee, a ); 304 297 305 298 return( FALSE ); /* Only have to run the timeout once */ … … 314 307 void imc_logout( struct im_connection *ic, int allow_reconnect ) 315 308 { 316 irc_t *irc = ic->irc; 317 user_t *t, *u; 309 bee_t *bee = ic->bee; 318 310 account_t *a; 311 GSList *l; 319 312 int delay; 320 313 … … 336 329 ic->away = NULL; 337 330 338 u = irc->users; 339 while( u ) 340 { 341 if( u->ic == ic ) 342 { 343 t = u->next; 344 user_del( irc, u->nick ); 345 u = t; 346 } 347 else 348 u = u->next; 349 } 350 351 query_del_by_conn( ic->irc, ic ); 352 353 for( a = irc->accounts; a; a = a->next ) 331 for( l = bee->users; l; l = l->next ) 332 { 333 bee_user_t *bu = l->data; 334 335 if( bu->ic == ic ) 336 bee_user_free( bee, ic, bu->handle ); 337 } 338 339 //query_del_by_conn( ic->irc, ic ); 340 341 for( a = bee->accounts; a; a = a->next ) 354 342 if( a->ic == ic ) 355 343 break; … … 359 347 /* Uhm... This is very sick. */ 360 348 } 361 else if( allow_reconnect && set_getbool( & irc->b->set, "auto_reconnect" ) &&349 else if( allow_reconnect && set_getbool( &bee->set, "auto_reconnect" ) && 362 350 set_getbool( &a->set, "auto_reconnect" ) && 363 351 ( delay = account_reconnect_delay( a ) ) > 0 ) … … 370 358 } 371 359 372 373 /* dialogs.c */374 375 360 void imcb_ask( struct im_connection *ic, char *msg, void *data, 376 361 query_callback doit, query_callback dont ) 377 362 { 378 query_add( ic->irc, ic, msg, doit, dont, data ); 379 } 380 381 382 /* list.c */ 363 //query_add( ic->irc, ic, msg, doit, dont, data ); 364 } 383 365 384 366 void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group ) 385 367 { 386 user_t *u;387 char nick[MAX_NICK_LENGTH+1], *s;388 irc_t *irc = ic->irc;389 390 if( user_findhandle(ic, handle ) )391 { 392 if( set_getbool( & irc->b->set, "debug" ) )368 bee_user_t *bu; 369 //char nick[MAX_NICK_LENGTH+1], *s; 370 bee_t *bee = ic->bee; 371 372 if( bee_user_by_handle( bee, ic, handle ) ) 373 { 374 if( set_getbool( &bee->set, "debug" ) ) 393 375 imcb_log( ic, "User already exists, ignoring add request: %s", handle ); 394 376 … … 401 383 } 402 384 403 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 404 strcpy( nick, nick_get( ic->acc, handle ) ); 405 406 u = user_add( ic->irc, nick ); 407 408 // if( !realname || !*realname ) realname = nick; 409 // u->realname = g_strdup( realname ); 410 411 if( ( s = strchr( handle, '@' ) ) ) 412 { 413 u->host = g_strdup( s + 1 ); 414 u->user = g_strndup( handle, s - handle ); 415 } 416 else if( ic->acc->server ) 417 { 418 u->host = g_strdup( ic->acc->server ); 419 u->user = g_strdup( handle ); 420 421 /* s/ /_/ ... important for AOL screennames */ 422 for( s = u->user; *s; s ++ ) 423 if( *s == ' ' ) 424 *s = '_'; 425 } 426 else 427 { 428 u->host = g_strdup( ic->acc->prpl->name ); 429 u->user = g_strdup( handle ); 430 } 431 432 u->ic = ic; 433 u->handle = g_strdup( handle ); 434 if( group ) u->group = g_strdup( group ); 435 u->send_handler = buddy_send_handler; 436 u->last_typing_notice = 0; 437 } 438 439 struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ) 440 { 441 static struct buddy b[1]; 442 user_t *u; 443 444 u = user_findhandle( ic, handle ); 445 446 if( !u ) 447 return( NULL ); 448 449 memset( b, 0, sizeof( b ) ); 450 strncpy( b->name, handle, 80 ); 451 strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN ); 452 b->present = u->online; 453 b->ic = u->ic; 454 455 return( b ); 385 bu = bee_user_new( bee, ic, handle ); 386 bu->group = g_strdup( group ); 456 387 } 457 388 458 389 void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname ) 459 390 { 391 #if 0 460 392 user_t *u = user_findhandle( ic, handle ); 461 393 char *set; … … 469 401 u->realname = g_strdup( realname ); 470 402 471 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic-> irc->b->set, "display_namechanges" ) )403 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->bee->set, "display_namechanges" ) ) 472 404 imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); 473 405 } … … 489 421 g_free( name ); 490 422 } 423 #endif 491 424 } 492 425 493 426 void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) 494 427 { 495 user_t *u; 496 497 if( ( u = user_findhandle( ic, handle ) ) ) 498 user_del( ic->irc, u->nick ); 428 bee_user_free( ic->bee, ic, handle ); 499 429 } 500 430 … … 503 433 void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick ) 504 434 { 435 #if 0 505 436 user_t *u = user_findhandle( ic, handle ); 506 437 char newnick[MAX_NICK_LENGTH+1], *orig_nick; … … 517 448 /* Some processing to make sure this string is a valid IRC nickname. */ 518 449 nick_strip( newnick ); 519 if( set_getbool( &ic-> irc->b->set, "lcnicks" ) )450 if( set_getbool( &ic->bee->set, "lcnicks" ) ) 520 451 nick_lc( newnick ); 521 452 … … 534 465 } 535 466 } 467 #endif 536 468 } 537 469 … … 565 497 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) 566 498 { 499 #if 0 567 500 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 568 501 char *s, *realname_ = NULL; … … 579 512 data->handle = g_strdup( handle ); 580 513 query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); 514 #endif 581 515 } 582 516 … … 599 533 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) 600 534 { 535 #if 0 601 536 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 602 537 char *s; … … 611 546 data->handle = g_strdup( handle ); 612 547 query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); 613 } 614 615 616 /* server.c */ 548 #endif 549 } 617 550 618 551 void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ) 619 552 { 620 user_t *u; 621 int oa, oo; 622 623 u = user_findhandle( ic, (char*) handle ); 624 625 if( !u ) 626 { 627 if( g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "add" ) == 0 ) 628 { 629 imcb_add_buddy( ic, (char*) handle, NULL ); 630 u = user_findhandle( ic, (char*) handle ); 553 bee_t *bee = ic->bee; 554 bee_user_t *bu, *old; 555 556 if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) 557 { 558 if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 ) 559 { 560 bu = bee_user_new( bee, ic, handle ); 631 561 } 632 562 else 633 563 { 634 if( set_getbool( &ic-> irc->b->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->b->set, "handle_unknown" ), "ignore" ) != 0 )564 if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 ) 635 565 { 636 566 imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle ); … … 643 573 } 644 574 575 /* May be nice to give the UI something to compare against. */ 576 old = g_memdup( bu, sizeof( bee_user_t ) ); 577 578 /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */ 579 bu->flags = ( flags & OPT_LOGGED_IN ? BEE_USER_ONLINE : 0 ) | 580 ( flags & OPT_AWAY ? BEE_USER_AWAY : 0 ); 581 bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state ); 582 bu->status_msg = g_strdup( message ); 583 584 if( bee->ui->user_status ) 585 bee->ui->user_status( bee, bu, old ); 586 587 g_free( old->status_msg ); 588 g_free( old->status ); 589 g_free( old ); 590 #if 0 645 591 oa = u->away != NULL; 646 592 oo = u->online; … … 692 638 693 639 /* LISPy... */ 694 if( ( set_getbool( &ic-> irc->b->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */640 if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 695 641 ( u->online ) && /* Don't touch offline people */ 696 642 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ … … 699 645 char *from; 700 646 701 if( set_getbool( &ic-> irc->b->set, "simulate_netsplit" ) )647 if( set_getbool( &ic->bee->set, "simulate_netsplit" ) ) 702 648 { 703 649 from = g_strdup( ic->irc->myhost ); … … 712 658 g_free( from ); 713 659 } 660 #endif 714 661 } 715 662 716 663 void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at ) 717 664 { 718 irc_t *irc = ic->irc; 665 #if 0 666 bee_t *bee = ic->bee; 719 667 char *wrapped; 720 668 user_t *u; … … 724 672 if( !u ) 725 673 { 726 char *h = set_getstr( & irc->b->set, "handle_unknown" );674 char *h = set_getstr( &bee->set, "handle_unknown" ); 727 675 728 676 if( g_strcasecmp( h, "ignore" ) == 0 ) 729 677 { 730 if( set_getbool( & irc->b->set, "debug" ) )678 if( set_getbool( &bee->set, "debug" ) ) 731 679 imcb_log( ic, "Ignoring message from unknown handle %s", handle ); 732 680 … … 735 683 else if( g_strncasecmp( h, "add", 3 ) == 0 ) 736 684 { 737 int private = set_getbool( & irc->b->set, "private" );685 int private = set_getbool( &bee->set, "private" ); 738 686 739 687 if( h[3] ) … … 756 704 } 757 705 758 if( ( g_strcasecmp( set_getstr( &ic-> irc->b->set, "strip_html" ), "always" ) == 0 ) ||759 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic-> irc->b->set, "strip_html" ) ) )706 if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) || 707 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) ) 760 708 strip_html( msg ); 761 709 … … 763 711 irc_msgfrom( irc, u->nick, wrapped ); 764 712 g_free( wrapped ); 713 #endif 765 714 } 766 715 767 716 void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags ) 768 717 { 718 #if 0 769 719 user_t *u; 770 720 771 if( !set_getbool( &ic-> irc->b->set, "typing_notice" ) )721 if( !set_getbool( &ic->bee->set, "typing_notice" ) ) 772 722 return; 773 723 … … 779 729 irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf ); 780 730 } 731 #endif 732 } 733 734 struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle ) 735 { 736 return bee_user_by_handle( ic->bee, ic, handle ); 781 737 } 782 738 783 739 struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) 784 740 { 741 #if 0 785 742 struct groupchat *c; 786 743 … … 800 757 c->topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title ); 801 758 802 if( set_getbool( &ic-> irc->b->set, "debug" ) )759 if( set_getbool( &ic->bee->set, "debug" ) ) 803 760 imcb_log( ic, "Creating new conversation: (id=%p,handle=%s)", c, handle ); 804 761 805 762 return c; 763 #endif 806 764 } 807 765 808 766 void imcb_chat_free( struct groupchat *c ) 809 767 { 768 #if 0 810 769 struct im_connection *ic = c->ic; 811 770 struct groupchat *l; 812 771 GList *ir; 813 772 814 if( set_getbool( &ic-> irc->b->set, "debug" ) )773 if( set_getbool( &ic->bee->set, "debug" ) ) 815 774 imcb_log( ic, "You were removed from conversation %p", c ); 816 775 … … 845 804 g_free( c ); 846 805 } 806 #endif 847 807 } 848 808 849 809 void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at ) 850 810 { 811 #if 0 851 812 struct im_connection *ic = c->ic; 852 813 char *wrapped; … … 859 820 u = user_findhandle( ic, who ); 860 821 861 if( ( g_strcasecmp( set_getstr( &ic-> irc->b->set, "strip_html" ), "always" ) == 0 ) ||862 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic-> irc->b->set, "strip_html" ) ) )822 if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) || 823 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) ) 863 824 strip_html( msg ); 864 825 … … 873 834 } 874 835 g_free( wrapped ); 836 #endif 875 837 } 876 838 877 839 void imcb_chat_log( struct groupchat *c, char *format, ... ) 878 840 { 841 #if 0 879 842 irc_t *irc = c->ic->irc; 880 843 va_list params; … … 891 854 892 855 g_free( text ); 856 #endif 893 857 } 894 858 895 859 void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at ) 896 860 { 861 #if 0 897 862 struct im_connection *ic = c->ic; 898 863 user_t *u = NULL; … … 905 870 u = user_findhandle( ic, who ); 906 871 907 if( ( g_strcasecmp( set_getstr( &ic-> irc->b->set, "strip_html" ), "always" ) == 0 ) ||908 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic-> irc->b->set, "strip_html" ) ) )872 if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) || 873 ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) ) 909 874 strip_html( topic ); 910 875 … … 914 879 if( c->joined && u ) 915 880 irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic ); 916 } 917 918 919 /* buddy_chat.c */ 881 #endif 882 } 920 883 921 884 void imcb_chat_add_buddy( struct groupchat *b, const char *handle ) 922 885 { 886 #if 0 923 887 user_t *u = user_findhandle( b->ic, handle ); 924 888 int me = 0; 925 889 926 if( set_getbool( &b->ic-> irc->b->set, "debug" ) )890 if( set_getbool( &b->ic->bee->set, "debug" ) ) 927 891 imcb_log( b->ic, "User %s added to conversation %p", handle, b ); 928 892 … … 951 915 b->in_room = g_list_append( b->in_room, g_strdup( handle ) ); 952 916 } 917 #endif 953 918 } 954 919 … … 956 921 void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason ) 957 922 { 923 #if 0 958 924 user_t *u; 959 925 int me = 0; 960 926 961 if( set_getbool( &b->ic-> irc->b->set, "debug" ) )927 if( set_getbool( &b->ic->bee->set, "debug" ) ) 962 928 imcb_log( b->ic, "User %s removed from conversation %p (%s)", handle, b, reason ? reason : "" ); 963 929 … … 979 945 if( me || ( remove_chat_buddy_silent( b, handle ) && b->joined && u ) ) 980 946 irc_part( b->ic->irc, u, b->channel ); 947 #endif 981 948 } 982 949 983 950 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ) 984 951 { 952 #if 0 985 953 GList *i; 986 954 … … 998 966 i = i->next; 999 967 } 1000 1001 return( 0 ); 968 #endif 969 970 return 0; 1002 971 } 1003 972 1004 973 1005 974 /* Misc. BitlBee stuff which shouldn't really be here */ 1006 975 #if 0 1007 976 char *set_eval_away_devoice( set_t *set, char *value ) 1008 977 { … … 1059 1028 return value; 1060 1029 } 1061 1030 #endif 1062 1031 1063 1032 … … 1106 1075 1107 1076 away = set_getstr( &ic->acc->set, "away" ) ? 1108 : set_getstr( &ic-> irc->b->set, "away" );1077 : set_getstr( &ic->bee->set, "away" ); 1109 1078 if( away && *away ) 1110 1079 { … … 1117 1086 away = NULL; 1118 1087 msg = set_getstr( &ic->acc->set, "status" ) ? 1119 : set_getstr( &ic-> irc->b->set, "status" );1088 : set_getstr( &ic->bee->set, "status" ); 1120 1089 } 1121 1090 -
protocols/nogaim.h
r10a96f4 r81e04e1 87 87 88 88 /* BitlBee */ 89 irc_t *irc;89 bee_t *bee; 90 90 91 91 struct groupchat *groupchats; -
protocols/oscar/oscar.c
r10a96f4 r81e04e1 1190 1190 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1191 1191 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1192 if(imcb_find_buddy(data->ic, uin) == NULL) 1193 imcb_ask_add(data->ic, uin, NULL); 1192 imcb_ask_add(data->ic, uin, NULL); 1194 1193 1195 1194 g_free(uin); … … 1952 1951 struct oscar_data *odata = (struct oscar_data *)g->proto_data; 1953 1952 if (odata->icq) { 1953 /** FIXME(wilmer): Hmm, lost the ability to get away msgs here, do we care to get that back? 1954 1954 struct buddy *budlight = imcb_find_buddy(g, who); 1955 1955 if (budlight) … … 1957 1957 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) 1958 1958 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7); 1959 */ 1959 1960 } else 1960 1961 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE); … … 2094 2095 switch (curitem->type) { 2095 2096 case 0x0000: /* Buddy */ 2096 if ((curitem->name) && (!imcb_ find_buddy(ic, nrm))) {2097 if ((curitem->name) && (!imcb_buddy_by_handle(ic, nrm))) { 2097 2098 char *realname = NULL; 2098 2099
Note: See TracChangeset
for help on using the changeset viewer.