More documentation + API cleaning
This commit is contained in:
parent
61286ac19e
commit
632afeabe0
11 changed files with 140 additions and 44 deletions
|
@ -27,7 +27,7 @@ void MyIrcSession::on_connected(){
|
|||
void MyIrcSession::on_disconnected()
|
||||
{
|
||||
std::cout << "disconnected:\n";
|
||||
np->handleDisconnected(user, "", 0, "");
|
||||
np->handleDisconnected(user, 0, "");
|
||||
}
|
||||
|
||||
void MyIrcSession::on_bufferAdded(Irc::Buffer* buffer)
|
||||
|
@ -79,10 +79,10 @@ void MyIrcBuffer::on_receiverChanged(const QString& receiver)
|
|||
qDebug() << "receiver changed:" << receiver;
|
||||
}
|
||||
|
||||
int MyIrcBuffer::correctNickname(std::string &nickname) {
|
||||
int flags = 0;
|
||||
Conversation::ParticipantFlag MyIrcBuffer::correctNickname(std::string &nickname) {
|
||||
Conversation::ParticipantFlag flags = Conversation::None;
|
||||
switch(nickname.at(0)) {
|
||||
case '@': nickname = nickname.substr(1); flags = 1; break;
|
||||
case '@': nickname = nickname.substr(1); flags = Conversation::Moderator; break;
|
||||
case '+': nickname = nickname.substr(1); break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ int MyIrcBuffer::correctNickname(std::string &nickname) {
|
|||
|
||||
void MyIrcBuffer::on_joined(const QString& origin) {
|
||||
qDebug() << "joined:" << receiver() << origin;
|
||||
int flags = 0;
|
||||
Conversation::ParticipantFlag flags = Conversation::None;
|
||||
std::string nickname = origin.toStdString();
|
||||
flags = correctNickname(nickname);
|
||||
np->handleParticipantChanged(user, origin.toStdString(), receiver().toStdString(), flags, Swift::StatusShow::Online);
|
||||
|
@ -99,7 +99,7 @@ void MyIrcBuffer::on_joined(const QString& origin) {
|
|||
|
||||
void MyIrcBuffer::on_parted(const QString& origin, const QString& message) {
|
||||
qDebug() << "parted:" << receiver() << origin << message;
|
||||
int flags = 0;
|
||||
Conversation::ParticipantFlag flags = Conversation::None;
|
||||
std::string nickname = origin.toStdString();
|
||||
flags = correctNickname(nickname);
|
||||
np->handleParticipantChanged(user, nickname, receiver().toStdString(), flags, Swift::StatusShow::None, message.toStdString());
|
||||
|
@ -114,8 +114,8 @@ void MyIrcBuffer::on_quit(const QString& origin, const QString& message)
|
|||
void MyIrcBuffer::on_nickChanged(const QString& origin, const QString& nick) {
|
||||
qDebug() << "nick changed:" << receiver() << origin << nick;
|
||||
std::string nickname = origin.toStdString();
|
||||
int flags = p->m_modes[receiver().toStdString() + nickname];
|
||||
std::cout << receiver().toStdString() + nickname << " " << flags << "\n";
|
||||
Conversation::ParticipantFlag flags = p->m_modes[receiver().toStdString() + nickname];
|
||||
// std::cout << receiver().toStdString() + nickname << " " << flags << "\n";
|
||||
np->handleParticipantChanged(user, nickname, receiver().toStdString(), flags, Swift::StatusShow::Online, "", nick.toStdString());
|
||||
}
|
||||
|
||||
|
@ -126,12 +126,12 @@ void MyIrcBuffer::on_modeChanged(const QString& origin, const QString& mode, con
|
|||
if (nickname.empty())
|
||||
return;
|
||||
if (mode == "+o") {
|
||||
p->m_modes[receiver().toStdString() + nickname] = 1;
|
||||
p->m_modes[receiver().toStdString() + nickname] = Conversation::Moderator;
|
||||
}
|
||||
else {
|
||||
p->m_modes[receiver().toStdString() + nickname] = 0;
|
||||
p->m_modes[receiver().toStdString() + nickname] = Conversation::None;
|
||||
}
|
||||
int flags = p->m_modes[receiver().toStdString() + nickname];
|
||||
Conversation::ParticipantFlag flags = p->m_modes[receiver().toStdString() + nickname];
|
||||
np->handleParticipantChanged(user, nickname, receiver().toStdString(), flags, Swift::StatusShow::Online, "");
|
||||
}
|
||||
|
||||
|
@ -199,11 +199,11 @@ void MyIrcBuffer::on_numericMessageReceived(const QString& origin, uint code, co
|
|||
QStringList members = params.value(3).split(" ");
|
||||
|
||||
for (int i = 0; i < members.size(); i++) {
|
||||
int flags = 0;
|
||||
Conversation::ParticipantFlag flags = Conversation::None;
|
||||
std::string nickname = members.at(i).toStdString();
|
||||
flags = correctNickname(nickname);
|
||||
p->m_modes[channel.toStdString() + nickname] = flags;
|
||||
std::cout << channel.toStdString() + nickname << " " << flags << "\n";
|
||||
// std::cout << channel.toStdString() + nickname << " " << flags << "\n";
|
||||
np->handleParticipantChanged(user, nickname, channel.toStdString(), flags, Swift::StatusShow::Online);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,7 @@ class MyIrcSession : public Irc::Session
|
|||
|
||||
public:
|
||||
MyIrcSession(const std::string &user, NetworkPlugin *np, QObject* parent = 0);
|
||||
std::map<std::string, int> m_modes;
|
||||
std::map<std::string, Conversation::ParticipantFlag> m_modes;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void on_connected();
|
||||
|
@ -67,7 +67,7 @@ protected Q_SLOTS:
|
|||
void on_numericMessageReceived(const QString& origin, uint code, const QStringList& params);
|
||||
void on_unknownMessageReceived(const QString& origin, const QStringList& params);
|
||||
|
||||
int correctNickname(std::string &nickname);
|
||||
Conversation::ParticipantFlag correctNickname(std::string &nickname);
|
||||
};
|
||||
|
||||
#endif // SESSION_H
|
||||
|
|
|
@ -180,12 +180,12 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
|
|||
}
|
||||
|
||||
if (password.empty()) {
|
||||
np->handleDisconnected(user, name, 0, "Empty password.");
|
||||
np->handleDisconnected(user, 0, "Empty password.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!purple_find_prpl(protocol.c_str())) {
|
||||
np->handleDisconnected(user, name, 0, "Invalid protocol " + protocol);
|
||||
np->handleDisconnected(user, 0, "Invalid protocol " + protocol);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ static void buddyListNewNode(PurpleBlistNode *node) {
|
|||
}
|
||||
|
||||
std::cout << "BLOCKED?" << (purple_privacy_check(account, purple_buddy_get_name(buddy)) == false) << "\n";
|
||||
np->handleBuddyChanged(np->m_accounts[account], purple_buddy_get_name(buddy), getAlias(buddy), getGroups(buddy)[0], (int) status.getType(), message, getIconHash(buddy),
|
||||
np->handleBuddyChanged(np->m_accounts[account], purple_buddy_get_name(buddy), getAlias(buddy), getGroups(buddy)[0], status.getType(), message, getIconHash(buddy),
|
||||
blocked
|
||||
);
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ static PurpleConversationUiOps conversation_ui_ops =
|
|||
|
||||
static void connection_report_disconnect(PurpleConnection *gc, PurpleConnectionError reason, const char *text){
|
||||
PurpleAccount *account = purple_connection_get_account(gc);
|
||||
np->handleDisconnected(np->m_accounts[account], purple_account_get_username(account), (int) reason, text ? text : "");
|
||||
np->handleDisconnected(np->m_accounts[account], (int) reason, text ? text : "");
|
||||
np->handleLogoutRequest(np->m_accounts[account], purple_account_get_username(account));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,44 +31,132 @@
|
|||
#include "Swiften/Network/BoostIOServiceThread.h"
|
||||
#include "Swiften/Network/Connection.h"
|
||||
#include "storagebackend.h"
|
||||
#include "conversation.h"
|
||||
|
||||
namespace Transport {
|
||||
|
||||
/// Represents Spectrum2 legacy network plugin.
|
||||
|
||||
/// This class is base class for all C++ legacy network plugins. It provides a way to connect
|
||||
/// Spectrum2 NetworkPluginServer and allows to use high-level API for legacy network plugins
|
||||
/// development.
|
||||
class NetworkPlugin {
|
||||
public:
|
||||
/// Creates new NetworkPlugin and connects the Spectrum2 NetworkPluginServer.
|
||||
/// \param loop Event loop.
|
||||
/// \param host Host where Spectrum2 NetworkPluginServer runs.
|
||||
/// \param port Port.
|
||||
NetworkPlugin(Swift::EventLoop *loop, const std::string &host, int port);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~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.
|
||||
void handleBuddyChanged(const std::string &user, const std::string &buddyName, const std::string &alias,
|
||||
const std::string &groups, int status, const std::string &statusMessage = "", const std::string &iconHash = "",
|
||||
const std::string &groups, Swift::StatusShow::Type status, const std::string &statusMessage = "", const std::string &iconHash = "",
|
||||
bool blocked = false
|
||||
);
|
||||
|
||||
void handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, int flags, int status = Swift::StatusShow::None, const std::string &statusMessage = "", const std::string &newname = "");
|
||||
/// 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.
|
||||
void handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, Conversation::ParticipantFlag flags = Conversation::None,
|
||||
Swift::StatusShow::Type status = Swift::StatusShow::None, const std::string &statusMessage = "", const std::string &newname = "");
|
||||
|
||||
void handleDisconnected(const std::string &user, const std::string &legacyName, int error, const std::string &message);
|
||||
/// 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.
|
||||
void handleDisconnected(const std::string &user, int error = 0, const std::string &message = "");
|
||||
|
||||
/// 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 xhtml XHTML message.
|
||||
void handleMessage(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &nickname = "", const std::string &xhtml = "");
|
||||
|
||||
/// 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.
|
||||
void handleSubject(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &nickname = "");
|
||||
|
||||
void handleRoomChanged(const std::string &user, const std::string &room, const std::string &nickname);
|
||||
/// 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)
|
||||
/// \param nickname New nickname.
|
||||
void handleRoomNicknameChanged(const std::string &user, const std::string &room, const std::string &nickname);
|
||||
|
||||
/// 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 nickname Nickname.
|
||||
/// \param photo Raw photo.
|
||||
void handleVCard(const std::string &user, unsigned int id, const std::string &legacyName, const std::string &fullName, const std::string &nickname, const std::string &photo);
|
||||
|
||||
/// Call this function when buddy started typing.
|
||||
/// \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")
|
||||
void handleBuddyTyping(const std::string &user, const std::string &buddyName);
|
||||
|
||||
|
||||
/// 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")
|
||||
void handleBuddyTyped(const std::string &user, const std::string &buddyName);
|
||||
|
||||
/// 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")
|
||||
void handleBuddyStoppedTyping(const std::string &user, const std::string &buddyName);
|
||||
|
||||
/// 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")
|
||||
void handleAuthorization(const std::string &user, const std::string &buddyName);
|
||||
|
||||
/// 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")
|
||||
/// \param message Message.
|
||||
void handleAttention(const std::string &user, const std::string &buddyName, const std::string &message);
|
||||
|
||||
/// Called when XMPP user wants to connect legacy network.
|
||||
/// You should connect it to legacy network and call handleConnected or handleDisconnected function later.
|
||||
/**
|
||||
\msc
|
||||
NetworkPlugin,YourNetworkPlugin,LegacyNetwork;
|
||||
NetworkPlugin->YourNetworkPlugin [label="handleLoginRequest(...)", URL="\ref NetworkPlugin::handleLoginRequest()"];
|
||||
YourNetworkPlugin->LegacyNetwork [label="connect the legacy network"];
|
||||
--- [label="If password was valid and user is connected and logged in"];
|
||||
YourNetworkPlugin<-LegacyNetwork [label="connected"];
|
||||
YourNetworkPlugin->NetworkPlugin [label="handleConnected()", URL="\ref NetworkPlugin::handleConnected()"];
|
||||
--- [label="else"];
|
||||
YourNetworkPlugin<-LegacyNetwork [label="disconnected"];
|
||||
YourNetworkPlugin->NetworkPlugin [label="handleDisconnected()", URL="\ref NetworkPlugin::handleDisconnected()"];
|
||||
\endmsc
|
||||
*/
|
||||
virtual void handleLoginRequest(const std::string &user, const std::string &legacyName, const std::string &password) = 0;
|
||||
virtual void handleLogoutRequest(const std::string &user, const std::string &legacyName) = 0;
|
||||
virtual void handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &xhtml = "") = 0;
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
#include "transport/config.h"
|
||||
#include "transport/factory.h"
|
||||
|
||||
#define tr(lang,STRING) (STRING)
|
||||
#define _(STRING) (STRING)
|
||||
|
||||
namespace Transport {
|
||||
// typedef enum { CLIENT_FEATURE_ROSTERX = 2,
|
||||
// CLIENT_FEATURE_XHTML_IM = 4,
|
||||
|
|
|
@ -76,7 +76,7 @@ class UserManager {
|
|||
int getUserCount();
|
||||
|
||||
/// Removes user. This function disconnects user and safely removes
|
||||
/// User class. This does *not* remove user from database.
|
||||
/// User class. This does *not* remove user from StorageBackend.
|
||||
/// \param user User class to remove
|
||||
void removeUser(User *user);
|
||||
|
||||
|
@ -88,15 +88,24 @@ class UserManager {
|
|||
/// \param user removed User class
|
||||
boost::signal<void (User *user)> onUserDestroyed;
|
||||
|
||||
/// Returns true if user is connected.
|
||||
/// \return True if user is connected.
|
||||
bool isUserConnected(const std::string &barejid) const {
|
||||
return m_users.find(barejid) != m_users.end();
|
||||
}
|
||||
|
||||
/// Returns pointer to UserRegistry.
|
||||
/// \return Pointer to UserRegistry.
|
||||
UserRegistry *getUserRegistry() {
|
||||
return m_userRegistry;
|
||||
}
|
||||
|
||||
/// Connects user manually.
|
||||
/// \param user JID of user.
|
||||
void connectUser(const Swift::JID &user);
|
||||
|
||||
/// Disconnects user manually.
|
||||
/// \param user JID of user.
|
||||
void disconnectUser(const Swift::JID &user);
|
||||
|
||||
private:
|
||||
|
|
|
@ -130,13 +130,13 @@ void NetworkPlugin::handleSubject(const std::string &user, const std::string &le
|
|||
}
|
||||
|
||||
void NetworkPlugin::handleBuddyChanged(const std::string &user, const std::string &buddyName, const std::string &alias,
|
||||
const std::string &groups, int status, const std::string &statusMessage, const std::string &iconHash, bool blocked) {
|
||||
const std::string &groups, Swift::StatusShow::Type status, const std::string &statusMessage, const std::string &iconHash, bool blocked) {
|
||||
pbnetwork::Buddy buddy;
|
||||
buddy.set_username(user);
|
||||
buddy.set_buddyname(buddyName);
|
||||
buddy.set_alias(alias);
|
||||
buddy.set_groups(groups);
|
||||
buddy.set_status(status);
|
||||
buddy.set_status((int)status);
|
||||
buddy.set_statusmessage(statusMessage);
|
||||
buddy.set_iconhash(iconHash);
|
||||
buddy.set_blocked(blocked);
|
||||
|
@ -214,10 +214,9 @@ void NetworkPlugin::handleConnected(const std::string &user) {
|
|||
send(message);
|
||||
}
|
||||
|
||||
void NetworkPlugin::handleDisconnected(const std::string &user, const std::string &legacyName, int error, const std::string &msg) {
|
||||
void NetworkPlugin::handleDisconnected(const std::string &user, int error, const std::string &msg) {
|
||||
pbnetwork::Disconnected d;
|
||||
d.set_user(user);
|
||||
d.set_name(legacyName);
|
||||
d.set_error(error);
|
||||
d.set_message(msg);
|
||||
|
||||
|
@ -229,7 +228,7 @@ 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, int status, const std::string &statusMessage, const std::string &newname) {
|
||||
void NetworkPlugin::handleParticipantChanged(const std::string &user, const std::string &nickname, const std::string &room, Conversation::ParticipantFlag flags, Swift::StatusShow::Type status, const std::string &statusMessage, const std::string &newname) {
|
||||
pbnetwork::Participant d;
|
||||
d.set_username(user);
|
||||
d.set_nickname(nickname);
|
||||
|
|
|
@ -170,7 +170,7 @@ static void handleBuddyPayload(LocalBuddy *buddy, const pbnetwork::Buddy &payloa
|
|||
}
|
||||
|
||||
NetworkPluginServer::NetworkPluginServer(Component *component, Config *config, UserManager *userManager) {
|
||||
std::cout << "BUDDY " << sizeof(Buddy) << "\n";
|
||||
std::cout << "BUDDY " << sizeof(LocalBuddy) << "\n";
|
||||
m_userManager = userManager;
|
||||
m_config = config;
|
||||
m_component = component;
|
||||
|
|
|
@ -6,9 +6,8 @@ message Connected {
|
|||
|
||||
message Disconnected {
|
||||
required string user = 1;
|
||||
required string name = 2;
|
||||
required int32 error = 3;
|
||||
optional string message = 4;
|
||||
required int32 error = 2;
|
||||
optional string message = 3;
|
||||
}
|
||||
|
||||
message Login {
|
||||
|
|
|
@ -324,6 +324,10 @@ void UserManager::connectUser(const Swift::JID &user) {
|
|||
// Called by UserRegistry in server mode when user connects the server and wants
|
||||
// to connect legacy network
|
||||
if (m_users.find(user.toBare().toString()) != m_users.end()) {
|
||||
if (!m_component->inServerMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_users[user.toBare().toString()]->isConnected()) {
|
||||
if (CONFIG_BOOL(m_component->getConfig(), "service.more_resources")) {
|
||||
m_userRegistry->onPasswordValid(user);
|
||||
|
|
|
@ -157,8 +157,8 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
|
|||
std::string usernameField = CONFIG_STRING(m_config, "registration.username_field");
|
||||
|
||||
Form::ref form(new Form(Form::FormType));
|
||||
form->setTitle(tr(_language, _("Registration")));
|
||||
form->setInstructions(tr(_language, instructions));
|
||||
form->setTitle((("Registration")));
|
||||
form->setInstructions((instructions));
|
||||
|
||||
HiddenFormField::ref type = HiddenFormField::create();
|
||||
type->setName("FORM_TYPE");
|
||||
|
@ -167,7 +167,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
|
|||
|
||||
TextSingleFormField::ref username = TextSingleFormField::create();
|
||||
username->setName("username");
|
||||
username->setLabel(tr(_language, usernameField));
|
||||
username->setLabel((usernameField));
|
||||
username->setValue(res.uin);
|
||||
username->setRequired(true);
|
||||
form->addField(username);
|
||||
|
@ -175,14 +175,14 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
|
|||
if (CONFIG_STRING(m_config, "service.protocol") != "twitter" && CONFIG_STRING(m_config, "service.protocol") != "bonjour") {
|
||||
TextPrivateFormField::ref password = TextPrivateFormField::create();
|
||||
password->setName("password");
|
||||
password->setLabel(tr(_language, _("Password")));
|
||||
password->setLabel((("Password")));
|
||||
password->setRequired(true);
|
||||
form->addField(password);
|
||||
}
|
||||
|
||||
ListSingleFormField::ref language = ListSingleFormField::create();
|
||||
language->setName("language");
|
||||
language->setLabel(tr(_language, _("Language")));
|
||||
language->setLabel((("Language")));
|
||||
if (registered)
|
||||
language->setValue(res.language);
|
||||
else
|
||||
|
@ -195,7 +195,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
|
|||
|
||||
TextSingleFormField::ref encoding = TextSingleFormField::create();
|
||||
encoding->setName("encoding");
|
||||
encoding->setLabel(tr(_language, _("Encoding")));
|
||||
encoding->setLabel((("Encoding")));
|
||||
if (registered)
|
||||
encoding->setValue(res.encoding);
|
||||
else
|
||||
|
@ -205,7 +205,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
|
|||
if (registered) {
|
||||
BooleanFormField::ref boolean = BooleanFormField::create();
|
||||
boolean->setName("unregister");
|
||||
boolean->setLabel(tr(_language, _("Remove your registration")));
|
||||
boolean->setLabel((("Remove your registration")));
|
||||
boolean->setValue(0);
|
||||
form->addField(boolean);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue