2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2010-05-16 16:02:50 -05:00
|
|
|
* Copyright 2009-2010, Andrea Anzani. All rights reserved.
|
|
|
|
* Copyright 2009-2010, 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-16 16:02:50 -05:00
|
|
|
typedef List<CayaProtocolAddOn*> ProtocolAddOns;
|
|
|
|
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
|
|
|
|
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
ProtocolAddOns Protocols();
|
|
|
|
ProtocolMap ProtocolInstances() const;
|
|
|
|
|
|
|
|
CayaProtocol* ProtocolInstance(bigtime_t identifier);
|
|
|
|
CayaProtocolAddOn* ProtocolAddOn(const char* signature);
|
|
|
|
|
|
|
|
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:
|
|
|
|
ProtocolManager();
|
2010-05-20 16:31:55 -05:00
|
|
|
void _GetAccounts(CayaProtocolAddOn* addOn,
|
|
|
|
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
|