Changeset - 457d19d1ec41
[Not reviewed]
0 7 0
HanzZ - 14 years ago 2011-05-19 00:33:38
hanzz.k@gmail.com
Working join/rename
7 files changed with 24 insertions and 13 deletions:
0 comments (0 inline, 0 general)
backends/libircclient-qt/session.cpp
Show inline comments
 
@@ -76,9 +76,9 @@ void MyIrcBuffer::on_receiverChanged(const QString& receiver)
 
    qDebug() << "receiver changed:" << receiver;
 
}
 

	
 
void MyIrcBuffer::on_joined(const QString& origin)
 
{
 
    qDebug() << "joined:" << receiver() << origin;
 
void MyIrcBuffer::on_joined(const QString& origin) {
 
	qDebug() << "joined:" << receiver() << origin;
 
	np->handleParticipantChanged(user, origin.toStdString(), receiver().toStdString(), 0);
 
}
 

	
 
void MyIrcBuffer::on_parted(const QString& origin, const QString& message)
 
@@ -91,9 +91,9 @@ void MyIrcBuffer::on_quit(const QString& origin, const QString& message)
 
    qDebug() << "quit:" << receiver() << origin << message;
 
}
 

	
 
void MyIrcBuffer::on_nickChanged(const QString& origin, const QString& nick)
 
{
 
    qDebug() << "nick changed:" << receiver() << origin << nick;
 
void MyIrcBuffer::on_nickChanged(const QString& origin, const QString& nick) {
 
	qDebug() << "nick changed:" << receiver() << origin << nick;
 
	np->handleParticipantChanged(user, origin.toStdString(), receiver().toStdString(), 0, nick.toStdString());
 
}
 

	
 
void MyIrcBuffer::on_modeChanged(const QString& origin, const QString& mode, const QString& args)
include/transport/conversation.h
Show inline comments
 
@@ -42,7 +42,7 @@ class Conversation {
 
		const std::string &getLegacyName() { return m_legacyName; }
 

	
 
		void handleMessage(boost::shared_ptr<Swift::Message> &message, const std::string &nickname = "");
 
		void handleParticipantChanged(const std::string &nickname, int flag);
 
		void handleParticipantChanged(const std::string &nickname, int flag, const std::string &newname = "");
 
		void setNickname(const std::string &nickname) {
 
			m_nickname = nickname;
 
		}
include/transport/networkplugin.h
Show inline comments
 
@@ -44,7 +44,7 @@ class NetworkPlugin {
 
			const std::string &groups, int status, const std::string &statusMessage = "", const std::string &iconHash = ""
 
		);
 

	
 
		void handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags);
 
		void handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags, const std::string &newname = "");
 

	
 
		void handleDisconnected(const std::string &user, const std::string &legacyName, int error, const std::string &message);
 

	
src/conversation.cpp
Show inline comments
 
@@ -78,7 +78,7 @@ void Conversation::handleMessage(boost::shared_ptr<Swift::Message> &message, con
 
	}
 
}
 

	
 
void Conversation::handleParticipantChanged(const std::string &nick, int flag) {
 
void Conversation::handleParticipantChanged(const std::string &nick, int flag, const std::string &newname) {
 
	std::string nickname = nick;
 
	if (nickname.find("@") == 0) {
 
		nickname = nickname.substr(1);
 
@@ -94,7 +94,16 @@ void Conversation::handleParticipantChanged(const std::string &nick, int flag) {
 
		c.code = 110;
 
		p->addStatusCode(c);
 
	}
 
	p->addItem(Swift::MUCUserPayload::Item(Swift::MUCOccupant::Member, Swift::MUCOccupant::Participant));
 

	
 
	Swift::MUCUserPayload::Item item(Swift::MUCOccupant::Member, Swift::MUCOccupant::Participant);
 
	if (!newname.empty()) {
 
		item.nick = newname;
 
		Swift::MUCUserPayload::StatusCode c;
 
		c.code = 303;
 
		p->addStatusCode(c);
 
	}
 

	
 
	p->addItem(item);
 

	
 
	presence->addPayload(boost::shared_ptr<Swift::Payload>(p));
 
	m_conversationManager->getComponent()->getStanzaChannel()->sendPresence(presence);
src/networkplugin.cpp
Show inline comments
 
@@ -105,12 +105,13 @@ void NetworkPlugin::handleDisconnected(const std::string &user, const std::strin
 
	send(message);
 
}
 

	
 
void NetworkPlugin::handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags) {
 
void NetworkPlugin::handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags, const std::string &newname) {
 
	pbnetwork::Participant d;
 
	d.set_username(user);
 
	d.set_nickname(nickname);
 
	d.set_room(room);
 
	d.set_flag(flags);
 
	d.set_newname(newname);
 

	
 
	std::string message;
 
	d.SerializeToString(&message);
src/networkpluginserver.cpp
Show inline comments
 
@@ -210,7 +210,7 @@ void NetworkPluginServer::handleParticipantChangedPayload(const std::string &dat
 
		return;
 
	}
 

	
 
	conv->handleParticipantChanged(payload.nickname(), payload.flag());
 
	conv->handleParticipantChanged(payload.nickname(), payload.flag(), payload.newname());
 

	
 
// 	LocalBuddy *buddy = (LocalBuddy *) user->getRosterManager()->getBuddy(payload.buddyname());
 
// 	if (buddy) {
 
@@ -222,7 +222,7 @@ void NetworkPluginServer::handleParticipantChangedPayload(const std::string &dat
 
// 		handleBuddyPayload(buddy, payload);
 
// 		user->getRosterManager()->setBuddy(buddy);
 
// 	}
 
	std::cout << payload.nickname() << "\n";
 
// 	std::cout << payload.nickname() << "\n";
 
}
 

	
 
void NetworkPluginServer::handleRoomChangedPayload(const std::string &data) {
src/pbnetwork.proto
Show inline comments
 
@@ -52,6 +52,7 @@ message Participant {
 
	required string room = 2;
 
	required string nickname = 3;
 
	required int32 flag = 4;
 
	optional string newname = 5;
 
}
 

	
 
message WrapperMessage {
0 comments (0 inline, 0 general)