0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-01 17:48:56 +02:00

send: allow passing NULL origin to build_msgbuf_from() (for future use)

This commit is contained in:
William Pitcock 2016-02-27 02:56:44 -06:00
parent be2ce24c42
commit 573896f639
2 changed files with 5 additions and 3 deletions

View file

@ -261,10 +261,12 @@ build_msgbuf_from(struct MsgBuf *msgbuf, struct Client *from, const char *cmd)
msgbuf->origin = buf;
msgbuf->cmd = cmd;
if (IsPerson(from))
if (from != NULL && IsPerson(from))
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);
else
rb_strlcpy(buf, me.name, sizeof buf);
hdata.client = from;
hdata.arg1 = msgbuf;

View file

@ -48,7 +48,7 @@ cap_account_tag_process(hook_data *data)
{
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);
}