summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-05-09 14:47:31 +0100
committerSadie Powell <sadie@witchery.services>2025-05-09 14:47:31 +0100
commit977780d8ef8cc2d28690d66eff4292b7d9bbd1a7 (patch)
tree279cb3f48cc68d32406452759c1ab529d292d27d /src/users.cpp
parent459f3d07c999a0d55555d10139758e586d891f64 (diff)
Store user away state and add it to the anope.user RPC event.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 63a524488..5887bba2f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -543,6 +543,24 @@ void User::UpdateHost()
}
}
+void User::SetAway(const Anope::string &msg, time_t ts)
+{
+ FOREACH_MOD(OnUserAway, (this, msg));
+ if (msg.empty())
+ {
+ this->awaymsg.clear();
+ this->awaytime = 0;
+ Log(this, "away") << "is no longer away";
+ }
+ else
+ {
+ this->awaymsg = msg;
+ this->awaytime = ts ? ts : Anope::CurTime;
+ Log(this, "away") << "is now away: " << msg;
+ }
+}
+
+
bool User::HasMode(const Anope::string &mname) const
{
return this->modes.count(mname);