Changes in protocols/jabber/jabber.c [75cde5d:0a3c243]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r75cde5d r0a3c243 471 471 } 472 472 473 static void jabber_callback(gpointer data, gint source, GaimInputCondition condition)473 static gboolean jabber_callback(gpointer data, gint source, b_input_condition condition) 474 474 { 475 475 struct gaim_connection *gc = (struct gaim_connection *)data; … … 477 477 478 478 gjab_recv(jd->gjc); 479 480 return TRUE; 479 481 } 480 482 … … 487 489 } 488 490 489 static void gjab_connected(gpointer data, gint source, GaimInputCondition cond)491 static gboolean gjab_connected(gpointer data, gint source, b_input_condition cond) 490 492 { 491 493 xmlnode x; … … 497 499 if (!g_slist_find(get_connections(), gc)) { 498 500 closesocket(source); 499 return ;501 return FALSE; 500 502 } 501 503 … … 508 510 if (source == -1) { 509 511 STATE_EVT(JCONN_STATE_OFF) 510 return ;512 return FALSE; 511 513 } 512 514 … … 530 532 531 533 gc = GJ_GC(gjc); 532 gc->inpa = gaim_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc); 533 } 534 535 static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition cond) 534 gc->inpa = b_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc); 535 536 return FALSE; 537 } 538 539 static gboolean gjab_connected_ssl(gpointer data, void *source, b_input_condition cond) 536 540 { 537 541 struct gaim_connection *gc = data; … … 544 548 if (source == NULL) { 545 549 STATE_EVT(JCONN_STATE_OFF) 546 return ;550 return FALSE; 547 551 } 548 552 549 553 if (!g_slist_find(get_connections(), gc)) { 550 554 ssl_disconnect(source); 551 return ;555 return FALSE; 552 556 } 553 557 554 gjab_connected(data, gjc->fd, cond);558 return gjab_connected(data, gjc->fd, cond); 555 559 } 556 560 557 561 static void gjab_start(gjconn gjc) 558 562 { 559 struct aim_user *user;563 account_t *acc; 560 564 int port = -1, ssl = 0; 561 565 char *server = NULL, *s; … … 564 568 return; 565 569 566 user = GJ_GC(gjc)->user;567 if ( *user->proto_opt[0]) {570 acc = GJ_GC(gjc)->acc; 571 if (acc->server) { 568 572 /* If there's a dot, assume there's a hostname in the beginning */ 569 if (strchr( user->proto_opt[0], '.')) {570 server = g_strdup( user->proto_opt[0]);573 if (strchr(acc->server, '.')) { 574 server = g_strdup(acc->server); 571 575 if ((s = strchr(server, ':'))) 572 576 *s = 0; … … 574 578 575 579 /* After the hostname, there can be a port number */ 576 s = strchr( user->proto_opt[0], ':');580 s = strchr(acc->server, ':'); 577 581 if (s && isdigit(s[1])) 578 582 sscanf(s + 1, "%d", &port); 579 583 580 584 /* And if there's the string ssl, the user wants an SSL-connection */ 581 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) 582 586 ssl = 1; 583 587 } … … 612 616 g_free(server); 613 617 614 if (! user->gc || (gjc->fd < 0)) {618 if (!acc->gc || (gjc->fd < 0)) { 615 619 STATE_EVT(JCONN_STATE_OFF) 616 620 return; … … 1512 1516 } 1513 1517 1514 static void jabber_login( struct aim_user *user)1515 { 1516 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); 1517 1521 struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1); 1518 char *loginname = create_valid_jid( user->username, DEFAULT_SERVER, "BitlBee");1522 char *loginname = create_valid_jid(acc->user, DEFAULT_SERVER, "BitlBee"); 1519 1523 1520 1524 jd->hash = g_hash_table_new(g_str_hash, g_str_equal); … … 1523 1527 set_login_progress(gc, 1, _("Connecting")); 1524 1528 1525 if (!(jd->gjc = gjab_new(loginname, user->password, gc))) {1529 if (!(jd->gjc = gjab_new(loginname, acc->pass, gc))) { 1526 1530 g_free(loginname); 1527 1531 hide_login_progress(gc, _("Unable to connect")); … … 1543 1547 } 1544 1548 1545 static gboolean jabber_free(gpointer data )1549 static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond) 1546 1550 { 1547 1551 struct jabber_data *jd = data; … … 1588 1592 } 1589 1593 if (gc->inpa) 1590 gaim_input_remove(gc->inpa);1594 b_event_remove(gc->inpa); 1591 1595 1592 1596 if(jd) { 1593 g_timeout_add(50, jabber_free, jd);1597 b_timeout_add(50, jabber_free, jd); 1594 1598 if(jd->gjc != NULL) 1595 1599 xmlnode_free(jd->gjc->current);
Note: See TracChangeset
for help on using the changeset viewer.