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
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
#include "CayaProtocol.h"
|
2010-05-16 16:02:50 -05:00
|
|
|
#include "CayaProtocolAddOn.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:
|
2010-05-16 16:02:50 -05:00
|
|
|
void Init(BDirectory dir, BHandler* target);
|
|
|
|
|
|
|
|
static ProtocolManager* Get();
|
|
|
|
|
2010-05-28 12:11:16 -05:00
|
|
|
uint32 CountProtocolAddOns() const;
|
|
|
|
CayaProtocolAddOn* ProtocolAddOnAt(uint32 i) const;
|
|
|
|
CayaProtocolAddOn* ProtocolAddOn(const char* signature);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
2010-05-28 12:11:16 -05:00
|
|
|
uint32 CountProtocolInstances() const;
|
|
|
|
CayaProtocol* ProtocolInstanceAt(uint32 i) const;
|
2010-05-16 16:02:50 -05:00
|
|
|
CayaProtocol* ProtocolInstance(bigtime_t identifier);
|
|
|
|
|
|
|
|
void AddAccount(CayaProtocolAddOn* addOn,
|
2010-05-20 16:31:55 -05:00
|
|
|
const char* account,
|
|
|
|
BHandler* target);
|
2010-05-16 16:02:50 -05:00
|
|
|
|
|
|
|
private:
|
2010-05-28 12:11:16 -05:00
|
|
|
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
|
|
|
|
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
|
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
ProtocolManager();
|
2021-06-11 21:43:50 -05:00
|
|
|
|
|
|
|
void _LoadAccounts(const char* image_path,
|
|
|
|
CayaProtocolAddOn* addOn, int protoIndex,
|
|
|
|
BHandler* target);
|
|
|
|
void _LoadAccount(const char* imagePath,
|
|
|
|
BEntry accountEntry, int protoIndex,
|
2010-05-20 16:31:55 -05:00
|
|
|
BHandler* target);
|
2021-06-11 21:43:50 -05:00
|
|
|
void _LoadAccount(CayaProtocolAddOn* addOn,
|
|
|
|
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
|