2021-06-22 14:42:07 -05:00
|
|
|
/*
|
2021-06-23 23:57:27 -05:00
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2021-06-24 12:22:34 -05:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA.
|
2021-06-23 23:57:27 -05:00
|
|
|
*/
|
2021-06-22 14:42:07 -05:00
|
|
|
|
|
|
|
#ifndef _PURPLE_PROTOCOL_H
|
|
|
|
#define _PURPLE_PROTOCOL_H
|
|
|
|
|
2021-07-07 15:02:59 -05:00
|
|
|
#include <FindDirectory.h>
|
2021-06-22 14:42:07 -05:00
|
|
|
#include <Path.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
#include <ChatProtocol.h>
|
|
|
|
|
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
// Required protocol exports
|
|
|
|
extern "C" _EXPORT ChatProtocol* protocol_at(int32 i);
|
|
|
|
extern "C" _EXPORT int32 protocol_count();
|
|
|
|
extern "C" _EXPORT const char* signature();
|
|
|
|
extern "C" _EXPORT const char* friendly_signature();
|
|
|
|
extern "C" _EXPORT uint32 version();
|
|
|
|
|
|
|
|
BMessenger* ensure_app_messenger();
|
|
|
|
void ensure_app();
|
|
|
|
|
|
|
|
status_t connect_thread(void* data);
|
2021-06-27 16:46:38 -05:00
|
|
|
BMessage receive_message();
|
2021-06-23 23:57:27 -05:00
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
class PurpleProtocol : public ChatProtocol {
|
|
|
|
public:
|
2021-06-24 12:22:34 -05:00
|
|
|
PurpleProtocol(BString name, BString id,
|
|
|
|
BMessage settings);
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-06-27 17:33:09 -05:00
|
|
|
~PurpleProtocol();
|
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
// ChatProtocol inheritance
|
|
|
|
virtual status_t Init(ChatProtocolMessengerInterface* interface);
|
|
|
|
virtual status_t Shutdown();
|
|
|
|
|
|
|
|
virtual status_t Process(BMessage* msg);
|
|
|
|
|
|
|
|
virtual status_t UpdateSettings(BMessage* msg);
|
|
|
|
virtual BMessage SettingsTemplate(const char* name);
|
|
|
|
|
|
|
|
virtual BObjectList<BMessage> Commands();
|
|
|
|
virtual BObjectList<BMessage> UserPopUpItems();
|
|
|
|
virtual BObjectList<BMessage> ChatPopUpItems();
|
|
|
|
virtual BObjectList<BMessage> MenuBarItems();
|
|
|
|
|
|
|
|
virtual const char* Signature() const;
|
|
|
|
virtual const char* FriendlySignature() const;
|
|
|
|
|
|
|
|
virtual BBitmap* Icon() const;
|
|
|
|
|
|
|
|
virtual void SetAddOnPath(BPath path);
|
|
|
|
virtual BPath AddOnPath();
|
|
|
|
|
|
|
|
virtual const char* GetName();
|
|
|
|
virtual void SetName(const char* name);
|
|
|
|
|
|
|
|
virtual uint32 GetEncoding();
|
|
|
|
|
|
|
|
virtual ChatProtocolMessengerInterface*
|
|
|
|
MessengerInterface() const;
|
|
|
|
|
2021-06-27 16:46:38 -05:00
|
|
|
void SendMessage(BMessage* msg);
|
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
private:
|
2021-06-26 20:40:39 -05:00
|
|
|
void _SendPrplMessage(BMessage* msg);
|
2021-06-27 16:46:38 -05:00
|
|
|
|
2021-07-03 15:00:05 -05:00
|
|
|
BMessage _RosterTemplate();
|
|
|
|
|
2021-07-07 15:02:59 -05:00
|
|
|
void _FindIcon(BPath* path, directory_which finddir);
|
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
ChatProtocolMessengerInterface* fMessenger;
|
2021-06-26 20:40:39 -05:00
|
|
|
BMessenger* fPrplMessenger;
|
2021-06-27 17:33:09 -05:00
|
|
|
thread_id fBirdThread;
|
2021-06-22 14:42:07 -05:00
|
|
|
|
|
|
|
BString fName;
|
|
|
|
BPath fAddOnPath;
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
BString fSignature;
|
|
|
|
BString fFriendlySignature;
|
2021-07-07 15:02:59 -05:00
|
|
|
BString fIconName;
|
|
|
|
BBitmap* fIcon;
|
2021-07-04 11:31:32 -05:00
|
|
|
BMessage fTemplates;
|
2021-07-05 23:56:59 -05:00
|
|
|
BObjectList<BMessage> fCommands;
|
2021-06-22 14:42:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _PURPLE_PROTOCOL_H
|