Changeset - 79b50300351f
[Not reviewed]
0 2 0
Jan Kaluza - 13 years ago 2012-12-13 12:10:14
hanzz.k@gmail.com
Check if the user is in room before sending information about nick change. Fixes bug when users have been added to all rooms when they changed their IRC nickname
2 files changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
backends/libcommuni/session.cpp
Show inline comments
 
@@ -129,6 +129,9 @@ void MyIrcSession::on_nickChanged(IrcMessage *message) {
 

	
 
	for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
 
		std::string nickname = TO_UTF8(m->sender().name());
 
		if (!hasIRCBuddy(it->second->getChannel(), nickname)) {
 
			continue;
 
		}
 
		IRCBuddy &buddy = getIRCBuddy(it->second->getChannel(), nickname);
 
		LOG4CXX_INFO(logger, user << ": " << nickname << " changed nickname to " << TO_UTF8(m->nick()));
 
		np->handleParticipantChanged(user, nickname, it->second->getChannel() + suffix,(int) buddy.isOp(), pbnetwork::STATUS_ONLINE, "", TO_UTF8(m->nick()));
 
@@ -145,6 +148,9 @@ void MyIrcSession::on_modeChanged(IrcMessage *message) {
 
		return;
 
	LOG4CXX_INFO(logger, user << ": " << nickname << " changed mode to " << mode);
 
	for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
 
		if (!hasIRCBuddy(it->second->getChannel(), nickname)) {
 
			continue;
 
		}
 
		IRCBuddy &buddy = getIRCBuddy(it->second->getChannel(), nickname);
 
		if (mode == "+o") {
 
			buddy.setOp(true);
backends/libcommuni/session.h
Show inline comments
 
@@ -89,6 +89,10 @@ public:
 
		return m_identify;
 
	}
 

	
 
	bool hasIRCBuddy(const std::string &channel, const std::string &name) {
 
		return m_buddies[channel].find(name) != m_buddies[channel].end();
 
	}
 

	
 
	IRCBuddy &getIRCBuddy(const std::string &channel, const std::string &name) {
 
		return m_buddies[channel][name];
 
	}
0 comments (0 inline, 0 general)