Browse Source

Added getUsers and getChannels

release/0.19
Jessica James 8 years ago
parent
commit
1414903c81
  1. 16
      Jupiter/IRC_Client.cpp
  2. 28
      Jupiter/IRC_Client.h

16
Jupiter/IRC_Client.cpp

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2013-2016 Jessica James. * Copyright (C) 2013-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -341,9 +341,9 @@ void Jupiter::IRC::Client::send(const Jupiter::ReadableString &rawMessage)
m_socket->send(out); m_socket->send(out);
} }
Jupiter::IRC::Client::User *Jupiter::IRC::Client::getUser(const Jupiter::ReadableString &in_nickname) const const Jupiter::IRC::Client::UserTableType &Jupiter::IRC::Client::getUsers() const
{ {
return m_users.get(in_nickname); return m_users;
} }
size_t Jupiter::IRC::Client::getUserCount() const size_t Jupiter::IRC::Client::getUserCount() const
@ -351,6 +351,16 @@ size_t Jupiter::IRC::Client::getUserCount() const
return m_users.size(); return m_users.size();
} }
Jupiter::IRC::Client::User *Jupiter::IRC::Client::getUser(const Jupiter::ReadableString &in_nickname) const
{
return m_users.get(in_nickname);
}
const Jupiter::IRC::Client::ChannelTableType &Jupiter::IRC::Client::getChannels() const
{
return m_channels;
}
size_t Jupiter::IRC::Client::getChannelCount() const size_t Jupiter::IRC::Client::getChannelCount() const
{ {
return m_channels.size(); return m_channels.size();

28
Jupiter/IRC_Client.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2013-2016 Jessica James. * Copyright (C) 2013-2017 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -418,6 +418,9 @@ namespace Jupiter
bool m_adding_names; bool m_adding_names;
}; // Jupiter::IRC::Client::Channel class }; // Jupiter::IRC::Client::Channel class
typedef Jupiter::Hash_Table<Jupiter::StringS, Client::Channel, Jupiter::ReadableString> ChannelTableType;
typedef Jupiter::Hash_Table<Jupiter::StringS, Client::User, Jupiter::ReadableString> UserTableType;
/** /**
* @brief Returns the name of the primary config section this client reads from. * @brief Returns the name of the primary config section this client reads from.
* *
@ -564,6 +567,20 @@ namespace Jupiter
*/ */
void setPrintOutput(FILE *outf); void setPrintOutput(FILE *outf);
/**
* @brief Fetches the channel table
*
* @return Channel table
*/
const UserTableType &getUsers() const;
/**
* @brief Fetches the size of the user list.
*
* @return Size of the user list.
*/
size_t getUserCount() const;
/** /**
* @brief Fetches a user from the user list. * @brief Fetches a user from the user list.
* *
@ -573,11 +590,11 @@ namespace Jupiter
Jupiter::IRC::Client::User *getUser(const Jupiter::ReadableString &in_nickname) const; Jupiter::IRC::Client::User *getUser(const Jupiter::ReadableString &in_nickname) const;
/** /**
* @brief Fetches the size of the user list. * @brief Fetches the channel table
* *
* @return Size of the user list. * @return Channel table
*/ */
size_t getUserCount() const; const ChannelTableType &getChannels() const;
/** /**
* @brief Returns the number of channels. * @brief Returns the number of channels.
@ -829,9 +846,6 @@ namespace Jupiter
Jupiter::StringS m_modeC = "l"; Jupiter::StringS m_modeC = "l";
Jupiter::StringS m_modeD = "psitnm"; Jupiter::StringS m_modeD = "psitnm";
typedef Jupiter::Hash_Table<Jupiter::StringS, Client::Channel, Jupiter::ReadableString> ChannelTableType;
typedef Jupiter::Hash_Table<Jupiter::StringS, Client::User, Jupiter::ReadableString> UserTableType;
UserTableType m_users; UserTableType m_users;
ChannelTableType m_channels; ChannelTableType m_channels;

Loading…
Cancel
Save