Browse Source

added additional Channel::getUserPrefix()

release/0.19
Jessica James 8 years ago
parent
commit
8d22e0e0de
  1. 17
      Jupiter/IRC_Client.cpp
  2. 1
      Jupiter/IRC_Client.h

17
Jupiter/IRC_Client.cpp

@ -1622,19 +1622,24 @@ Jupiter::IRC::Client::Channel::User *Jupiter::IRC::Client::Channel::getUser(cons
return m_users.get(in_nickname); return m_users.get(in_nickname);
} }
char Jupiter::IRC::Client::Channel::getUserPrefix(const Jupiter::ReadableString &in_nickname) const char Jupiter::IRC::Client::Channel::getUserPrefix(const Channel::User &in_user) const
{
Channel::User *user = m_users.get(in_nickname);
if (user != nullptr)
{ {
const Jupiter::ReadableString &prefixes = m_parent->getPrefixes(); const Jupiter::ReadableString &prefixes = m_parent->getPrefixes();
for (size_t index = 0; index != prefixes.size(); ++index) for (size_t index = 0; index != prefixes.size(); ++index)
if (user->m_prefixes.contains(prefixes[index])) if (in_user.m_prefixes.contains(prefixes[index]))
return prefixes[index]; return prefixes[index];
return 0;
} }
char Jupiter::IRC::Client::Channel::getUserPrefix(const Jupiter::ReadableString &in_nickname) const
{
Channel::User *user = m_users.get(in_nickname);
if (user != nullptr)
return this->getUserPrefix(*user);
return 0; return 0;
} }

1
Jupiter/IRC_Client.h

@ -377,6 +377,7 @@ namespace Jupiter
* @param user String containing the nickname of a user. * @param user String containing the nickname of a user.
* @return User's most significant prefix. * @return User's most significant prefix.
*/ */
char getUserPrefix(const Channel::User &in_user) const;
char getUserPrefix(const Jupiter::ReadableString &in_nickname) const; char getUserPrefix(const Jupiter::ReadableString &in_nickname) const;
/** /**

Loading…
Cancel
Save