diff --git a/application/CayaProtocol.h b/application/CayaProtocol.h index 3971994..fa2899b 100644 --- a/application/CayaProtocol.h +++ b/application/CayaProtocol.h @@ -8,6 +8,12 @@ #include +// 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; @@ -15,27 +21,32 @@ public: class CayaProtocol { public: - // Messenger + //! Messenger virtual status_t Init(CayaProtocolMessengerInterface*) = 0; - // Called before unloading from memory + //! Called before unloading from memory virtual status_t Shutdown() = 0; - // Process message + //! Process message virtual status_t Process(BMessage*) = 0; - // Change settings + //! Change settings virtual status_t UpdateSettings(BMessage*) = 0; - // Protocol information + //! Protocol signature virtual const char* Signature() const = 0; + + //! Protocol name virtual const char* FriendlySignature() const = 0; - // Preferred encoding of messages + //! Preferred encoding of messages virtual uint32 GetEncoding() = 0; - // Messenger interface used + //! Messenger interface used virtual CayaProtocolMessengerInterface* MessengerInterface() const = 0; + + //! Caya interface version + virtual uint32 Version() const = 0; }; #endif // _CAYA_PROTOCOL_H diff --git a/application/ProtocolManager.cpp b/application/ProtocolManager.cpp index c0579a9..752216e 100644 --- a/application/ProtocolManager.cpp +++ b/application/ProtocolManager.cpp @@ -40,10 +40,12 @@ ProtocolManager::Init(BDirectory dir, BHandler* target) if (id < 0) continue; + // If add-on's API version fits then load accounts... CayaProtocolAddOn* addOn = new CayaProtocolAddOn(id, path.Path()); - fAddOnMap.AddItem(addOn->Signature(), addOn); - - _GetAccounts(addOn, target); + if (addOn->Protocol()->Version() == CAYA_VERSION) { + fAddOnMap.AddItem(addOn->Signature(), addOn); + _GetAccounts(addOn, target); + } } } diff --git a/protocols/aim/AIM.cpp b/protocols/aim/AIM.cpp index bb8a5b1..8eafbe1 100644 --- a/protocols/aim/AIM.cpp +++ b/protocols/aim/AIM.cpp @@ -241,6 +241,13 @@ AIMProtocol::MessengerInterface() const } +uint32 +AIMProtocol::Version() const +{ + return CAYA_VERSION_1_PRE_ALPHA_1; +} + + status_t AIMProtocol::A_LogOn() { diff --git a/protocols/aim/AIM.h b/protocols/aim/AIM.h index 3ad9648..df016e3 100644 --- a/protocols/aim/AIM.h +++ b/protocols/aim/AIM.h @@ -33,6 +33,8 @@ public: virtual CayaProtocolMessengerInterface* MessengerInterface() const; + virtual uint32 Version() const; + static int32 WaitForData(void*); static void GotMessage(void*, char*, int, char*);