size_t inbufdata, inbufsize;
struct qcommand *queue;
int extended, dcppemu;
+ char *charset;
char *nativename;
char *nativenick;
};
int compress;
int hascurpos, fetchingtthl, notthl;
struct tigertreehash tth;
+ char *charset;
void *cprsdata;
char *key;
char *nativename;
wchar_t *chat, *wfrom, *wpeer;
char *p, *end;
struct fnetpeer *peer;
+ struct dchub *hub;
+ hub = fn->data;
end = string + strlen(string);
while((p = strchr(string, 13)) != NULL)
memmove(p, p + 1, (end-- - p));
{
if((strlen(string) > strlen(from) + 2) && (*string == '<') && !memcmp(string + 1, from, strlen(from)) && (*(string + strlen(from) + 1) == '>'))
string += strlen(from) + 2;
- if((wfrom = icmbstowcs(from, DCCHARSET)) == NULL)
+ if((wfrom = icmbstowcs(from, hub->charset)) == NULL)
return;
wpeer = swcsdup(wfrom);
} else {
*(p++) = 0;
if(*p == ' ')
p++;
- if((wpeer = icmbstowcs(string + 1, DCCHARSET)) == NULL)
+ if((wpeer = icmbstowcs(string + 1, hub->charset)) == NULL)
return;
string = p;
}
if(wpeer == NULL)
wpeer = swcsdup(L"");
}
- if((chat = icmbstowcs(string, DCCHARSET)) == NULL)
+ if((chat = icmbstowcs(string, hub->charset)) == NULL)
{
if(wfrom != NULL)
free(wfrom);
static void sendmynick(struct dcpeer *peer)
{
- struct dchub *hub;
+ struct fnetnode *fn;
- hub = (peer->fn == NULL)?NULL:(peer->fn->data);
- if(hub == NULL)
- qstrf(peer->sk, "$MyNick %s|", icswcstombs(confgetstr("cli", "defnick"), DCCHARSET, "DoldaConnectUser-IN"));
+ fn = peer->fn;
+ if(fn == NULL)
+ qstrf(peer->sk, "$MyNick %s|", icswcstombs(confgetstr("cli", "defnick"), peer->charset, "DoldaConnectUser-IN"));
else
- qstrf(peer->sk, "$MyNick %s|", hub->nativenick);
+ qstrf(peer->sk, "$MyNick %s|", icswcstombs(fn->mynick, peer->charset, "DoldaConnectUser-IN"));
}
static void sendpeerlock(struct dcpeer *peer)
if(peer->transfer->size == -1)
{
+ /* Use DCCHARSET for $Get paths until further researched... */
if((buf = icswcstombs(peer->transfer->path, DCCHARSET, NULL)) == NULL)
{
transferseterror(peer->transfer, TRNSE_NOTFOUND);
}
qstrf(peer->sk, "$UGetBlock %i %i %s|", peer->transfer->curpos, peer->transfer->size - peer->transfer->curpos, buf);
} else {
+ /* Use DCCHARSET for $Get paths until further researched... */
if((buf = icswcstombs(peer->transfer->path, DCCHARSET, NULL)) == NULL)
{
transferseterror(peer->transfer, TRNSE_NOTFOUND);
hub = fn->data;
qstrf(sk, "$MyINFO $ALL %s ", hub->nativenick);
- buf = tr(icswcstombs(confgetstr("dc", "desc"), DCCHARSET, "Charset_conv_failure"), "$_|_");
+ buf = tr(icswcstombs(confgetstr("dc", "desc"), hub->charset, "Charset_conv_failure"), "$_|_");
qstrf(sk, "%s", buf);
hn1 = hn2 = hn3 = 0;
for(cfn = fnetnodes; cfn != NULL; cfn = cfn->next)
confgetint("transfer", "slots")
);
qstrf(sk, "$ $");
- buf = tr(icswcstombs(confgetstr("dc", "speedstring"), DCCHARSET, "Charset_conv_failure"), "$_|_");
+ buf = tr(icswcstombs(confgetstr("dc", "speedstring"), hub->charset, "Charset_conv_failure"), "$_|_");
qstrf(sk, "%s\x01$", buf);
- buf = tr(icswcstombs(confgetstr("dc", "email"), DCCHARSET, "Charset_conv_failure"), "$_|_");
+ buf = tr(icswcstombs(confgetstr("dc", "email"), hub->charset, "Charset_conv_failure"), "$_|_");
qstrf(sk, "%s$", buf);
qstrf(sk, "%llu$|", sharesize);
}
if(hub->nativename == NULL)
free(hub->nativename);
hub->nativename = sstrdup(args);
- buf = icmbstowcs(args, DCCHARSET);
+ buf = icmbstowcs(args, hub->charset);
fnetsetname(fn, (buf == NULL)?L"Hubname conv error":buf);
if(buf != NULL)
free(buf);
struct dchub *hub;
hub = fn->data;
- if((nick = icmbstowcs(args, DCCHARSET)) == NULL)
+ if((nick = icmbstowcs(args, hub->charset)) == NULL)
return;
if(strcmp(args, hub->nativenick) && (fnetfindpeer(fn, nick) == NULL))
fnetaddpeer(fn, nick, nick);
struct dchub *hub;
hub = fn->data;
- if((nick = icmbstowcs(args, DCCHARSET)) == NULL)
+ if((nick = icmbstowcs(args, hub->charset)) == NULL)
return;
if((peer = fnetfindpeer(fn, nick)) != NULL)
fnetdelpeer(peer);
while((p = strstr(args, "$$")) != NULL)
{
*p = 0;
- if((buf = icmbstowcs(args, DCCHARSET)) != NULL)
+ if((buf = icmbstowcs(args, hub->charset)) != NULL)
{
if((peer = fnetfindpeer(fn, buf)) == NULL)
peer = fnetaddpeer(fn, buf, buf);
while((p = strstr(args, "$$")) != NULL)
{
*p = 0;
- if((buf = icmbstowcs(args, DCCHARSET)) != NULL)
+ if((buf = icmbstowcs(args, hub->charset)) != NULL)
{
if((peer = fnetfindpeer(fn, buf)) != NULL)
peer->flags.b.op = 1;
if((p2 = strchr(p, ' ')) == NULL)
return;
*p2 = 0;
- if((buf = icmbstowcs(p, DCCHARSET)) == NULL)
+ if((buf = icmbstowcs(p, hub->charset)) == NULL)
return;
if((peer = fnetfindpeer(fn, buf)) == NULL)
peer = fnetaddpeer(fn, buf, buf);
if((p2 = strstr(p, "$ $")) == NULL)
return;
*p2 = 0;
- if((buf = icmbstowcs(p, DCCHARSET)) == NULL)
+ if((buf = icmbstowcs(p, hub->charset)) == NULL)
return;
if((wcslen(buf) > 0) && (buf[wcslen(buf) - 1] == L'>') && ((wp = wcsrchr(buf, L'<')) != NULL))
{
if((p2 = strchr(p, '$')) == NULL)
return;
*(p2 - 1) = 0;
- if((buf = icmbstowcs(p, DCCHARSET)) == NULL)
+ if((buf = icmbstowcs(p, hub->charset)) == NULL)
return;
fnetpeersetstr(peer, L"dc-speed", buf);
free(buf);
if((p2 = strchr(p, '$')) == NULL)
return;
*p2 = 0;
- if((buf = icmbstowcs(p, DCCHARSET)) == NULL)
+ if((buf = icmbstowcs(p, hub->charset)) == NULL)
return;
fnetpeersetstr(peer, L"email", buf);
free(buf);
free(args);
}
-static char *getdcpath(struct sharecache *node, size_t *retlen)
+static char *getdcpath(struct sharecache *node, size_t *retlen, char *charset)
{
char *buf, *buf2;
size_t len, len2;
return(NULL);
if(node->parent == shareroot)
{
- if((buf = icwcstombs(node->name, DCCHARSET)) == NULL)
+ if((buf = icwcstombs(node->name, charset)) == NULL)
return(NULL);
if(retlen != NULL)
*retlen = strlen(buf);
return(buf);
} else {
- if((buf2 = icwcstombs(node->name, DCCHARSET)) == NULL)
+ if((buf2 = icwcstombs(node->name, charset)) == NULL)
return(NULL);
- if((buf = getdcpath(node->parent, &len)) == NULL)
+ if((buf = getdcpath(node->parent, &len, charset)) == NULL)
{
free(buf2);
return(NULL);
memcpy(hashtth, buf, 24);
free(buf);
} else {
- if((terms[termnum] = icmbstowcs(p, DCCHARSET)) != NULL)
+ if((terms[termnum] = icmbstowcs(p, hub->charset)) != NULL)
termnum++;
}
}
}
if(!skipcheck && (satisfied == termnum))
{
- if((buf = getdcpath(node, NULL)) != NULL)
+ /* Use DCCHARSET in $Get paths until further researched... */
+ if((buf = getdcpath(node, NULL, DCCHARSET)) != NULL)
{
if(node->f.b.hastth)
{
if((p2 = strstr(p, " (")) == NULL)
return;
*p2 = 0;
- if((wnick = icmbstowcs(nick, DCCHARSET)) == NULL)
+ if((wnick = icmbstowcs(nick, hub->charset)) == NULL)
return;
+ /* Use DCCHARSET in $Get paths until further researched... */
if((wfile = icmbstowcs(filename, DCCHARSET)) == NULL)
{
free(wnick);
hub = fn->data;
pw = wpfind(fn->args, L"password");
- if((pw == NULL) || ((mbspw = icwcstombs(pw, DCCHARSET)) == NULL))
+ if((pw == NULL) || ((mbspw = icwcstombs(pw, hub->charset)) == NULL))
{
killfnetnode(fn);
return;
peer->nativename = sstrdup(args);
if(peer->wcsname != NULL)
free(peer->wcsname);
- if((peer->wcsname = icmbstowcs(peer->nativename, DCCHARSET)) == NULL)
+ if((peer->wcsname = icmbstowcs(peer->nativename, peer->charset)) == NULL)
{
freedcpeer(peer);
return;
}
if(fd < 0)
{
+ /* Use DCCHARSET in $Get paths until further researched... */
if((node = resdcpath(args, DCCHARSET, '\\')) == NULL)
{
qstrf(sk, "$Error File not in share|");
if(!strcmp(cmd, "$UGetBlock") || !strcmp(cmd, "$UGetZBlock"))
charset = "UTF-8";
else
+ /* Use DCCHARSET in $Get paths until further researched... */
charset = DCCHARSET;
if(!strcmp(cmd, "$GetZBlock") || !strcmp(cmd, "$UGetZBlock"))
initcompress(peer, CPRS_ZLIB);
errno = EFAULT;
return(1);
}
- if((mbsnick = icwcstombs(peer->id, DCCHARSET)) == NULL)
+ if((mbsnick = icwcstombs(peer->id, hub->charset)) == NULL)
return(1); /* Shouldn't happen, of course, but who knows... */
if(tcpsock != NULL)
{
char *mbsstring, *mbsto;
hub = fn->data;
- if((mbsto = icwcstombs(to, DCCHARSET)) == NULL)
+ if((mbsto = icwcstombs(to, hub->charset)) == NULL)
{
errno = EILSEQ;
return(1);
}
- if((mbsstring = icwcstombs(string, DCCHARSET)) == NULL)
+ if((mbsstring = icwcstombs(string, hub->charset)) == NULL)
{
errno = EILSEQ;
return(1);
{
for(cur = list; cur != NULL; cur = cur->next)
{
+ /* Use DCCHARSET in $Get paths until further researched... */
if((buf = icwcstombs(cur->str, DCCHARSET)) == NULL)
{
/* Can't find anything anyway if the search expression
}
*p2 = 0;
hubaddr.sin_port = htons(atoi(p));
- if((wnick = icmbstowcs(nick, DCCHARSET)) == NULL)
- {
- free(buf);
- return;
- }
+ /* Use DCCHARSET in $Get paths until further researched... */
if((wfile = icmbstowcs(filename, DCCHARSET)) == NULL)
{
- free(wnick);
free(buf);
return;
}
}
}
}
+ hub = NULL;
+ if(myfn != NULL)
+ hub = myfn->data;
+ if((wnick = icmbstowcs(nick, (hub == NULL)?DCCHARSET:(hub->charset))) == NULL)
+ {
+ free(buf);
+ return;
+ }
sr = newsrchres(&dcnet, wfile, wnick);
if(sr->peernick != NULL)
free(sr->peernick);
char *buf;
hub = fn->data;
- if((buf = icwcstombs(newnick, DCCHARSET)) == NULL)
+ if((buf = icwcstombs(newnick, (hub == NULL)?DCCHARSET:(hub->charset))) == NULL)
return(1);
if((strchr(buf, ' ') != NULL) || (strchr(buf, '|') != NULL) || (strchr(buf, '$') != NULL))
{
{
struct dchub *new;
wchar_t *emu;
+ wchar_t *wcharset;
+ char *charset;
new = smalloc(sizeof(*new));
memset(new, 0, sizeof(*new));
if(*emu == L'n')
new->dcppemu = 0;
}
+ charset = NULL;
+ if((wcharset = wpfind(fn->args, L"charset")) != NULL)
+ {
+ if((charset = icwcstombs(wcharset, "US-ASCII")) != NULL)
+ {
+ if(!havecharset(charset))
+ {
+ free(charset);
+ charset = NULL;
+ }
+ }
+ }
+ if(charset != NULL)
+ new->charset = charset;
+ else
+ new->charset = sstrdup(DCCHARSET);
if(hubsetnick(fn, fn->mynick))
fnetsetnick(fn, L"DoldaConnectUser-IN");
/* IN as in Invalid Nick */
free(peer->wcsname);
if(peer->nativename != NULL)
free(peer->nativename);
+ if(peer->charset != NULL)
+ free(peer->charset);
if(peer->fn != NULL)
putfnetnode(peer->fn);
while((qcmd = ulqcmd(&peer->queue)) != NULL)
free(hub->nativename);
if(hub->nativenick != NULL)
free(hub->nativenick);
+ if(hub->charset != NULL)
+ free(hub->charset);
if(hub->inbuf != NULL)
free(hub->inbuf);
free(hub);
while(1)
{
ic = 0;
+ /* Use DCCHARSET in $Get paths until further researched... */
if((buf2 = icwcstombs(node->name, DCCHARSET)) != NULL)
{
for(i = 0; i < lev; i++)