- Timestamp:
- 2006-10-15T09:41:12Z (18 years ago)
- Branches:
- master
- Children:
- 2529faf
- Parents:
- 695e392 (diff), e97827b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/Makefile
r695e392 r69cb623 10 10 11 11 # [SH] Program variables 12 objects = $(EVENT_HANDLER) http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)12 objects = nogaim.o 13 13 14 14 # [SH] The next two lines should contain the directory name (in $(subdirs)) -
protocols/jabber/jabber.c
r695e392 r69cb623 561 561 static void gjab_start(gjconn gjc) 562 562 { 563 struct aim_user *user;563 account_t *acc; 564 564 int port = -1, ssl = 0; 565 char *server = NULL , *s;565 char *server = NULL; 566 566 567 567 if (!gjc || gjc->state != JCONN_STATE_OFF) 568 568 return; 569 569 570 user = GJ_GC(gjc)->user; 571 if (*user->proto_opt[0]) { 572 /* If there's a dot, assume there's a hostname in the beginning */ 573 if (strchr(user->proto_opt[0], '.')) { 574 server = g_strdup(user->proto_opt[0]); 575 if ((s = strchr(server, ':'))) 576 *s = 0; 577 } 578 579 /* After the hostname, there can be a port number */ 580 s = strchr(user->proto_opt[0], ':'); 581 if (s && isdigit(s[1])) 582 sscanf(s + 1, "%d", &port); 583 584 /* And if there's the string ssl, the user wants an SSL-connection */ 585 if (strstr(user->proto_opt[0], ":ssl") || g_strcasecmp(user->proto_opt[0], "ssl") == 0) 586 ssl = 1; 587 } 588 589 if (port == -1 && !ssl) 590 port = DEFAULT_PORT; 591 else if (port == -1 && ssl) 592 port = DEFAULT_PORT_SSL; 593 else if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) { 570 acc = GJ_GC(gjc)->acc; 571 server = acc->server; 572 port = set_getint(&acc->set, "port"); 573 ssl = set_getbool(&acc->set, "ssl"); 574 575 if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) { 594 576 serv_got_crap(GJ_GC(gjc), "For security reasons, the Jabber port number must be in the %d-%d range.", JABBER_PORT_MIN, JABBER_PORT_MAX); 595 577 STATE_EVT(JCONN_STATE_OFF) … … 614 596 } 615 597 616 g_free(server); 617 618 if (!user->gc || (gjc->fd < 0)) { 598 if (!acc->gc || (gjc->fd < 0)) { 619 599 STATE_EVT(JCONN_STATE_OFF) 620 600 return; … … 1516 1496 } 1517 1497 1518 static void jabber_login(struct aim_user *user) 1519 { 1520 struct gaim_connection *gc = new_gaim_conn(user); 1521 struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1); 1522 char *loginname = create_valid_jid(user->username, DEFAULT_SERVER, "BitlBee"); 1523 1498 static void jabber_acc_init(account_t *acc) 1499 { 1500 set_t *s; 1501 1502 s = set_add( &acc->set, "port", "5222", set_eval_int, acc ); 1503 s->flags |= ACC_SET_OFFLINE_ONLY; 1504 1505 s = set_add( &acc->set, "resource", "BitlBee", NULL, acc ); 1506 s->flags |= ACC_SET_OFFLINE_ONLY; 1507 1508 s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); 1509 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; 1510 1511 s = set_add( &acc->set, "ssl", "false", set_eval_bool, acc ); 1512 s->flags |= ACC_SET_OFFLINE_ONLY; 1513 } 1514 1515 static void jabber_login(account_t *acc) 1516 { 1517 struct gaim_connection *gc; 1518 struct jabber_data *jd; 1519 char *resource, *loginname; 1520 1521 /* Time to move some data/things from the old syntax to the new one: */ 1522 if (acc->server) { 1523 char *s, *tmp_server; 1524 int port; 1525 1526 if (g_strcasecmp(acc->server, "ssl") == 0) { 1527 set_setstr(&acc->set, "server", ""); 1528 set_setint(&acc->set, "port", DEFAULT_PORT_SSL); 1529 set_setstr(&acc->set, "ssl", "true"); 1530 1531 g_free(acc->server); 1532 acc->server = NULL; 1533 } else if ((s = strchr(acc->server, ':'))) { 1534 if (strstr(acc->server, ":ssl")) { 1535 set_setint(&acc->set, "port", DEFAULT_PORT_SSL); 1536 set_setstr(&acc->set, "ssl", "true"); 1537 } 1538 if (isdigit(s[1])) { 1539 if (sscanf(s + 1, "%d", &port) == 1) 1540 set_setint(&acc->set, "port", port); 1541 } 1542 tmp_server = g_strndup(acc->server, s - acc->server); 1543 set_setstr(&acc->set, "server", tmp_server); 1544 g_free(tmp_server); 1545 } 1546 } 1547 1548 gc = new_gaim_conn(acc); 1549 jd = gc->proto_data = g_new0(struct jabber_data, 1); 1550 1551 if( strchr( acc->user, '@' ) == NULL ) 1552 { 1553 hide_login_progress( gc, "Invalid account name" ); 1554 signoff( gc ); 1555 return; 1556 } 1557 1558 resource = set_getstr(&acc->set, "resource"); 1559 loginname = create_valid_jid(acc->user, DEFAULT_SERVER, resource); 1560 1524 1561 jd->hash = g_hash_table_new(g_str_hash, g_str_equal); 1525 1562 jd->chats = NULL; /* we have no chats yet */ … … 1527 1564 set_login_progress(gc, 1, _("Connecting")); 1528 1565 1529 if (!(jd->gjc = gjab_new(loginname, user->password, gc))) {1566 if (!(jd->gjc = gjab_new(loginname, acc->pass, gc))) { 1530 1567 g_free(loginname); 1531 1568 hide_login_progress(gc, _("Unable to connect")); … … 2337 2374 ret->name = "jabber"; 2338 2375 ret->away_states = jabber_away_states; 2376 ret->acc_init = jabber_acc_init; 2339 2377 ret->login = jabber_login; 2340 2378 ret->close = jabber_close; … … 2349 2387 ret->alias_buddy = jabber_roster_update; 2350 2388 ret->group_buddy = jabber_group_change; 2351 ret-> cmp_buddynames= g_strcasecmp;2389 ret->handle_cmp = g_strcasecmp; 2352 2390 2353 2391 register_protocol (ret); -
protocols/msn/msn.c
r695e392 r69cb623 27 27 #include "msn.h" 28 28 29 static void msn_login( struct aim_user *acct ) 30 { 31 struct gaim_connection *gc = new_gaim_conn( acct ); 29 static char *msn_set_display_name( set_t *set, char *value ); 30 31 static void msn_acc_init( account_t *acc ) 32 { 33 set_t *s; 34 35 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 36 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 37 } 38 39 static void msn_login( account_t *acc ) 40 { 41 struct gaim_connection *gc = new_gaim_conn( acc ); 32 42 struct msn_data *md = g_new0( struct msn_data, 1 ); 33 43 … … 37 47 md->fd = -1; 38 48 39 if( strchr( acc t->username, '@' ) == NULL )49 if( strchr( acc->user, '@' ) == NULL ) 40 50 { 41 51 hide_login_progress( gc, "Invalid account name" ); … … 212 222 static void msn_set_info( struct gaim_connection *gc, char *info ) 213 223 { 214 char buf[1024], *fn; 215 struct msn_data *md = gc->proto_data; 216 217 if( strlen( info ) > 129 ) 218 { 219 do_error_dialog( gc, "Maximum name length exceeded", "MSN" ); 220 return; 221 } 222 223 fn = msn_http_encode( info ); 224 225 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn ); 226 msn_write( gc, buf, strlen( buf ) ); 227 g_free( fn ); 224 msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info ); 228 225 } 229 226 … … 364 361 } 365 362 363 static char *msn_set_display_name( set_t *set, char *value ) 364 { 365 account_t *acc = set->data; 366 struct gaim_connection *gc = acc->gc; 367 struct msn_data *md; 368 char buf[1024], *fn; 369 int i; 370 371 /* Double-check. */ 372 if( gc == NULL ) 373 return NULL; 374 375 md = gc->proto_data; 376 377 if( strlen( value ) > 129 ) 378 { 379 serv_got_crap( gc, "Maximum name length exceeded" ); 380 return NULL; 381 } 382 383 fn = msn_http_encode( value ); 384 385 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn ); 386 msn_write( gc, buf, strlen( buf ) ); 387 g_free( fn ); 388 389 /* Returning NULL would be better, because the server still has to 390 confirm the name change. However, it looks a bit confusing to the 391 user. */ 392 return value; 393 } 394 366 395 void msn_init() 367 396 { 368 397 struct prpl *ret = g_new0(struct prpl, 1); 398 369 399 ret->name = "msn"; 370 400 ret->login = msn_login; 401 ret->acc_init = msn_acc_init; 371 402 ret->close = msn_close; 372 403 ret->send_im = msn_send_im; … … 388 419 ret->rem_deny = msn_rem_deny; 389 420 ret->send_typing = msn_send_typing; 390 ret-> cmp_buddynames= g_strcasecmp;421 ret->handle_cmp = g_strcasecmp; 391 422 392 423 register_protocol(ret); -
protocols/msn/ns.c
r695e392 r69cb623 223 223 else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 ) 224 224 { 225 set_t *s; 226 225 227 http_decode( cmd[4] ); 226 228 227 229 strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) ); 228 230 gc->displayname[sizeof(gc->displayname)-1] = 0; 231 232 if( ( s = set_find( &gc->acc->set, "display_name" ) ) ) 233 { 234 g_free( s->value ); 235 s->value = g_strdup( cmd[4] ); 236 } 229 237 230 238 set_login_progress( gc, 1, "Authenticated, getting buddy list" ); … … 517 525 if( g_strcasecmp( cmd[3], gc->username ) == 0 ) 518 526 { 527 set_t *s; 528 519 529 http_decode( cmd[4] ); 520 530 strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) ); 521 531 gc->displayname[sizeof(gc->displayname)-1] = 0; 532 533 if( ( s = set_find( &gc->acc->set, "display_name" ) ) ) 534 { 535 g_free( s->value ); 536 s->value = g_strdup( cmd[4] ); 537 } 522 538 } 523 539 else -
protocols/nogaim.c
r695e392 r69cb623 145 145 /* multi.c */ 146 146 147 struct gaim_connection *new_gaim_conn( struct aim_user *user)147 struct gaim_connection *new_gaim_conn( account_t *acc ) 148 148 { 149 149 struct gaim_connection *gc; 150 account_t *a;151 150 152 151 gc = g_new0( struct gaim_connection, 1 ); 153 152 154 gc->prpl = user->prpl;155 g_snprintf( gc->username, sizeof( gc->username ), "%s", user->username);156 g_snprintf( gc->password, sizeof( gc->password ), "%s", user->password);157 /* [MD] BUGFIX: don't set gc->irc to the global IRC, but use the one from the struct aim_user.158 * This fixes daemon mode breakage where IRC doesn't point to the currently active connection.159 */160 gc->irc = user->irc;153 /* Maybe we should get rid of this memory waste later. ;-) */ 154 g_snprintf( gc->username, sizeof( gc->username ), "%s", acc->user ); 155 g_snprintf( gc->password, sizeof( gc->password ), "%s", acc->pass ); 156 157 gc->irc = acc->irc; 158 gc->acc = acc; 159 acc->gc = gc; 161 160 162 161 connections = g_slist_append( connections, gc ); 163 164 user->gc = gc;165 gc->user = user;166 167 // Find the account_t so we can set its gc pointer168 for( a = gc->irc->accounts; a; a = a->next )169 if( ( struct aim_user * ) a->gc == user )170 {171 a->gc = gc;172 break;173 }174 162 175 163 return( gc ); … … 189 177 190 178 connections = g_slist_remove( connections, gc ); 191 g_free( gc->user );192 179 g_free( gc ); 193 180 } … … 220 207 va_end( params ); 221 208 222 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||223 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( gc->irc, "strip_html" ) ) )209 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 210 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 224 211 strip_html( text ); 225 212 226 213 /* Try to find a different connection on the same protocol. */ 227 214 for( a = gc->irc->accounts; a; a = a->next ) 228 if( a->prpl == gc-> prpl && a->gc != gc )215 if( a->prpl == gc->acc->prpl && a->gc != gc ) 229 216 break; 230 217 231 218 /* If we found one, include the screenname in the message. */ 232 219 if( a ) 233 irc_usermsg( gc->irc, "%s(%s) - %s", gc-> prpl->name, gc->username, text );220 irc_usermsg( gc->irc, "%s(%s) - %s", gc->acc->prpl->name, gc->username, text ); 234 221 else 235 irc_usermsg( gc->irc, "%s - %s", gc-> prpl->name, text );222 irc_usermsg( gc->irc, "%s - %s", gc->acc->prpl->name, text ); 236 223 237 224 g_free( text ); … … 242 229 struct gaim_connection *gc = d; 243 230 244 if( gc-> prpl && gc->prpl->keepalive )245 gc-> prpl->keepalive( gc );231 if( gc->acc->prpl->keepalive ) 232 gc->acc->prpl->keepalive( gc ); 246 233 247 234 return TRUE; … … 297 284 b_event_remove( gc->keepalive ); 298 285 gc->flags |= OPT_LOGGING_OUT; 286 299 287 gc->keepalive = 0; 300 gc-> prpl->close( gc );288 gc->acc->prpl->close( gc ); 301 289 b_event_remove( gc->inpa ); 302 290 … … 323 311 /* Uhm... This is very sick. */ 324 312 } 325 else if( !gc->wants_to_die && set_getint( irc, "auto_reconnect" ) ) 326 { 327 int delay = set_getint( irc, "auto_reconnect_delay" ); 313 else if( !gc->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) && 314 set_getbool( &a->set, "auto_reconnect" ) ) 315 { 316 int delay = set_getint( &irc->set, "auto_reconnect_delay" ); 328 317 329 318 serv_got_crap( gc, "Reconnecting in %d seconds..", delay ); … … 364 353 irc_t *irc = gc->irc; 365 354 366 if( set_get int( irc, "debug" ) && 0 ) /* This message is too useless */355 if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */ 367 356 serv_got_crap( gc, "Receiving user add from handle: %s", handle ); 368 357 369 358 if( user_findhandle( gc, handle ) ) 370 359 { 371 if( set_get int( irc, "debug" ) )360 if( set_getbool( &irc->set, "debug" ) ) 372 361 serv_got_crap( gc, "User already exists, ignoring add request: %s", handle ); 373 362 … … 378 367 379 368 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 380 strcpy( nick, nick_get( gc-> irc, handle, gc->prpl, realname ) );369 strcpy( nick, nick_get( gc->acc, handle, realname ) ); 381 370 382 371 u = user_add( gc->irc, nick ); … … 390 379 u->user = g_strndup( handle, s - handle ); 391 380 } 392 else if( gc-> user->proto_opt[0] && *gc->user->proto_opt[0])381 else if( gc->acc->server ) 393 382 { 394 383 char *colon; 395 384 396 if( ( colon = strchr( gc-> user->proto_opt[0], ':' ) ) )397 u->host = g_strndup( gc-> user->proto_opt[0],398 colon - gc-> user->proto_opt[0]);385 if( ( colon = strchr( gc->acc->server, ':' ) ) ) 386 u->host = g_strndup( gc->acc->server, 387 colon - gc->acc->server ); 399 388 else 400 u->host = g_strdup( gc-> user->proto_opt[0]);389 u->host = g_strdup( gc->acc->server ); 401 390 402 391 u->user = g_strdup( handle ); … … 409 398 else 410 399 { 411 u->host = g_strdup( gc-> user->prpl->name );400 u->host = g_strdup( gc->acc->prpl->name ); 412 401 u->user = g_strdup( handle ); 413 402 } … … 457 446 u->realname = g_strdup( realname ); 458 447 459 if( ( gc->flags & OPT_LOGGED_IN ) && set_get int( gc->irc, "display_namechanges" ) )448 if( ( gc->flags & OPT_LOGGED_IN ) && set_getbool( &gc->irc->set, "display_namechanges" ) ) 460 449 serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname ); 461 450 } … … 479 468 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 480 469 { 481 data->gc-> prpl->add_buddy( data->gc, data->handle );470 data->gc->acc->prpl->add_buddy( data->gc, data->handle ); 482 471 add_buddy( data->gc, NULL, data->handle, data->handle ); 483 472 … … 513 502 if( !u ) 514 503 { 515 if( g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "add" ) == 0 )504 if( g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "add" ) == 0 ) 516 505 { 517 506 add_buddy( gc, NULL, handle, NULL ); … … 520 509 else 521 510 { 522 if( set_get int( gc->irc, "debug" ) || g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "ignore" ) != 0 )511 if( set_getbool( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 ) 523 512 { 524 513 serv_got_crap( gc, "serv_got_update() for handle %s:", handle ); … … 558 547 } 559 548 560 if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) )549 if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "oscar" ) == 0 || strcmp( gc->acc->prpl->name, "icq" ) == 0 ) ) 561 550 { 562 551 u->away = g_strdup( "Away" ); 563 552 } 564 else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber")) )553 else if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "jabber" ) == 0 ) ) 565 554 { 566 555 if( type & UC_DND ) … … 571 560 u->away = g_strdup( "Away" ); 572 561 } 573 else if( ( type & UC_UNAVAILABLE ) && gc-> prpl->get_status_string )574 { 575 u->away = g_strdup( gc-> prpl->get_status_string( gc, type ) );562 else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string ) 563 { 564 u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) ); 576 565 } 577 566 else … … 579 568 580 569 /* LISPy... */ 581 if( ( set_get int( gc->irc, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */570 if( ( set_getbool( &gc->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 582 571 ( u->online ) && /* Don't touch offline people */ 583 572 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ … … 598 587 if( !u ) 599 588 { 600 char *h = set_getstr( irc, "handle_unknown" );589 char *h = set_getstr( &irc->set, "handle_unknown" ); 601 590 602 591 if( g_strcasecmp( h, "ignore" ) == 0 ) 603 592 { 604 if( set_get int( irc, "debug" ) )593 if( set_getbool( &irc->set, "debug" ) ) 605 594 serv_got_crap( gc, "Ignoring message from unknown handle %s", handle ); 606 595 … … 609 598 else if( g_strncasecmp( h, "add", 3 ) == 0 ) 610 599 { 611 int private = set_get int( irc, "private" );600 int private = set_getbool( &irc->set, "private" ); 612 601 613 602 if( h[3] ) … … 630 619 } 631 620 632 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||633 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( gc->irc, "strip_html" ) ) )621 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 622 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 634 623 strip_html( msg ); 635 624 … … 671 660 user_t *u; 672 661 673 if( !set_get int( gc->irc, "typing_notice" ) )662 if( !set_getbool( &gc->irc->set, "typing_notice" ) ) 674 663 return; 675 664 … … 693 682 GList *ir; 694 683 695 if( set_get int( gc->irc, "debug" ) )684 if( set_getbool( &gc->irc->set, "debug" ) ) 696 685 serv_got_crap( gc, "You were removed from conversation %d", (int) id ); 697 686 … … 732 721 733 722 /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ 734 if( g_strcasecmp( who, gc->user ->username ) == 0 )723 if( g_strcasecmp( who, gc->username ) == 0 ) 735 724 return; 736 725 … … 738 727 for( c = gc->conversations; c && c->id != id; c = c->next ); 739 728 740 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||741 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( gc->irc, "strip_html" ) ) )729 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 730 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 742 731 strip_html( msg ); 743 732 … … 772 761 g_free( s ); 773 762 774 if( set_get int( gc->irc, "debug" ) )763 if( set_getbool( &gc->irc->set, "debug" ) ) 775 764 serv_got_crap( gc, "Creating new conversation: (id=%d,handle=%s)", id, handle ); 776 765 … … 786 775 int me = 0; 787 776 788 if( set_get int( b->gc->irc, "debug" ) )777 if( set_getbool( &b->gc->irc->set, "debug" ) ) 789 778 serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id ); 790 779 791 780 /* It might be yourself! */ 792 if( b->gc-> prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 )781 if( b->gc->acc->prpl->handle_cmp( handle, b->gc->username ) == 0 ) 793 782 { 794 783 u = user_find( b->gc->irc, b->gc->irc->nick ); … … 820 809 int me = 0; 821 810 822 if( set_get int( b->gc->irc, "debug" ) )811 if( set_getbool( &b->gc->irc->set, "debug" ) ) 823 812 serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" ); 824 813 825 814 /* It might be yourself! */ 826 if( g_strcasecmp( handle, b->gc->user ->username ) == 0 )815 if( g_strcasecmp( handle, b->gc->username ) == 0 ) 827 816 { 828 817 u = user_find( b->gc->irc, b->gc->irc->nick ); … … 882 871 } 883 872 884 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ) 885 { 873 char *set_eval_away_devoice( set_t *set, char *value ) 874 { 875 irc_t *irc = set->data; 886 876 int st; 887 877 … … 897 887 /* Horror.... */ 898 888 899 if( st != set_get int( irc, "away_devoice" ) )889 if( st != set_getbool( &irc->set, "away_devoice" ) ) 900 890 { 901 891 char list[80] = ""; … … 937 927 } 938 928 939 return( set_eval_bool( irc,set, value ) );929 return( set_eval_bool( set, value ) ); 940 930 } 941 931 … … 957 947 } 958 948 959 st = gc-> prpl->send_im( gc, handle, msg, strlen( msg ), flags );949 st = gc->acc->prpl->send_im( gc, handle, msg, strlen( msg ), flags ); 960 950 g_free( buf ); 961 951 … … 974 964 } 975 965 976 st = gc-> prpl->chat_send( gc, id, msg );966 st = gc->acc->prpl->chat_send( gc, id, msg ); 977 967 g_free( buf ); 978 968 … … 988 978 989 979 if( !away ) away = ""; 990 ms = m = gc-> prpl->away_states( gc );980 ms = m = gc->acc->prpl->away_states( gc ); 991 981 992 982 while( m ) … … 1009 999 if( m ) 1010 1000 { 1011 gc-> prpl->set_away( gc, m->data, *away ? away : NULL );1001 gc->acc->prpl->set_away( gc, m->data, *away ? away : NULL ); 1012 1002 } 1013 1003 else … … 1016 1006 if( s ) 1017 1007 { 1018 gc-> prpl->set_away( gc, s, away );1019 if( set_get int( gc->irc, "debug" ) )1008 gc->acc->prpl->set_away( gc, s, away ); 1009 if( set_getbool( &gc->irc->set, "debug" ) ) 1020 1010 serv_got_crap( gc, "Setting away state to %s", s ); 1021 1011 } 1022 1012 else 1023 gc-> prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );1013 gc->acc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); 1024 1014 } 1025 1015 … … 1073 1063 void bim_add_allow( struct gaim_connection *gc, char *handle ) 1074 1064 { 1075 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc-> prpl->cmp_buddynames) == NULL )1065 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL ) 1076 1066 { 1077 1067 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); 1078 1068 } 1079 1069 1080 gc-> prpl->add_permit( gc, handle );1070 gc->acc->prpl->add_permit( gc, handle ); 1081 1071 } 1082 1072 … … 1085 1075 GSList *l; 1086 1076 1087 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc-> prpl->cmp_buddynames) ) )1077 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) ) 1088 1078 { 1089 1079 g_free( l->data ); … … 1091 1081 } 1092 1082 1093 gc-> prpl->rem_permit( gc, handle );1083 gc->acc->prpl->rem_permit( gc, handle ); 1094 1084 } 1095 1085 1096 1086 void bim_add_block( struct gaim_connection *gc, char *handle ) 1097 1087 { 1098 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc-> prpl->cmp_buddynames) == NULL )1088 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL ) 1099 1089 { 1100 1090 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); 1101 1091 } 1102 1092 1103 gc-> prpl->add_deny( gc, handle );1093 gc->acc->prpl->add_deny( gc, handle ); 1104 1094 } 1105 1095 … … 1108 1098 GSList *l; 1109 1099 1110 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc-> prpl->cmp_buddynames) ) )1100 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) ) 1111 1101 { 1112 1102 g_free( l->data ); … … 1114 1104 } 1115 1105 1116 gc-> prpl->rem_deny( gc, handle );1117 } 1106 gc->acc->prpl->rem_deny( gc, handle ); 1107 } -
protocols/nogaim.h
r695e392 r69cb623 39 39 40 40 #include "bitlbee.h" 41 #include "account.h" 41 42 #include "proxy.h" 42 43 #include "md5.h" … … 63 64 struct gaim_connection 64 65 { 65 struct prpl *prpl;66 account_t *acc; 66 67 guint32 flags; 67 68 … … 78 79 GSList *deny; 79 80 int permdeny; 80 81 struct aim_user *user;82 81 83 82 char username[64]; … … 126 125 }; 127 126 128 struct aim_user {129 char username[64];130 char alias[SELF_ALIAS_LEN];131 char password[32];132 char user_info[2048];133 int options;134 struct prpl *prpl;135 /* prpls can use this to save information about the user,136 * like which server to connect to, etc */137 char proto_opt[7][256];138 139 struct gaim_connection *gc;140 irc_t *irc;141 };142 143 127 struct prpl { 144 128 int options; 145 129 const char *name; 146 130 147 void (* login) (struct aim_user *); 131 void (* acc_init) (account_t *); 132 void (* login) (account_t *); 148 133 void (* keepalive) (struct gaim_connection *); 149 134 void (* close) (struct gaim_connection *); … … 180 165 181 166 /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */ 182 int (* cmp_buddynames) (const char *who1, const char *who2);167 int (* handle_cmp) (const char *who1, const char *who2); 183 168 }; 184 169 … … 206 191 207 192 void nogaim_init(); 208 char *set_eval_away_devoice( irc_t *irc,set_t *set, char *value );193 char *set_eval_away_devoice( set_t *set, char *value ); 209 194 210 195 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); … … 212 197 213 198 /* multi.c */ 214 G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( struct aim_user *user);199 G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc ); 215 200 G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc ); 216 201 G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg ); -
protocols/oscar/oscar.c
r695e392 r69cb623 356 356 } 357 357 358 static void oscar_login(struct aim_user *user) { 358 static void oscar_acc_init(account_t *acc) 359 { 360 set_t *s; 361 362 s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); 363 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY; 364 365 if (isdigit(acc->user[0])) { 366 s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc ); 367 s->flags |= ACC_SET_OFFLINE_ONLY; 368 } 369 } 370 371 static void oscar_login(account_t *acc) { 359 372 aim_session_t *sess; 360 373 aim_conn_t *conn; 361 374 char buf[256]; 362 struct gaim_connection *gc = new_gaim_conn( user);375 struct gaim_connection *gc = new_gaim_conn(acc); 363 376 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 364 377 365 if (isdigit( *user->username)) {378 if (isdigit(acc->user[0])) { 366 379 odata->icq = TRUE; 367 380 /* This is odd but it's necessary for a proper do_import and do_export. 368 381 We don't do those anymore, but let's stick with it, just in case 369 it accidentally fixes something else too... */382 it accidentally fixes something else too... </bitlbee> */ 370 383 gc->password[8] = 0; 371 384 } else { … … 390 403 } 391 404 392 if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && 393 g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { 394 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]); 405 if (acc->server == NULL) { 406 hide_login_progress(gc, "No servername specified"); 407 signoff(gc); 408 return; 409 } 410 411 if (g_strcasecmp(acc->server, "login.icq.com") != 0 && 412 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { 413 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 395 414 } 396 415 … … 402 421 403 422 conn->status |= AIM_CONN_STATUS_INPROGRESS; 404 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? 405 user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER, 406 user->proto_opt[USEROPT_AUTHPORT][0] ? 407 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 408 oscar_login_connect, gc); 423 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); 409 424 if (conn->fd < 0) { 410 425 hide_login_progress(gc, _("Couldn't connect to host")); … … 485 500 struct aim_authresp_info *info; 486 501 int i; char *host; int port; 487 struct aim_user *user;488 502 aim_conn_t *bosconn; 489 503 490 504 struct gaim_connection *gc = sess->aux_data; 491 505 struct oscar_data *od = gc->proto_data; 492 user = gc->user; 493 port = user->proto_opt[USEROPT_AUTHPORT][0] ? 494 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT, 506 port = AIM_LOGIN_PORT; 495 507 496 508 va_start(ap, fr); … … 871 883 struct aim_redirect_data *redir; 872 884 struct gaim_connection *gc = sess->aux_data; 873 struct aim_user *user = gc->user;874 885 aim_conn_t *tstconn; 875 886 int i; … … 877 888 int port; 878 889 879 port = user->proto_opt[USEROPT_AUTHPORT][0] ?880 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,881 882 890 va_start(ap, fr); 883 891 redir = va_arg(ap, struct aim_redirect_data *); 884 892 va_end(ap); 885 893 894 port = AIM_LOGIN_PORT; 886 895 for (i = 0; i < (int)strlen(redir->ip); i++) { 887 896 if (redir->ip[i] == ':') { … … 1242 1251 channel = va_arg(ap, int); 1243 1252 userinfo = va_arg(ap, aim_userinfo_t *); 1244 1245 if (set_getint(sess->aux_data, "debug")) {1246 serv_got_crap(sess->aux_data, "channel %i called", channel);1247 }1248 1253 1249 1254 switch (channel) { … … 1723 1728 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 1724 1729 1730 /* FIXME: It seems we're not really using this, and it broke now that 1731 struct aim_user is dead. 1725 1732 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); 1726 1733 */ 1734 1727 1735 return 1; 1728 1736 } … … 2656 2664 ret->away_states = oscar_away_states; 2657 2665 ret->login = oscar_login; 2666 ret->acc_init = oscar_acc_init; 2658 2667 ret->close = oscar_close; 2659 2668 ret->send_im = oscar_send_im; … … 2673 2682 ret->set_permit_deny = oscar_set_permit_deny; 2674 2683 ret->keepalive = oscar_keepalive; 2675 ret->cmp_buddynames = aim_sncmp;2676 2684 ret->get_status_string = oscar_get_status_string; 2677 2685 ret->send_typing = oscar_send_typing; 2686 2687 ret->handle_cmp = aim_sncmp; 2678 2688 2679 2689 register_protocol(ret); -
protocols/oscar/rxhandlers.c
r695e392 r69cb623 112 112 /* Following SNAC will be related */ 113 113 } 114 115 if (set_getint(sess->aux_data, "debug")) {116 serv_got_crap(sess->aux_data, "snac %x/%x received", snac.family, snac.subtype);117 }118 114 119 115 for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { -
protocols/oscar/service.c
r695e392 r69cb623 732 732 guint32 data; 733 733 int tlvlen; 734 struct gaim_connection *gc = sess ? sess->aux_data : NULL; 734 735 735 736 data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */ 737 738 if (gc && set_getbool(&gc->acc->set, "web_aware")) 739 data |= AIM_ICQ_STATE_WEBAWARE; 736 740 737 741 tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); -
protocols/yahoo/libyahoo2.c
r695e392 r69cb623 89 89 #define vsnprintf _vsnprintf 90 90 #endif 91 92 #include "base64.h" 91 93 92 94 #ifdef USE_STRUCT_CALLBACKS … … 695 697 } 696 698 697 static char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 698 "abcdefghijklmnopqrstuvwxyz" 699 "0123456789._"; 699 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ 700 700 static void to_y64(unsigned char *out, const unsigned char *in, int inlen) 701 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ 702 { 703 for (; inlen >= 3; inlen -= 3) 704 { 705 *out++ = base64digits[in[0] >> 2]; 706 *out++ = base64digits[((in[0]<<4) & 0x30) | (in[1]>>4)]; 707 *out++ = base64digits[((in[1]<<2) & 0x3c) | (in[2]>>6)]; 708 *out++ = base64digits[in[2] & 0x3f]; 709 in += 3; 710 } 711 if (inlen > 0) 712 { 713 unsigned char fragment; 714 715 *out++ = base64digits[in[0] >> 2]; 716 fragment = (in[0] << 4) & 0x30; 717 if (inlen > 1) 718 fragment |= in[1] >> 4; 719 *out++ = base64digits[fragment]; 720 *out++ = (inlen < 2) ? '-' 721 : base64digits[(in[1] << 2) & 0x3c]; 722 *out++ = '-'; 723 } 724 *out = '\0'; 701 { 702 base64_encode_real(in, inlen, out, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); 725 703 } 726 704 -
protocols/yahoo/yahoo.c
r695e392 r69cb623 121 121 } 122 122 123 static void byahoo_login( struct aim_user *user)124 { 125 struct gaim_connection *gc = new_gaim_conn( user);123 static void byahoo_login( account_t *acc ) 124 { 125 struct gaim_connection *gc = new_gaim_conn( acc ); 126 126 struct byahoo_data *yd = gc->proto_data = g_new0( struct byahoo_data, 1 ); 127 127 … … 130 130 131 131 set_login_progress( gc, 1, "Connecting" ); 132 yd->y2_id = yahoo_init( user->username, user->password);132 yd->y2_id = yahoo_init( acc->user, acc->pass ); 133 133 yahoo_login( yd->y2_id, yd->current_status ); 134 134 } … … 411 411 ret->chat_leave = byahoo_chat_leave; 412 412 ret->chat_open = byahoo_chat_open; 413 ret->cmp_buddynames = g_strcasecmp; 413 414 ret->handle_cmp = g_strcasecmp; 414 415 415 416 register_protocol(ret); … … 427 428 yd = gc->proto_data; 428 429 429 if( !strcmp(gc->prpl->name, "yahoo")&& yd->y2_id == id )430 if( strcmp( gc->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id ) 430 431 return( gc ); 431 432 }
Note: See TracChangeset
for help on using the changeset viewer.