Changeset 0a3c243 for protocols/nogaim.c
- Timestamp:
- 2006-06-30T23:18:56Z (18 years ago)
- Branches:
- master
- Children:
- 5100caa
- Parents:
- 5c9512f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r5c9512f r0a3c243 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 } … … 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; … … 299 286 300 287 gc->keepalive = 0; 301 gc-> prpl->close( gc );288 gc->acc->prpl->close( gc ); 302 289 b_event_remove( gc->inpa ); 303 290 … … 379 366 380 367 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 381 strcpy( nick, nick_get( gc->irc, handle, gc-> prpl, realname ) );368 strcpy( nick, nick_get( gc->irc, handle, gc->acc->prpl, realname ) ); 382 369 383 370 u = user_add( gc->irc, nick ); … … 391 378 u->user = g_strndup( handle, s - handle ); 392 379 } 393 else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0])380 else if( *gc->acc->server ) 394 381 { 395 382 char *colon; 396 383 397 if( ( colon = strchr( gc-> user->proto_opt[0], ':' ) ) )398 u->host = g_strndup( gc-> user->proto_opt[0],399 colon - gc-> user->proto_opt[0]);384 if( ( colon = strchr( gc->acc->server, ':' ) ) ) 385 u->host = g_strndup( gc->acc->server, 386 colon - gc->acc->server ); 400 387 else 401 u->host = g_strdup( gc-> user->proto_opt[0]);388 u->host = g_strdup( gc->acc->server ); 402 389 403 390 u->user = g_strdup( handle ); … … 410 397 else 411 398 { 412 u->host = g_strdup( gc-> user->prpl->name );399 u->host = g_strdup( gc->acc->prpl->name ); 413 400 u->user = g_strdup( handle ); 414 401 } … … 480 467 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 481 468 { 482 data->gc-> prpl->add_buddy( data->gc, data->handle );469 data->gc->acc->prpl->add_buddy( data->gc, data->handle ); 483 470 add_buddy( data->gc, NULL, data->handle, data->handle ); 484 471 … … 559 546 } 560 547 561 if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "oscar") || !strcmp(gc->prpl->name, "icq")) )548 if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "oscar" ) == 0 || strcmp( gc->acc->prpl->name, "icq" ) == 0 ) ) 562 549 { 563 550 u->away = g_strdup( "Away" ); 564 551 } 565 else if( ( type & UC_UNAVAILABLE ) && ( !strcmp(gc->prpl->name, "jabber")) )552 else if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "jabber" ) == 0 ) ) 566 553 { 567 554 if( type & UC_DND ) … … 572 559 u->away = g_strdup( "Away" ); 573 560 } 574 else if( ( type & UC_UNAVAILABLE ) && gc-> prpl->get_status_string )575 { 576 u->away = g_strdup( gc-> prpl->get_status_string( gc, type ) );561 else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string ) 562 { 563 u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) ); 577 564 } 578 565 else … … 733 720 734 721 /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ 735 if( g_strcasecmp( who, gc->user ->username ) == 0 )722 if( g_strcasecmp( who, gc->username ) == 0 ) 736 723 return; 737 724 … … 791 778 792 779 /* It might be yourself! */ 793 if( b->gc-> prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 )780 if( b->gc->acc->prpl->cmp_buddynames( handle, b->gc->username ) == 0 ) 794 781 { 795 782 u = user_find( b->gc->irc, b->gc->irc->nick ); … … 825 812 826 813 /* It might be yourself! */ 827 if( g_strcasecmp( handle, b->gc->user ->username ) == 0 )814 if( g_strcasecmp( handle, b->gc->username ) == 0 ) 828 815 { 829 816 u = user_find( b->gc->irc, b->gc->irc->nick ); … … 959 946 } 960 947 961 st = gc-> prpl->send_im( gc, handle, msg, strlen( msg ), flags );948 st = gc->acc->prpl->send_im( gc, handle, msg, strlen( msg ), flags ); 962 949 g_free( buf ); 963 950 … … 976 963 } 977 964 978 st = gc-> prpl->chat_send( gc, id, msg );965 st = gc->acc->prpl->chat_send( gc, id, msg ); 979 966 g_free( buf ); 980 967 … … 990 977 991 978 if( !away ) away = ""; 992 ms = m = gc-> prpl->away_states( gc );979 ms = m = gc->acc->prpl->away_states( gc ); 993 980 994 981 while( m ) … … 1011 998 if( m ) 1012 999 { 1013 gc-> prpl->set_away( gc, m->data, *away ? away : NULL );1000 gc->acc->prpl->set_away( gc, m->data, *away ? away : NULL ); 1014 1001 } 1015 1002 else … … 1018 1005 if( s ) 1019 1006 { 1020 gc-> prpl->set_away( gc, s, away );1007 gc->acc->prpl->set_away( gc, s, away ); 1021 1008 if( set_getint( &gc->irc->set, "debug" ) ) 1022 1009 serv_got_crap( gc, "Setting away state to %s", s ); 1023 1010 } 1024 1011 else 1025 gc-> prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );1012 gc->acc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); 1026 1013 } 1027 1014 … … 1075 1062 void bim_add_allow( struct gaim_connection *gc, char *handle ) 1076 1063 { 1077 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc-> prpl->cmp_buddynames ) == NULL )1064 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->cmp_buddynames ) == NULL ) 1078 1065 { 1079 1066 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); 1080 1067 } 1081 1068 1082 gc-> prpl->add_permit( gc, handle );1069 gc->acc->prpl->add_permit( gc, handle ); 1083 1070 } 1084 1071 … … 1087 1074 GSList *l; 1088 1075 1089 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc-> prpl->cmp_buddynames ) ) )1076 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->cmp_buddynames ) ) ) 1090 1077 { 1091 1078 g_free( l->data ); … … 1093 1080 } 1094 1081 1095 gc-> prpl->rem_permit( gc, handle );1082 gc->acc->prpl->rem_permit( gc, handle ); 1096 1083 } 1097 1084 1098 1085 void bim_add_block( struct gaim_connection *gc, char *handle ) 1099 1086 { 1100 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc-> prpl->cmp_buddynames ) == NULL )1087 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->cmp_buddynames ) == NULL ) 1101 1088 { 1102 1089 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); 1103 1090 } 1104 1091 1105 gc-> prpl->add_deny( gc, handle );1092 gc->acc->prpl->add_deny( gc, handle ); 1106 1093 } 1107 1094 … … 1110 1097 GSList *l; 1111 1098 1112 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc-> prpl->cmp_buddynames ) ) )1099 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->cmp_buddynames ) ) ) 1113 1100 { 1114 1101 g_free( l->data ); … … 1116 1103 } 1117 1104 1118 gc-> prpl->rem_deny( gc, handle );1119 } 1105 gc->acc->prpl->rem_deny( gc, handle ); 1106 }
Note: See TracChangeset
for help on using the changeset viewer.