src/protocols/irc/irc.c

changeset 4452
1e5d62c19533
parent 4422
d7d5938502f0
child 4456
ac4e44eb7e98
equal deleted inserted replaced
4451:5a484f11e395 4452:1e5d62c19533
1662 return; 1662 return;
1663 } 1663 }
1664 1664
1665 idata = gc->proto_data; 1665 idata = gc->proto_data;
1666 1666
1667 if (source == -1) { 1667 if (source != 1) {
1668 hide_login_progress(gc, "Write error"); 1668 hide_login_progress(gc, "Write error");
1669 signoff(gc); 1669 signoff(gc);
1670 return; 1670 return;
1671 } 1671 }
1672 1672 idata->fd = source;
1673 1673
1674 /* Try a quick conversion to see if the specified encoding is OK */ 1674 /* Try a quick conversion to see if the specified encoding is OK */
1675 test = g_convert("test", strlen("test"), gc->user->proto_opt[USEROPT_CHARSET], 1675 test = g_convert("test", strlen("test"), gc->user->proto_opt[USEROPT_CHARSET],
1676 "UTF-8", NULL, NULL, &err); 1676 "UTF-8", NULL, NULL, &err);
1677 if (err) { 1677 if (err) {
1680 strcpy(gc->user->proto_opt[USEROPT_CHARSET], "ISO-8859-1"); 1680 strcpy(gc->user->proto_opt[USEROPT_CHARSET], "ISO-8859-1");
1681 } 1681 }
1682 1682
1683 g_free(test); 1683 g_free(test);
1684 1684
1685 idata->fd = source;
1686
1687 gethostname(hostname, sizeof(hostname) - 1); 1685 gethostname(hostname, sizeof(hostname) - 1);
1688 hostname[sizeof(hostname) - 1] = 0; 1686 hostname[sizeof(hostname) - 1] = 0;
1689 if (!*hostname) 1687 if (!*hostname)
1690 g_snprintf(hostname, sizeof(hostname), "localhost"); 1688 g_snprintf(hostname, sizeof(hostname), "localhost");
1691 1689
1738 idata->nickmodes = g_strdup("ohv"); 1736 idata->nickmodes = g_strdup("ohv");
1739 idata->str = g_string_new(""); 1737 idata->str = g_string_new("");
1740 idata->fd = -1; 1738 idata->fd = -1;
1741 1739
1742 rc = proxy_connect(user->proto_opt[USEROPT_SERV], 1740 rc = proxy_connect(user->proto_opt[USEROPT_SERV],
1743 user->proto_opt[USEROPT_PORT][0] ? atoi(user-> 1741 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) :
1744 proto_opt[USEROPT_PORT]) : 1742 6667, irc_login_callback, gc);
1745 6667, irc_login_callback, gc); 1743 if (!user->gc || (rc != 0)) {
1746 if (!user->gc || (rc < 0)) {
1747 hide_login_progress(gc, "Unable to create socket"); 1744 hide_login_progress(gc, "Unable to create socket");
1748 signoff(gc); 1745 signoff(gc);
1749 return; 1746 return;
1750 } 1747 }
1751 } 1748 }

mercurial