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-09-30 18:45:10 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:10 +0000
commite6111d9ff4cb897b5c8bd00fcde339ffce1b66bf (patch)
tree1d4fc7192245c06032400dcbb673772fc1f68f56 /src
parentca8996472c5e855087bacf947186d919b653ab7d (diff)
Mark some stuff deprecated, move implementation from the interface into the user class.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1206 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/send.c13
-rw-r--r--src/users.c36
2 files changed, 38 insertions, 11 deletions
diff --git a/src/send.c b/src/send.c
index bd03cc4a6..accf6a680 100644
--- a/src/send.c
+++ b/src/send.c
@@ -100,17 +100,8 @@ void notice_user(char *source, User * u, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, BUFSIZE - 1, fmt, args);
- /* Send privmsg instead of notice if:
- * - UsePrivmsg is enabled
- * - The user is not registered and NSDefMsg is enabled
- * - The user is registered and has set /ns set msg on
- */
- if (UsePrivmsg && ((!u->na && (NSDefFlags & NI_MSG))
- || (u->na && (u->na->nc->flags & NI_MSG)))) {
- anope_cmd_privmsg2(source, u->nick, buf);
- } else {
- anope_cmd_notice2(source, u->nick, buf);
- }
+ u->SendMessage(source, buf);
+
va_end(args);
}
}
diff --git a/src/users.c b/src/users.c
index ba9fb3e48..f69e5ef37 100644
--- a/src/users.c
+++ b/src/users.c
@@ -260,6 +260,42 @@ User::~User()
alog("debug: User::~User() done");
}
+void User::SendMessage(const char *source, const char *fmt, ...)
+{
+ va_list args;
+ char buf[BUFSIZE];
+ *buf = '\0';
+
+ if (fmt)
+ {
+ va_start(args, fmt);
+ vsnprintf(buf, BUFSIZE - 1, fmt, args);
+
+ this->SendMessage(source, std::string(buf));
+
+ va_end(args);
+ }
+}
+
+void User::SendMessage(const char *source, const std::string &msg)
+{
+ /* Send privmsg instead of notice if:
+ * - UsePrivmsg is enabled
+ * - The user is not registered and NSDefMsg is enabled
+ * - The user is registered and has set /ns set msg on
+ */
+ if (UsePrivmsg &&
+ ((!this->na && NSDefFlags & NI_MSG) || (this->na && this->na->nc->flags & NI_MSG)))
+ {
+ anope_cmd_privmsg2(source, this->nick, msg.c_str());
+ }
+ else
+ {
+ anope_cmd_notice2(source, this->nick, msg.c_str());
+ }
+}
+
+
/*************************************************************************/
/*************************************************************************/