From 1414903c81570ba651547e6416659c6623856ed3 Mon Sep 17 00:00:00 2001 From: Jessica James Date: Tue, 3 Jan 2017 20:35:35 -0500 Subject: [PATCH] Added getUsers and getChannels --- Jupiter/IRC_Client.cpp | 16 +++++++++++++--- Jupiter/IRC_Client.h | 28 +++++++++++++++++++++------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Jupiter/IRC_Client.cpp b/Jupiter/IRC_Client.cpp index 00d4132..025222f 100644 --- a/Jupiter/IRC_Client.cpp +++ b/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 * 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); } -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 @@ -351,6 +351,16 @@ size_t Jupiter::IRC::Client::getUserCount() const 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 { return m_channels.size(); diff --git a/Jupiter/IRC_Client.h b/Jupiter/IRC_Client.h index b9f3304..f2d160c 100644 --- a/Jupiter/IRC_Client.h +++ b/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 * purpose with or without fee is hereby granted, provided that the above @@ -418,6 +418,9 @@ namespace Jupiter bool m_adding_names; }; // Jupiter::IRC::Client::Channel class + typedef Jupiter::Hash_Table ChannelTableType; + typedef Jupiter::Hash_Table UserTableType; + /** * @brief Returns the name of the primary config section this client reads from. * @@ -564,6 +567,20 @@ namespace Jupiter */ 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. * @@ -573,11 +590,11 @@ namespace Jupiter 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. @@ -829,9 +846,6 @@ namespace Jupiter Jupiter::StringS m_modeC = "l"; Jupiter::StringS m_modeD = "psitnm"; - typedef Jupiter::Hash_Table ChannelTableType; - typedef Jupiter::Hash_Table UserTableType; - UserTableType m_users; ChannelTableType m_channels;