Changeset - ad858d6c8dcb
[Not reviewed]
0 4 0
Jan Kaluza - 9 years ago 2016-02-26 06:57:02
jkaluza@redhat.com
Libcommuni: Respond to VCard with empty payload, change name automatically in case of conflict
4 files changed with 30 insertions and 7 deletions:
0 comments (0 inline, 0 general)
backends/libcommuni/ircnetworkplugin.cpp
Show inline comments
 
@@ -146,6 +146,10 @@ void IRCNetworkPlugin::handleLoginRequest(const std::string &user, const std::st
 
	}
 
}
 

	
 
void IRCNetworkPlugin::handleVCardRequest(const std::string &user, const std::string &legacyName, unsigned int id) {
 
	handleVCard(user, id, legacyName, "", "", "");
 
}
 

	
 
void IRCNetworkPlugin::handleLogoutRequest(const std::string &user, const std::string &legacyName) {
 
	if (m_sessions[user] == NULL) {
 
		LOG4CXX_WARN(logger, user << ": Already disconnected.");
 
@@ -253,6 +257,7 @@ void IRCNetworkPlugin::handleJoinRoomRequest(const std::string &user, const std:
 

	
 
	// update nickname, because we have nickname per session, no nickname per room.
 
	handleRoomNicknameChanged(user, target, TO_UTF8(m_sessions[session]->nickName()));
 
	handleParticipantChanged(user, nickname, target, 0, pbnetwork::STATUS_ONLINE, "", TO_UTF8(m_sessions[session]->nickName()));
 
}
 

	
 
void IRCNetworkPlugin::handleLeaveRoomRequest(const std::string &user, const std::string &room) {
backends/libcommuni/ircnetworkplugin.h
Show inline comments
 
@@ -47,6 +47,8 @@ class IRCNetworkPlugin : public QObject, public NetworkPlugin {
 

	
 
		void handleRoomSubjectChangedRequest(const std::string &user, const std::string &room, const std::string &message);
 

	
 
		void handleVCardRequest(const std::string &user, const std::string &legacyName, unsigned int id);
 

	
 
		void tryNextServer();
 

	
 
	public slots:
backends/libcommuni/session.cpp
Show inline comments
 
@@ -389,11 +389,17 @@ void MyIrcSession::on_numericMessageReceived(IrcMessage *message) {
 
			break;
 
		case 433:
 
			for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
 
				m_np->handleParticipantChanged(m_user, TO_UTF8(nickName()), it->second->getChannel() + m_suffix, pbnetwork::PARTICIPANT_FLAG_CONFLICT);
 
			}
 
			if (m_suffix.empty()) {
 
				m_np->handleDisconnected(m_user, pbnetwork::CONNECTION_ERROR_INVALID_USERNAME, "Nickname is already in use");
 
				m_np->handleRoomNicknameChanged(m_user, it->second->getChannel() + m_suffix, TO_UTF8(nickName() + "_"));
 
				m_np->handleParticipantChanged(m_user, TO_UTF8(nickName()), it->second->getChannel() + m_suffix, 0, pbnetwork::STATUS_ONLINE, "", TO_UTF8(nickName() + "_"));
 
			}
 
			setNickName(nickName() + "_");
 
			open();
 
// 			for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
 
// 				m_np->handleParticipantChanged(m_user, TO_UTF8(nickName()), it->second->getChannel() + m_suffix, pbnetwork::PARTICIPANT_FLAG_CONFLICT);
 
// 			}
 
// 			if (m_suffix.empty()) {
 
// 				m_np->handleDisconnected(m_user, pbnetwork::CONNECTION_ERROR_INVALID_USERNAME, "Nickname is already in use");
 
// 			}
 
			break;
 
		case 436:
 
			for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
tests/start.py
Show inline comments
 
@@ -6,6 +6,10 @@ import os
 

	
 
import sleekxmpp
 
import imp
 
import logging
 

	
 
#logging.basicConfig(level=logging.DEBUG,
 
                        #format='%(levelname)-8s %(message)s')
 

	
 
def registerXMPPAccount(user, password):
 
	responder = sleekxmpp.ClientXMPP(user, password)
 
@@ -69,7 +73,7 @@ class BaseTest:
 
		client.register_plugin('xep_0054')
 
		client['feature_mechanisms'].unencrypted_plain = True
 

	
 
		time.sleep(2)
 
		time.sleep(1)
 

	
 
		to = ("127.0.0.1", 5223)
 
		if self.responder_password != "password":
 
@@ -82,6 +86,7 @@ class BaseTest:
 
			self.post_test()
 
			sys.exit(1)
 

	
 

	
 
		max_time = 60
 
		while not client.finished and not responder.finished and max_time > 0:
 
			time.sleep(1)
 
@@ -113,6 +118,11 @@ class LibcommuniServerModeSingleServerConf(BaseTest):
 
		BaseTest.__init__(self, "../libcommuni/irc_test.cfg", True, "#channel@localhost")
 
		self.directory = "../libcommuni/"
 

	
 
	def skip_test(self, test):
 
		if test in ["muc_join_nickname_used.py"]:
 
			return True
 
		return False
 

	
 
	def pre_test(self):
 
		os.system("ngircd -f ../libcommuni/ngircd.conf &")
 

	
 
@@ -199,8 +209,8 @@ configurations = []
 
configurations.append(LibcommuniServerModeSingleServerConf())
 
configurations.append(LibcommuniServerModeConf())
 
configurations.append(JabberServerModeConf())
 
#configurations.append(JabberSlackServerModeConf())
 
configurations.append(TwitterServerModeConf())
 
##configurations.append(JabberSlackServerModeConf())
 
#configurations.append(TwitterServerModeConf())
 

	
 
exitcode = 0
 

	
0 comments (0 inline, 0 general)