2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2011-12-03 16:38:03 -06:00
|
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
|
|
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
2010-05-07 04:47:10 -05:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2010-05-16 16:02:50 -05:00
|
|
|
#ifndef _PROTOCOL_MANAGER_H
|
|
|
|
#define _PROTOCOL_MANAGER_H
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
#include <Path.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
#include <libsupport/KeyMap.h>
|
2010-05-08 14:35:28 -05:00
|
|
|
|
2021-06-20 12:44:20 -05:00
|
|
|
#include "ChatProtocol.h"
|
|
|
|
#include "ChatProtocolAddOn.h"
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
class BBitmap;
|
2010-05-16 16:02:50 -05:00
|
|
|
class BDirectory;
|
|
|
|
class BHandler;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-05-20 16:31:55 -05:00
|
|
|
class ProtocolManager {
|
2010-05-07 04:47:10 -05:00
|
|
|
public:
|
2021-08-15 00:53:45 -05:00
|
|
|
bool Init(BDirectory dir, BHandler* target);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
static ProtocolManager* Get();
|
|
|
|
|
2010-05-28 12:11:16 -05:00
|
|
|
uint32 CountProtocolAddOns() const;
|
2021-06-20 12:44:20 -05:00
|
|
|
ChatProtocolAddOn* ProtocolAddOnAt(uint32 i) const;
|
|
|
|
ChatProtocolAddOn* ProtocolAddOn(const char* signature);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
2010-05-28 12:11:16 -05:00
|
|
|
uint32 CountProtocolInstances() const;
|
2021-06-20 12:44:20 -05:00
|
|
|
ChatProtocol* ProtocolInstanceAt(uint32 i) const;
|
|
|
|
ChatProtocol* ProtocolInstance(bigtime_t identifier);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
2021-06-20 12:44:20 -05:00
|
|
|
void AddAccount(ChatProtocolAddOn* addOn,
|
2010-05-20 16:31:55 -05:00
|
|
|
const char* account,
|
|
|
|
BHandler* target);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
private:
|
2021-06-20 12:44:20 -05:00
|
|
|
typedef KeyMap<BString, ChatProtocolAddOn*> AddOnMap;
|
|
|
|
typedef KeyMap<bigtime_t, ChatProtocol*> ProtocolMap;
|
2010-05-28 12:11:16 -05:00
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
ProtocolManager();
|
2021-06-11 21:43:50 -05:00
|
|
|
|
|
|
|
void _LoadAccounts(const char* image_path,
|
2021-06-20 12:44:20 -05:00
|
|
|
ChatProtocolAddOn* addOn, int protoIndex,
|
2021-06-11 21:43:50 -05:00
|
|
|
BHandler* target);
|
|
|
|
void _LoadAccount(const char* imagePath,
|
|
|
|
BEntry accountEntry, int protoIndex,
|
2010-05-20 16:31:55 -05:00
|
|
|
BHandler* target);
|
2021-06-20 12:44:20 -05:00
|
|
|
void _LoadAccount(ChatProtocolAddOn* addOn,
|
2021-06-11 21:43:50 -05:00
|
|
|
BEntry accountEntry, BHandler* target);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
AddOnMap fAddOnMap;
|
|
|
|
ProtocolMap fProtocolMap;
|
2010-05-07 04:47:10 -05:00
|
|
|
};
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
#endif // _PROTOCOL_MANAGER_H
|