Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions ircd/s_serv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3793,6 +3793,38 @@ static void report_listeners(aClient *sptr, char *to)
}
}

static void
encap_route(aClient *cptr, char *mask, char *buf)
{
aClient *acptr;
int exact;

if (!strcmp(mask, me.name) || !strcmp(mask, me.serv->sid))
return;

exact = (strchr(mask, '*') == NULL &&
strchr(mask, '?') == NULL &&
strchr(mask, '#') == NULL);

if (!exact)
{
sendto_serv_v(cptr, SV_UID, "%s", buf);
return;
}

acptr = find_sid(mask, NULL);
if (!acptr)
acptr = find_server(mask, NULL);

if (!acptr)
{
return;
}

if (acptr->from != cptr)
sendto_one(acptr, "%s", buf);
}

/*
** allows ENCAPsulation of commands
** parv[0] is ignored (though it's source)
Expand Down Expand Up @@ -3823,8 +3855,8 @@ int m_encap(aClient *cptr, aClient *sptr, int parc, char *parv[])
else
len += sprintf(buf+len, " %s", parv[i]);
}
/* ...and broadcast it. */
sendto_serv_v(cptr, SV_UID, "%s", buf);

encap_route(cptr, parv[1], buf);

/* FIXME: in 2.11.1 */
/* Do we match parv[1]? */
Expand Down
Loading