Changeset - b44919ed9b6b
[Not reviewed]
0 5 0
Jan Kaluza - 10 years ago 2015-12-17 18:25:26
jkaluza@redhat.com
Handle situation when sending /whois with non existing nickname :)
5 files changed with 20 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/libcommuni/ircnetworkplugin.cpp
Show inline comments
 
@@ -183,6 +183,7 @@ void IRCNetworkPlugin::handleMessageSendRequest(const std::string &user, const s
 
	}
 
	else if (message.find("/whois") == 0 || message.find(".whois") == 0) {
 
		m_sessions[session]->sendWhoisCommand(target, message.substr(7));
 
		return;
 
	}
 
	else {
 
		m_sessions[session]->sendCommand(IrcCommand::createMessage(FROM_UTF8(target), FROM_UTF8(message)));
backends/libcommuni/session.cpp
Show inline comments
 
@@ -376,6 +376,14 @@ void MyIrcSession::on_numericMessageReceived(IrcMessage *message) {
 
			LOG4CXX_INFO(logger, m_user << "Asking /who for channel " << TO_UTF8(channel));
 
			sendCommand(IrcCommand::createWho(channel));
 
			break;
 
		case 401:
 
		case 402:
 
			nick = TO_UTF8(parameters[1]);
 
			if (m_whois.find(nick) != m_whois.end()) {
 
				sendMessageToFrontend(m_whois[nick], "whois", nick + ": No such client");
 
				m_whois.erase(nick);
 
			}
 
			break;
 
		case 432:
 
			m_np->handleDisconnected(m_user, pbnetwork::CONNECTION_ERROR_INVALID_USERNAME, "Erroneous Nickname");
 
			break;
spectrum/src/tests/muc_whois.py
Show inline comments
 
@@ -29,12 +29,15 @@ class Client(sleekxmpp.ClientXMPP):
 
		self.finished = False
 

	
 
		self.tests = {}
 
		self.tests["whois_received"] = ["libcommuni: Receive /whois command response", False]
 
		self.tests["whois1_received"] = ["libcommuni: Receive /whois command response", False]
 
		self.tests["whois2_received"] = ["libcommuni: Receive /whois command response for invalid nickname", False]
 

	
 
	def muc_message(self, msg):
 
		if msg['mucnick'] != self.nick:
 
			if msg["body"] == "responder is connected to irc.example.net (responder)\nresponder is a user on channels: @#channel":
 
				self.tests["whois_received"][1] = True
 
				self.tests["whois1_received"][1] = True
 
			elif msg["body"] == "nonexisting: No such client":
 
				self.tests["whois2_received"][1] = True
 
				self.finished = True
 

	
 
	def start(self, event):
 
@@ -42,3 +45,4 @@ class Client(sleekxmpp.ClientXMPP):
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.send_message(mto=self.room, mbody="/whois responder", mtype='groupchat')
 
		self.send_message(mto=self.room, mbody="/whois nonexisting", mtype='groupchat')
spectrum/src/tests/ngircd.conf
Show inline comments
 
@@ -171,12 +171,12 @@
 
	;DefaultUserModes = i
 

	
 
	# Do DNS lookups when a client connects to the server.
 
	;DNS = yes
 
	DNS = no
 

	
 
	# Do IDENT lookups if ngIRCd has been compiled with support for it.
 
	# Users identified using IDENT are registered without the "~" character
 
	# prepended to their user name.
 
	;Ident = yes
 
	Ident = no
 

	
 
	# Directory containing configuration snippets (*.conf), that should
 
	# be read in after parsing this configuration file.
spectrum/src/tests/start.py
Show inline comments
 
@@ -103,6 +103,9 @@ for conf in configurations:
 
		if not f.endswith(".py") or f == "start.py":
 
			continue
 

	
 
		if len(sys.argv) == 2 and sys.argv[1] != f:
 
			continue
 

	
 
		print conf.__class__.__name__ + ": Starting " + f + " test ..."
 
		test = imp.load_source('test', './' + f)
 
		try:
0 comments (0 inline, 0 general)