Backend should forward to buddy represented by buddyName message received from user.
|_. Variable|_. Description|
|userName| JID of XMPP user|
|buddyName| Name of the buddy in legacy network|
|message|Plain text message|
|xhtml|Message formatted using XHTML-IM XEP if available|
h3. Type: TYPE_VCARD, Payload: VCard
If buddyName is empty, backend should update XMPP user's VCard according to VCard payload. If buddyName is not empty, backend has to fetch VCard of buddyName buddy including photo send it back using @Type: TYPE_VCard, Payload: Buddy@
|_. Variable|_. Description|
|userName| JID of XMPP user|
|buddyName| Name of the buddy in legacy network|
|id|Id used when sending the response with buddy's photo back. You have to use the same id in response as you received in request.|
|photo| Binary photo|
|nickname|Nickname|
h2. WrapperMessage payloads sent by backend
This chapter describes all possible payloads which can be sent by backend to Spectrum 2 main instance.
Backend sends this payload when it receives new message from legacy network which should be forwarded to XMPP user.
|_. Variable|_. Description|
|userName| JID of XMPP user|
|buddyName| Name of the buddy in legacy network who sent the message. If the conversation is room, buddyName is name of the room.|
|message|Plain text message|
|xhtml|Message formatted using XHTML-IM XEP if available|
|nickname| If the conversation is room, this is the nickname of user who sent the original message|
|carbon| If set, the message is a carbon copy of our own message sent in a different legacy network client. It should be treated as a message FROM us, not TO us|
/// Returns ConversationManager associated with this Conversation.
/// \return ConversationManager associated with this Conversation.
include/transport/NetworkPlugin.h
➞
Show inline comments
@@ -77,97 +77,98 @@ class NetworkPlugin {
/// Call this function when legacy network buddy changed.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// \param alias Alias of legacy network buddy. If empty, then it's not changed on XMPP side.
/// \param groups Groups in which buddy currently is. If empty, then it's not changed on XMPP side.
/// \param status Status of this buddy.
/// \param statusMessage Status message of this buddy.
/// \param iconHash MD5 hash of buddy icon. Empty if none buddy icon.
/// \param blocked True if this buddy is blocked in privacy lists in legacy network.
/// Call this method when buddy is removed from legacy network contact list.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// Call this function when participant in room changed.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param nickname Nickname of participant. If participant renamed, this is old name of participant. (eg. "HanzZ")
/// \param room Room in which participant changed. (eg. #spectrum)
/// \param flags Participant flags.
/// \param status Current status of participant. Swift::StatusShow::None if participant left the room.
/// \param statusMessage Current status message of participant.
/// \param newname New name of participant if he changed the nickname. Otherwise empty.
/// Call this function when user disconnected the legacy network because of some legacy network error.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param error Reserved for future use, currently keep it on 0.
/// \param message XMPP message which is sent to XMPP user.
/// Call this function when user connected the legacy network and is logged in.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
void handleConnected(const std::string &user);
/// Call this function when new message is received from legacy network for user.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param legacyName Name of legacy network buddy or name of room. (eg. "user2@gmail.com")
/// \param message Plain text message.
/// \param nickname Nickname of buddy in room. Empty if it's normal chat message.
/// \param carbon If set, the message is a carbon copy of our own message, sent in a different legacy network client. The message should be treated as sent FROM us, not TO us.
/// Call this function when subject in room changed.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param legacyName Name of room. (eg. "#spectrum")
/// \param message Subject message.
/// \param nickname Nickname of user who changed subject.
/// Call this function XMPP user's nickname changed.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param room Room in which participant changed. (eg. #spectrum)
/// Call this function when requested VCard arrived.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param id VCard ID.
/// \param legacyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// \param fullName Name of legacy network buddy. (eg. "Monty Python")
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// Call this function when buddy typed, but is not typing anymore.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// Call this function when buddy has been typing, but paused for a while.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// Call this function when new authorization request arrived form legacy network
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
/// Call this function when attention request arrived from legacy network.
/// \param user XMPP JID of user for which this event occurs. You can get it from NetworkPlugin::handleLoginRequest(). (eg. "user%gmail.com@xmpp.domain.tld")
/// \param buddyName Name of legacy network buddy. (eg. "user2@gmail.com")
include/transport/protocol.proto
➞
Show inline comments
@@ -32,96 +32,97 @@ enum StatusType {
message Connected {
required string user = 1;
}
message Disconnected {
required string user = 1;
required int32 error = 2;
optional string message = 3;
}
message Login {
required string user = 1;
required string legacyName = 2;
required string password = 3;
repeated string extraFields = 4;
}
message Logout {
required string user = 1;
required string legacyName = 2;
}
message Buddy {
required string userName = 1;
required string buddyName = 2;
optional string alias = 3;
repeated string group = 4;
optional StatusType status = 5;
optional string statusMessage = 6;
optional string iconHash = 7;
optional bool blocked = 8;
}
message Buddies {
repeated Buddy buddy = 1;
}
message ConversationMessage {
required string userName = 1;
required string buddyName = 2;
required string message = 3;
optional string nickname = 4;
optional string xhtml = 5;
optional string timestamp = 6;
optional bool headline = 7;
optional string id = 8;
optional bool pm = 9;
optional bool carbon = 10;
}
message Room {
required string userName = 1;
required string nickname = 2;
required string room = 3;
optional string password = 4;
}
message RoomList {
repeated string room = 1;
repeated string name = 2;
optional string user = 3;
}
enum ParticipantFlag {
PARTICIPANT_FLAG_NONE = 0;
PARTICIPANT_FLAG_MODERATOR = 1;
PARTICIPANT_FLAG_CONFLICT = 2;
PARTICIPANT_FLAG_BANNED = 4;
PARTICIPANT_FLAG_NOT_AUTHORIZED = 8;
PARTICIPANT_FLAG_ME = 16;
PARTICIPANT_FLAG_KICKED = 32;
PARTICIPANT_FLAG_ROOM_NOT_FOUND = 64;
}
message Participant {
required string userName = 1;
required string room = 2;
required string nickname = 3;
required int32 flag = 4;
required StatusType status = 5;
optional string statusMessage = 6;
optional string newname = 7;
optional string iconHash = 8;
optional string alias = 9;
}
message VCard {
required string userName = 1;
required string buddyName = 2;
required int32 id = 3;
optional string fullname = 4;
optional string nickname = 5;
optional bytes photo = 6;
}
message Status {
libtransport/Conversation.cpp
➞
Show inline comments
/**
* XMPP - libpurple transport
*
* Copyright (C) 2009, Jan Kaluza <hanzz@soc.pidgin.im>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
for (std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> >::const_iterator it = m_cachedMessages.begin(); it != m_cachedMessages.end(); it++) {