summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/send.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/send.c b/src/send.c
index 79e8f5e68..d99b08dab 100644
--- a/src/send.c
+++ b/src/send.c
@@ -51,6 +51,36 @@ void send_cmd(const char *source, const char *fmt, ...)
va_end(args);
}
+
+/*
+ * Copypasta version that accepts std::string source.
+void send_cmd(const std::string &source, const char *fmt, ...)
+{
+ va_list args;
+ static char buf[BUFSIZE];
+
+ va_start(args, fmt);
+
+ vsnprintf(buf, BUFSIZE - 1, fmt, args);
+
+ if (!source.empty())
+ {
+ sockprintf(servsock, ":%s %s\r\n", source.c_str(), buf);
+ eventprintf(":%s %s", source, buf);
+ if (debug)
+ alog("debug: Sent: :%s %s", source.c_str(), buf);
+ }
+ else
+ {
+ sockprintf(servsock, "%s\r\n", buf);
+ eventprintf("%s", buf);
+ if (debug)
+ alog("debug: Sent: %s", buf);
+ }
+
+ va_end(args);
+}
+
/*************************************************************************/
/**