- Timestamp:
- 2006-06-30T23:18:56Z (18 years ago)
- Branches:
- master
- Children:
- 5100caa
- Parents:
- 5c9512f
- Location:
- protocols
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r5c9512f r0a3c243 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 565 char *server = NULL, *s; … … 568 568 return; 569 569 570 user = GJ_GC(gjc)->user;571 if ( *user->proto_opt[0]) {570 acc = GJ_GC(gjc)->acc; 571 if (acc->server) { 572 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]);573 if (strchr(acc->server, '.')) { 574 server = g_strdup(acc->server); 575 575 if ((s = strchr(server, ':'))) 576 576 *s = 0; … … 578 578 579 579 /* After the hostname, there can be a port number */ 580 s = strchr( user->proto_opt[0], ':');580 s = strchr(acc->server, ':'); 581 581 if (s && isdigit(s[1])) 582 582 sscanf(s + 1, "%d", &port); 583 583 584 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)585 if (strstr(acc->server, ":ssl") || g_strcasecmp(acc->server, "ssl") == 0) 586 586 ssl = 1; 587 587 } … … 616 616 g_free(server); 617 617 618 if (! user->gc || (gjc->fd < 0)) {618 if (!acc->gc || (gjc->fd < 0)) { 619 619 STATE_EVT(JCONN_STATE_OFF) 620 620 return; … … 1516 1516 } 1517 1517 1518 static void jabber_login( struct aim_user *user)1519 { 1520 struct gaim_connection *gc = new_gaim_conn( user);1518 static void jabber_login(account_t *acc) 1519 { 1520 struct gaim_connection *gc = new_gaim_conn(acc); 1521 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");1522 char *loginname = create_valid_jid(acc->user, DEFAULT_SERVER, "BitlBee"); 1523 1523 1524 1524 jd->hash = g_hash_table_new(g_str_hash, g_str_equal); … … 1527 1527 set_login_progress(gc, 1, _("Connecting")); 1528 1528 1529 if (!(jd->gjc = gjab_new(loginname, user->password, gc))) {1529 if (!(jd->gjc = gjab_new(loginname, acc->pass, gc))) { 1530 1530 g_free(loginname); 1531 1531 hide_login_progress(gc, _("Unable to connect")); -
protocols/msn/msn.c
r5c9512f r0a3c243 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( acc t);29 static void msn_login( account_t *acc ) 30 { 31 struct gaim_connection *gc = new_gaim_conn( acc ); 32 32 struct msn_data *md = g_new0( struct msn_data, 1 ); 33 33 … … 37 37 md->fd = -1; 38 38 39 if( strchr( acc t->username, '@' ) == NULL )39 if( strchr( acc->user, '@' ) == NULL ) 40 40 { 41 41 hide_login_progress( gc, "Invalid account name" ); -
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 } -
protocols/nogaim.h
r5c9512f r0a3c243 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 (* login) (account_t *); 148 132 void (* keepalive) (struct gaim_connection *); 149 133 void (* close) (struct gaim_connection *); … … 212 196 213 197 /* multi.c */ 214 G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( struct aim_user *user);198 G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc ); 215 199 G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc ); 216 200 G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg ); -
protocols/oscar/oscar.c
r5c9512f r0a3c243 356 356 } 357 357 358 static void oscar_login( struct aim_user *user) {358 static void oscar_login(account_t *acc) { 359 359 aim_session_t *sess; 360 360 aim_conn_t *conn; 361 361 char buf[256]; 362 struct gaim_connection *gc = new_gaim_conn( user);362 struct gaim_connection *gc = new_gaim_conn(acc); 363 363 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 364 364 365 if (isdigit( *user->username)) {365 if (isdigit(acc->user[0])) { 366 366 odata->icq = TRUE; 367 367 /* This is odd but it's necessary for a proper do_import and do_export. 368 368 We don't do those anymore, but let's stick with it, just in case 369 it accidentally fixes something else too... */369 it accidentally fixes something else too... </bitlbee> */ 370 370 gc->password[8] = 0; 371 371 } else { … … 390 390 } 391 391 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]);392 if (g_strcasecmp(acc->server, "login.icq.com") != 0 && 393 g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) { 394 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server); 395 395 } 396 396 … … 402 402 403 403 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); 404 conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc); 409 405 if (conn->fd < 0) { 410 406 hide_login_progress(gc, _("Couldn't connect to host")); … … 485 481 struct aim_authresp_info *info; 486 482 int i; char *host; int port; 487 struct aim_user *user;488 483 aim_conn_t *bosconn; 489 484 490 485 struct gaim_connection *gc = sess->aux_data; 491 486 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, 487 port = AIM_LOGIN_PORT; 495 488 496 489 va_start(ap, fr); … … 871 864 struct aim_redirect_data *redir; 872 865 struct gaim_connection *gc = sess->aux_data; 873 struct aim_user *user = gc->user;874 866 aim_conn_t *tstconn; 875 867 int i; … … 877 869 int port; 878 870 879 port = user->proto_opt[USEROPT_AUTHPORT][0] ?880 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,881 882 871 va_start(ap, fr); 883 872 redir = va_arg(ap, struct aim_redirect_data *); 884 873 va_end(ap); 885 874 875 port = AIM_LOGIN_PORT; 886 876 for (i = 0; i < (int)strlen(redir->ip); i++) { 887 877 if (redir->ip[i] == ':') { … … 1723 1713 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; 1724 1714 1715 /* FIXME: It seems we're not really using this, and it broke now that 1716 struct aim_user is dead. 1725 1717 aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps); 1726 1718 */ 1719 1727 1720 return 1; 1728 1721 } -
protocols/yahoo/yahoo.c
r5c9512f r0a3c243 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 } … … 425 425 yd = gc->proto_data; 426 426 427 if( !strcmp(gc->prpl->name, "yahoo")&& yd->y2_id == id )427 if( strcmp( gc->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id ) 428 428 return( gc ); 429 429 }
Note: See TracChangeset
for help on using the changeset viewer.