send: allow passing NULL origin to build_msgbuf_from() (for future use)
This commit is contained in:
parent
be2ce24c42
commit
573896f639
2 changed files with 5 additions and 3 deletions
|
@ -261,10 +261,12 @@ build_msgbuf_from(struct MsgBuf *msgbuf, struct Client *from, const char *cmd)
|
||||||
msgbuf->origin = buf;
|
msgbuf->origin = buf;
|
||||||
msgbuf->cmd = cmd;
|
msgbuf->cmd = cmd;
|
||||||
|
|
||||||
if (IsPerson(from))
|
if (from != NULL && IsPerson(from))
|
||||||
snprintf(buf, sizeof buf, "%s!%s@%s", from->name, from->username, from->host);
|
snprintf(buf, sizeof buf, "%s!%s@%s", from->name, from->username, from->host);
|
||||||
else
|
else if (from != NULL)
|
||||||
rb_strlcpy(buf, from->name, sizeof buf);
|
rb_strlcpy(buf, from->name, sizeof buf);
|
||||||
|
else
|
||||||
|
rb_strlcpy(buf, me.name, sizeof buf);
|
||||||
|
|
||||||
hdata.client = from;
|
hdata.client = from;
|
||||||
hdata.arg1 = msgbuf;
|
hdata.arg1 = msgbuf;
|
||||||
|
|
|
@ -48,7 +48,7 @@ cap_account_tag_process(hook_data *data)
|
||||||
{
|
{
|
||||||
struct MsgBuf *msgbuf = data->arg1;
|
struct MsgBuf *msgbuf = data->arg1;
|
||||||
|
|
||||||
if (IsPerson(data->client) && *data->client->user->suser)
|
if (data->client != NULL && IsPerson(data->client) && *data->client->user->suser)
|
||||||
msgbuf_append_tag(msgbuf, "account", data->client->user->suser, CLICAP_ACCOUNT_TAG);
|
msgbuf_append_tag(msgbuf, "account", data->client->user->suser, CLICAP_ACCOUNT_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue