Chat-O-Matic/protocols/xmpp/JabberProtocol.cpp
Jaidyn Ann 3fbe072d42 Generalize protocol settings' GUI templating
A nice templating system is used for account settings dialogues― the
required slots are specified by the protocol, and are reflected in the
settings dialogue.

To generalize this templating system (and eventually use elsewhere),
ProtocolSettings was split into two classes― ProtocolSettings and
ProtocolTemplate.

The CayaProtocol::SettingsTemplate() call was also edited to require a
string parameter, naming the specific template that should be returned.

"account" is used for the account settings dialogue, and other values
are TBA.
2021-06-17 17:02:29 -05:00

73 lines
1.0 KiB
C++

/*
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the GPL v2 License.
*
* Authors:
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/
#include "JabberProtocol.h"
#include <Resources.h>
#include <libinterface/BitmapUtils.h>
JabberProtocol::JabberProtocol()
: JabberHandler()
{
}
JabberProtocol::~JabberProtocol()
{
}
const char*
JabberProtocol::Signature() const
{
return "jabber";
}
const char*
JabberProtocol::FriendlySignature() const
{
return "Jabber";
}
BBitmap*
JabberProtocol::Icon() const
{
return ReadNodeIcon(fPath.Path(), B_LARGE_ICON, true);
}
BMessage
JabberProtocol::SettingsTemplate(const char* name)
{
if (name == BString("account"))
return JabberHandler::_SettingsTemplate("Jabber identifier", true);
else
return BMessage();
}
void
JabberProtocol::OverrideSettings()
{
}
BString
JabberProtocol::ComposeJID() const
{
BString jid(fUsername);
if (jid.FindLast("@") < 0)
jid << "@" << fServer;
jid << "/" << fResource;
return jid;
}