From 71c875fb9a876ff749e477c89edaa110b80378b8 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 20 Feb 2016 17:59:00 -0600 Subject: [PATCH] msgbuf: allow for an explicit target to be defined --- include/msgbuf.h | 5 +++-- ircd/msgbuf.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/msgbuf.h b/include/msgbuf.h index 64e481cdf..6e362ff95 100644 --- a/include/msgbuf.h +++ b/include/msgbuf.h @@ -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]) */ }; diff --git a/ircd/msgbuf.c b/ircd/msgbuf.c index aadcea279..0e33fd6fd 100644 --- a/ircd/msgbuf.c +++ b/ircd/msgbuf.c @@ -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); } /*