Mercurial > pidgin
comparison src/protocols/irc/irc.c @ 4422:2fd80799d8f4
[gaim-migrate @ 4695]
niqueco wants to be able to use ipv6. so now you can recieve a dcc from sone using it.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 26 Jan 2003 05:04:03 +0000 |
parents | 8e62cee6d738 |
children | 2afc0f845e74 |
comparison
equal
deleted
inserted
replaced
4421:31834b4598eb | 4422:2fd80799d8f4 |
---|---|
63 | 63 |
64 /* for win32 compatability */ | 64 /* for win32 compatability */ |
65 G_MODULE_IMPORT GSList *connections; | 65 G_MODULE_IMPORT GSList *connections; |
66 G_MODULE_IMPORT GSList *groups; | 66 G_MODULE_IMPORT GSList *groups; |
67 | 67 |
68 #ifndef INET6_ADDRSTRLEN | |
69 #define INET6_ADDRSTRLEN 46 | |
70 #endif | |
71 | |
68 /* Datastructs */ | 72 /* Datastructs */ |
69 struct dcc_chat | 73 struct dcc_chat |
70 { | 74 { |
71 struct gaim_connection *gc; | 75 struct gaim_connection *gc; |
72 char ip_address[12]; | 76 char ip_address[INET6_ADDRSTRLEN]; |
73 int port; | 77 int port; |
74 int fd; | 78 int fd; |
75 int inpa; | 79 int inpa; |
76 char nick[80]; | 80 char nick[80]; |
77 }; | 81 }; |
1280 char **chat_args = g_strsplit(msg, " ", 5); | 1284 char **chat_args = g_strsplit(msg, " ", 5); |
1281 char ask[1024]; | 1285 char ask[1024]; |
1282 struct dcc_chat *dccchat = g_new0(struct dcc_chat, 1); | 1286 struct dcc_chat *dccchat = g_new0(struct dcc_chat, 1); |
1283 dccchat->gc = gc; | 1287 dccchat->gc = gc; |
1284 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]); | 1288 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]); |
1285 printf("DCC CHAT DEBUG CRAP: %s\n", dccchat->ip_address); | |
1286 dccchat->port=atoi(chat_args[4]); | 1289 dccchat->port=atoi(chat_args[4]); |
1287 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); | 1290 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); |
1288 g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick); | 1291 g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick); |
1289 do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers. Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); | 1292 do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers. Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
1290 } | 1293 } |
1677 strcpy(gc->user->proto_opt[USEROPT_CHARSET], "ISO-8859-1"); | 1680 strcpy(gc->user->proto_opt[USEROPT_CHARSET], "ISO-8859-1"); |
1678 } | 1681 } |
1679 | 1682 |
1680 g_free(test); | 1683 g_free(test); |
1681 | 1684 |
1682 if (idata->fd != source) | 1685 idata->fd = source; |
1683 idata->fd = source; | |
1684 | 1686 |
1685 gethostname(hostname, sizeof(hostname) - 1); | 1687 gethostname(hostname, sizeof(hostname) - 1); |
1686 hostname[sizeof(hostname) - 1] = 0; | 1688 hostname[sizeof(hostname) - 1] = 0; |
1687 if (!*hostname) | 1689 if (!*hostname) |
1688 g_snprintf(hostname, sizeof(hostname), "localhost"); | 1690 g_snprintf(hostname, sizeof(hostname), "localhost"); |
1719 | 1721 |
1720 static void | 1722 static void |
1721 irc_login(struct aim_user *user) | 1723 irc_login(struct aim_user *user) |
1722 { | 1724 { |
1723 char buf[IRC_BUF_LEN]; | 1725 char buf[IRC_BUF_LEN]; |
1726 int rc; | |
1724 | 1727 |
1725 struct gaim_connection *gc = new_gaim_conn(user); | 1728 struct gaim_connection *gc = new_gaim_conn(user); |
1726 struct irc_data *idata = gc->proto_data = g_new0(struct irc_data, 1); | 1729 struct irc_data *idata = gc->proto_data = g_new0(struct irc_data, 1); |
1727 | 1730 |
1728 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", gc->username); | 1731 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", gc->username); |
1732 | 1735 |
1733 idata->chantypes = g_strdup("#&!+"); | 1736 idata->chantypes = g_strdup("#&!+"); |
1734 idata->chanmodes = g_strdup("beI,k,lnt"); | 1737 idata->chanmodes = g_strdup("beI,k,lnt"); |
1735 idata->nickmodes = g_strdup("ohv"); | 1738 idata->nickmodes = g_strdup("ohv"); |
1736 idata->str = g_string_new(""); | 1739 idata->str = g_string_new(""); |
1737 | 1740 idata->fd = -1; |
1738 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], | 1741 |
1742 rc = proxy_connect(user->proto_opt[USEROPT_SERV], | |
1739 user->proto_opt[USEROPT_PORT][0] ? atoi(user-> | 1743 user->proto_opt[USEROPT_PORT][0] ? atoi(user-> |
1740 proto_opt[USEROPT_PORT]) : | 1744 proto_opt[USEROPT_PORT]) : |
1741 6667, irc_login_callback, gc); | 1745 6667, irc_login_callback, gc); |
1742 if (!user->gc || (idata->fd < 0)) { | 1746 if (!user->gc || (rc < 0)) { |
1743 hide_login_progress(gc, "Unable to create socket"); | 1747 hide_login_progress(gc, "Unable to create socket"); |
1744 signoff(gc); | 1748 signoff(gc); |
1745 return; | 1749 return; |
1746 } | 1750 } |
1747 } | 1751 } |