msgbuf: allow for an explicit target to be defined

This commit is contained in:
William Pitcock 2016-02-20 17:59:00 -06:00
parent 815fbc146f
commit 71c875fb9a
2 changed files with 6 additions and 2 deletions

View file

@ -38,10 +38,11 @@ struct MsgBuf {
struct MsgTag tags[MAXPARA]; /* the tags themselves, upto MAXPARA tags available */
const char *origin; /* the origin of the message (or NULL) */
const char *cmd; /* the cmd/verb of the message (also para[0]) */
const char *target; /* the target of the message (either NULL, or custom defined) */
const char *cmd; /* the cmd/verb of the message (either NULL, or para[0]) */
size_t parselen; /* the length of the message */
size_t n_para; /* the number of parameters (always at least 1) */
size_t n_para; /* the number of parameters (always at least 1 if a full message) */
const char *para[MAXPARA]; /* parameters vector (starting with cmd as para[0]) */
};

View file

@ -156,6 +156,9 @@ msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned
if (msgbuf->cmd != NULL)
rb_snprintf_append(buf, buflen, "%s ", msgbuf->cmd);
if (msgbuf->target != NULL)
rb_snprintf_append(buf, buflen, "%s ", msgbuf->target);
}
/*