From fef9c8193ddf8cdf81978874be788af9441e2286 Mon Sep 17 00:00:00 2001
From: Florent Le Coz <louiz@louiz.org>
Date: Mon, 6 Jan 2014 01:22:43 +0100
Subject: Also set the role and affiliation of users already in the chan

---
 src/irc/irc_client.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'src/irc')

diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 1e8e326..644351e 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -247,7 +247,9 @@ void IrcClient::set_and_forward_user_list(const IrcMessage& message)
       if (user->nick != channel->get_self()->nick)
         {
           log_debug("Adding user [" << nick << "] to chan " << chan_name);
-          this->bridge->send_user_join(this->hostname, chan_name, user, false);
+          this->bridge->send_user_join(this->hostname, chan_name, user,
+                                       user->get_most_significant_mode(this->sorted_user_modes),
+                                       false);
         }
       else
         {
@@ -270,7 +272,9 @@ void IrcClient::on_channel_join(const IrcMessage& message)
   else
     {
       const IrcUser* user = channel->add_user(nick, this->prefix_to_mode);
-      this->bridge->send_user_join(this->hostname, chan_name, user, false);
+      this->bridge->send_user_join(this->hostname, chan_name, user,
+                                   user->get_most_significant_mode(this->sorted_user_modes),
+                                   false);
     }
 }
 
@@ -334,7 +338,9 @@ void IrcClient::on_channel_completely_joined(const IrcMessage& message)
 {
   const std::string chan_name = utils::tolower(message.arguments[1]);
   IrcChannel* channel = this->get_channel(chan_name);
-  this->bridge->send_user_join(this->hostname, chan_name, channel->get_self(), true);
+  this->bridge->send_user_join(this->hostname, chan_name, channel->get_self(),
+                               channel->get_self()->get_most_significant_mode(this->sorted_user_modes),
+                               true);
   this->bridge->send_topic(this->hostname, chan_name, channel->topic);
 }
 
-- 
cgit v1.2.3