Chat-O-Matic/protocols/xmpp/JabberProtocol.cpp
Jaidyn Ann c0f126206a Include default templates, split "room"
The "room" template has been split into two seperate
templates― "join_room" and "create_room". Before, "room" was used in the
room creation window, but now that's delegated to "create_room".

"join_room" is used with the join window― so now, the add-on has total
control over the slots used to join/create rooms generally, if they
specify the templates. Even a "/join" command could be overriden by the
add-on.

Also, default templates are now in use. Rather than add-ons being
required to specify templates, there are sensible defaults included with
Cardie for each one.
2021-07-05 13:48:33 -05:00

77 lines
1.2 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 (strcmp(name, "account") == 0)
return JabberHandler::_SettingsTemplate("Jabber identifier:", true);
if (strcmp(name, "join_room") == 0 || strcmp(name, "create_room") == 0)
return JabberHandler::_RoomTemplate();
if (strcmp(name, "roster") == 0)
return JabberHandler::_RosterTemplate();
else
return BMessage();
}
void
JabberProtocol::OverrideSettings()
{
}
BString
JabberProtocol::ComposeJID() const
{
BString jid(fUsername);
if (jid.FindLast("@") < 0)
jid << "@" << fServer;
jid << "/" << fResource;
return jid;
}