diff options
author | louiz’ <louiz@louiz.org> | 2017-07-05 20:18:26 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-07-16 00:16:43 +0200 |
commit | dd343609d561c95a3231ab9db26d44dec6395a6f (patch) | |
tree | 5ac9142b86b73d767010bcb47a08720ac12dfeb4 /src/xmpp | |
parent | f9a6f973966430b108642ac57d54db5fd0d5535e (diff) | |
download | biboumi-dd343609d561c95a3231ab9db26d44dec6395a6f.tar.gz biboumi-dd343609d561c95a3231ab9db26d44dec6395a6f.tar.bz2 biboumi-dd343609d561c95a3231ab9db26d44dec6395a6f.tar.xz biboumi-dd343609d561c95a3231ab9db26d44dec6395a6f.zip |
Only send the IRC server presence if the user has this JID in their roster
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 71a5f3d..b951629 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -1025,12 +1025,20 @@ void BiboumiComponent::send_presence_to_contact(const std::string& from, const s void BiboumiComponent::on_irc_client_connected(const std::string& irc_hostname, const std::string& jid) { - this->send_presence_to_contact(irc_hostname + "@" + this->served_hostname, jid, ""); +#ifdef USE_DATABASE + const auto local_jid = irc_hostname + "@" + this->served_hostname; + if (Database::has_roster_item(local_jid, jid)) + this->send_presence_to_contact(local_jid, jid, ""); +#endif } void BiboumiComponent::on_irc_client_disconnected(const std::string& irc_hostname, const std::string& jid) { - this->send_presence_to_contact(irc_hostname + "@" + this->served_hostname, jid, "unavailable"); +#ifdef USE_DATABASE + const auto local_jid = irc_hostname + "@" + this->served_hostname; + if (Database::has_roster_item(local_jid, jid)) + this->send_presence_to_contact(irc_hostname + "@" + this->served_hostname, jid, "unavailable"); +#endif } void BiboumiComponent::after_handshake() |