diff options
-rw-r--r-- | include/channels.h | 3 | ||||
-rw-r--r-- | src/channels.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/include/channels.h b/include/channels.h index cf7285210..e3b38a2db 100644 --- a/include/channels.h +++ b/include/channels.h @@ -218,8 +218,9 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel> * @param privs Priviliges (prefix mode letters) to give to this user, may be NULL * @param bursting True if this join is the result of a netburst (passed to modules in the OnUserJoin hook) * @param created_by_local True if this channel was just created by a local user (passed to modules in the OnUserJoin hook) + * @return A newly created Membership object, or NULL if the user was already inside the channel or if the user is a server user */ - void ForceJoin(User* user, const std::string* privs = NULL, bool bursting = false, bool created_by_local = false); + Membership* ForceJoin(User* user, const std::string* privs = NULL, bool bursting = false, bool created_by_local = false); /** Write to a channel, from a user, using va_args for text * @param user User whos details to prefix the line with diff --git a/src/channels.cpp b/src/channels.cpp index 77b7f81db..6a864fafe 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -292,17 +292,17 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co return chan; } -void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, bool created_by_local) +Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursting, bool created_by_local) { if (IS_SERVER(user)) { ServerInstance->Logs->Log("CHANNELS", LOG_DEBUG, "Attempted to join server user " + user->uuid + " to channel " + this->name); - return; + return NULL; } Membership* memb = this->AddUser(user); if (!memb) - return; // Already on the channel + return NULL; // Already on the channel user->chans.push_front(memb); @@ -350,6 +350,7 @@ void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, boo } FOREACH_MOD(OnPostJoin, (memb)); + return memb; } bool Channel::IsBanned(User* user) |