75de08a18b
Protocol messages was added to the API to allow joining abstract rooms by their chat_id― IM_JOIN_ROOM and IM_ROOM_JOINED. To make room in anticipation of future room-related calls, some messages' values have been shifted. A JoinWindow was created (found through [Chat→Join Room] or [Alt-J] in the main window), to allow joining a room with this protocol message. The user can select which account the room should be joined from through a drop-down menu in the lower left-hand corner― a design I think could be replicated in other parts of Caya well. Path() and SetPath() in CayaProtocol were renamed to AddOnPath() and SetAddOnPath() respectively. GetName() and SetName() were also added, where "name" is the account name (aka the leaf of the protocols settings path). To Server, a new KeyMap was added for convenience (AccountInstances), to associate these account names with their instance IDs.
69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
/*
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _CAYA_PROTOCOL_H
|
|
#define _CAYA_PROTOCOL_H
|
|
|
|
#include <Messenger.h>
|
|
|
|
class BBitmap;
|
|
|
|
// Caya protocol interface version
|
|
#define CAYA_VERSION_1_PRE_ALPHA_1 0x00000001
|
|
#define CAYA_VERSION_1_ALPHA_1 0x00000100
|
|
|
|
#define CAYA_VERSION CAYA_VERSION_1_PRE_ALPHA_1
|
|
|
|
class CayaProtocolMessengerInterface {
|
|
public:
|
|
virtual status_t SendMessage(BMessage* message) = 0;
|
|
};
|
|
|
|
class CayaProtocol {
|
|
public:
|
|
//! Messenger
|
|
virtual status_t Init(CayaProtocolMessengerInterface*) = 0;
|
|
|
|
//! Called before unloading from memory
|
|
virtual status_t Shutdown() = 0;
|
|
|
|
//! Process message
|
|
virtual status_t Process(BMessage*) = 0;
|
|
|
|
//! Change settings
|
|
virtual status_t UpdateSettings(BMessage*) = 0;
|
|
|
|
//! Settings menu template
|
|
virtual BMessage SettingsTemplate() = 0;
|
|
|
|
//! Protocol signature
|
|
virtual const char* Signature() const = 0;
|
|
|
|
//! Protocol name
|
|
virtual const char* FriendlySignature() const = 0;
|
|
|
|
//! Protocol icon
|
|
virtual BBitmap* Icon() const = 0;
|
|
|
|
//! Use local logs to populate chat
|
|
virtual bool SaveLogs() const = 0;
|
|
|
|
//! Add-on's path
|
|
virtual void SetAddOnPath(BPath path) = 0;
|
|
virtual BPath AddOnPath() = 0;
|
|
|
|
//! Name of account file (leaf)
|
|
virtual const char* GetName() = 0;
|
|
virtual void SetName(const char* name) = 0;
|
|
|
|
//! Preferred encoding of messages
|
|
virtual uint32 GetEncoding() = 0;
|
|
|
|
//! Messenger interface used
|
|
virtual CayaProtocolMessengerInterface* MessengerInterface() const = 0;
|
|
};
|
|
|
|
#endif // _CAYA_PROTOCOL_H
|