+/* linebuf_put_msgbuf
+ *
+ * inputs - msgbuf header, linebuf object, capability mask, pattern, arguments
+ * outputs - none
+ * side effects - the linebuf object is cleared, then populated using rb_linebuf_putmsg().
+ */
+static void
+linebuf_put_msgbuf(struct MsgBuf *msgbuf, buf_head_t *linebuf, unsigned int capmask, const char *pattern, ...)
+{
+ char buf[IRCD_BUFSIZE];
+ va_list va;
+
+ rb_linebuf_newbuf(linebuf);
+
+ msgbuf_unparse_prefix(buf, sizeof buf, msgbuf, capmask);
+
+ va_start(va, pattern);
+ rb_linebuf_putprefix(linebuf, pattern, &va, buf);
+ va_end(va);
+}
+
+/* build_msgbuf_from
+ *
+ * inputs - msgbuf object, client the message is from
+ * outputs - none
+ * side effects - a msgbuf object is populated with an origin and relevant tags
+ * notes - to make this reentrant, find a solution for `buf` below
+ */
+static void
+build_msgbuf_from(struct MsgBuf *msgbuf, struct Client *from)
+{
+ static char buf[BUFSIZE];
+ hook_data hdata;
+
+ msgbuf_init(msgbuf);
+
+ msgbuf->origin = buf;
+
+ if (IsPerson(from))
+ snprintf(buf, sizeof buf, "%s!%s@%s", from->name, from->username, from->host);
+ else
+ rb_strlcpy(buf, from->name, sizeof buf);
+
+ hdata.client = from;
+ hdata.arg1 = msgbuf;
+
+ call_hook(h_outbound_msgbuf, &hdata);
+}
+