2010-05-28 15:41:58 -05:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
#include <Resources.h>
|
2021-05-20 09:32:52 -05:00
|
|
|
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
#include <libinterface/BitmapUtils.h>
|
2010-05-28 15:41:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
JabberProtocol::JabberProtocol()
|
|
|
|
: JabberHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JabberProtocol::~JabberProtocol()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
const char*
|
|
|
|
JabberProtocol::Signature() const
|
|
|
|
{
|
|
|
|
return "jabber";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
JabberProtocol::FriendlySignature() const
|
|
|
|
{
|
|
|
|
return "Jabber";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BBitmap*
|
|
|
|
JabberProtocol::Icon() const
|
2010-05-28 15:41:58 -05:00
|
|
|
{
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
return ReadNodeIcon(fPath.Path(), B_LARGE_ICON, true);
|
2010-05-28 15:41:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-20 09:32:52 -05:00
|
|
|
BMessage
|
2021-06-17 16:51:37 -05:00
|
|
|
JabberProtocol::SettingsTemplate(const char* name)
|
2021-05-20 09:32:52 -05:00
|
|
|
{
|
2021-06-17 16:51:37 -05:00
|
|
|
if (name == BString("account"))
|
|
|
|
return JabberHandler::_SettingsTemplate("Jabber identifier", true);
|
2021-06-18 01:30:59 -05:00
|
|
|
if (name == BString("room"))
|
|
|
|
return JabberHandler::_RoomTemplate();
|
2021-06-17 16:51:37 -05:00
|
|
|
else
|
|
|
|
return BMessage();
|
2021-05-20 09:32:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Allow multiple protocols per add-on
Now an add-on can contain multiple protocols, and the protocol API has
changed. An add-on must now export protocol_count() and protocol_at(),
with the latter replacing protocol(). protocol_count() returning the
amount of protocols in a given add-on, and protocol_at(i) giving a
new CayaProtocol* "at" the given index.
CayaProtocol has also been changed, adding Signature(),
FriendlySignature(), Icon(), Path(), and SetPath(). The reasoning is
that different protocols (even within a single add-on) will have
different signatures and icons, so this data should be accessible from
the protocol itself.
CayaProtocolAddOn now has CountProtocols() and ProtocolAt(i), allowing
the accessing of multiple protocols. A CayaProtocolAddOn can be given a
default protocol index in the constructor, whose protocol will be
returned with Protocol(). Version() was also moved from CayaProtocol to
CayaProtocolAddOn.
2021-05-21 13:33:43 -05:00
|
|
|
void
|
|
|
|
JabberProtocol::OverrideSettings()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-28 15:41:58 -05:00
|
|
|
BString
|
|
|
|
JabberProtocol::ComposeJID() const
|
|
|
|
{
|
|
|
|
BString jid(fUsername);
|
|
|
|
if (jid.FindLast("@") < 0)
|
|
|
|
jid << "@" << fServer;
|
|
|
|
jid << "/" << fResource;
|
|
|
|
return jid;
|
|
|
|
}
|