Changeset 69cb623 for protocols/nogaim.c
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.