summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-29 19:57:43 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commitacf769d83a40e971ccc1346225688841465b36ee (patch)
tree8388af28b20e258d412cc34f79cb3c3cfcedbcb6 /src/bridge
parenta075517824da7e82e1be7b67d615834851482861 (diff)
downloadbiboumi-acf769d83a40e971ccc1346225688841465b36ee.tar.gz
biboumi-acf769d83a40e971ccc1346225688841465b36ee.tar.bz2
biboumi-acf769d83a40e971ccc1346225688841465b36ee.tar.xz
biboumi-acf769d83a40e971ccc1346225688841465b36ee.zip
Use isupport informations to know the user modes when joining
Also remove the duplicate send_self_join methods, user only send_user_join
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp18
-rw-r--r--src/bridge/bridge.hpp7
2 files changed, 13 insertions, 12 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 7f245db..fb3afc7 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -189,14 +189,18 @@ void Bridge::send_xmpp_message(const std::string& from, const std::string& autho
void Bridge::send_user_join(const std::string& hostname,
const std::string& chan_name,
- const IrcUser* user)
+ const IrcUser* user,
+ const bool self)
{
- this->xmpp->send_user_join(chan_name + "%" + hostname, user->nick, user->host, this->user_jid);
-}
-
-void Bridge::send_self_join(const std::string& hostname, const std::string& chan_name, const std::string nick)
-{
- this->xmpp->send_self_join(chan_name + "%" + hostname, nick, this->user_jid);
+ std::string affiliation = "participant";
+ std::string role = "none";
+ if (user->modes.find('o') != user->modes.end())
+ {
+ affiliation = "admin";
+ role = "moderator";
+ }
+ this->xmpp->send_user_join(chan_name + "%" + hostname, user->nick, user->host,
+ affiliation, role, this->user_jid, self);
}
void Bridge::send_topic(const std::string& hostname, const std::string& chan_name, const std::string topic)
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index b5bee9e..a4eeaa4 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -66,11 +66,8 @@ public:
*/
void send_user_join(const std::string& hostname,
const std::string& chan_name,
- const IrcUser* user);
- /**
- * Send the self presence of an user when the MUC is fully joined.
- */
- void send_self_join(const std::string& hostname, const std::string& chan_name, const std::string nick);
+ const IrcUser* user,
+ const bool self);
/**
* Send the topic of the MUC to the user
*/