diff options
author | Markus Ullmann <jokey@gentoo.org> | 2006-07-05 07:49:30 +0000 |
---|---|---|
committer | Markus Ullmann <jokey@gentoo.org> | 2006-07-05 07:49:30 +0000 |
commit | bdfea12f138cae4a3e8bc66d74f7d384b450ace2 (patch) | |
tree | 0c2717cdc951937d58423b9949cdf24d44b2e124 /net-irc/xchat | |
parent | Moving dccserver patch to distfiles mirror (diff) | |
download | historical-bdfea12f138cae4a3e8bc66d74f7d384b450ace2.tar.gz historical-bdfea12f138cae4a3e8bc66d74f7d384b450ace2.tar.bz2 historical-bdfea12f138cae4a3e8bc66d74f7d384b450ace2.zip |
Moving dccserver patch to distfiles mirror
Package-Manager: portage-2.1.1_pre2-r2
Diffstat (limited to 'net-irc/xchat')
-rw-r--r-- | net-irc/xchat/Manifest | 49 | ||||
-rw-r--r-- | net-irc/xchat/files/xchat-dccserver-0.5.patch | 447 |
2 files changed, 23 insertions, 473 deletions
diff --git a/net-irc/xchat/Manifest b/net-irc/xchat/Manifest index f6bfb2ecaa19..5d4a755001e2 100644 --- a/net-irc/xchat/Manifest +++ b/net-irc/xchat/Manifest @@ -29,17 +29,14 @@ AUX xchat-2.6.4-fix-proxy.patch 450 RMD160 f75495b601e5620e1127e61c89db3bda2560b MD5 050bd58e8e6428c25c5c0bbff642a9fa files/xchat-2.6.4-fix-proxy.patch 450 RMD160 f75495b601e5620e1127e61c89db3bda2560bb80 files/xchat-2.6.4-fix-proxy.patch 450 SHA256 6f1a03d7e2bb6b01071fff26589846f3ccffca7091bb0bb408e75d1346d80b40 files/xchat-2.6.4-fix-proxy.patch 450 -AUX xchat-dccserver-0.5.patch 11776 RMD160 21c97e84b11417c730663a1a22b7df4e0fee99ce SHA1 1c24e67ae496cc7d47c569a28ff4ce09928f80fb SHA256 94b51262d90bc8e8a09829cf944e9370ea3d5c252f1472799651d45a96de1de2 -MD5 ee98eba7f1061680d8d0582a10d72cb7 files/xchat-dccserver-0.5.patch 11776 -RMD160 21c97e84b11417c730663a1a22b7df4e0fee99ce files/xchat-dccserver-0.5.patch 11776 -SHA256 94b51262d90bc8e8a09829cf944e9370ea3d5c252f1472799651d45a96de1de2 files/xchat-dccserver-0.5.patch 11776 DIST xchat-1.8.11.tar.bz2 850453 RMD160 5055190942e28933e33b9f520a6811b86241daae SHA256 b3d457e014649e4b25ba5241e6dde600ffe2c8c6c4d462b8d4392b9f38b5abed DIST xchat-2.4.3.tar.bz2 1259520 RMD160 2222632f2c3db2eac260547e952047bcc450b731 SHA256 3dc8560dd35e1052546cf1fec69b4d1a01fd0caaaa0e71cde9d06712dd393398 -DIST xchat-2.4.5.tar.bz2 1324626 RMD160 19d1033d01af784f8b7af5103a7de8cf3a26f3fb SHA256 44cabb5c31047d5a036495bc7fac64a5b86c8003bd575ea869bcd377032db2db +DIST xchat-2.4.5.tar.bz2 1324626 RMD160 19d1033d01af784f8b7af5103a7de8cf3a26f3fb SHA1 e027a20caa47b4ffea00896ee68269a7ae885e2d SHA256 44cabb5c31047d5a036495bc7fac64a5b86c8003bd575ea869bcd377032db2db DIST xchat-2.6.1.tar.bz2 996111 RMD160 88138d4c92ee2712eff045957a76a1502af47e7f SHA256 4827a11db099d4968183d322e326ea5657ddec560c3f2ceef8d210d0a3b83584 DIST xchat-2.6.2.tar.bz2 1046910 RMD160 d7c1d0a02c9575898f68bdbd6e90d5a2fb8cb2ff SHA256 a184d42a8130e5a4151e0190ba45dc3440c49270818fec02f35bca932da64f9c DIST xchat-2.6.4.tar.bz2 1083938 RMD160 998069aa49e7b26dd98d53173e9dc67f947f95a2 SHA1 84bb9e2b3f8eef03c199208c81520c20a172e825 SHA256 76e67fc03d3318d6159d1f22408c607bfa72e5e7687ddcb8969c95a01bcf4222 DIST xchat-dccserver-0.4.patch 11767 RMD160 09da784890316141a04502ed6179a5cef60f6352 SHA256 1d64e4447587c111f995cb6b5fa9bdc37f0f142c4aabdb1db57135ee86e4df7e +DIST xchat-dccserver-0.5.patch.bz2 3814 RMD160 6f6957e78b7236bcacd076d598a81fcbcec27502 SHA1 2975a3fc3c43cd5e0eeb3d8e507ae460f19bc8a4 SHA256 40b3dd9e15c4378ae2fc3c450beaec65ce5302561369f90fa8cead62a0015329 DIST xchat-dccserver-0.6.patch.bz2 49320 RMD160 24cc9bd414b1dd0e7e38ba9a49d12257aeb89e68 SHA1 e7b8b58cf7f647ff8778c7542cd46e9b22987385 SHA256 90a49a8d810380020c507c1a36f02e7d972cf92b5e4802dcd5cc518cba29078f EBUILD xchat-1.8.11-r1.ebuild 2264 RMD160 d385b9f013ced7af59498fe59ad15f8a205bd8c0 SHA1 f4bb51c3e637808e9b98afa0c2587075582790d2 SHA256 52ca3be93bf11db829bc99f1c01aa19b7c07fd0669c6df9d9be6a9e05949c712 MD5 4634f562e01b219d3bcfb0ae6acb8397 xchat-1.8.11-r1.ebuild 2264 @@ -49,14 +46,14 @@ EBUILD xchat-2.4.3.ebuild 2277 RMD160 c9ee0cbe83521b429ff8f09c1b2df11ab04cd2f4 S MD5 17a297f209fdb09e9b27f8b2561577d3 xchat-2.4.3.ebuild 2277 RMD160 c9ee0cbe83521b429ff8f09c1b2df11ab04cd2f4 xchat-2.4.3.ebuild 2277 SHA256 1c862b9146d230db5841c15fbe7fe0fd8e2bd1784bb49eec7fc1e931ec14c479 xchat-2.4.3.ebuild 2277 -EBUILD xchat-2.4.5-r1.ebuild 2374 RMD160 a567f64ad14cff535f378b696a692432bf8945b9 SHA1 f681c9deee75666a5823f55388b27259a0a4e5cf SHA256 49b9307a8cb84c00731a1bed1d2fc21575ec75a0924b33814179e1563a9cecb2 -MD5 e5a3b50b4fc6a72849e6e60e001a1e31 xchat-2.4.5-r1.ebuild 2374 -RMD160 a567f64ad14cff535f378b696a692432bf8945b9 xchat-2.4.5-r1.ebuild 2374 -SHA256 49b9307a8cb84c00731a1bed1d2fc21575ec75a0924b33814179e1563a9cecb2 xchat-2.4.5-r1.ebuild 2374 -EBUILD xchat-2.4.5.ebuild 2314 RMD160 9fb7765573dc193ad4e53bd50e94a9cca1240526 SHA1 534501e05251dfe7a0670e94e07fe5085009fa1c SHA256 8ccc5226c20a8463e3edd96a69d57e1a38e6b76e2dea27f2f49e77c1b0a43ec1 -MD5 93bf9360d9130184961e723172f9fc9a xchat-2.4.5.ebuild 2314 -RMD160 9fb7765573dc193ad4e53bd50e94a9cca1240526 xchat-2.4.5.ebuild 2314 -SHA256 8ccc5226c20a8463e3edd96a69d57e1a38e6b76e2dea27f2f49e77c1b0a43ec1 xchat-2.4.5.ebuild 2314 +EBUILD xchat-2.4.5-r1.ebuild 2420 RMD160 32635dc8b2709f2a6389528c15e1ab8c31938cdb SHA1 2c7648d10335d6e2335d364866d020b02731c472 SHA256 4a7e3e2a2ad16a722f04732fa0adc4d032d71f15064dcfebd7205545b2fe656c +MD5 4e0d5c1dc7d9c7226b107433c4f16a63 xchat-2.4.5-r1.ebuild 2420 +RMD160 32635dc8b2709f2a6389528c15e1ab8c31938cdb xchat-2.4.5-r1.ebuild 2420 +SHA256 4a7e3e2a2ad16a722f04732fa0adc4d032d71f15064dcfebd7205545b2fe656c xchat-2.4.5-r1.ebuild 2420 +EBUILD xchat-2.4.5.ebuild 2360 RMD160 a695475a77e8160bb4a3ebc832f3cd34ee3c201d SHA1 a7bac47c4137c719c6b1d34119e7c20bf1984a97 SHA256 93425d4076ecf129086ab9e9458064b650d193e134e1d53c02072587d7cbde66 +MD5 4362fb5fd195cbc3650ccd57c140a314 xchat-2.4.5.ebuild 2360 +RMD160 a695475a77e8160bb4a3ebc832f3cd34ee3c201d xchat-2.4.5.ebuild 2360 +SHA256 93425d4076ecf129086ab9e9458064b650d193e134e1d53c02072587d7cbde66 xchat-2.4.5.ebuild 2360 EBUILD xchat-2.6.1.ebuild 2285 RMD160 dd6836000e29a826c230340b11a615aa0fab7e5d SHA1 b3d19228b08339a471f6529813e157e2aa7a94a0 SHA256 8b5522b43e2c52e7f7cb3fa8c2387e14411ad222093e220f364e1b55389d992c MD5 3560d1b051405ddf11a82850e414c320 xchat-2.6.1.ebuild 2285 RMD160 dd6836000e29a826c230340b11a615aa0fab7e5d xchat-2.6.1.ebuild 2285 @@ -69,10 +66,10 @@ EBUILD xchat-2.6.4.ebuild 2521 RMD160 2477fd7032d68603391278b1169d7231bb8304cd S MD5 3c8fe36ef561d8f91c20ad982bd72272 xchat-2.6.4.ebuild 2521 RMD160 2477fd7032d68603391278b1169d7231bb8304cd xchat-2.6.4.ebuild 2521 SHA256 16b25a4cf4a2ab6cc9aa373838dc0a4b784a1135da6beb43d739811e2f0a8f2f xchat-2.6.4.ebuild 2521 -MISC ChangeLog 29705 RMD160 b1e43c08b7467245342d396fea910f419f2f266a SHA1 64736fc9b8467da830992859e50efb137a70194c SHA256 9a083d1245737b96f33ca02bf7923badcf75696cb18dd44f266bf710118041f7 -MD5 4f203e999f50fc6d409b444148bc2156 ChangeLog 29705 -RMD160 b1e43c08b7467245342d396fea910f419f2f266a ChangeLog 29705 -SHA256 9a083d1245737b96f33ca02bf7923badcf75696cb18dd44f266bf710118041f7 ChangeLog 29705 +MISC ChangeLog 29881 RMD160 fda3c2e55e1fb26d915fb36931f08d4aa6d2f7aa SHA1 6219537ea85a1a41e5005f44bd332063abd80442 SHA256 043e14f565e4778f61fd31d6c3045be257c9ceecf9fbd354d78643908061846e +MD5 30981afc16996cb5f269cfaaf5a9e6a2 ChangeLog 29881 +RMD160 fda3c2e55e1fb26d915fb36931f08d4aa6d2f7aa ChangeLog 29881 +SHA256 043e14f565e4778f61fd31d6c3045be257c9ceecf9fbd354d78643908061846e ChangeLog 29881 MISC metadata.xml 160 RMD160 279429d1df694561fc2b163cb81c09387b9d940c SHA1 97da1b72eecc5585c65717da08eaccc9bc1cf7cd SHA256 5e058419199e306612929b80a996e3d16c6b20de674a56bb60558d3d36524fe2 MD5 44c39c6ad372a8e5a5e7ee3311f703a7 metadata.xml 160 RMD160 279429d1df694561fc2b163cb81c09387b9d940c metadata.xml 160 @@ -83,12 +80,12 @@ SHA256 5b6c911a7a3e729496e32b0742eadcbd47b76bb8d525a990b8ee5d40bc51c9d5 files/di MD5 f93bad1f0c24207886b8ad09e1561020 files/digest-xchat-2.4.3 494 RMD160 b384775653c61661b573d7e4fe10e52e64418777 files/digest-xchat-2.4.3 494 SHA256 25e3bceed531d2ba299fcd942ece95a3a2f42927cc7f47ae5fd020f1fbe7c8f0 files/digest-xchat-2.4.3 494 -MD5 e4bedfc8913ccc7a4e3c390849d5b6ca files/digest-xchat-2.4.5 241 -RMD160 5fd2de721fd59d00d75cc3a399c6ed1e4f90f015 files/digest-xchat-2.4.5 241 -SHA256 33e988d4470b31d0f2ce1cc76798a1f282725b0c67b918b34aa722d1fad28228 files/digest-xchat-2.4.5 241 -MD5 e4bedfc8913ccc7a4e3c390849d5b6ca files/digest-xchat-2.4.5-r1 241 -RMD160 5fd2de721fd59d00d75cc3a399c6ed1e4f90f015 files/digest-xchat-2.4.5-r1 241 -SHA256 33e988d4470b31d0f2ce1cc76798a1f282725b0c67b918b34aa722d1fad28228 files/digest-xchat-2.4.5-r1 241 +MD5 914fbec8a39cb8699c49995691921128 files/digest-xchat-2.4.5 503 +RMD160 741d90162b454e3576a23adb5a2b467050d740e3 files/digest-xchat-2.4.5 503 +SHA256 d59666e01b11e3347b88f1badc633137ab4bea46029ba9d5663c3adec2b95739 files/digest-xchat-2.4.5 503 +MD5 914fbec8a39cb8699c49995691921128 files/digest-xchat-2.4.5-r1 503 +RMD160 741d90162b454e3576a23adb5a2b467050d740e3 files/digest-xchat-2.4.5-r1 503 +SHA256 d59666e01b11e3347b88f1badc633137ab4bea46029ba9d5663c3adec2b95739 files/digest-xchat-2.4.5-r1 503 MD5 40381e3f683f2f2f8e2bdffca7fe986e files/digest-xchat-2.6.1 238 RMD160 c1a56ea8706eecd3c5a41ea12b2d84f48bc607d9 files/digest-xchat-2.6.1 238 SHA256 ca6ed4ab95d8947df163955fe2e29db502ab7fa2db426f16ecc5be4f8c9f7cb4 files/digest-xchat-2.6.1 238 @@ -101,7 +98,7 @@ SHA256 5f976a0febb7f3b07814c8ac167f3d2a31f909a2833d524b47570ecb9e183d5d files/di -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) -iD8DBQFEq2zrz974XjDVpbkRAg6EAJ0SI8IiACdf3TK0g4bPaG0QuHVVGQCfYLuQ -bG4Rr5OtU9Pm16Gjq9g+AM8= -=w/td +iD8DBQFEq28Gz974XjDVpbkRArBcAKCzWJs5yAYrL0pTuadW/1Dqjf+EsgCghMAc +J14JUqQd+n4zc/mUNjPzZrw= +=BaBL -----END PGP SIGNATURE----- diff --git a/net-irc/xchat/files/xchat-dccserver-0.5.patch b/net-irc/xchat/files/xchat-dccserver-0.5.patch deleted file mode 100644 index d88af2e77bc0..000000000000 --- a/net-irc/xchat/files/xchat-dccserver-0.5.patch +++ /dev/null @@ -1,447 +0,0 @@ -diff -ur ../xchat-2.0.9-ori/src/common/cfgfiles.c ./src/common/cfgfiles.c ---- ../xchat-2.0.9-ori/src/common/cfgfiles.c 2004-05-23 07:06:08.000000000 +0200 -+++ ./src/common/cfgfiles.c 2004-06-06 17:01:20.000000000 +0200 -@@ -378,6 +378,7 @@ - {"dcc_auto_send", P_OFFINT (autodccsend), TYPE_INT}, - {"dcc_blocksize", P_OFFINT (dcc_blocksize), TYPE_INT}, - {"dcc_completed_dir", P_OFFSET (dcc_completed_dir), TYPE_STR}, -+ {"dcc_dccserver_port", P_OFFINT (dcc_dccserver_port), TYPE_INT}, - {"dcc_dir", P_OFFSET (dccdir), TYPE_STR}, - {"dcc_fast_send", P_OFFINT (fastdccsend), TYPE_BOOL}, - {"dcc_global_max_get_cps", P_OFFINT (dcc_global_max_get_cps), TYPE_INT}, -diff -ur ../xchat-2.0.9-ori/src/common/dcc.c ./src/common/dcc.c ---- ../xchat-2.0.9-ori/src/common/dcc.c 2004-05-29 12:47:19.000000000 +0200 -+++ ./src/common/dcc.c 2004-06-06 17:04:06.000000000 +0200 -@@ -66,6 +66,16 @@ - {N_("Aborted"), 4 /*red */ }, - }; - -+static struct -+{ -+ int fd; -+ int iotag; -+} -+dccserver = -+{ -+ fd: -1 -+}; -+ - static int dcc_global_throttle; /* 0x1 = sends, 0x2 = gets */ - static int dcc_sendcpssum, dcc_getcpssum; - -@@ -818,6 +828,18 @@ - int ret; - char tbuf[400]; - -+ if (dcc->fromdccserver) -+ { -+ /* yet another special case, making cross calls to unrelated functions. fun. */ -+ if (dcc->type == TYPE_CHATRECV) -+ snprintf(tbuf, sizeof(tbuf) - 1, "1%c1 %s\n", dcc->dccservchtype, dcc->serv->nick); -+ else /* TYPE_RECV */ -+ snprintf(tbuf, sizeof(tbuf) - 1, "121 %s %i\n", dcc->serv->nick, dcc->resumable); -+ send(dcc->sok, tbuf, strlen(tbuf), 0); -+ dcc_connect_finished(NULL, 0, dcc); -+ return; -+ } -+ - if (dcc->dccstat == STAT_CONNECTING) - return; - dcc->dccstat = STAT_CONNECTING; -@@ -1563,6 +1585,12 @@ - { - char tbuf[500]; - -+ if (dcc->fromdccserver) -+ { -+ dcc_connect(dcc); -+ return 1; -+ } -+ - if (dcc->dccstat == STAT_QUEUED && dcc->resumable) - { - /* filename contains spaces? Quote them! */ -@@ -1876,3 +1904,240 @@ - if (!i) - PrintText (sess, _("No active DCCs\n")); - } -+ -+static gboolean -+dccserver_readcmd(GIOChannel *chan, GIOCondition cond, struct DCC *dcc) -+{ -+ char line[1024]; -+ int ret; -+ char *p, *nick, *filename; -+ int filesize; -+ int linelen; -+ struct stat st; -+ -+ /* too lazy to do buffering */ -+ ret = recv(dcc->sok, line, sizeof(line), MSG_PEEK); -+ if (ret <= 0) -+ { -+ if (errno != EWOULDBLOCK && errno != EAGAIN && errno != EINTR) -+ dcc_close(dcc, 0, 1); -+ return TRUE; -+ } -+ -+ p = memchr(line, '\n', ret); -+ if (!p) -+ { -+ /* close if too long a line, otherwise continue to recv */ -+ if (ret >= sizeof(line)) -+ dcc_close(dcc, 0, 1); -+ return TRUE; -+ } -+ -+ /* discard from recv-q */ -+ recv(dcc->sok, line, (p - line) + 1, 0); -+ -+ *p-- = '\0'; -+ if (p >= line && *p == '\r') -+ *p = '\0'; -+ -+ linelen = strlen(line); -+ if (linelen < 5 || line[3] != ' ' || line[4] == ' ') -+ { -+ dcc_close(dcc, 0, 1); -+ return TRUE; -+ } -+ -+ nick = &line[4]; -+ p = strchr(nick, ' '); -+ if (p) -+ *p++ = '\0'; -+ -+ /* what follows is a lot of duplicate code from handle_dcc */ -+ if (!memcmp(line, "100", 3) || !memcmp(line, "110", 3)) -+ { -+ /* dcc chat request */ -+ dcc->dccstat = STAT_QUEUED; -+ dcc->nick = strdup(nick); -+ dcc->serv = current_tab->server; /* ? */ -+ time(&dcc->lasttime); -+ dcc->fromdccserver = 1; -+ dcc->dccservchtype = line[1]; -+ dcc->type = TYPE_CHATRECV; -+ -+ EMIT_SIGNAL(XP_TE_DCCCHATOFFER, current_tab, nick, NULL, NULL, NULL, 0); -+ if (prefs.autoopendccchatwindow) -+ fe_dcc_open_chat_win (TRUE); -+ if (prefs.autodccchat) -+ dcc_connect (dcc); -+ } -+ else if (!memcmp(line, "120", 3)) -+ { -+ /* dcc send req */ -+ if (!p) -+ { -+ dcc_close(dcc, 0, 1); -+ return TRUE; -+ } -+ filename = strchr(p, ' '); -+ if (!filename) -+ { -+ dcc_close(dcc, 0, 1); -+ return TRUE; -+ } -+ *filename++ = '\0'; -+ filesize = atoi(p); -+ -+ dcc->file = strdup(filename); -+ dcc->destfile = malloc(strlen (prefs.dccdir) + strlen (nick) + strlen (filename) + 4); -+ sprintf(dcc->destfile, "%s/%s%s%s", -+ prefs.dccdir, prefs.dccwithnick ? nick : "", prefs.dccwithnick ? "." : "", -+ filename); -+ dcc->destfile_fs = g_filename_from_utf8 (dcc->destfile, -1, 0, 0, 0); -+ -+ dcc->resumable = 0; -+ if (stat (dcc->destfile, &st) != -1) -+ { -+ if (st.st_size < filesize) -+ dcc->resumable = st.st_size; -+ } -+ -+ dcc->pos = dcc->resumable; -+ dcc->serv = current_tab->server; -+ dcc->type = TYPE_RECV; -+ dcc->dccstat = STAT_QUEUED; -+ dcc->size = filesize; -+ dcc->nick = strdup (nick); -+ dcc->maxcps = prefs.dcc_max_get_cps; -+ time(&dcc->lasttime); -+ dcc->fromdccserver = 1; -+ if (prefs.autodccsend) -+ { -+ if (prefs.autoresume && dcc->resumable) -+ { -+ /* don't resume the same file from two people! */ -+ GSList *list = dcc_list; -+ struct DCC *d; -+ while (list) -+ { -+ d = list->data; -+ if (d->type == TYPE_RECV && d->dccstat != STAT_ABORTED && -+ d->dccstat != STAT_DONE && d->dccstat != STAT_FAILED) -+ { -+ if (d != dcc && strcmp (d->destfile, dcc->destfile) == 0) -+ goto dontresume; -+ } -+ list = list->next; -+ } -+ dcc_resume (dcc); -+ } else -+ { -+dontresume: -+ dcc->resumable = 0; -+ dcc->pos = 0; -+ dcc_connect (dcc); -+ } -+ } -+ if (prefs.autoopendccrecvwindow) -+ fe_dcc_open_recv_win (TRUE); -+ -+ /* abuse line var */ -+ sprintf (line, "%d", filesize); -+ sprintf(line + 30, "%s:%i", net_ip(dcc->addr), dcc->port); -+ EMIT_SIGNAL (XP_TE_DCCSENDOFFER, current_tab->server->front_session, dcc->nick, -+ dcc->file, line, line + 30, 0); -+ } -+ -+ return TRUE; -+} -+ -+static gboolean -+dccserver_accept(GIOChannel *chan, GIOCondition cond, void *ptr) -+{ -+ int fd; -+ char msg[1024]; -+ struct DCC *dcc; -+ struct sockaddr_in sin; -+ int socklen; -+ -+ socklen = sizeof(sin); -+ fd = accept(dccserver.fd, (struct sockaddr *) &sin, &socklen); -+ if (fd == -1) -+ { -+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) -+ return TRUE; -+ if (!current_tab) -+ return TRUE; -+ snprintf(msg, sizeof(msg) - 1, "Error accept connection on dcc server socket: %s\n", strerror(errno)); -+ PrintText(current_tab, msg); -+ return TRUE; -+ } -+ -+ set_nonblocking(fd); -+ -+ dcc = new_dcc(); -+ if (!dcc) -+ return TRUE; -+ -+ dcc->addr = ntohl(sin.sin_addr.s_addr); -+ dcc->port = ntohs(sin.sin_port); -+ dcc->type = TYPE_DCCSERVERCONN; -+ dcc->dccstat = STAT_ACTIVE; -+ dcc->sok = fd; -+ time(&dcc->starttime); -+ dcc->lasttime = dcc->starttime; -+ dcc->iotag = fe_input_add(fd, FIA_READ|FIA_EX, dccserver_readcmd, dcc); -+ -+ return TRUE; -+} -+ -+int -+dccserver_update(struct session *sess) -+{ -+ int fd; -+ char msg[1024]; -+ struct sockaddr_in sin; -+ int ret; -+ -+ if (dccserver.fd != -1) -+ { -+ close(dccserver.fd); -+ fe_input_remove(dccserver.iotag); -+ dccserver.fd = -1; -+ } -+ -+ if (prefs.dcc_dccserver_port <= 0) -+ return TRUE; -+ -+ fd = socket(AF_INET, SOCK_STREAM, 0); -+ if (fd == -1) -+ { -+errout: -+ if (!sess) -+ return FALSE; -+ snprintf(msg, sizeof(msg) - 1, N_("Could not open dccserver listening port on port %u: %s\n"), -+ prefs.dcc_dccserver_port, strerror(errno)); -+ PrintText(sess, msg); -+ return FALSE; -+ } -+ -+ ret = 1; -+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &ret, sizeof(ret)); -+ set_nonblocking(fd); -+ -+ memset(&sin, 0, sizeof(sin)); -+ sin.sin_family = AF_INET; -+ sin.sin_port = htons(prefs.dcc_dccserver_port); -+ ret = bind(fd, (struct sockaddr *) &sin, sizeof(sin)); -+ if (ret != 0) -+ { -+ close(fd); -+ goto errout; /* considered harmful! */ -+ } -+ -+ listen(fd, 5); -+ -+ dccserver.fd = fd; -+ dccserver.iotag = fe_input_add(fd, FIA_READ|FIA_EX, dccserver_accept, NULL); -+ -+ return TRUE; -+} -diff -ur ../xchat-2.0.9-ori/src/common/dcc.h ./src/common/dcc.h ---- ../xchat-2.0.9-ori/src/common/dcc.h 2004-02-01 10:55:34.000000000 +0100 -+++ ./src/common/dcc.h 2004-06-06 17:01:20.000000000 +0200 -@@ -16,6 +16,7 @@ - #define TYPE_RECV 1 - #define TYPE_CHATRECV 2 - #define TYPE_CHATSEND 3 -+#define TYPE_DCCSERVERCONN 4 - - #define CPS_AVG_WINDOW 10 - -@@ -51,6 +52,8 @@ - char *nick; - unsigned char type; /* 0 = SEND 1 = RECV 2 = CHAT */ - unsigned char dccstat; /* 0 = QUEUED 1 = ACTIVE 2 = FAILED 3 = DONE */ -+ char dccservchtype; /* chat or fserve request? */ -+ unsigned int fromdccserver:1; /* this dcc was opened from a dccserver connection */ - unsigned int fastsend:1; - unsigned int ackoffset:1; /* is reciever sending acks as an offset from */ - /* the resume point? */ -@@ -88,5 +91,6 @@ - void open_dcc_recv_window (void); - void open_dcc_send_window (void); - void open_dcc_chat_window (void); -+int dccserver_update(struct session *); - - #endif -diff -ur ../xchat-2.0.9-ori/src/common/outbound.c ./src/common/outbound.c ---- ../xchat-2.0.9-ori/src/common/outbound.c 2004-05-31 15:03:02.000000000 +0200 -+++ ./src/common/outbound.c 2004-06-06 17:01:20.000000000 +0200 -@@ -762,6 +762,80 @@ - return TRUE; - } - -+int -+cmd_dccserver(struct session *sess, char *tbuf, char *word[], char *word_eol[]) -+{ -+ int i; -+ char buf[1024]; -+ int action; -+ int port; -+ -+ i = 2; -+ if (!*word[i]) -+ { -+ if (prefs.dcc_dccserver_port == 0) -+ snprintf(buf, sizeof(buf) - 1, N_("DCC server inactive and no port configured\n")); -+ else if (prefs.dcc_dccserver_port < 0) -+ snprintf(buf, sizeof(buf) - 1, N_("DCC server inactive, configured to port %i\n"), -1 * prefs.dcc_dccserver_port); -+ else -+ snprintf(buf, sizeof(buf) - 1, N_("DCC server active and listening on port %i\n"), prefs.dcc_dccserver_port); -+ PrintText(sess, buf); -+ return TRUE; -+ } -+ -+ action = 0; -+ if (*word[i] == '+' || !strcasecmp(word[i], "on")) -+ { -+ action = 1; -+ i++; -+ } -+ else if (*word[i] == '-' || !strcasecmp(word[i], "off")) -+ { -+ action = -1; -+ i++; -+ } -+ -+ if (*word[i]) -+ { -+ port = atoi(word[i]); -+ i++; -+ } -+ else -+ port = prefs.dcc_dccserver_port; -+ -+ if (port > 65535 || port < -65535) -+ { -+ PrintText(sess, N_("Invalid port. Port must be in range 1-65535\n")); -+ return FALSE; -+ } -+ else if (port == 0 && action == 1) -+ { -+ PrintText(sess, N_("Cannot enable dcc server, no port configured. Please specify a valid listening port\n")); -+ return FALSE; -+ } -+ else if (port < 0 && action == 1) -+ port = -1 * port; -+ else if (port > 0 && action == -1) -+ port = -1 * port; -+ -+ prefs.dcc_dccserver_port = port; -+ if (dccserver_update(sess)) -+ { -+ if (port > 0) -+ snprintf(buf, sizeof(buf) - 1, N_("Enabled DCC server on port %i\n"), port); -+ else -+ snprintf(buf, sizeof(buf) - 1, N_("Disabled DCC server\n")); -+ PrintText(sess, buf); -+ } -+ else -+ { -+ if (prefs.dcc_dccserver_port > 0) -+ prefs.dcc_dccserver_port = -1 * prefs.dcc_dccserver_port; -+ } -+ -+ return TRUE; -+} -+ - static int - cmd_debug (struct session *sess, char *tbuf, char *word[], char *word_eol[]) - { -@@ -2623,6 +2697,8 @@ - "DCC CHAT <nick> - offer DCC CHAT to someone\n" - "DCC CLOSE <type> <nick> <file> example:\n" - " /dcc close send johnsmith file.tar.gz")}, -+ {"DCCSERVER", cmd_dccserver, 0, 0, 0, -+ N_("DCCSERVER [+|-|on|off] [port], Enable or disable dcc server on a certain port or reports its status")}, - {"DEBUG", cmd_debug, 0, 0, 1, 0}, - - {"DEHOP", cmd_dehop, 1, 1, 1, -diff -ur ../xchat-2.0.9-ori/src/common/xchat.c ./src/common/xchat.c ---- ../xchat-2.0.9-ori/src/common/xchat.c 2004-05-02 07:00:37.000000000 +0200 -+++ ./src/common/xchat.c 2004-06-06 17:01:20.000000000 +0200 -@@ -1039,6 +1039,8 @@ - if (prefs.slist_skip) - new_ircwindow (NULL, NULL, SESS_SERVER); - } -+ -+ dccserver_update(current_tab); - } - - void -diff -ur ../xchat-2.0.9-ori/src/common/xchat.h ./src/common/xchat.h ---- ../xchat-2.0.9-ori/src/common/xchat.h 2004-05-12 06:57:19.000000000 +0200 -+++ ./src/common/xchat.h 2004-06-06 17:01:20.000000000 +0200 -@@ -174,6 +174,7 @@ - unsigned long local_ip; - unsigned long dcc_ip; - char dcc_ip_str[DOMAINLEN + 1]; -+ int dcc_dccserver_port; - - unsigned int tab_dnd; - unsigned int tab_sort; |