Changeset - 9813552ebfe1
[Not reviewed]
0 3 0
Jan Kaluza - 10 years ago 2015-12-03 12:19:34
jkaluza@redhat.com
Send api version to backend so it can use future features based on this version number
3 files changed with 24 insertions and 0 deletions:
0 comments (0 inline, 0 general)
include/transport/NetworkPluginServer.h
Show inline comments
 
@@ -43,6 +43,8 @@
 
#include <Swiften/FileTransfer/FileTransfer.h>
 
#define HAVE_SWIFTEN_3  (SWIFTEN_VERSION >= 0x030000)
 

	
 
#define NETWORK_PLUGIN_API_VERSION (1)
 

	
 
namespace Transport {
 

	
 
class UserManager;
 
@@ -160,6 +162,7 @@ class NetworkPluginServer : Swift::XMPPParserClient {
 

	
 
		void pingTimeout();
 
		void sendPing(Backend *c);
 
		void sendAPIVersion(Backend *c);
 
		Backend *getFreeClient(bool acceptUsers = true, bool longRun = false, bool check = false);
 
		void connectWaitingUsers();
 
		void loginDelayFinished();
include/transport/protocol.proto
Show inline comments
 
@@ -151,6 +151,10 @@ message BackendConfig {
 
	required string config = 1;
 
}
 

	
 
message APIVersion {
 
	required int32 version = 1;
 
}
 

	
 
message WrapperMessage {
 
	enum Type { 
 
		TYPE_CONNECTED 				= 1;
 
@@ -187,6 +191,7 @@ message WrapperMessage {
 
		TYPE_CONV_MESSAGE_ACK		= 33;
 
		TYPE_RAW_XML				= 34;
 
		TYPE_BUDDIES				= 35;
 
		TYPE_API_VERSION			= 36;
 
	}
 
	required Type type = 1;
 
	optional bytes payload = 2;
src/NetworkPluginServer.cpp
Show inline comments
 
@@ -1936,6 +1936,22 @@ void NetworkPluginServer::sendPing(Backend *c) {
 
// 	LOG4CXX_INFO(logger, "PING to " << c);
 
}
 

	
 
void NetworkPluginServer::sendAPIVersion(Backend *c) {
 

	
 
	pbnetwork::APIVersion apiver;
 
	apiver.set_version(NETWORK_PLUGIN_API_VERSION);
 

	
 
	std::string message;
 
	apiver.SerializeToString(&message);
 

	
 
	WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_API_VERSION);
 

	
 
	if (c->connection) {
 
		LOG4CXX_INFO(logger, "API Version to " << c << " (ID=" << c->id << ")");
 
		send(c->connection, message);
 
	}
 
}
 

	
 
void NetworkPluginServer::handlePIDTerminated(unsigned long pid) {
 
	std::vector<unsigned long>::iterator log_id_it;
 
	log_id_it = std::find(m_pids.begin(), m_pids.end(), pid);
0 comments (0 inline, 0 general)