diff options
Diffstat (limited to '')
-rw-r--r-- | src/Client.hxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/Client.hxx b/src/Client.hxx index 13a4a14e7..cbb0cbafc 100644 --- a/src/Client.hxx +++ b/src/Client.hxx @@ -87,11 +87,6 @@ public: } gcc_pure - bool IsSubscribed(const char *channel_name) const { - return subscriptions.find(channel_name) != subscriptions.end(); - } - - gcc_pure bool IsExpired() const { return !FullyBufferedSocket::IsDefined(); } @@ -132,6 +127,30 @@ public: void IdleAdd(unsigned flags); bool IdleWait(unsigned flags); + enum class SubscribeResult { + /** success */ + OK, + + /** invalid channel name */ + INVALID, + + /** already subscribed to this channel */ + ALREADY, + + /** too many subscriptions */ + FULL, + }; + + gcc_pure + bool IsSubscribed(const char *channel_name) const { + return subscriptions.find(channel_name) != subscriptions.end(); + } + + SubscribeResult Subscribe(const char *channel); + bool Unsubscribe(const char *channel); + void UnsubscribeAll(); + bool PushMessage(const ClientMessage &msg); + private: /* virtual methods from class BufferedSocket */ virtual InputResult OnSocketInput(void *data, size_t length) override; |