summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-02 15:17:08 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-02 15:17:08 +0000
commit44e1e23a738d98815911b500e275808b435fa7c6 (patch)
treeefc18cba8c41b6bd2d30f58673812da66be24e02 /src
parent5eee13a97de3518d543b59f5114ad140a6b21d0c (diff)
Add overridden send_cmd() accepting a string source.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1318 5417fbe8-f217-4b02-8779-1006273d7864
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);
+}
+
/*************************************************************************/
/**