f4342d9310
The base for roster management (RosterEditWindow) has been made, and adding new contacts works. Up next is contact removal and editing. This leverages a new template (as defined in a protocol's CayaProtocol::SettingsTemplate()), "roster," which should contain all slots pertinent to editing/adding a contact member. Two new API messages were added for this― IM_CONTACT_LIST_CONTACT_ADDED and IM_CONTACT_LIST_CONTACT_REMOVED. The former will functionally just be IM_CONTACT_INFO, but with some semantical meaning. A new CayaMessage (CAYA_EDIT_ROSTER) was also added. TemplateWindow was also edited to this end: Now, like RosterWindow/View, it can be given a specific accounts' instance id, and it will prevent the selection of another account. A new constructor was also added, to allow a ProtocolTemplate to be explicitly passed to it― probably from the program itself.
77 lines
1.2 KiB
C++
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 (name == BString("account"))
|
|
return JabberHandler::_SettingsTemplate("Jabber identifier:", true);
|
|
if (name == BString("room"))
|
|
return JabberHandler::_RoomTemplate();
|
|
if (name == BString("roster"))
|
|
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;
|
|
}
|