CBCHAINDOCB(fn, fnetnode_ac, fn, L"state");
}
+wchar_t *fnfilebasename(wchar_t *path)
+{
+ wchar_t *p;
+
+ if((p = wcsrchr(path, L'/')) != NULL)
+ return(p + 1);
+ return(path);
+}
+
struct fnet *findfnet(wchar_t *name)
{
struct fnet *fnet;
int (*reqconn)(struct fnetpeer *peer);
int (*sendchat)(struct fnetnode *fn, int public, wchar_t *to, wchar_t *string);
int (*search)(struct fnetnode *fn, struct search *srch, struct srchfnnlist *ln);
- wchar_t *(*filebasename)(wchar_t *filename);
};
struct fnetpeerdatum
void fnethandlechat(struct fnetnode *fn, int public, wchar_t *name, wchar_t *peer, wchar_t *chat);
int fnetsendchat(struct fnetnode *fn, int public, wchar_t *to, wchar_t *string);
int fnetsearch(struct fnetnode *fn, struct search *srch, struct srchfnnlist *ln);
+wchar_t *fnfilebasename(wchar_t *path);
extern struct fnetnode *fnetnodes;
EGCBCHAIN(newfncb, struct fnetnode *);
hub->sk->close = 1;
}
-static wchar_t *dcbasename(wchar_t *filename)
-{
- wchar_t *ret;
-
- if((ret = wcsrchr(filename, L'/')) != NULL)
- return(ret + 1);
- return(filename);
-}
-
static struct transferiface dctransfer =
{
.detach = (void (*)(struct transfer *, void *))dctransdetach,
.reqconn = hubreqconn,
.sendchat = hubsendchat,
.search = hubsearch,
- .filebasename = dcbasename
};
static void peerread(struct socket *sk, struct dcpeer *peer)
free(buf);
return(!ret);
case SOP_LINKRE:
- p = sr->filename;
- if(sr->fnet->filebasename != NULL)
- p = sr->fnet->filebasename(p);
+ p = fnfilebasename(sr->filename);
if((buf = icwcstombs(p, "UTF-8")) == NULL)
return(0);
ret = regexec(&sexpr->d.re.cre, buf, 0, NULL, 0);
case SOP_NAMESS:
return(wcsexists(sr->filename, sexpr->d.s));
case SOP_LINKSS:
- p = sr->filename;
- if(sr->fnet->filebasename != NULL)
- p = sr->fnet->filebasename(p);
+ p = fnfilebasename(sr->filename);
return(wcsexists(p, sexpr->d.s));
case SOP_SIZELT:
return(sr->size < sexpr->d.n);
struct wcspair *ta;
char *rec, *val;
- wfilename = transfer->path;
- if(transfer->fnet->filebasename != NULL)
- wfilename = transfer->fnet->filebasename(wfilename);
+ wfilename = fnfilebasename(transfer->path);
if(transfer->auth == NULL)
{
flog(LOG_WARNING, "tried to fork filter for transfer with NULL authhandle (tranfer %i)", transfer->id);