diff --git a/application/Account.cpp b/application/Account.cpp index 1f6ab45..952137f 100644 --- a/application/Account.cpp +++ b/application/Account.cpp @@ -15,10 +15,10 @@ #include #include "Account.h" -#include "CayaUtils.h" +#include "Utils.h" -Account::Account(bigtime_t instanceId, CayaProtocol* cayap, +Account::Account(bigtime_t instanceId, ChatProtocol* cayap, const char* name, const char* addOnSignature, BHandler* target) : fIdentifier(instanceId), @@ -30,7 +30,7 @@ Account::Account(bigtime_t instanceId, CayaProtocol* cayap, fProtocol->Init(this); // Find user's settings path - BPath path(CayaAccountPath(addOnSignature, fProtocol->Signature())); + BPath path(AccountPath(addOnSignature, fProtocol->Signature())); if (path.InitCheck() == B_OK) { path.Append(name); diff --git a/application/Account.h b/application/Account.h index ac01e93..9e11965 100644 --- a/application/Account.h +++ b/application/Account.h @@ -10,11 +10,11 @@ #include #include -#include "CayaProtocol.h" +#include "ChatProtocol.h" -class Account : public CayaProtocolMessengerInterface { +class Account : public ChatProtocolMessengerInterface { public: - Account(bigtime_t instanceId, CayaProtocol* cayap, + Account(bigtime_t instanceId, ChatProtocol* cayap, const char* name, const char* addOnSignature, BHandler* target); virtual ~Account(); @@ -26,7 +26,7 @@ public: private: bigtime_t fIdentifier; - CayaProtocol* fProtocol; + ChatProtocol* fProtocol; BString fName; BMessenger fMessenger; BMessage* fSettings; diff --git a/application/AccountManager.cpp b/application/AccountManager.cpp index 49b1331..98943ae 100644 --- a/application/AccountManager.cpp +++ b/application/AccountManager.cpp @@ -7,7 +7,7 @@ */ #include "AccountManager.h" -#include "CayaProtocolMessages.h" +#include "ChatProtocolMessages.h" #include "MainWindow.h" #include "NotifyMessage.h" #include "Server.h" @@ -20,7 +20,7 @@ static AccountManager* fInstance = NULL; AccountManager::AccountManager() : - fStatus(CAYA_OFFLINE), + fStatus(STATUS_OFFLINE), fReplicantMessenger(NULL) { TheApp* theApp = reinterpret_cast(be_app); @@ -67,7 +67,7 @@ AccountManager::SetReplicantMessenger(BMessenger* messenger) } -CayaStatus +UserStatus AccountManager::Status() const { return fStatus; @@ -75,7 +75,7 @@ AccountManager::Status() const void -AccountManager::SetStatus(CayaStatus status, const char* str) +AccountManager::SetStatus(UserStatus status, const char* str) { if (fStatus != status) { // Create status change message @@ -93,13 +93,13 @@ AccountManager::SetStatus(CayaStatus status, const char* str) // Notify status change fStatus = status; NotifyInteger(INT_ACCOUNT_STATUS, (int32)fStatus); - ReplicantStatusNotify((CayaStatus)status); + ReplicantStatusNotify((UserStatus)status); } } void -AccountManager::ReplicantStatusNotify(CayaStatus status, bool wait) +AccountManager::ReplicantStatusNotify(UserStatus status, bool wait) { if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) { printf("notification sent\n"); diff --git a/application/AccountManager.h b/application/AccountManager.h index bb4c7cf..ed0f76a 100644 --- a/application/AccountManager.h +++ b/application/AccountManager.h @@ -7,7 +7,7 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "Notifier.h" @@ -17,18 +17,18 @@ public: void SetNickname(BString nick); - CayaStatus Status() const; - void SetStatus(CayaStatus status, + UserStatus Status() const; + void SetStatus(UserStatus status, const char* str = NULL); void SetReplicantMessenger(BMessenger* messenger); - void ReplicantStatusNotify(CayaStatus status, + void ReplicantStatusNotify(UserStatus status, bool wait = false); private: AccountManager(); ~AccountManager(); - CayaStatus fStatus; + UserStatus fStatus; BMessenger* fReplicantMessenger; }; diff --git a/application/AppConstants.h b/application/AppConstants.h new file mode 100644 index 0000000..62e7ca6 --- /dev/null +++ b/application/AppConstants.h @@ -0,0 +1,40 @@ +/* + * Copyright 2009-2011, Andrea Anzani. All rights reserved. + * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _APP_CONSTANTS_H +#define _APP_CONSTANTS_H + +#include + +/** + * Color constants. + */ +const rgb_color APP_ORANGE_COLOR = {255, 186, 0, 255}; +const rgb_color APP_GREEN_COLOR = {43, 134, 43, 255}; +const rgb_color APP_RED_COLOR = {175, 1, 1, 255}; +const rgb_color APP_WHITE_COLOR = {255, 255, 255, 255}; +const rgb_color APP_BLACK_COLOR = {0, 0, 0, 255}; +const rgb_color APP_SELSTART_COLOR = {254, 150, 57}; +const rgb_color APP_SELEND_COLOR = {230, 113, 9}; + +/** + * Miscellaneous. + */ +#define APP_UTF8_MUSICAL_NOTES "\xE2\x99\xAB" + +/** + * Status codes. + */ +enum UserStatus { + STATUS_ONLINE = 1, + STATUS_AWAY = 2, + STATUS_DO_NOT_DISTURB = 3, + STATUS_CUSTOM_STATUS = 4, + STATUS_INVISIBLE = 5, + STATUS_OFFLINE = 6, + STATUS_STATUSES = 7 +}; + +#endif // _APP_CONSTANTS_H diff --git a/application/AppMessages.h b/application/AppMessages.h new file mode 100644 index 0000000..efba792 --- /dev/null +++ b/application/AppMessages.h @@ -0,0 +1,62 @@ +/* + * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _APP_MESSAGES_H +#define _APP_MESSAGES_H + +//! Show settings window +const uint32 APP_SHOW_SETTINGS = 'RPST'; + +//! Open chat window +const uint32 APP_OPEN_CHAT_WINDOW = 'CYow'; + +//! Close chat window +const uint32 APP_CLOSE_CHAT_WINDOW = 'CYcw'; + +//! Chat messages +const uint32 APP_CHAT = 'CYch'; + +//! Create a new chat +const uint32 APP_NEW_CHAT = 'CYnc'; + +//! Create a new chat +const uint32 APP_NEW_ROOM = 'CYnr'; + +//! Join a chat +const uint32 APP_JOIN_ROOM = 'CYjr'; + +//! Invite user to current chat +const uint32 APP_SEND_INVITE = 'CYin'; + +//! Send replicant's messenger to the app +const uint32 APP_REPLICANT_MESSENGER = 'RPme'; + +//! Status notification from the replicant +const uint32 APP_REPLICANT_STATUS_SET = 'RPMS'; + +//! Exit notification from replicant +const uint32 APP_REPLICANT_EXIT = 'RPEX'; + +//! Show main window replicant notification +const uint32 APP_REPLICANT_SHOW_WINDOW = 'CYSW'; + +//! Select the upward conversation +const uint32 APP_MOVE_UP = 'CYmu'; + +//! Select the downward conversation +const uint32 APP_MOVE_DOWN = 'CYmd'; + +//! Disable a given account +const uint32 APP_DISABLE_ACCOUNT = 'CYda'; + +//! Request a "help" message +const uint32 APP_REQUEST_HELP = 'CYhm'; + +//! Display a "user info" window +const uint32 APP_USER_INFO = 'CYuw'; + +//! Edit the contact roster +const uint32 APP_EDIT_ROSTER = 'CYer'; + +#endif // _APP_MESSAGES_H diff --git a/application/CayaResources.h b/application/AppResources.h similarity index 82% rename from application/CayaResources.h rename to application/AppResources.h index 98b5946..6cb9a56 100644 --- a/application/CayaResources.h +++ b/application/AppResources.h @@ -2,8 +2,8 @@ * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_RESOURCES_H -#define _CAYA_RESOURCES_H +#ifndef _APP_RESOURCES_H +#define _APP_RESOURCES_H enum { kOnlineIcon = 10, @@ -17,7 +17,7 @@ enum { kProtocolSettingsTemplate = 1000, kOnlineReplicant = 1200, - kCayaIconReplicant = 1220, + kIconReplicant = 1220, kOfflineReplicant = 1300, kBusyReplicant = 1333, kAwayReplicant = 1400, @@ -27,4 +27,4 @@ enum { kPersonIcon = 1500 }; -#endif // _CAYA_RESOURCES_H +#endif // _APP_RESOURCES_H diff --git a/application/Caya.h b/application/Caya.h index c06c5b6..2554b4f 100644 --- a/application/Caya.h +++ b/application/Caya.h @@ -2,9 +2,9 @@ * Copyright 2009-2011, Andrea Anzani. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_H -#define _CAYA_H +#ifndef _APP_H +#define _APP_H -#define CAYA_SIGNATURE "application/x-vnd.caya.Caya" +#define APP_SIGNATURE "application/x-vnd.caya.Caya" -#endif // _CAYA_H +#endif // _APP_H diff --git a/application/Caya.rdef b/application/Caya.rdef index a497cf6..4e866cd 100644 --- a/application/Caya.rdef +++ b/application/Caya.rdef @@ -1,6 +1,6 @@ #include "Caya.h" -resource app_signature CAYA_SIGNATURE; +resource app_signature APP_SIGNATURE; resource app_version { major = 0, diff --git a/application/CayaConstants.h b/application/CayaConstants.h deleted file mode 100644 index adb8f50..0000000 --- a/application/CayaConstants.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2009-2011, Andrea Anzani. All rights reserved. - * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _CAYA_CONSTANTS_H -#define _CAYA_CONSTANTS_H - -#include - -/** - * Color constants. - */ -const rgb_color CAYA_ORANGE_COLOR = {255, 186, 0, 255}; -const rgb_color CAYA_GREEN_COLOR = {43, 134, 43, 255}; -const rgb_color CAYA_RED_COLOR = {175, 1, 1, 255}; -const rgb_color CAYA_WHITE_COLOR = {255, 255, 255, 255}; -const rgb_color CAYA_BLACK_COLOR = {0, 0, 0, 255}; -const rgb_color CAYA_SELSTART_COLOR = {254, 150, 57}; -const rgb_color CAYA_SELEND_COLOR = {230, 113, 9}; - -/** - * Miscellaneous. - */ -#define CAYA_UTF8_MUSICAL_NOTES "\xE2\x99\xAB" - -/** - * Status codes. - */ -enum CayaStatus { - CAYA_ONLINE = 1, - CAYA_AWAY = 2, - CAYA_DO_NOT_DISTURB = 3, - CAYA_CUSTOM_STATUS = 4, - CAYA_INVISIBLE = 5, - CAYA_OFFLINE = 6, - CAYA_STATUSES = 7 -}; - -#endif // _CAYA_CONSTANTS_H diff --git a/application/CayaMessages.h b/application/CayaMessages.h deleted file mode 100644 index 9bc1d94..0000000 --- a/application/CayaMessages.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _CAYA_MESSAGES_H -#define _CAYA_MESSAGES_H - -//! Show settings window -const uint32 CAYA_SHOW_SETTINGS = 'RPST'; - -//! Open chat window -const uint32 CAYA_OPEN_CHAT_WINDOW = 'CYow'; - -//! Close chat window -const uint32 CAYA_CLOSE_CHAT_WINDOW = 'CYcw'; - -//! Chat messages -const uint32 CAYA_CHAT = 'CYch'; - -//! Create a new chat -const uint32 CAYA_NEW_CHAT = 'CYnc'; - -//! Create a new chat -const uint32 CAYA_NEW_ROOM = 'CYnr'; - -//! Join a chat -const uint32 CAYA_JOIN_ROOM = 'CYjr'; - -//! Invite user to current chat -const uint32 CAYA_SEND_INVITE = 'CYin'; - -//! Send replicant's messenger to Caya -const uint32 CAYA_REPLICANT_MESSENGER = 'RPme'; - -//! Status notification from the replicant -const uint32 CAYA_REPLICANT_STATUS_SET = 'RPMS'; - -//! Exit notification from replicant -const uint32 CAYA_REPLICANT_EXIT = 'RPEX'; - -//! Show main window replicant notification -const uint32 CAYA_REPLICANT_SHOW_WINDOW = 'CYSW'; - -//! Select the upward conversation -const uint32 CAYA_MOVE_UP = 'CYmu'; - -//! Select the downward conversation -const uint32 CAYA_MOVE_DOWN = 'CYmd'; - -//! Disable a given account -const uint32 CAYA_DISABLE_ACCOUNT = 'CYda'; - -//! Request a "help" message -const uint32 CAYA_REQUEST_HELP = 'CYhm'; - -//! Display a "user info" window -const uint32 CAYA_USER_INFO = 'CYuw'; - -//! Edit the contact roster -const uint32 CAYA_EDIT_ROSTER = 'CYer'; - -#endif // _CAYA_MESSAGES_H diff --git a/application/CayaProtocol.h b/application/ChatProtocol.h similarity index 86% rename from application/CayaProtocol.h rename to application/ChatProtocol.h index f03cd71..f4ddd10 100644 --- a/application/CayaProtocol.h +++ b/application/ChatProtocol.h @@ -4,8 +4,8 @@ * Copyright 2021, Jaidyn Levesque. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_PROTOCOL_H -#define _CAYA_PROTOCOL_H +#ifndef _APP_PROTOCOL_H +#define _APP_PROTOCOL_H #include #include @@ -14,21 +14,21 @@ class BBitmap; // Caya protocol interface version -#define CAYA_VERSION_1_PRE_ALPHA_1 0x00000001 -#define CAYA_VERSION_1_ALPHA_1 0x00000100 +#define APP_VERSION_1_PRE_ALPHA_1 0x00000001 +#define APP_VERSION_1_ALPHA_1 0x00000100 -#define CAYA_VERSION CAYA_VERSION_1_PRE_ALPHA_1 +#define APP_VERSION APP_VERSION_1_PRE_ALPHA_1 -class CayaProtocolMessengerInterface { +class ChatProtocolMessengerInterface { public: virtual status_t SendMessage(BMessage* message) = 0; }; -class CayaProtocol { +class ChatProtocol { public: //! Messenger - virtual status_t Init(CayaProtocolMessengerInterface*) = 0; + virtual status_t Init(ChatProtocolMessengerInterface*) = 0; //! Called before unloading from memory virtual status_t Shutdown() = 0; @@ -93,7 +93,7 @@ public: virtual uint32 GetEncoding() = 0; //! Messenger interface used - virtual CayaProtocolMessengerInterface* MessengerInterface() const = 0; + virtual ChatProtocolMessengerInterface* MessengerInterface() const = 0; }; -#endif // _CAYA_PROTOCOL_H +#endif // _APP_PROTOCOL_H diff --git a/application/CayaProtocolAddOn.cpp b/application/ChatProtocolAddOn.cpp similarity index 72% rename from application/CayaProtocolAddOn.cpp rename to application/ChatProtocolAddOn.cpp index 56d2e0e..0e0fffd 100644 --- a/application/CayaProtocolAddOn.cpp +++ b/application/ChatProtocolAddOn.cpp @@ -12,11 +12,11 @@ #include -#include "CayaProtocol.h" -#include "CayaProtocolAddOn.h" +#include "ChatProtocol.h" +#include "ChatProtocolAddOn.h" -CayaProtocolAddOn::CayaProtocolAddOn(image_id image, const char* path, int32 subProto) +ChatProtocolAddOn::ChatProtocolAddOn(image_id image, const char* path, int32 subProto) : fImage(image), fPath(path), @@ -28,67 +28,67 @@ CayaProtocolAddOn::CayaProtocolAddOn(image_id image, const char* path, int32 sub status_t -CayaProtocolAddOn::InitCheck() const +ChatProtocolAddOn::InitCheck() const { return fStatus; } const char* -CayaProtocolAddOn::Path() const +ChatProtocolAddOn::Path() const { return fPath.String(); } -CayaProtocol* -CayaProtocolAddOn::Protocol() const +ChatProtocol* +ChatProtocolAddOn::Protocol() const { return ProtocolAt(fProtoIndex); } -CayaProtocol* -CayaProtocolAddOn::ProtocolAt(int32 i) const +ChatProtocol* +ChatProtocolAddOn::ProtocolAt(int32 i) const { - CayaProtocol* proto = fGetProtocol(i); + ChatProtocol* proto = fGetProtocol(i); proto->SetAddOnPath(BPath(fPath.String())); return proto; } int32 -CayaProtocolAddOn::CountProtocols() const +ChatProtocolAddOn::CountProtocols() const { return fCountProtocols(); } const char* -CayaProtocolAddOn::Signature() const +ChatProtocolAddOn::Signature() const { return fSignature.String(); } const char* -CayaProtocolAddOn::FriendlySignature() const +ChatProtocolAddOn::FriendlySignature() const { return fFriendlySignature.String(); } BBitmap* -CayaProtocolAddOn::Icon() const +ChatProtocolAddOn::Icon() const { return ReadNodeIcon(fPath, B_LARGE_ICON, true); } const char* -CayaProtocolAddOn::ProtoSignature() const +ChatProtocolAddOn::ProtoSignature() const { - CayaProtocol* proto = Protocol(); + ChatProtocol* proto = Protocol(); const char* signature = proto->Signature(); delete proto; return signature; @@ -96,9 +96,9 @@ CayaProtocolAddOn::ProtoSignature() const const char* -CayaProtocolAddOn::ProtoFriendlySignature() const +ChatProtocolAddOn::ProtoFriendlySignature() const { - CayaProtocol* proto = Protocol(); + ChatProtocol* proto = Protocol(); const char* signature = proto->FriendlySignature(); delete proto; return signature; @@ -106,9 +106,9 @@ CayaProtocolAddOn::ProtoFriendlySignature() const BBitmap* -CayaProtocolAddOn::ProtoIcon() const +ChatProtocolAddOn::ProtoIcon() const { - CayaProtocol* proto = Protocol(); + ChatProtocol* proto = Protocol(); BBitmap* icon = proto->Icon(); delete proto; return icon; @@ -116,14 +116,14 @@ CayaProtocolAddOn::ProtoIcon() const uint32 -CayaProtocolAddOn::Version() const +ChatProtocolAddOn::Version() const { return fVersion; } void -CayaProtocolAddOn::_Init() +ChatProtocolAddOn::_Init() { const char* (*signature)(); const char* (*friendly_signature)(); diff --git a/application/CayaProtocolAddOn.h b/application/ChatProtocolAddOn.h similarity index 71% rename from application/CayaProtocolAddOn.h rename to application/ChatProtocolAddOn.h index 3e9aa47..4fd4629 100644 --- a/application/CayaProtocolAddOn.h +++ b/application/ChatProtocolAddOn.h @@ -2,28 +2,28 @@ * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_PROTOCOL_ADDON_H -#define _CAYA_PROTOCOL_ADDON_H +#ifndef _APP_PROTOCOL_ADDON_H +#define _APP_PROTOCOL_ADDON_H #include #include class BBitmap; -class CayaProtocol; +class ChatProtocol; -class CayaProtocolAddOn { +class ChatProtocolAddOn { public: - CayaProtocolAddOn(image_id image, const char* path, + ChatProtocolAddOn(image_id image, const char* path, int32 subProto=0); status_t InitCheck() const; const char* Path() const; - CayaProtocol* Protocol() const; - CayaProtocol* ProtocolAt(int32 i) const; + ChatProtocol* Protocol() const; + ChatProtocol* ProtocolAt(int32 i) const; int32 CountProtocols() const; @@ -40,7 +40,7 @@ public: private: image_id fImage; BString fPath; - CayaProtocol* (*fGetProtocol)(int32 i); + ChatProtocol* (*fGetProtocol)(int32 i); int32 (*fCountProtocols)(); int32 fProtoIndex; uint32 fVersion; @@ -52,4 +52,4 @@ private: void _Init(); }; -#endif // _CAYA_PROTOCOL_ADDON_H +#endif // _APP_PROTOCOL_ADDON_H diff --git a/application/CayaProtocolMessages.h b/application/ChatProtocolMessages.h similarity index 84% rename from application/CayaProtocolMessages.h rename to application/ChatProtocolMessages.h index f254bed..16d6227 100644 --- a/application/CayaProtocolMessages.h +++ b/application/ChatProtocolMessages.h @@ -4,8 +4,8 @@ * Copyright 2021, Jaidyn Levesque. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_PROTOCOL_MESSAGES_H -#define _CAYA_PROTOCOL_MESSAGES_H +#ifndef _CHAT_PROTOCOL_MESSAGES_H +#define _CHAT_PROTOCOL_MESSAGES_H /** * What-codes for messages. @@ -32,26 +32,26 @@ enum im_what_code { //! Request a server-side contact list from protocol →Protocol IM_GET_CONTACT_LIST = 1, - //! Server-side contact list received →Caya + //! Server-side contact list received →App // Requires: Stringlist "user_id" IM_CONTACT_LIST = 2, //! Add a contact to the roster →Protocol // The slots for this message are determined by the protocol's - // "roster" template (CayaProtocol::SettingsTemplate("roster")) + // "roster" template (ChatProtocol::SettingsTemplate("roster")) IM_CONTACT_LIST_ADD_CONTACT = 3, //! Remove a contact →Protocol // Requires: String "user_id" IM_CONTACT_LIST_REMOVE_CONTACT = 4, - //! Contact(s) removed from the server-side list →Caya + //! Contact(s) removed from the server-side list →App // Requires: String "user_id" IM_CONTACT_LIST_CONTACT_REMOVED = 5, //! Edit some data on contact →Protocol // The slots for this message are determined by the protocol's - // "roster" template (CayaProtocol::SettingsTemplate("roster")) + // "roster" template (ChatProtocol::SettingsTemplate("roster")) IM_CONTACT_LIST_EDIT_CONTACT = 6, @@ -63,27 +63,27 @@ enum im_what_code { // Requires: String "user_id", String "body" IM_SEND_MESSAGE = 20, - //! Chat message has been sent →Caya + //! Chat message has been sent →App // If no user_id is specified, it's treated as a system message // Requires: String "chat_id", String "body" // Allows: String "user_id" IM_MESSAGE_SENT = 21, - //! Chat message received →Caya + //! Chat message received →App // Requires: String "chat_id", String "user_id", String "body" IM_MESSAGE_RECEIVED = 22, - //! Logs received →Caya + //! Logs received →App // Without "when" (a time_t), the logged message will lack a timestamp // Requires: Strings "chat_id", Strings "user_id", Strings "body" // Accepts: in64s "when" IM_LOGS_RECEIVED = 23, - //! User started typing →Caya + //! User started typing →App // Requires: String "chat_id", String "user_id" IM_USER_STARTED_TYPING = 24, - //! User stopped typing →Caya + //! User stopped typing →App // Requires: String "chat_id", String "user_id" IM_USER_STOPPED_TYPING = 25, @@ -95,7 +95,7 @@ enum im_what_code { //! Change contact's status →Protocol IM_SET_NICKNAME = 40, - //! Contact's status has changed →Caya + //! Contact's status has changed →App IM_NICKNAME_SET = 41, @@ -103,26 +103,26 @@ enum im_what_code { * Messages related to contact's information received from protocols. */ - //! Received contact new status →Caya - // Requires: String "user_id", int32/CayaStatus "status" + //! Received contact new status →App + // Requires: String "user_id", int32/UserStatus "status" IM_STATUS_SET = 60, - //! User's avatar icon was changed →Caya + //! User's avatar icon was changed →App // Requires: String "user_id", Ref "ref" IM_AVATAR_SET = 61, //! Get contact information →Protocol IM_GET_CONTACT_INFO = 62, - //! Received contact information →Caya + //! Received contact information →App // Requires: String "user_id" - // Accepts: String "user_name", String "message", int32/CayaStatus "status" + // Accepts: String "user_name", String "message", int32/UserStatus "status" IM_CONTACT_INFO = 63, //! Request contact information →Protocol IM_GET_EXTENDED_CONTACT_INFO = 64, - //! Received contact information →Caya + //! Received contact information →App // Requires: String "user_id", // non-standard slots used by "roster" template // Accepts: String "user_name", String "full_name" @@ -137,15 +137,15 @@ enum im_what_code { // Requires: String "user_name" IM_SET_OWN_NICKNAME = 80, - //! Own nickname was changed →Caya + //! Own nickname was changed →App IM_OWN_NICKNAME_SET = 81, //! Change own status →Protocol - // Requires: int32/CayaStatus "status" + // Requires: int32/UserStatus "status" IM_SET_OWN_STATUS = 82, - // Own status was changed →Caya - // Requires: int32/CayaStatus "status" + // Own status was changed →App + // Requires: int32/UserStatus "status" IM_OWN_STATUS_SET = 83, //! Get own contact information @@ -208,14 +208,14 @@ enum im_what_code { //! Create an individual chat →Protocol // Individual chats and rooms are really the same thing (at least according - // to Caya)― the only difference is in how they're created and joined. + // to App)― the only difference is in how they're created and joined. // A "chat" should be uniquely tied to a single user, and its chat_id // should be derivable from the user's ID (when sent back from // CHAT_CREATED). It doesn't matter how you get this done, really. // Requires: String "user_id" IM_CREATE_CHAT = 150, - //! Chat has been created →Caya + //! Chat has been created →App // Requires: String "chat_id", String "user_id" IM_CHAT_CREATED = 151, @@ -223,10 +223,10 @@ enum im_what_code { // The required slots for this message are completely determined by the // protocol itself― the protocol will just receive data from the // "room" template (which is fetched via - // CayaProtocol::SettingsTemplate("room") + // ChatProtocol::SettingsTemplate("room") IM_CREATE_ROOM = 152, - //! Inform Caya room was created →Caya + //! Inform App room was created →App // Just a semantically-dressed IM_ROOM_JOINED // Requires: String "chat_id" IM_ROOM_CREATED = 153, @@ -235,7 +235,7 @@ enum im_what_code { // Requires: String "chat_id" IM_JOIN_ROOM = 154, - //! Confirm the room's been joined →Caya + //! Confirm the room's been joined →App // Requires: String "chat_id" IM_ROOM_JOINED = 155, @@ -243,7 +243,7 @@ enum im_what_code { // Requires: String "chat_id" IM_LEAVE_ROOM = 156, - //! User left the room →Caya + //! User left the room →App // Requires: String "chat_id" IM_ROOM_LEFT = 157, @@ -251,18 +251,18 @@ enum im_what_code { // Requires: String "chat_id" IM_GET_ROOM_PARTICIPANTS = 158, - //! Quietly add user(s) to the chat →Caya + //! Quietly add user(s) to the chat →App // Shouldn't be sent automatically on joining a room. // Requires: String "chat_id", StringList "user_id" // Accepts: StringList "user_name" IM_ROOM_PARTICIPANTS = 159, - //! User has explicitly joined →Caya + //! User has explicitly joined →App // Requires: String "chat_id", String "user_id" // Accepts: String "body" IM_ROOM_PARTICIPANT_JOINED = 160, - //! A user left the room →Caya + //! A user left the room →App // Requires: String "chat_id", String "user_id" // Accepts: String "user_name", String "body" IM_ROOM_PARTICIPANT_LEFT = 161, @@ -273,12 +273,12 @@ enum im_what_code { // Accepts: String "body" IM_ROOM_SEND_INVITE = 162, - //! Invitee explicitly refused →Caya + //! Invitee explicitly refused →App // Requires: String "chat_id", String "user_id" // Accepts: String "user_name", String "body" IM_ROOM_INVITE_REFUSED = 163, - //! User was invited to a room →Caya + //! User was invited to a room →App // Requires: String "chat_id" // Accepts: String "user_id", String "chat_name", String "body" IM_ROOM_INVITE_RECEIVED = 164, @@ -300,7 +300,7 @@ enum im_what_code { // Requires: String "chat_id" IM_GET_ROOM_METADATA = 170, - //! Receive room metadata →Caya + //! Receive room metadata →App // The idea is that all other metadata-related messages should only be // called either from a request, or from a change. // This shouldn't be sent automatically upon joining a room. @@ -317,11 +317,11 @@ enum im_what_code { // Requires: String "chat_id", String "chat_name" IM_ROOM_NAME_SET = 173, - //! Set the room subject →Caya + //! Set the room subject →App // Requires: String "chat_id", String "subject" IM_SET_ROOM_SUBJECT = 174, - //! Subject has been changed →Caya + //! Subject has been changed →App // Requires: String "chat_id", String "subject" IM_ROOM_SUBJECT_SET = 175, @@ -330,7 +330,7 @@ enum im_what_code { * Room moderation */ - //! A user's role has been changed →Caya + //! A user's role has been changed →App // Requires: String "role_title", int32 "role_perms", int32 "role_priority" IM_ROOM_ROLECHANGED = 190, @@ -338,7 +338,7 @@ enum im_what_code { // Requires: String "chat_id", String "user_id" IM_ROOM_KICK_PARTICIPANT = 191, - //! A user was kicked →Caya + //! A user was kicked →App // Requires: String "chat_id", String "user_id" // Accepts: String "user_name", String "body" IM_ROOM_PARTICIPANT_KICKED = 192, @@ -347,7 +347,7 @@ enum im_what_code { // Requires: String "chat_id", String "user_id" IM_ROOM_BAN_PARTICIPANT = 193, - //! A user was banned →Caya + //! A user was banned →App // Requires: String "chat_id", String "user_id" // Accepts: String "user_name", String "body" IM_ROOM_PARTICIPANT_BANNED = 194, @@ -390,6 +390,4 @@ enum im_what_code { IM_PROTOCOL_READY = 1002, }; - -#endif // _CAYA_PROTOCOL_MESSAGES_H - +#endif // _CHAT_PROTOCOL_MESSAGES_H diff --git a/application/Contact.cpp b/application/Contact.cpp index 5717f1f..c352913 100644 --- a/application/Contact.cpp +++ b/application/Contact.cpp @@ -9,7 +9,7 @@ */ #include "Contact.h" -#include "CayaUtils.h" +#include "Utils.h" #include "ProtocolLooper.h" #include "RosterItem.h" @@ -44,7 +44,7 @@ Contact::_EnsureCachePath() { if (fCachePath.InitCheck() == B_OK) return; - fCachePath.SetTo(CayaContactCachePath(fLooper->Protocol()->GetName(), + fCachePath.SetTo(ContactCachePath(fLooper->Protocol()->GetName(), fID.String())); } diff --git a/application/Contact.h b/application/Contact.h index bdb9823..123180e 100644 --- a/application/Contact.h +++ b/application/Contact.h @@ -11,7 +11,7 @@ #include #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "User.h" class BBitmap; diff --git a/application/Conversation.cpp b/application/Conversation.cpp index 4149156..f4fd354 100644 --- a/application/Conversation.cpp +++ b/application/Conversation.cpp @@ -9,10 +9,9 @@ #include #include -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaRenderView.h" -#include "CayaUtils.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" +#include "RenderView.h" #include "ChatCommand.h" #include "ConversationItem.h" #include "ConversationView.h" @@ -23,6 +22,7 @@ #include "RoomFlags.h" #include "Server.h" #include "TheApp.h" +#include "Utils.h" Conversation::Conversation(BString id, BMessenger msgn) @@ -235,8 +235,8 @@ Conversation::SetProtocolLooper(ProtocolLooper* looper) BBitmap* Conversation::ProtocolBitmap() const { - CayaProtocol* protocol = fLooper->Protocol(); - CayaProtocolAddOn* addOn + ChatProtocol* protocol = fLooper->Protocol(); + ChatProtocolAddOn* addOn = ProtocolManager::Get()->ProtocolAddOn(protocol->Signature()); return addOn->ProtoIcon(); @@ -405,7 +405,7 @@ Conversation::_LogChatMessage(BMessage* msg) newLogMsg.AddInt64("when", times[i]); BFile logFile(fCachePath.Path(), B_READ_WRITE | B_OPEN_AT_END | B_CREATE_FILE); - WriteAttributeMessage(&logFile, "Caya:logs", &newLogMsg); + WriteAttributeMessage(&logFile, "Chat:logs", &newLogMsg); // Plain-text logs BString uname; @@ -428,7 +428,7 @@ Conversation::_GetChatLogs(BMessage* msg) BFile logFile(fCachePath.Path(), B_READ_WRITE | B_CREATE_FILE); - return ReadAttributeMessage(&logFile, "Caya:logs", msg); + return ReadAttributeMessage(&logFile, "Chat:logs", msg); } @@ -440,7 +440,7 @@ Conversation::_CacheRoomFlags() if (cacheFile.InitCheck() != B_OK) return; - cacheFile.WriteAttr("Caya:flags", B_INT32_TYPE, 0, &fRoomFlags, sizeof(int32)); + cacheFile.WriteAttr("Chat:flags", B_INT32_TYPE, 0, &fRoomFlags, sizeof(int32)); } @@ -452,7 +452,7 @@ Conversation::_LoadRoomFlags() if (cacheFile.InitCheck() != B_OK) return; - cacheFile.ReadAttr("Caya:flags", B_INT32_TYPE, 0, &fRoomFlags, sizeof(int32)); + cacheFile.ReadAttr("Chat:flags", B_INT32_TYPE, 0, &fRoomFlags, sizeof(int32)); } @@ -461,7 +461,7 @@ Conversation::_EnsureCachePath() { if (fCachePath.InitCheck() == B_OK) return; - fCachePath.SetTo(CayaRoomCachePath(fLooper->Protocol()->GetName(), + fCachePath.SetTo(RoomCachePath(fLooper->Protocol()->GetName(), fID.String())); } diff --git a/application/DefaultItems.cpp b/application/DefaultItems.cpp index 390c1cd..66c179b 100644 --- a/application/DefaultItems.cpp +++ b/application/DefaultItems.cpp @@ -8,8 +8,8 @@ #include #include -#include "CayaMessages.h" -#include "CayaProtocolMessages.h" +#include "AppMessages.h" +#include "ChatProtocolMessages.h" #include "ChatCommand.h" #include "Role.h" @@ -80,7 +80,7 @@ DefaultCommands() invite->SetDesc("Invite a user to the current room."); commands.AddItem("invite", invite); - BMessage helpMsg(CAYA_REQUEST_HELP); + BMessage helpMsg(APP_REQUEST_HELP); ChatCommand* help = new ChatCommand("help", helpMsg, false, List()); help->SetDesc("List all current commands, or get help for certain command."); commands.AddItem("help", help); @@ -119,7 +119,7 @@ DefaultUserPopUpItems() { BObjectList items; - BMessage* infoMsg = new BMessage(CAYA_USER_INFO); + BMessage* infoMsg = new BMessage(APP_USER_INFO); items.AddItem(_UserMenuItem("User info" B_UTF8_ELLIPSIS, infoMsg, 0, 0, 0, false, false)); diff --git a/application/EditingFilter.cpp b/application/EditingFilter.cpp index c864a71..37e12a1 100644 --- a/application/EditingFilter.cpp +++ b/application/EditingFilter.cpp @@ -10,7 +10,7 @@ #include #include -#include "CayaMessages.h" +#include "AppMessages.h" #include "EditingFilter.h" @@ -39,7 +39,7 @@ EditingFilter::Filter(BMessage* message, BHandler** target) fView->Insert("\n"); return B_SKIP_MESSAGE; } else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) { - fView->Window()->PostMessage(CAYA_CHAT); + fView->Window()->PostMessage(APP_CHAT); return B_SKIP_MESSAGE; } diff --git a/application/ImageCache.cpp b/application/ImageCache.cpp index 852a4fa..3dabd1b 100644 --- a/application/ImageCache.cpp +++ b/application/ImageCache.cpp @@ -17,8 +17,8 @@ #include -#include "CayaResources.h" -#include "CayaUtils.h" +#include "AppResources.h" +#include "Utils.h" ImageCache* ImageCache::fInstance = NULL; @@ -93,7 +93,7 @@ ImageCache::Release() void ImageCache::_LoadResource(int identifier, const char* key) { - BResources* res = CayaResources(); + BResources* res = ChatResources(); BBitmap* bitmap = IconFromResources(res, identifier, B_LARGE_ICON); if (bitmap != NULL && bitmap->IsValid() == true) fBitmaps.AddItem(BString(key), bitmap); diff --git a/application/Makefile b/application/Makefile index ba6ea48..9e219ed 100644 --- a/application/Makefile +++ b/application/Makefile @@ -34,8 +34,7 @@ APP_MIME_SIG = application/x-vnd.caya.Caya SRCS = \ application/Account.cpp \ application/AccountManager.cpp \ - application/CayaProtocolAddOn.cpp \ - application/CayaUtils.cpp \ + application/ChatProtocolAddOn.cpp \ application/ChatCommand.cpp \ application/Contact.cpp \ application/Conversation.cpp \ @@ -51,14 +50,15 @@ SRCS = \ application/Server.cpp \ application/TheApp.cpp \ application/User.cpp \ + application/Utils.cpp \ application/preferences/AccountDialog.cpp \ application/preferences/AccountListItem.cpp \ - application/preferences/CayaPreferences.cpp \ + application/preferences/AppPreferences.cpp \ application/preferences/PreferencesChatWindow.cpp \ application/preferences/PreferencesAccounts.cpp \ application/preferences/PreferencesBehavior.cpp \ application/preferences/PreferencesReplicant.cpp \ - application/views/CayaRenderView.cpp \ + application/views/RenderView.cpp \ application/views/ConversationAccountItem.cpp \ application/views/ConversationItem.cpp \ application/views/ConversationListView.cpp \ diff --git a/application/ProtocolLooper.cpp b/application/ProtocolLooper.cpp index 9214e32..8acbb58 100644 --- a/application/ProtocolLooper.cpp +++ b/application/ProtocolLooper.cpp @@ -19,7 +19,7 @@ #include "ConversationAccountItem.h" -ProtocolLooper::ProtocolLooper(CayaProtocol* protocol, int64 instance) +ProtocolLooper::ProtocolLooper(ChatProtocol* protocol, int64 instance) : BLooper(), fProtocol(protocol), @@ -54,7 +54,7 @@ ProtocolLooper::MessageReceived(BMessage* msg) } -CayaProtocol* +ChatProtocol* ProtocolLooper::Protocol() { return fProtocol; diff --git a/application/ProtocolLooper.h b/application/ProtocolLooper.h index 520333f..bd66bef 100644 --- a/application/ProtocolLooper.h +++ b/application/ProtocolLooper.h @@ -13,7 +13,7 @@ #include -#include "CayaProtocol.h" +#include "ChatProtocol.h" #include "ChatCommand.h" class Contact; @@ -29,12 +29,12 @@ typedef KeyMap UserMap; class ProtocolLooper : public BLooper { public: - ProtocolLooper(CayaProtocol* protocol, int64 instance); + ProtocolLooper(ChatProtocol* protocol, int64 instance); ~ProtocolLooper(); void MessageReceived(BMessage* msg); - CayaProtocol* Protocol(); + ChatProtocol* Protocol(); ChatMap Conversations() const; Conversation* ConversationById(BString id); @@ -64,7 +64,7 @@ public: private: void _InitCommands(); - CayaProtocol* fProtocol; + ChatProtocol* fProtocol; int64 fInstance; BString fMySelf; diff --git a/application/ProtocolManager.cpp b/application/ProtocolManager.cpp index 749cb7b..d0ac873 100644 --- a/application/ProtocolManager.cpp +++ b/application/ProtocolManager.cpp @@ -15,11 +15,11 @@ #include "Account.h" #include "ProtocolManager.h" -#include "CayaProtocol.h" -#include "CayaUtils.h" +#include "ChatProtocol.h" #include "MainWindow.h" #include "Server.h" #include "TheApp.h" +#include "Utils.h" static ProtocolManager* fInstance = NULL; @@ -41,17 +41,17 @@ ProtocolManager::Init(BDirectory dir, BHandler* target) continue; // If add-on's API version fits then load accounts... - CayaProtocolAddOn* addOn = new CayaProtocolAddOn(id, path.Path()); - if (addOn->Version() != CAYA_VERSION) + ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, path.Path()); + if (addOn->Version() != APP_VERSION) continue; // If add-on has multiple protocols, also load them for (int32 i = 0; i < addOn->CountProtocols(); i++) { - CayaProtocolAddOn* subAddOn = addOn; + ChatProtocolAddOn* subAddOn = addOn; if (i > 0) - subAddOn = new CayaProtocolAddOn(id, path.Path(), i); + subAddOn = new ChatProtocolAddOn(id, path.Path(), i); - CayaProtocol* proto = subAddOn->Protocol(); + ChatProtocol* proto = subAddOn->Protocol(); fAddOnMap.AddItem(proto->Signature(), subAddOn); _LoadAccounts(path.Path(), subAddOn, i, target); @@ -82,14 +82,14 @@ ProtocolManager::CountProtocolAddOns() const } -CayaProtocolAddOn* +ChatProtocolAddOn* ProtocolManager::ProtocolAddOnAt(uint32 i) const { return fAddOnMap.ValueAt(i); } -CayaProtocolAddOn* +ChatProtocolAddOn* ProtocolManager::ProtocolAddOn(const char* signature) { return fAddOnMap.ValueFor(signature); @@ -103,14 +103,14 @@ ProtocolManager::CountProtocolInstances() const } -CayaProtocol* +ChatProtocol* ProtocolManager::ProtocolInstanceAt(uint32 i) const { return fProtocolMap.ValueAt(i); } -CayaProtocol* +ChatProtocol* ProtocolManager::ProtocolInstance(bigtime_t identifier) { return fProtocolMap.ValueFor(identifier); @@ -118,11 +118,11 @@ ProtocolManager::ProtocolInstance(bigtime_t identifier) void -ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account, +ProtocolManager::AddAccount(ChatProtocolAddOn* addOn, const char* account, BHandler* target) { bigtime_t instanceId = system_time(); - CayaProtocol* cayap = addOn->Protocol(); + ChatProtocol* cayap = addOn->Protocol(); (void)new Account(instanceId, cayap, account, addOn->Signature(), target); fProtocolMap.AddItem(instanceId, cayap); @@ -133,11 +133,11 @@ ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account, void -ProtocolManager::_LoadAccounts(const char* image_path, CayaProtocolAddOn* addOn, +ProtocolManager::_LoadAccounts(const char* image_path, ChatProtocolAddOn* addOn, int protoIndex, BHandler* target) { // Find accounts path for this protocol - BPath path(CayaAccountPath(addOn->Signature(), addOn->Protocol()->Signature())); + BPath path(AccountPath(addOn->Signature(), addOn->Protocol()->Signature())); if (path.InitCheck() != B_OK) return; @@ -160,8 +160,8 @@ ProtocolManager::_LoadAccount(const char* imagePath, BEntry accountEntry, return; // If add-on's API version fits then load accounts... - CayaProtocolAddOn* addOn = new CayaProtocolAddOn(id, imagePath, protoIndex); - if (addOn->Version() != CAYA_VERSION) + ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, imagePath, protoIndex); + if (addOn->Version() != APP_VERSION) return; _LoadAccount(addOn, accountEntry, target); @@ -169,7 +169,7 @@ ProtocolManager::_LoadAccount(const char* imagePath, BEntry accountEntry, void -ProtocolManager::_LoadAccount(CayaProtocolAddOn* addOn, BEntry accountEntry, +ProtocolManager::_LoadAccount(ChatProtocolAddOn* addOn, BEntry accountEntry, BHandler* target) { BFile file(&accountEntry, B_READ_ONLY); diff --git a/application/ProtocolManager.h b/application/ProtocolManager.h index ef34d6b..d77a3d3 100644 --- a/application/ProtocolManager.h +++ b/application/ProtocolManager.h @@ -11,8 +11,8 @@ #include -#include "CayaProtocol.h" -#include "CayaProtocolAddOn.h" +#include "ChatProtocol.h" +#include "ChatProtocolAddOn.h" class BBitmap; class BDirectory; @@ -25,30 +25,30 @@ public: static ProtocolManager* Get(); uint32 CountProtocolAddOns() const; - CayaProtocolAddOn* ProtocolAddOnAt(uint32 i) const; - CayaProtocolAddOn* ProtocolAddOn(const char* signature); + ChatProtocolAddOn* ProtocolAddOnAt(uint32 i) const; + ChatProtocolAddOn* ProtocolAddOn(const char* signature); uint32 CountProtocolInstances() const; - CayaProtocol* ProtocolInstanceAt(uint32 i) const; - CayaProtocol* ProtocolInstance(bigtime_t identifier); + ChatProtocol* ProtocolInstanceAt(uint32 i) const; + ChatProtocol* ProtocolInstance(bigtime_t identifier); - void AddAccount(CayaProtocolAddOn* addOn, + void AddAccount(ChatProtocolAddOn* addOn, const char* account, BHandler* target); private: - typedef KeyMap AddOnMap; - typedef KeyMap ProtocolMap; + typedef KeyMap AddOnMap; + typedef KeyMap ProtocolMap; ProtocolManager(); void _LoadAccounts(const char* image_path, - CayaProtocolAddOn* addOn, int protoIndex, + ChatProtocolAddOn* addOn, int protoIndex, BHandler* target); void _LoadAccount(const char* imagePath, BEntry accountEntry, int protoIndex, BHandler* target); - void _LoadAccount(CayaProtocolAddOn* addOn, + void _LoadAccount(ChatProtocolAddOn* addOn, BEntry accountEntry, BHandler* target); AddOnMap fAddOnMap; diff --git a/application/ProtocolSettings.cpp b/application/ProtocolSettings.cpp index 7caaed2..02dae13 100644 --- a/application/ProtocolSettings.cpp +++ b/application/ProtocolSettings.cpp @@ -18,11 +18,11 @@ #include #include -#include "CayaProtocolAddOn.h" -#include "CayaUtils.h" +#include "ChatProtocolAddOn.h" +#include "Utils.h" -ProtocolSettings::ProtocolSettings(CayaProtocolAddOn* addOn) +ProtocolSettings::ProtocolSettings(ChatProtocolAddOn* addOn) : fTemplate(addOn->Protocol(), "account"), fAddOn(addOn) @@ -37,7 +37,7 @@ ProtocolSettings::InitCheck() const } -CayaProtocolAddOn* +ChatProtocolAddOn* ProtocolSettings::AddOn() const { return fAddOn; @@ -49,7 +49,7 @@ ProtocolSettings::Accounts() const { BObjectList list(true); - BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); + BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); if (path.InitCheck() != B_OK) return list; @@ -99,7 +99,7 @@ ProtocolSettings::Save(const char* account, BView* parent, BString* errorText) status_t ret = B_ERROR; // Find user's settings path - BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); + BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); if ((ret = path.InitCheck()) != B_OK) return ret; @@ -117,7 +117,7 @@ ProtocolSettings::Rename(const char* from, const char* to) status_t ret = B_ERROR; // Find user's settings path - BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); + BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); if ((ret = path.InitCheck()) != B_OK) return ret; @@ -139,7 +139,7 @@ ProtocolSettings::Delete(const char* account) status_t ret = B_ERROR; // Find user's settings path - BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); + BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); if ((ret = path.InitCheck()) != B_OK) return ret; @@ -166,7 +166,7 @@ ProtocolSettings::_Load(const char* account, BMessage** settings) status_t ret = B_ERROR; // Find user's settings path - BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); + BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); if ((ret = path.InitCheck()) != B_OK) return ret; diff --git a/application/ProtocolSettings.h b/application/ProtocolSettings.h index 64324db..e7ac826 100644 --- a/application/ProtocolSettings.h +++ b/application/ProtocolSettings.h @@ -13,15 +13,15 @@ #include "ProtocolTemplate.h" class BMessage; -class CayaProtocolAddOn; +class ChatProtocolAddOn; class ProtocolSettings { public: - ProtocolSettings(CayaProtocolAddOn* addOn); + ProtocolSettings(ChatProtocolAddOn* addOn); status_t InitCheck() const; - CayaProtocolAddOn* AddOn() const; + ChatProtocolAddOn* AddOn() const; BObjectList Accounts() const; status_t Load(const char* account, BView* parent); @@ -34,7 +34,7 @@ public: private: status_t _Load(const char* account, BMessage** settings); - CayaProtocolAddOn* fAddOn; + ChatProtocolAddOn* fAddOn; ProtocolTemplate fTemplate; status_t fStatus; }; diff --git a/application/ProtocolTemplate.cpp b/application/ProtocolTemplate.cpp index c5409a0..490e783 100644 --- a/application/ProtocolTemplate.cpp +++ b/application/ProtocolTemplate.cpp @@ -25,14 +25,14 @@ #include -#include "CayaProtocol.h" -#include "CayaProtocolAddOn.h" +#include "ChatProtocol.h" +#include "ChatProtocolAddOn.h" const float kDividerWidth = 1.0f; -ProtocolTemplate::ProtocolTemplate(CayaProtocol* protocol, const char* type) +ProtocolTemplate::ProtocolTemplate(ChatProtocol* protocol, const char* type) : fProtocol(protocol), fTemplate(new BMessage()) @@ -58,7 +58,7 @@ ProtocolTemplate::~ProtocolTemplate() } -CayaProtocol* +ChatProtocol* ProtocolTemplate::Protocol() const { return fProtocol; diff --git a/application/ProtocolTemplate.h b/application/ProtocolTemplate.h index a51e30c..3623d1b 100644 --- a/application/ProtocolTemplate.h +++ b/application/ProtocolTemplate.h @@ -12,25 +12,25 @@ class BMessage; class BString; class BView; -class CayaProtocol; +class ChatProtocol; class ProtocolTemplate { public: - ProtocolTemplate(CayaProtocol* protocol, + ProtocolTemplate(ChatProtocol* protocol, const char* type); ProtocolTemplate(BMessage pTemplate); ~ProtocolTemplate(); status_t InitCheck() const; - CayaProtocol* Protocol() const; + ChatProtocol* Protocol() const; status_t Load(BView* parent, BMessage* settings = NULL); status_t Save(BView* parent, BMessage* settings, BString* errorText = NULL); private: - CayaProtocol* fProtocol; + ChatProtocol* fProtocol; BMessage* fTemplate; }; diff --git a/application/Server.cpp b/application/Server.cpp index a339777..0a1cef4 100644 --- a/application/Server.cpp +++ b/application/Server.cpp @@ -25,11 +25,10 @@ #include "Account.h" #include "AccountManager.h" -#include "CayaMessages.h" -#include "CayaProtocol.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "ChatProtocol.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" #include "DefaultItems.h" #include "ImageCache.h" #include "InviteDialogue.h" @@ -38,6 +37,7 @@ #include "RoomFlags.h" #include "RosterItem.h" #include "UserInfoWindow.h" +#include "Utils.h" Server::Server() @@ -70,7 +70,7 @@ Server::LoginAll() BMessage* msg = new BMessage(IM_MESSAGE); msg->AddInt32("im_what", IM_SET_OWN_STATUS); - msg->AddInt32("status", CAYA_ONLINE); + msg->AddInt32("status", STATUS_ONLINE); looper->PostMessage(msg); } } @@ -82,7 +82,7 @@ Server::Filter(BMessage* message, BHandler **target) filter_result result = B_DISPATCH_MESSAGE; switch (message->what) { - case CAYA_CLOSE_CHAT_WINDOW: + case APP_CLOSE_CHAT_WINDOW: { BString id = message->FindString("chat_id"); if (id.Length() > 0) { @@ -96,7 +96,7 @@ Server::Filter(BMessage* message, BHandler **target) result = ImMessage(message); break; - case CAYA_REPLICANT_MESSENGER: + case APP_REPLICANT_MESSENGER: { BMessenger* messenger = new BMessenger(); @@ -113,7 +113,7 @@ Server::Filter(BMessage* message, BHandler **target) break; } - case CAYA_DISABLE_ACCOUNT: + case APP_DISABLE_ACCOUNT: { int64 instance = 0; if (message->FindInt64("instance", &instance) != B_OK) { @@ -124,7 +124,7 @@ Server::Filter(BMessage* message, BHandler **target) break; } - case CAYA_USER_INFO: + case APP_USER_INFO: { User* user = _EnsureUser(message); if (user != NULL) { @@ -134,7 +134,7 @@ Server::Filter(BMessage* message, BHandler **target) break; } - case CAYA_REQUEST_HELP: + case APP_REQUEST_HELP: { BString body; BString cmd_name = message->FindString("misc_str"); @@ -222,7 +222,7 @@ Server::ImMessage(BMessage* msg) return B_SKIP_MESSAGE; AccountManager* accountManager = AccountManager::Get(); - accountManager->SetStatus((CayaStatus)status); + accountManager->SetStatus((UserStatus)status); break; } @@ -237,7 +237,7 @@ Server::ImMessage(BMessage* msg) if (!user) break; - user->SetNotifyStatus((CayaStatus)status); + user->SetNotifyStatus((UserStatus)status); BString statusMsg; if (msg->FindString("message", &statusMsg) == B_OK) { user->SetNotifyPersonalStatus(statusMsg); @@ -495,10 +495,10 @@ Server::ImMessage(BMessage* msg) if (msg->FindFloat("progress", &progress) != B_OK) return result; - if (!CayaPreferences::Item()->NotifyProtocolStatus) + if (!AppPreferences::Item()->NotifyProtocolStatus) break; - CayaProtocolAddOn* addOn + ChatProtocolAddOn* addOn = ProtocolManager::Get()->ProtocolAddOn(protocol); BNotification notification(B_PROGRESS_NOTIFICATION); @@ -527,10 +527,10 @@ Server::ImMessage(BMessage* msg) if (msg->FindString("message", &message) != B_OK) return result; - if (!CayaPreferences::Item()->NotifyProtocolStatus) + if (!AppPreferences::Item()->NotifyProtocolStatus) break; - CayaProtocolAddOn* addOn + ChatProtocolAddOn* addOn = ProtocolManager::Get()->ProtocolAddOn(protocol); BNotification notification((notification_type)type); @@ -548,7 +548,7 @@ Server::ImMessage(BMessage* msg) ProtocolLooper* looper = _LooperFromMessage(msg); if (looper == NULL) break; - CayaProtocol* proto = looper->Protocol(); + ChatProtocol* proto = looper->Protocol(); BString content("%user% has connected!"); content.ReplaceAll("%user%", looper->Protocol()->GetName()); @@ -563,7 +563,7 @@ Server::ImMessage(BMessage* msg) // Join cached rooms BEntry entry; char fileName[B_FILE_NAME_LENGTH] = {'\0'}; - BDirectory dir(CayaRoomsCachePath(proto->GetName())); + BDirectory dir(RoomsCachePath(proto->GetName())); while (dir.GetNextEntry(&entry, true) == B_OK) if (entry.GetName(fileName) == B_OK) { @@ -572,7 +572,7 @@ Server::ImMessage(BMessage* msg) if (file.InitCheck() != B_OK) continue; - if (file.ReadAttr("Caya:flags", B_INT32_TYPE, 0, &flags, + if (file.ReadAttr("Chat:flags", B_INT32_TYPE, 0, &flags, sizeof(int32)) < 0) continue; @@ -601,7 +601,7 @@ Server::ImMessage(BMessage* msg) void -Server::AddProtocolLooper(bigtime_t instanceId, CayaProtocol* cayap) +Server::AddProtocolLooper(bigtime_t instanceId, ChatProtocol* cayap) { ProtocolLooper* looper = new ProtocolLooper(cayap, instanceId); fLoopers.AddItem(instanceId, looper); diff --git a/application/Server.h b/application/Server.h index f3184e4..ae5ef46 100644 --- a/application/Server.h +++ b/application/Server.h @@ -11,14 +11,14 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "ChatCommand.h" #include "Contact.h" #include "Conversation.h" #include "ProtocolLooper.h" #include "User.h" -class CayaProtocol; +class ChatProtocol; class RosterItem; class ProtocolLooper; @@ -37,7 +37,7 @@ public: filter_result ImMessage(BMessage* msg); void AddProtocolLooper(bigtime_t instanceId, - CayaProtocol* cayap); + ChatProtocol* cayap); void RemoveProtocolLooper(bigtime_t instanceId); ProtocolLooper* GetProtocolLooper(bigtime_t instanceId); @@ -74,7 +74,7 @@ private: Role* _GetRole(BMessage* msg); - void _ReplicantStatusNotify(CayaStatus status); + void _ReplicantStatusNotify(UserStatus status); ProtocolLoopers fLoopers; AccountInstances diff --git a/application/TheApp.cpp b/application/TheApp.cpp index b27a3b8..746a490 100644 --- a/application/TheApp.cpp +++ b/application/TheApp.cpp @@ -20,7 +20,7 @@ #include "AboutWindow.h" #include "Caya.h" -#include "CayaMessages.h" +#include "AppMessages.h" #include "FilePanel.h" #include "MainWindow.h" #include "ProtocolManager.h" @@ -30,7 +30,7 @@ TheApp::TheApp() : - BApplication(CAYA_SIGNATURE), + BApplication(APP_SIGNATURE), fMainWin(NULL) { } @@ -100,6 +100,7 @@ TheApp::AboutRequested() "Andrea Anzani", "Dario Casalinuovo", "Pier Luigi Fiorini", + "Jaidyn Levesque", NULL }; @@ -126,14 +127,14 @@ void TheApp::MessageReceived(BMessage* message) { switch (message->what) { - case CAYA_REPLICANT_STATUS_SET: - case CAYA_REPLICANT_SHOW_WINDOW: - case CAYA_SHOW_SETTINGS: - case CAYA_REPLICANT_MESSENGER: + case APP_REPLICANT_STATUS_SET: + case APP_REPLICANT_SHOW_WINDOW: + case APP_SHOW_SETTINGS: + case APP_REPLICANT_MESSENGER: DetachCurrentMessage(); fMainWin->PostMessage(message); break; - case CAYA_REPLICANT_EXIT: + case APP_REPLICANT_EXIT: // TODO BAlert here PostMessage(B_QUIT_REQUESTED); break; diff --git a/application/User.cpp b/application/User.cpp index 747c63a..d799ff0 100644 --- a/application/User.cpp +++ b/application/User.cpp @@ -15,9 +15,8 @@ #include #include -#include "CayaProtocolAddOn.h" -#include "CayaResources.h" -#include "CayaUtils.h" +#include "ChatProtocolAddOn.h" +#include "AppResources.h" #include "Conversation.h" #include "ImageCache.h" #include "NotifyMessage.h" @@ -25,6 +24,7 @@ #include "ProtocolManager.h" #include "UserItem.h" #include "UserPopUp.h" +#include "Utils.h" User::User(BString id, BMessenger msgn) @@ -34,8 +34,8 @@ User::User(BString id, BMessenger msgn) fMessenger(msgn), fLooper(NULL), fListItem(NULL), - fItemColor(CayaForegroundColor(ui_color(B_LIST_BACKGROUND_COLOR))), - fStatus(CAYA_OFFLINE), + fItemColor(ForegroundColor(ui_color(B_LIST_BACKGROUND_COLOR))), + fStatus(STATUS_OFFLINE), fAvatarBitmap(NULL), fPopUp(NULL) { @@ -140,8 +140,8 @@ User::AvatarBitmap() const BBitmap* User::ProtocolBitmap() const { - CayaProtocol* protocol = fLooper->Protocol(); - CayaProtocolAddOn* addOn + ChatProtocol* protocol = fLooper->Protocol(); + ChatProtocolAddOn* addOn = ProtocolManager::Get()->ProtocolAddOn(protocol->Signature()); return addOn->ProtoIcon(); @@ -159,7 +159,7 @@ User::GetListItem() } -CayaStatus +UserStatus User::GetNotifyStatus() const { return fStatus; @@ -209,7 +209,7 @@ User::SetNotifyAvatarBitmap(BBitmap* bitmap) void -User::SetNotifyStatus(CayaStatus status) +User::SetNotifyStatus(UserStatus status) { if (fStatus != status) { fStatus = status; @@ -240,7 +240,7 @@ User::_EnsureCachePath() { if (fCachePath.InitCheck() == B_OK) return; - fCachePath.SetTo(CayaUserCachePath(fLooper->Protocol()->GetName(), + fCachePath.SetTo(UserCachePath(fLooper->Protocol()->GetName(), fID.String())); } diff --git a/application/User.h b/application/User.h index c793637..c31b593 100644 --- a/application/User.h +++ b/application/User.h @@ -15,7 +15,7 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "Notifier.h" class BBitmap; @@ -55,12 +55,12 @@ public: BString GetName() const; BBitmap* AvatarBitmap() const; - CayaStatus GetNotifyStatus() const; + UserStatus GetNotifyStatus() const; BString GetNotifyPersonalStatus() const; void SetNotifyName(BString name); void SetNotifyAvatarBitmap(BBitmap* bitmap); - void SetNotifyStatus(CayaStatus status); + void SetNotifyStatus(UserStatus status); void SetNotifyPersonalStatus(BString personalStatus); ChatMap Conversations(); @@ -84,7 +84,7 @@ protected: BString fPersonalStatus; BBitmap* fAvatarBitmap; BPath fCachePath; - CayaStatus fStatus; + UserStatus fStatus; UserPopUp* fPopUp; ChatMap fConversations; }; diff --git a/application/CayaUtils.cpp b/application/Utils.cpp similarity index 84% rename from application/CayaUtils.cpp rename to application/Utils.cpp index db59d5c..9e410d8 100644 --- a/application/CayaUtils.cpp +++ b/application/Utils.cpp @@ -18,24 +18,24 @@ #include -#include "CayaUtils.h" +#include "Utils.h" const char* -CayaStatusToString(CayaStatus status) +UserStatusToString(UserStatus status) { switch (status) { - case CAYA_ONLINE: + case STATUS_ONLINE: return "Available"; - case CAYA_AWAY: + case STATUS_AWAY: return "Away"; - case CAYA_DO_NOT_DISTURB: + case STATUS_DO_NOT_DISTURB: return "Busy"; - case CAYA_CUSTOM_STATUS: + case STATUS_CUSTOM_STATUS: return "Custom Status"; - case CAYA_INVISIBLE: + case STATUS_INVISIBLE: return "Invisible"; - case CAYA_OFFLINE: + case STATUS_OFFLINE: return "Offline"; default: return NULL; @@ -70,7 +70,7 @@ CommandArgs(BString line) BResources* -CayaResources() +ChatResources() { image_info info; if (our_image(info) != B_OK) @@ -111,7 +111,7 @@ CreateAccountMenu(AccountInstances accounts, BMessage msg, BMessage* allMsg) const char* -CayaAccountsPath() +AccountsPath() { BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) @@ -126,12 +126,12 @@ CayaAccountsPath() const char* -CayaAccountPath(const char* signature) +AccountPath(const char* signature) { if (!signature) return NULL; - BPath path(CayaAccountsPath()); + BPath path(AccountsPath()); if (path.InitCheck() != B_OK) return NULL; @@ -144,13 +144,13 @@ CayaAccountPath(const char* signature) const char* -CayaAccountPath(const char* signature, const char* subsignature) +AccountPath(const char* signature, const char* subsignature) { if (BString(signature) == BString(subsignature) || BString(subsignature).IsEmpty() == true) - return CayaAccountPath(signature); + return AccountPath(signature); - BPath path(CayaAccountPath(signature)); + BPath path(AccountPath(signature)); path.Append(subsignature); if (create_directory(path.Path(), 0755) != B_OK) @@ -161,7 +161,7 @@ CayaAccountPath(const char* signature, const char* subsignature) const char* -CayaCachePath() +CachePath() { BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) @@ -174,9 +174,9 @@ CayaCachePath() const char* -CayaAccountCachePath(const char* accountName) +AccountCachePath(const char* accountName) { - BPath path(CayaCachePath()); + BPath path(CachePath()); if (path.InitCheck() != B_OK) return NULL; path.Append(accountName); @@ -187,9 +187,9 @@ CayaAccountCachePath(const char* accountName) const char* -CayaRoomsCachePath(const char* accountName) +RoomsCachePath(const char* accountName) { - BPath path(CayaAccountCachePath(accountName)); + BPath path(AccountCachePath(accountName)); if (path.InitCheck() != B_OK) return NULL; path.Append("Rooms"); @@ -200,9 +200,9 @@ CayaRoomsCachePath(const char* accountName) const char* -CayaRoomCachePath(const char* accountName, const char* roomIdentifier) +RoomCachePath(const char* accountName, const char* roomIdentifier) { - BPath path(CayaRoomsCachePath(accountName)); + BPath path(RoomsCachePath(accountName)); if (path.InitCheck() != B_OK) return NULL; path.Append(roomIdentifier); return path.Path(); @@ -210,9 +210,9 @@ CayaRoomCachePath(const char* accountName, const char* roomIdentifier) const char* -CayaUserCachePath(const char* accountName, const char* userIdentifier) +UserCachePath(const char* accountName, const char* userIdentifier) { - BPath path(CayaAccountCachePath(accountName)); + BPath path(AccountCachePath(accountName)); if (path.InitCheck() != B_OK) return NULL; path.Append("Users"); if (create_directory(path.Path(), 0755) != B_OK) return NULL; @@ -222,9 +222,9 @@ CayaUserCachePath(const char* accountName, const char* userIdentifier) const char* -CayaContactCachePath(const char* accountName, const char* userIdentifier) +ContactCachePath(const char* accountName, const char* userIdentifier) { - BPath path(CayaAccountCachePath(accountName)); + BPath path(AccountCachePath(accountName)); if (path.InitCheck() != B_OK) return NULL; path.Append("People"); if (create_directory(path.Path(), 0755) != B_OK) return NULL; @@ -234,7 +234,7 @@ CayaContactCachePath(const char* accountName, const char* userIdentifier) rgb_color -CayaTintColor(rgb_color color, int severity) +TintColor(rgb_color color, int severity) { bool dark = false; if (color.Brightness() < 127) @@ -263,7 +263,7 @@ CayaTintColor(rgb_color color, int severity) rgb_color -CayaForegroundColor(rgb_color background) +ForegroundColor(rgb_color background) { rgb_color foreground; int32 brighter; diff --git a/application/CayaUtils.h b/application/Utils.h similarity index 50% rename from application/CayaUtils.h rename to application/Utils.h index 2ba34fa..beb2c3c 100644 --- a/application/CayaUtils.h +++ b/application/Utils.h @@ -4,8 +4,8 @@ * Copyright 2021, Jaidyn Levesque * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_UTILS_H -#define _CAYA_UTILS_H +#ifndef _APP_UTILS_H +#define _APP_UTILS_H #include @@ -13,36 +13,36 @@ #include #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "Server.h" class BMenu; -const char* CayaStatusToString(CayaStatus status); +const char* UserStatusToString(UserStatus status); bool IsCommand(BString line); BString CommandName(BString line); BString CommandArgs(BString line); -BResources* CayaResources(); +BResources* ChatResources(); BMenu* CreateAccountMenu(AccountInstances accounts, BMessage msg, BMessage* allMsg = NULL); -const char* CayaAccountsPath(); -const char* CayaAccountPath(const char* signature); -const char* CayaAccountPath(const char* signature, const char* subsignature); +const char* AccountsPath(); +const char* AccountPath(const char* signature); +const char* AccountPath(const char* signature, const char* subsignature); -const char* CayaCachePath(); -const char* CayaAccountCachePath(const char* accountName); -const char* CayaRoomsCachePath(const char* accountName); -const char* CayaRoomCachePath(const char* accountName, const char* roomIdentifier); -const char* CayaUserCachePath(const char* accountName, const char* userIdentifier); -const char* CayaContactCachePath(const char* accountName, const char* userIdentifier); +const char* CachePath(); +const char* AccountCachePath(const char* accountName); +const char* RoomsCachePath(const char* accountName); +const char* RoomCachePath(const char* accountName, const char* roomIdentifier); +const char* UserCachePath(const char* accountName, const char* userIdentifier); +const char* ContactCachePath(const char* accountName, const char* userIdentifier); -rgb_color CayaTintColor(rgb_color color, int severity); -rgb_color CayaForegroundColor(rgb_color background); +rgb_color TintColor(rgb_color color, int severity); +rgb_color ForegroundColor(rgb_color background); // Borrowed from BePodder's own libfunky. Groovy B) status_t ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size); @@ -52,5 +52,5 @@ status_t ReadAttributeMessage(BNode* node, const char* name, BMessage* data); extern "C" status_t our_image(image_info& image); -#endif // _CAYA_UTILS_H +#endif // _APP_UTILS_H diff --git a/application/preferences/CayaPreferences.cpp b/application/preferences/AppPreferences.cpp similarity index 74% rename from application/preferences/CayaPreferences.cpp rename to application/preferences/AppPreferences.cpp index 1ded33a..0352bae 100644 --- a/application/preferences/CayaPreferences.cpp +++ b/application/preferences/AppPreferences.cpp @@ -2,13 +2,13 @@ * Copyright 2012, Casalinuovo Dario. All rights reserved. * Distributed under the terms of the MIT License. */ -#include "CayaPreferences.h" +#include "AppPreferences.h" #include #include -template<> const char* CayaPreferences::fFolder = "Caya"; -template<> const char* CayaPreferences::fFilename = "preferences"; +template<> const char* AppPreferences::fFolder = "Caya"; +template<> const char* AppPreferences::fFilename = "preferences"; /* TODO update _Add* methods to don't take the BPositionIO argument @@ -23,13 +23,13 @@ template<> const char* CayaPreferences::fFilename = "preferences"; size become very minimal : ). */ -CayaPreferencesData::CayaPreferencesData() +AppPreferencesData::AppPreferencesData() : MoveToCurrentWorkspace(true), RaiseOnMessageReceived(false), RaiseUserIsTyping(false), MarkUnreadWindow(true), - HideCayaDeskbar(false), + HideDeskbar(false), DisableReplicant(false), IgnoreEmoticons(false), NotifyProtocolStatus(true), @@ -41,29 +41,29 @@ CayaPreferencesData::CayaPreferencesData() } -CayaPreferencesData::~CayaPreferencesData() +AppPreferencesData::~AppPreferencesData() { } bool -CayaPreferencesData::IsFixedSize() const +AppPreferencesData::IsFixedSize() const { return false; } type_code -CayaPreferencesData::TypeCode() const +AppPreferencesData::TypeCode() const { - return CAYA_PREFERENCES_TYPE; + return APP_PREFERENCES_TYPE; } bool -CayaPreferencesData::AllowsTypeCode(type_code code) const +AppPreferencesData::AllowsTypeCode(type_code code) const { - if (code == CAYA_PREFERENCES_TYPE) + if (code == APP_PREFERENCES_TYPE) return true; return false; @@ -71,7 +71,7 @@ CayaPreferencesData::AllowsTypeCode(type_code code) const ssize_t -CayaPreferencesData::FlattenedSize() const +AppPreferencesData::FlattenedSize() const { // NOTE add the size of every settings // you added. @@ -83,13 +83,13 @@ CayaPreferencesData::FlattenedSize() const status_t -CayaPreferencesData::Flatten(BPositionIO* flatData) const +AppPreferencesData::Flatten(BPositionIO* flatData) const { if (flatData == NULL) return B_BAD_VALUE; // Write our type code - type_code code = CAYA_PREFERENCES_TYPE; + type_code code = APP_PREFERENCES_TYPE; flatData->Write(&code, sizeof(type_code)); // Behaviour @@ -104,7 +104,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const _AddBool(flatData, DisableQuitConfirm); // Replicant - _AddBool(flatData, HideCayaDeskbar); + _AddBool(flatData, HideDeskbar); _AddBool(flatData, DisableReplicant); // Chat window @@ -124,7 +124,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const status_t -CayaPreferencesData::Flatten(void* buffer, ssize_t size) const +AppPreferencesData::Flatten(void* buffer, ssize_t size) const { if (buffer == NULL) return B_BAD_VALUE; @@ -136,7 +136,7 @@ CayaPreferencesData::Flatten(void* buffer, ssize_t size) const status_t -CayaPreferencesData::Unflatten(type_code code, const void* buffer, ssize_t size) +AppPreferencesData::Unflatten(type_code code, const void* buffer, ssize_t size) { if (buffer == NULL) return B_BAD_VALUE; @@ -147,9 +147,9 @@ CayaPreferencesData::Unflatten(type_code code, const void* buffer, ssize_t size) status_t -CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData) +AppPreferencesData::Unflatten(type_code code, BPositionIO* flatData) { - if (code != CAYA_PREFERENCES_TYPE || flatData == NULL) + if (code != APP_PREFERENCES_TYPE || flatData == NULL) return B_BAD_VALUE; // Reading our type code @@ -172,7 +172,7 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData) DisableQuitConfirm = _ReadBool(flatData); // Replicant - HideCayaDeskbar = _ReadBool(flatData); + HideDeskbar = _ReadBool(flatData); DisableReplicant = _ReadBool(flatData); // Chat window @@ -193,14 +193,14 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData) void -CayaPreferencesData::_AddBool(BPositionIO* data, bool value) const +AppPreferencesData::_AddBool(BPositionIO* data, bool value) const { data->Write(&value, sizeof(value)); } void -CayaPreferencesData::_AddString(BPositionIO* data, const char* value) const +AppPreferencesData::_AddString(BPositionIO* data, const char* value) const { size_t len = strlen(value); data->Write(&len, sizeof(size_t)); @@ -209,7 +209,7 @@ CayaPreferencesData::_AddString(BPositionIO* data, const char* value) const bool -CayaPreferencesData::_ReadBool(BPositionIO* data) +AppPreferencesData::_ReadBool(BPositionIO* data) { bool ret; data->Read(&ret, sizeof(bool)); @@ -218,7 +218,7 @@ CayaPreferencesData::_ReadBool(BPositionIO* data) const char* -CayaPreferencesData::_ReadString(BPositionIO* data) +AppPreferencesData::_ReadString(BPositionIO* data) { size_t len; data->Read(&len, sizeof(size_t)); diff --git a/application/preferences/CayaPreferences.h b/application/preferences/AppPreferences.h similarity index 80% rename from application/preferences/CayaPreferences.h rename to application/preferences/AppPreferences.h index 0f0b1e5..52db474 100644 --- a/application/preferences/CayaPreferences.h +++ b/application/preferences/AppPreferences.h @@ -3,16 +3,16 @@ * Copyright 2012, Casalinuovo Dario. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef _CAYA_PREFERENCES_H -#define _CAYA_PREFERENCES_H +#ifndef _APP_PREFERENCES_H +#define _APP_PREFERENCES_H #include "PreferencesContainer.h" -class CayaPreferencesData : public BFlattenable { +class AppPreferencesData : public BFlattenable { public: - CayaPreferencesData(); - virtual ~CayaPreferencesData(); + AppPreferencesData(); + virtual ~AppPreferencesData(); virtual bool IsFixedSize() const; virtual type_code TypeCode() const; @@ -33,7 +33,7 @@ public: bool NotifyContactStatus; bool NotifyNewMessage; - bool HideCayaDeskbar; + bool HideDeskbar; bool DisableReplicant; bool DisableQuitConfirm; @@ -49,6 +49,6 @@ private: const char* _ReadString(BPositionIO* data); }; -typedef PreferencesContainer CayaPreferences; +typedef PreferencesContainer AppPreferences; -#endif // _CAYA_PREFERENCES_H +#endif // _APP_PREFERENCES_H diff --git a/application/preferences/PreferencesAccounts.cpp b/application/preferences/PreferencesAccounts.cpp index 2090df9..aeed3d9 100644 --- a/application/preferences/PreferencesAccounts.cpp +++ b/application/preferences/PreferencesAccounts.cpp @@ -18,8 +18,8 @@ #include "AccountDialog.h" #include "AccountListItem.h" -#include "CayaMessages.h" -#include "CayaProtocol.h" +#include "AppMessages.h" +#include "ChatProtocol.h" #include "PreferencesAccounts.h" #include "ProtocolManager.h" #include "ProtocolSettings.h" @@ -59,7 +59,7 @@ PreferencesAccounts::PreferencesAccounts() fProtosMenu = new BPopUpMenu(NULL, true); for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) { - CayaProtocolAddOn* addOn = pm->ProtocolAddOnAt(i); + ChatProtocolAddOn* addOn = pm->ProtocolAddOnAt(i); ProtocolSettings* settings = new ProtocolSettings(addOn); // Add accounts to list view @@ -197,7 +197,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg) if (found == false) return; - BMessage* remove = new BMessage(CAYA_DISABLE_ACCOUNT); + BMessage* remove = new BMessage(APP_DISABLE_ACCOUNT); remove->AddInt64("instance", instance); ((TheApp*)be_app)->GetMainWindow()->PostMessage(remove); diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index 53c8957..372f6fe 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -14,9 +14,9 @@ #include #include "AccountManager.h" -#include "CayaProtocol.h" +#include "ChatProtocol.h" #include "PreferencesBehavior.h" -#include "CayaPreferences.h" +#include "AppPreferences.h" #include "ProtocolManager.h" #include "ProtocolSettings.h" #include "MainWindow.h" @@ -139,23 +139,23 @@ PreferencesBehavior::AttachedToWindow() fDisableQuitConfirm->SetTarget(this); fHideOffline->SetValue( - CayaPreferences::Item()->HideOffline); + AppPreferences::Item()->HideOffline); fToCurrentWorkspace->SetValue( - CayaPreferences::Item()->MoveToCurrentWorkspace); + AppPreferences::Item()->MoveToCurrentWorkspace); fRaiseUserIsTyping->SetValue( - CayaPreferences::Item()->RaiseUserIsTyping); + AppPreferences::Item()->RaiseUserIsTyping); fRaiseOnMessageReceived->SetValue( - CayaPreferences::Item()->RaiseOnMessageReceived); + AppPreferences::Item()->RaiseOnMessageReceived); fMarkUnreadWindow->SetValue( - CayaPreferences::Item()->MarkUnreadWindow); + AppPreferences::Item()->MarkUnreadWindow); fNotifyProtocols->SetValue( - CayaPreferences::Item()->NotifyProtocolStatus); + AppPreferences::Item()->NotifyProtocolStatus); fNotifyContactStatus->SetValue( - CayaPreferences::Item()->NotifyContactStatus); + AppPreferences::Item()->NotifyContactStatus); fNotifyNewMessage->SetValue( - CayaPreferences::Item()->NotifyNewMessage); + AppPreferences::Item()->NotifyNewMessage); fDisableQuitConfirm->SetValue( - CayaPreferences::Item()->DisableQuitConfirm); + AppPreferences::Item()->DisableQuitConfirm); } @@ -164,39 +164,39 @@ PreferencesBehavior::MessageReceived(BMessage* message) { switch (message->what) { case kHideOffline: - CayaPreferences::Item()->HideOffline + AppPreferences::Item()->HideOffline = fHideOffline->Value(); break; case kToCurrentWorkspace: - CayaPreferences::Item()->MoveToCurrentWorkspace + AppPreferences::Item()->MoveToCurrentWorkspace = fToCurrentWorkspace->Value(); break; case kRaiseOnMessageReceived: - CayaPreferences::Item()->RaiseOnMessageReceived + AppPreferences::Item()->RaiseOnMessageReceived = fRaiseOnMessageReceived->Value(); break; case kRaiseUserIsTyping: - CayaPreferences::Item()->RaiseUserIsTyping + AppPreferences::Item()->RaiseUserIsTyping = fRaiseUserIsTyping->Value(); break; case kNotifyProtocolsLogin: - CayaPreferences::Item()->NotifyProtocolStatus + AppPreferences::Item()->NotifyProtocolStatus = fNotifyProtocols->Value(); break; case kNotifyContactStatus: - CayaPreferences::Item()->NotifyContactStatus + AppPreferences::Item()->NotifyContactStatus = fNotifyContactStatus->Value(); break; case kNotifyNewMessage: - CayaPreferences::Item()->NotifyNewMessage + AppPreferences::Item()->NotifyNewMessage = fNotifyNewMessage->Value(); break; case kMarkUnreadWindow: - CayaPreferences::Item()->MarkUnreadWindow + AppPreferences::Item()->MarkUnreadWindow = fMarkUnreadWindow->Value(); break; case kDisablePrompt: - CayaPreferences::Item()->DisableQuitConfirm + AppPreferences::Item()->DisableQuitConfirm = fDisableQuitConfirm->Value(); break; default: diff --git a/application/preferences/PreferencesChatWindow.cpp b/application/preferences/PreferencesChatWindow.cpp index 33e87a4..34fa987 100644 --- a/application/preferences/PreferencesChatWindow.cpp +++ b/application/preferences/PreferencesChatWindow.cpp @@ -10,9 +10,9 @@ #include #include -#include "CayaProtocol.h" +#include "ChatProtocol.h" #include "PreferencesChatWindow.h" -#include "CayaPreferences.h" +#include "AppPreferences.h" #include "ProtocolManager.h" #include "ProtocolSettings.h" #include "MainWindow.h" @@ -55,7 +55,7 @@ PreferencesChatWindow::AttachedToWindow() { fIgnoreEmoticons->SetTarget(this); fIgnoreEmoticons->SetValue( - CayaPreferences::Item()->IgnoreEmoticons); + AppPreferences::Item()->IgnoreEmoticons); } @@ -65,7 +65,7 @@ PreferencesChatWindow::MessageReceived(BMessage* message) { switch (message->what) { case kIgnoreEmoticons: - CayaPreferences::Item()->IgnoreEmoticons + AppPreferences::Item()->IgnoreEmoticons = fIgnoreEmoticons->Value(); break; default: diff --git a/application/preferences/PreferencesContainer.h b/application/preferences/PreferencesContainer.h index dd46127..3636b19 100644 --- a/application/preferences/PreferencesContainer.h +++ b/application/preferences/PreferencesContainer.h @@ -14,23 +14,23 @@ #include enum { - CAYA_PREFERENCES_TYPE = 'CPTY' + APP_PREFERENCES_TYPE = 'CPTY' }; // TODO: added to main singleton class? template T* Singleton::fInstance = 0; -template +template class PreferencesContainer - : public Singleton > { + : public Singleton > { public: - static CayaPreferencesData* + static AppPreferencesData* Item() { - return &(Singleton > + return &(Singleton > ::Get()->fSettings); } @@ -40,7 +40,7 @@ public: if (fPreferencesFile.SetTo(&fDirectory, fFilename, B_READ_WRITE | B_FAIL_IF_EXISTS) == B_OK) { - return fSettings.Unflatten(CAYA_PREFERENCES_TYPE, + return fSettings.Unflatten(APP_PREFERENCES_TYPE, &fPreferencesFile); } return B_ERROR; @@ -58,8 +58,8 @@ public: } private: - PreferencesContainer() - : Singleton >() + PreferencesContainer() + : Singleton >() { BPath path; @@ -70,14 +70,14 @@ private: Load(); } - CayaPreferencesData fSettings; + AppPreferencesData fSettings; BFile fPreferencesFile; BDirectory fDirectory; static const char* fFilename; static const char* fFolder; - friend class Singleton >; + friend class Singleton >; }; diff --git a/application/preferences/PreferencesReplicant.cpp b/application/preferences/PreferencesReplicant.cpp index 0079e78..c9a0965 100644 --- a/application/preferences/PreferencesReplicant.cpp +++ b/application/preferences/PreferencesReplicant.cpp @@ -12,9 +12,9 @@ #include #include "AccountManager.h" -#include "CayaProtocol.h" +#include "ChatProtocol.h" #include "PreferencesReplicant.h" -#include "CayaPreferences.h" +#include "AppPreferences.h" #include "ProtocolManager.h" #include "ProtocolSettings.h" #include "MainWindow.h" @@ -23,7 +23,7 @@ const uint32 kDisableReplicant = 'DSrp'; const uint32 kPermanentReplicant ='PRpt'; -const uint32 kHideCayaDeskbar = 'HCtk'; +const uint32 kHideDeskbar = 'HCtk'; PreferencesReplicant::PreferencesReplicant() @@ -40,16 +40,16 @@ PreferencesReplicant::PreferencesReplicant() fDisableReplicant = new BCheckBox("DisableReplicant", "Disable Deskbar replicant", new BMessage(kDisableReplicant)); - if (!CayaPreferences::Item()->HideCayaDeskbar) + if (!AppPreferences::Item()->HideDeskbar) Looper()->PostMessage(new BMessage(kDisableReplicant)); fPermanentReplicant = new BCheckBox("PermanentReplicant", "Permanent Deskbar Replicant", NULL); fPermanentReplicant->SetEnabled(false); - fHideCayaDeskbar = new BCheckBox("HideCayaDeskbar", - "Hide Caya field in Deskbar", new BMessage(kHideCayaDeskbar)); - fHideCayaDeskbar->SetEnabled(false); + fHideDeskbar = new BCheckBox("HideDeskbar", + "Hide field in Deskbar", new BMessage(kHideDeskbar)); + fHideDeskbar->SetEnabled(false); const float spacing = be_control_look->DefaultItemSpacing(); @@ -59,7 +59,7 @@ PreferencesReplicant::PreferencesReplicant() .AddGroup(B_VERTICAL, spacing) .Add(fDisableReplicant) .Add(fPermanentReplicant) - .Add(fHideCayaDeskbar) + .Add(fHideDeskbar) .SetInsets(spacing * 2, spacing, spacing, spacing) .End() .AddGlue() @@ -72,13 +72,13 @@ PreferencesReplicant::PreferencesReplicant() void PreferencesReplicant::AttachedToWindow() { - fHideCayaDeskbar->SetTarget(this); + fHideDeskbar->SetTarget(this); fDisableReplicant->SetTarget(this); - fHideCayaDeskbar->SetValue( - CayaPreferences::Item()->HideCayaDeskbar); + fHideDeskbar->SetValue( + AppPreferences::Item()->HideDeskbar); fDisableReplicant->SetValue( - CayaPreferences::Item()->DisableReplicant); + AppPreferences::Item()->DisableReplicant); } @@ -86,12 +86,12 @@ void PreferencesReplicant::MessageReceived(BMessage* message) { switch (message->what) { - case kHideCayaDeskbar: - CayaPreferences::Item()->HideCayaDeskbar - = fHideCayaDeskbar->Value(); + case kHideDeskbar: + AppPreferences::Item()->HideDeskbar + = fHideDeskbar->Value(); break; case kDisableReplicant: - CayaPreferences::Item()->DisableReplicant + AppPreferences::Item()->DisableReplicant = fDisableReplicant->Value(); if (fDisableReplicant->Value() == true) diff --git a/application/preferences/PreferencesReplicant.h b/application/preferences/PreferencesReplicant.h index 5ff2c4b..fb0a43b 100644 --- a/application/preferences/PreferencesReplicant.h +++ b/application/preferences/PreferencesReplicant.h @@ -22,7 +22,7 @@ private: BStringView* fReplicantString; BCheckBox* fDisableReplicant; BCheckBox* fPermanentReplicant; - BCheckBox* fHideCayaDeskbar; + BCheckBox* fHideDeskbar; }; diff --git a/application/views/ConversationListView.cpp b/application/views/ConversationListView.cpp index 96ac4ab..893861d 100644 --- a/application/views/ConversationListView.cpp +++ b/application/views/ConversationListView.cpp @@ -9,8 +9,8 @@ #include #include -#include "CayaMessages.h" -#include "CayaProtocolMessages.h" +#include "AppMessages.h" +#include "ChatProtocolMessages.h" #include "Conversation.h" #include "ConversationAccountItem.h" #include "ConversationItem.h" @@ -201,7 +201,7 @@ ConversationListView::_BlankPopUp() BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); BMenuItem* newChat = new BMenuItem("New chat" B_UTF8_ELLIPSIS, - new BMessage(CAYA_NEW_CHAT), 'M', B_COMMAND_KEY); + new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY); newChat->SetEnabled(enabled); menu->AddItem(newChat); diff --git a/application/views/ConversationView.cpp b/application/views/ConversationView.cpp index b862678..5455554 100644 --- a/application/views/ConversationView.cpp +++ b/application/views/ConversationView.cpp @@ -19,16 +19,16 @@ #include -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaRenderView.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" +#include "RenderView.h" #include "Conversation.h" #include "NotifyMessage.h" #include "User.h" #include "UserItem.h" #include "UserListView.h" +#include "Utils.h" ConversationView::ConversationView() @@ -52,7 +52,7 @@ ConversationView::ConversationView(Conversation* chat) bool ConversationView::QuitRequested() { - BMessage msg(CAYA_CLOSE_CHAT_WINDOW); + BMessage msg(APP_CLOSE_CHAT_WINDOW); msg.AddString("chat_id", fConversation->GetId()); fConversation->Messenger().SendMessage(&msg); return false; @@ -73,7 +73,7 @@ void ConversationView::MessageReceived(BMessage* message) { switch (message->what) { - case CAYA_CHAT: + case APP_CHAT: { BString text = message->FindString("body"); if (text == "") @@ -118,7 +118,7 @@ ConversationView::ImMessage(BMessage* msg) // Send a notification, if it's appropriate if ((Window() == NULL || Window()->IsActive() == false) - && (!CayaPreferences::Item()->NotifyNewMessage) + && (!AppPreferences::Item()->NotifyNewMessage) && sender != NULL) { fMessageCount++; @@ -139,7 +139,7 @@ ConversationView::ImMessage(BMessage* msg) notification.SetMessageID(sender->GetName()); notification.Send(); // Check if the user want the notification - if (!CayaPreferences::Item()->NotifyNewMessage) + if (!AppPreferences::Item()->NotifyNewMessage) break; } @@ -260,7 +260,7 @@ ConversationView::ObserveString(int32 what, BString str) void ConversationView::_InitInterface() { - fReceiveView = new CayaRenderView("fReceiveView"); + fReceiveView = new RenderView("fReceiveView"); BScrollView* scrollViewReceive = new BScrollView("receiveScrollView", fReceiveView, B_WILL_DRAW, false, true); diff --git a/application/views/ConversationView.h b/application/views/ConversationView.h index a07b978..061a45d 100644 --- a/application/views/ConversationView.h +++ b/application/views/ConversationView.h @@ -8,7 +8,7 @@ #include #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "Conversation.h" #include "Observer.h" @@ -16,7 +16,7 @@ class BStringView; class BTextView; class BitmapView; -class CayaRenderView; +class RenderView; class User; class UserListView; @@ -62,7 +62,7 @@ private: BitmapView* fProtocolView; BitmapView* fIcon; - CayaRenderView* fReceiveView; + RenderView* fReceiveView; UserListView* fUserList; }; diff --git a/application/views/NicknameTextControl.cpp b/application/views/NicknameTextControl.cpp index 3412c8d..211fb53 100644 --- a/application/views/NicknameTextControl.cpp +++ b/application/views/NicknameTextControl.cpp @@ -6,7 +6,7 @@ * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com */ -#include "CayaConstants.h" +#include "AppConstants.h" #include "NicknameTextControl.h" #include diff --git a/application/views/CayaRenderView.cpp b/application/views/RenderView.cpp similarity index 84% rename from application/views/CayaRenderView.cpp rename to application/views/RenderView.cpp index eb687e3..731a676 100644 --- a/application/views/CayaRenderView.cpp +++ b/application/views/RenderView.cpp @@ -1,12 +1,12 @@ -#include "CayaRenderView.h" +#include "RenderView.h" #include #include -#include "CayaPreferences.h" +#include "AppPreferences.h" -CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) +RenderView::RenderView(const char *name, const char* smileyConfig) : RunView(BRect(0, 0, 1, 1), name, fTheme = new Theme(name, COL_MAX_COLORS + 1, COL_MAX_COLORS + 1, @@ -26,7 +26,7 @@ CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) void -CayaRenderView::AppendMessage(const char* nick, const char* message, +RenderView::AppendMessage(const char* nick, const char* message, rgb_color nameColor, time_t time) { rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); @@ -43,7 +43,7 @@ CayaRenderView::AppendMessage(const char* nick, const char* message, void -CayaRenderView::AppendGenericMessage(const char* message) +RenderView::AppendGenericMessage(const char* message) { rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color fg = ui_color(B_PANEL_TEXT_COLOR); @@ -54,9 +54,9 @@ CayaRenderView::AppendGenericMessage(const char* message) void -CayaRenderView::AddEmoticText(const char * txt, rgb_color fore, rgb_color bg) +RenderView::AddEmoticText(const char * txt, rgb_color fore, rgb_color bg) { - if (CayaPreferences::Item()->IgnoreEmoticons) + if (AppPreferences::Item()->IgnoreEmoticons) Append(txt, fore, bg, fore); else Emoticor::Get()->AddText(this, txt, fore, fore, bg, fore); @@ -64,7 +64,7 @@ CayaRenderView::AddEmoticText(const char * txt, rgb_color fore, rgb_color bg) void -CayaRenderView::PrepareTheme(Theme *fTheme) +RenderView::PrepareTheme(Theme *fTheme) { Theme::TimestampFore = COL_TIMESTAMP_DUMMY; Theme::TimestampBack = COL_TIMESTAMP_DUMMY; diff --git a/application/views/CayaRenderView.h b/application/views/RenderView.h similarity index 78% rename from application/views/CayaRenderView.h rename to application/views/RenderView.h index ee64ac1..5a56ca6 100644 --- a/application/views/CayaRenderView.h +++ b/application/views/RenderView.h @@ -1,5 +1,5 @@ -#ifndef _CayaRenderView_H -#define _CayaRenderView_H_ +#ifndef _RenderView_H +#define _RenderView_H_ #include @@ -9,7 +9,7 @@ class RunView; class Theme; -enum CayaRenderViewColors { +enum RenderViewColors { COL_URL = 0, COL_TIMESTAMP, COL_TEXT, @@ -32,10 +32,10 @@ enum { }; -class CayaRenderView : public RunView +class RenderView : public RunView { public: - CayaRenderView(const char* name, const char* smileyConfig = NULL); + RenderView(const char* name, const char* smileyConfig = NULL); void AppendMessage(const char* nick, const char* message, rgb_color nameColor, time_t time = 0); diff --git a/application/views/ReplicantMenuItem.cpp b/application/views/ReplicantMenuItem.cpp index 7ab1dc7..8097ec2 100644 --- a/application/views/ReplicantMenuItem.cpp +++ b/application/views/ReplicantMenuItem.cpp @@ -16,23 +16,23 @@ #include -#include "CayaMessages.h" -#include "CayaResources.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "AppResources.h" #include "ReplicantStatusView.h" +#include "Utils.h" const float kSize = 16; const float kCircle = 12; -ReplicantMenuItem::ReplicantMenuItem(const char* label, CayaStatus status, +ReplicantMenuItem::ReplicantMenuItem(const char* label, UserStatus status, bool custom, char shortcut, uint32 modifiers) : BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), fStatus(status), fCustom(custom) { - BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET); + BMessage* msg = new BMessage(APP_REPLICANT_STATUS_SET); msg->AddInt32("status", fStatus); SetMessage(msg); @@ -40,7 +40,7 @@ ReplicantMenuItem::ReplicantMenuItem(const char* label, CayaStatus status, } -CayaStatus +UserStatus ReplicantMenuItem::Status() const { return fStatus; @@ -57,27 +57,27 @@ ReplicantMenuItem::IsCustom() const void ReplicantMenuItem::SetIcon() { - BResources* res = CayaResources(); + BResources* res = ChatResources(); if (!res) return; int32 num = 0; switch (fStatus) { - case CAYA_ONLINE: + case STATUS_ONLINE: num = kOnlineReplicant; break; - case CAYA_AWAY: + case STATUS_AWAY: num = kAwayReplicant; break; - case CAYA_DO_NOT_DISTURB: + case STATUS_DO_NOT_DISTURB: num = kBusyReplicant; break; - case CAYA_CUSTOM_STATUS: - num = kCayaIconReplicant; + case STATUS_CUSTOM_STATUS: + num = kIconReplicant; break; - case CAYA_INVISIBLE: - case CAYA_OFFLINE: + case STATUS_INVISIBLE: + case STATUS_OFFLINE: num = kOfflineReplicant; break; default: diff --git a/application/views/ReplicantMenuItem.h b/application/views/ReplicantMenuItem.h index 6cc8a30..03ed23e 100644 --- a/application/views/ReplicantMenuItem.h +++ b/application/views/ReplicantMenuItem.h @@ -10,7 +10,7 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" class BBitmap; @@ -18,14 +18,14 @@ const int32 kSetStatus = 'SEST'; class ReplicantMenuItem : public BitmapMenuItem { public: - ReplicantMenuItem(const char* label, CayaStatus status, + ReplicantMenuItem(const char* label, UserStatus status, bool custom = false, char shortcut = 0, uint32 modifiers = 0); - CayaStatus Status() const; + UserStatus Status() const; bool IsCustom() const; private: - CayaStatus fStatus; + UserStatus fStatus; bool fCustom; void SetIcon(); diff --git a/application/views/ReplicantStatusView.cpp b/application/views/ReplicantStatusView.cpp index f10a90f..cb2158d 100644 --- a/application/views/ReplicantStatusView.cpp +++ b/application/views/ReplicantStatusView.cpp @@ -28,12 +28,12 @@ #include "AccountManager.h" #include "Caya.h" -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" #include "NicknameTextControl.h" #include "ReplicantMenuItem.h" +#include "Utils.h" extern "C" _EXPORT BView *instantiate_deskbar_item(void); @@ -61,7 +61,7 @@ public: if (message->FindInt32("status", &status) != B_OK) return; - fTarget->SetStatus((CayaStatus)status); + fTarget->SetStatus((UserStatus)status); break; } default: @@ -100,7 +100,7 @@ ReplicantStatusView::~ReplicantStatusView() // TODO: Use a list for that // maybe our List wrapper to std::list delete fConnectingIcon; - delete fCayaIcon; + delete fIcon; delete fOfflineIcon; delete fBusyIcon; delete fAwayIcon; @@ -111,21 +111,21 @@ void ReplicantStatusView::MessageReceived(BMessage* msg) { switch (msg->what) { - case CAYA_REPLICANT_STATUS_SET: + case APP_REPLICANT_STATUS_SET: { int32 status; if (msg->FindInt32("status", &status) != B_OK) return; - SetStatus((CayaStatus)status); + SetStatus((UserStatus)status); fCayaMsg->SendMessage(msg); break; } - case CAYA_REPLICANT_EXIT: - case CAYA_SHOW_SETTINGS: - case CAYA_REPLICANT_SHOW_WINDOW: - case CAYA_REPLICANT_MESSENGER: + case APP_REPLICANT_EXIT: + case APP_SHOW_SETTINGS: + case APP_REPLICANT_SHOW_WINDOW: + case APP_REPLICANT_MESSENGER: fCayaMsg->SendMessage(msg); break; default: @@ -135,7 +135,7 @@ ReplicantStatusView::MessageReceived(BMessage* msg) void -ReplicantStatusView::SetStatus(CayaStatus status) +ReplicantStatusView::SetStatus(UserStatus status) { for (int32 i = 0; i < fReplicantMenu->CountItems(); i++) { ReplicantMenuItem* item @@ -152,21 +152,21 @@ ReplicantStatusView::SetStatus(CayaStatus status) } switch (status) { - case CAYA_AWAY: + case STATUS_AWAY: fIcon = fAwayIcon; break; - case CAYA_DO_NOT_DISTURB: + case STATUS_DO_NOT_DISTURB: fIcon = fBusyIcon; break; - case CAYA_CUSTOM_STATUS: - fIcon = fCayaIcon; + case STATUS_CUSTOM_STATUS: + fIcon = fAppIcon; break; - case CAYA_INVISIBLE: - case CAYA_OFFLINE: + case STATUS_INVISIBLE: + case STATUS_OFFLINE: fIcon = fOfflineIcon; break; default: - fIcon = fCayaIcon; + fIcon = fIcon; break; } Invalidate(); @@ -199,7 +199,7 @@ ReplicantStatusView::Archive(BMessage* archive, bool deep) const status_t status = BView::Archive(archive, deep); if (status == B_OK) - status = archive->AddString("add_on", CAYA_SIGNATURE); + status = archive->AddString("add_on", APP_SIGNATURE); if (status == B_OK) status = archive->AddString("class", "ReplicantStatusView"); @@ -225,7 +225,7 @@ ReplicantStatusView::AttachedToWindow() Window()->Unlock(); } - BMessage msg(CAYA_REPLICANT_MESSENGER); + BMessage msg(APP_REPLICANT_MESSENGER); BMessenger messenger(fReplicantHandler); if (!messenger.IsValid()) return; @@ -255,7 +255,7 @@ ReplicantStatusView::MouseDown(BPoint point) } if (buttons & B_PRIMARY_MOUSE_BUTTON) { // Show / Hide Window command - BMessage msg(CAYA_REPLICANT_SHOW_WINDOW); + BMessage msg(APP_REPLICANT_SHOW_WINDOW); fCayaMsg->SendMessage(&msg); } else if(buttons & B_SECONDARY_MOUSE_BUTTON) { // Build replicant menu @@ -273,13 +273,13 @@ ReplicantStatusView::_Init() // a messenger targeting this to Caya. // This will allow the Replicant to communicate // whith Caya. - fCayaMsg = new BMessenger(CAYA_SIGNATURE); + fCayaMsg = new BMessenger(APP_SIGNATURE); - fResources = CayaResources(); + fResources = ChatResources(); //Get icons from resources fConnectingIcon = _GetIcon(kOnlineReplicant); - fCayaIcon = _GetIcon(kCayaIconReplicant); + fAppIcon = _GetIcon(kIconReplicant); fOfflineIcon = _GetIcon(kOfflineReplicant); fIcon = fOfflineIcon; fBusyIcon = _GetIcon(kBusyReplicant); @@ -307,17 +307,17 @@ ReplicantStatusView::_BuildMenu() fReplicantMenu = new BPopUpMenu(" - ", false, false); // Add status menu items - int32 s = CAYA_ONLINE; - while (s >= CAYA_ONLINE && s < CAYA_STATUSES) { - BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET); + int32 s = STATUS_ONLINE; + while (s >= STATUS_ONLINE && s < STATUS_STATUSES) { + BMessage* msg = new BMessage(APP_REPLICANT_STATUS_SET); msg->AddInt32("status", s); ReplicantMenuItem* item = new ReplicantMenuItem( - CayaStatusToString((CayaStatus)s), (CayaStatus)s); + UserStatusToString((UserStatus)s), (UserStatus)s); fReplicantMenu->AddItem(item); // Mark offline status by default - if (s == CAYA_OFFLINE) + if (s == STATUS_OFFLINE) item->SetMarked(true); s++; } @@ -325,10 +325,10 @@ ReplicantStatusView::_BuildMenu() fReplicantMenu->AddItem(new BSeparatorItem()); fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ", - new BMessage(CAYA_SHOW_SETTINGS), fPreferencesIcon)); + new BMessage(APP_SHOW_SETTINGS), fPreferencesIcon)); fReplicantMenu->AddItem(new BitmapMenuItem("Exit", - new BMessage(CAYA_REPLICANT_EXIT), fExitMenuIcon)); + new BMessage(APP_REPLICANT_EXIT), fExitMenuIcon)); fReplicantMenu->SetTargetForItems(this); } @@ -356,7 +356,7 @@ instantiate_deskbar_item(void) status_t ReplicantStatusView::InstallReplicant() { - if (CayaPreferences::Item()->DisableReplicant == true) + if (AppPreferences::Item()->DisableReplicant == true) return B_OK; BDeskbar deskbar; diff --git a/application/views/ReplicantStatusView.h b/application/views/ReplicantStatusView.h index 293a331..0eb2a12 100644 --- a/application/views/ReplicantStatusView.h +++ b/application/views/ReplicantStatusView.h @@ -13,8 +13,8 @@ #include #include -#include "CayaConstants.h" -#include "CayaResources.h" +#include "AppConstants.h" +#include "AppResources.h" class BPopUpMenu; @@ -36,7 +36,7 @@ public: virtual void Draw(BRect rect); - void SetStatus(CayaStatus status); + void SetStatus(UserStatus status); virtual status_t Archive(BMessage* archive, bool deep) const; @@ -53,10 +53,10 @@ private: void _ShowMenu(BPoint point); BBitmap* _GetIcon(const uint32 id); - BBitmap* fIcon; + BBitmap* fAppIcon; BBitmap* fConnectingIcon; - BBitmap* fCayaIcon; + BBitmap* fIcon; BBitmap* fOfflineIcon; BBitmap* fBusyIcon; BBitmap* fAwayIcon; diff --git a/application/views/RosterItem.cpp b/application/views/RosterItem.cpp index ce7b9c9..ceccadd 100644 --- a/application/views/RosterItem.cpp +++ b/application/views/RosterItem.cpp @@ -11,17 +11,17 @@ #include -#include "CayaUtils.h" -#include "CayaResources.h" +#include "AppResources.h" #include "Contact.h" #include "NotifyMessage.h" #include "RosterItem.h" +#include "Utils.h" RosterItem::RosterItem(const char* name, Contact* contact) : BStringItem(name), fBitmap(NULL), - fStatus(CAYA_OFFLINE), + fStatus(STATUS_OFFLINE), contactLinker(contact), fVisible(true) { @@ -85,7 +85,7 @@ RosterItem::ObserveInteger(int32 what, int32 val) { switch (what) { case INT_CONTACT_STATUS: - SetStatus((CayaStatus)val); + SetStatus((UserStatus)val); break; } } @@ -114,18 +114,18 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete) // Draw contact status switch (fStatus) { - case CAYA_ONLINE: - owner->SetHighColor(CAYA_GREEN_COLOR); + case STATUS_ONLINE: + owner->SetHighColor(APP_GREEN_COLOR); break; - case CAYA_CUSTOM_STATUS: - case CAYA_AWAY: - owner->SetHighColor(CAYA_ORANGE_COLOR); + case STATUS_CUSTOM_STATUS: + case STATUS_AWAY: + owner->SetHighColor(APP_ORANGE_COLOR); break; - case CAYA_DO_NOT_DISTURB: - owner->SetHighColor(CAYA_RED_COLOR); + case STATUS_DO_NOT_DISTURB: + owner->SetHighColor(APP_RED_COLOR); break; - case CAYA_INVISIBLE: - case CAYA_OFFLINE: + case STATUS_INVISIBLE: + case STATUS_OFFLINE: break; default: break; @@ -156,7 +156,7 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete) fBaselineOffset + 3); owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT)); if (fPersonalStatus.Length() == 0) - owner->DrawString(CayaStatusToString(fStatus)); + owner->DrawString(UserStatusToString(fStatus)); else owner->DrawString(fPersonalStatus); @@ -193,7 +193,7 @@ RosterItem::Update(BView* owner, const BFont* font) void -RosterItem::SetStatus(CayaStatus status) +RosterItem::SetStatus(UserStatus status) { if (fStatus != status) fStatus = status; diff --git a/application/views/RosterItem.h b/application/views/RosterItem.h index b2c7d8a..a279c05 100644 --- a/application/views/RosterItem.h +++ b/application/views/RosterItem.h @@ -11,7 +11,7 @@ #include #include -#include "CayaConstants.h" +#include "AppConstants.h" #include "Contact.h" #include "Observer.h" @@ -30,8 +30,8 @@ public: Contact* GetContact() { return contactLinker;} - CayaStatus Status() const { return fStatus; } - void SetStatus(CayaStatus status); + UserStatus Status() const { return fStatus; } + void SetStatus(UserStatus status); BString PersonalStatus() const { return fPersonalStatus; } void SetPersonalStatus(BString str) { fPersonalStatus = str; } @@ -48,7 +48,7 @@ private: Contact* contactLinker; float fBaselineOffset; BString fPersonalStatus; - CayaStatus fStatus; + UserStatus fStatus; BBitmap* fBitmap; bool fVisible; BGradientLinear fGradient; diff --git a/application/views/RosterListView.cpp b/application/views/RosterListView.cpp index ad757fe..5125186 100644 --- a/application/views/RosterListView.cpp +++ b/application/views/RosterListView.cpp @@ -16,7 +16,7 @@ #include #include -#include "CayaProtocolMessages.h" +#include "ChatProtocolMessages.h" #include "Contact.h" #include "ProtocolLooper.h" #include "RosterItem.h" diff --git a/application/views/RosterView.cpp b/application/views/RosterView.cpp index a8b8175..fb9957b 100644 --- a/application/views/RosterView.cpp +++ b/application/views/RosterView.cpp @@ -16,9 +16,9 @@ #include #include -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" #include "RosterItem.h" #include "RosterListView.h" @@ -113,9 +113,9 @@ RosterView::ImMessage(BMessage* msg) // Add or remove item switch (status) { - /*case CAYA_OFFLINE: + /*case STATUS_OFFLINE: // By default offline contacts are hidden - if (!CayaPreferences::Item()->HideOffline) + if (!AppPreferences::Item()->HideOffline) break; if (HasItem(rosterItem)) RemoveItem(rosterItem); @@ -132,18 +132,18 @@ RosterView::ImMessage(BMessage* msg) fListView->Sort(); // Check if the user want the notification - if (!CayaPreferences::Item()->NotifyContactStatus) + if (!AppPreferences::Item()->NotifyContactStatus) break; switch (status) { - case CAYA_ONLINE: - case CAYA_OFFLINE: + case STATUS_ONLINE: + case STATUS_OFFLINE: // Notify when contact is online or offline - if (status == CAYA_ONLINE) { + if (status == STATUS_ONLINE) { BString message; message << rosterItem->GetContact()->GetName(); - if (status == CAYA_ONLINE) + if (status == STATUS_ONLINE) message << " is available!"; else message << " is offline!"; diff --git a/application/views/StatusMenuItem.cpp b/application/views/StatusMenuItem.cpp index 5dc1dd5..324512d 100644 --- a/application/views/StatusMenuItem.cpp +++ b/application/views/StatusMenuItem.cpp @@ -13,15 +13,15 @@ #include -#include "CayaResources.h" -#include "CayaUtils.h" +#include "AppResources.h" #include "StatusMenuItem.h" +#include "Utils.h" const float kSize = 16; const float kCircle = 12; -StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status, +StatusMenuItem::StatusMenuItem(const char* label, UserStatus status, bool custom, char shortcut, uint32 modifiers) : BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), @@ -37,7 +37,7 @@ StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status, } -CayaStatus +UserStatus StatusMenuItem::Status() const { return fStatus; @@ -54,27 +54,27 @@ StatusMenuItem::IsCustom() const void StatusMenuItem::SetIcon() { - BResources* res = CayaResources(); + BResources* res = ChatResources(); if (!res) return; int32 num = 0; switch (fStatus) { - case CAYA_ONLINE: + case STATUS_ONLINE: num = kOnlineReplicant; break; - case CAYA_AWAY: + case STATUS_AWAY: num = kAwayReplicant; break; - case CAYA_DO_NOT_DISTURB: + case STATUS_DO_NOT_DISTURB: num = kBusyReplicant; break; - case CAYA_CUSTOM_STATUS: - num = kCayaIconReplicant; + case STATUS_CUSTOM_STATUS: + num = kIconReplicant; break; - case CAYA_INVISIBLE: - case CAYA_OFFLINE: + case STATUS_INVISIBLE: + case STATUS_OFFLINE: num = kOfflineReplicant; break; default: diff --git a/application/views/StatusMenuItem.h b/application/views/StatusMenuItem.h index a7287c9..75613bb 100644 --- a/application/views/StatusMenuItem.h +++ b/application/views/StatusMenuItem.h @@ -9,7 +9,7 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" class BBitmap; @@ -17,15 +17,15 @@ const int32 kSetStatus = 'SEST'; class StatusMenuItem : public BitmapMenuItem { public: - StatusMenuItem(const char* label, CayaStatus status, + StatusMenuItem(const char* label, UserStatus status, bool custom = false, char shortcut = 0, uint32 modifiers = 0); - CayaStatus Status() const; + UserStatus Status() const; bool IsCustom() const; private: - CayaStatus fStatus; + UserStatus fStatus; bool fCustom; void SetIcon(); diff --git a/application/views/StatusView.cpp b/application/views/StatusView.cpp index 479511a..5c2ed41 100644 --- a/application/views/StatusView.cpp +++ b/application/views/StatusView.cpp @@ -21,9 +21,9 @@ #include #include "AccountManager.h" -#include "CayaUtils.h" #include "NicknameTextControl.h" #include "StatusMenuItem.h" +#include "Utils.h" const int32 kSetNickname = 'stnk'; @@ -41,21 +41,21 @@ StatusView::StatusView(const char* name) fStatusMenu = new BPopUpMenu("-"); // Add status menu items - int32 s = CAYA_ONLINE; - while (s >= CAYA_ONLINE && s < CAYA_STATUSES) { - StatusMenuItem* item = new StatusMenuItem(CayaStatusToString( - (CayaStatus)s), (CayaStatus)s); + int32 s = STATUS_ONLINE; + while (s >= STATUS_ONLINE && s < STATUS_STATUSES) { + StatusMenuItem* item = new StatusMenuItem(UserStatusToString( + (UserStatus)s), (UserStatus)s); fStatusMenu->AddItem(item); /*// Add items for custom messages - if (s == CAYA_ONLINE || s == CAYA_DO_NOT_DISTURB) { - item = new StatusMenuItem("Custom...", (CayaStatus)s, true); + if (s == STATUS_ONLINE || s == STATUS_DO_NOT_DISTURB) { + item = new StatusMenuItem("Custom...", (UserStatus)s, true); fStatusMenu->AddItem(item); fStatusMenu->AddItem(new BSeparatorItem()); }*/ // Mark offline status by default - if (s == CAYA_OFFLINE) + if (s == STATUS_OFFLINE) item->SetMarked(true); s++; @@ -109,7 +109,7 @@ StatusView::MessageReceived(BMessage* msg) return; AccountManager* accountManager = AccountManager::Get(); - accountManager->SetStatus((CayaStatus)status, ""); + accountManager->SetStatus((UserStatus)status, ""); break; } default: @@ -126,7 +126,7 @@ StatusView::SetName(BString name) void -StatusView::SetStatus(CayaStatus status) +StatusView::SetStatus(UserStatus status) { for (int32 i = 0; i < fStatusMenu->CountItems(); i++) { StatusMenuItem* item diff --git a/application/views/StatusView.h b/application/views/StatusView.h index 2b1cf8e..66c0459 100644 --- a/application/views/StatusView.h +++ b/application/views/StatusView.h @@ -7,7 +7,7 @@ #include -#include "CayaConstants.h" +#include "AppConstants.h" class BPopUpMenu; @@ -22,7 +22,7 @@ public: virtual void MessageReceived(BMessage* msg); void SetName(BString name); - void SetStatus(CayaStatus status); + void SetStatus(UserStatus status); void SetAvatarIcon(const BBitmap* bitmap); private: diff --git a/application/views/UserItem.cpp b/application/views/UserItem.cpp index 046964c..7f61e26 100644 --- a/application/views/UserItem.cpp +++ b/application/views/UserItem.cpp @@ -8,10 +8,10 @@ #include #include -#include "CayaConstants.h" -#include "CayaUtils.h" +#include "AppConstants.h" #include "NotifyMessage.h" #include "User.h" +#include "Utils.h" UserItem::UserItem(const char* name, User* user, int32 status) @@ -71,13 +71,13 @@ UserItem::_GetTextColor(rgb_color highColor) { switch (fStatus) { - case CAYA_AWAY: - return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 1); - case CAYA_INVISIBLE: - case CAYA_DO_NOT_DISTURB: - return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2); - case CAYA_OFFLINE: - return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 3); + case STATUS_AWAY: + return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 1); + case STATUS_INVISIBLE: + case STATUS_DO_NOT_DISTURB: + return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2); + case STATUS_OFFLINE: + return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 3); } return highColor; } diff --git a/application/views/UserListView.cpp b/application/views/UserListView.cpp index a2809a1..d4d52f0 100644 --- a/application/views/UserListView.cpp +++ b/application/views/UserListView.cpp @@ -9,8 +9,8 @@ #include #include -#include "CayaMessages.h" -#include "CayaProtocolMessages.h" +#include "AppMessages.h" +#include "ChatProtocolMessages.h" #include "Conversation.h" #include "MainWindow.h" #include "ProtocolLooper.h" @@ -82,7 +82,7 @@ UserListView::_BlankPopUp() BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); BMenuItem* invite = new BMenuItem("Invite user…" B_UTF8_ELLIPSIS, - new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY); + new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY); if (fChat == NULL) invite->SetEnabled(false); diff --git a/application/windows/MainWindow.cpp b/application/windows/MainWindow.cpp index a2f3f6e..3c78a8a 100644 --- a/application/windows/MainWindow.cpp +++ b/application/windows/MainWindow.cpp @@ -18,9 +18,9 @@ #include #include "AccountManager.h" -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" #include "ConversationItem.h" #include "ConversationListView.h" #include "ConversationView.h" @@ -77,7 +77,7 @@ bool MainWindow::QuitRequested() { int32 button_index = 0; - if(!CayaPreferences::Item()->DisableQuitConfirm) + if(!AppPreferences::Item()->DisableQuitConfirm) { BAlert* alert = new BAlert("Closing", "Are you sure you want to quit?", "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, @@ -88,7 +88,7 @@ MainWindow::QuitRequested() if(button_index == 0) { fServer->Quit(); - CayaPreferences::Get()->Save(); + AppPreferences::Get()->Save(); ReplicantStatusView::RemoveReplicant(); be_app->PostMessage(B_QUIT_REQUESTED); return true; @@ -101,13 +101,13 @@ void MainWindow::MessageReceived(BMessage* message) { switch (message->what) { - case CAYA_SHOW_SETTINGS: + case APP_SHOW_SETTINGS: { PreferencesWindow* win = new PreferencesWindow(); win->Show(); break; } - case CAYA_NEW_CHAT: + case APP_NEW_CHAT: { BMessage* newMsg = new BMessage(IM_MESSAGE); newMsg->AddInt32("im_what", IM_CREATE_CHAT); @@ -117,7 +117,7 @@ MainWindow::MessageReceived(BMessage* message) fRosterWindow->Show(); break; } - case CAYA_NEW_ROOM: + case APP_NEW_ROOM: { BMessage* createMsg = new BMessage(IM_MESSAGE); createMsg->AddInt32("im_what", IM_CREATE_ROOM); @@ -127,7 +127,7 @@ MainWindow::MessageReceived(BMessage* message) win->Show(); break; } - case CAYA_JOIN_ROOM: + case APP_JOIN_ROOM: { BMessage temp; BMessage roomId; @@ -146,7 +146,7 @@ MainWindow::MessageReceived(BMessage* message) win->Show(); break; } - case CAYA_SEND_INVITE: + case APP_SEND_INVITE: { if (fConversation == NULL) break; @@ -165,12 +165,12 @@ MainWindow::MessageReceived(BMessage* message) fRosterWindow->Show(); break; } - case CAYA_EDIT_ROSTER: + case APP_EDIT_ROSTER: { RosterEditWindow::Get(fServer)->Show(); break; } - case CAYA_MOVE_UP: + case APP_MOVE_UP: { if (fConversation == NULL) break; @@ -180,7 +180,7 @@ MainWindow::MessageReceived(BMessage* message) fListView->SelectConversation(index - 1); break; } - case CAYA_MOVE_DOWN: + case APP_MOVE_DOWN: { if (fConversation == NULL) break; @@ -191,15 +191,15 @@ MainWindow::MessageReceived(BMessage* message) fListView->SelectConversation(index + 1); break; } - case CAYA_REPLICANT_STATUS_SET: + case APP_REPLICANT_STATUS_SET: { int32 status; message->FindInt32("status", &status); AccountManager* accountManager = AccountManager::Get(); - accountManager->SetStatus((CayaStatus)status); + accountManager->SetStatus((UserStatus)status); break; } - case CAYA_REPLICANT_SHOW_WINDOW: + case APP_REPLICANT_SHOW_WINDOW: { if (LockLooper()) { SetWorkspaces(B_CURRENT_WORKSPACE); @@ -217,14 +217,14 @@ MainWindow::MessageReceived(BMessage* message) } break; } - case CAYA_CHAT: + case APP_CHAT: { message->AddString("body", fSendView->Text()); fChatView->MessageReceived(message); fSendView->SetText(""); break; } - case CAYA_DISABLE_ACCOUNT: + case APP_DISABLE_ACCOUNT: _ToggleMenuItems(); break; case IM_MESSAGE: @@ -322,7 +322,7 @@ MainWindow::ObserveInteger(int32 what, int32 val) { switch (what) { case INT_ACCOUNT_STATUS: - fStatusView->SetStatus((CayaStatus)val); + fStatusView->SetStatus((UserStatus)val); break; } } @@ -462,7 +462,7 @@ MainWindow::_CreateMenuBar() programMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); programMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, - new BMessage(CAYA_SHOW_SETTINGS), ',', B_COMMAND_KEY)); + new BMessage(APP_SHOW_SETTINGS), ',', B_COMMAND_KEY)); programMenu->AddItem(new BSeparatorItem()); programMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY)); @@ -471,29 +471,29 @@ MainWindow::_CreateMenuBar() // Chat BMenu* chatMenu = new BMenu("Chat"); chatMenu->AddItem(new BMenuItem("Join room" B_UTF8_ELLIPSIS, - new BMessage(CAYA_JOIN_ROOM), 'J', B_COMMAND_KEY)); + new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY)); chatMenu->AddSeparatorItem(); chatMenu->AddItem(new BMenuItem("New room" B_UTF8_ELLIPSIS, - new BMessage(CAYA_NEW_ROOM), 'N', B_COMMAND_KEY)); + new BMessage(APP_NEW_ROOM), 'N', B_COMMAND_KEY)); chatMenu->AddItem(new BMenuItem("New chat" B_UTF8_ELLIPSIS, - new BMessage(CAYA_NEW_CHAT), 'M', B_COMMAND_KEY)); + new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY)); chatMenu->SetTargetForItems(this); // Roster BMenu* rosterMenu = new BMenu("Roster"); rosterMenu->AddItem(new BMenuItem("Edit roster" B_UTF8_ELLIPSIS, - new BMessage(CAYA_EDIT_ROSTER), 'R', B_COMMAND_KEY)); + new BMessage(APP_EDIT_ROSTER), 'R', B_COMMAND_KEY)); rosterMenu->AddSeparatorItem(); rosterMenu->AddItem(new BMenuItem("Invite user" B_UTF8_ELLIPSIS, - new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY)); + new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY)); rosterMenu->SetTargetForItems(this); // Window BMenu* windowMenu = new BMenu("Window"); windowMenu->AddItem(new BMenuItem("Up", - new BMessage(CAYA_MOVE_UP), B_UP_ARROW, B_COMMAND_KEY)); + new BMessage(APP_MOVE_UP), B_UP_ARROW, B_COMMAND_KEY)); windowMenu->AddItem(new BMenuItem("Down", - new BMessage(CAYA_MOVE_DOWN), B_DOWN_ARROW, B_COMMAND_KEY)); + new BMessage(APP_MOVE_DOWN), B_DOWN_ARROW, B_COMMAND_KEY)); windowMenu->SetTargetForItems(this); menuBar->AddItem(programMenu); diff --git a/application/windows/RosterEditWindow.cpp b/application/windows/RosterEditWindow.cpp index 2689a1c..fd2d9bf 100644 --- a/application/windows/RosterEditWindow.cpp +++ b/application/windows/RosterEditWindow.cpp @@ -19,14 +19,14 @@ #include #include -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" #include "RosterItem.h" #include "RosterListView.h" #include "RosterView.h" #include "TemplateWindow.h" +#include "Utils.h" const uint32 kSendMessage = 'RWSM'; diff --git a/application/windows/RosterWindow.cpp b/application/windows/RosterWindow.cpp index 39dd8f1..163c6dc 100644 --- a/application/windows/RosterWindow.cpp +++ b/application/windows/RosterWindow.cpp @@ -18,10 +18,10 @@ #include #include -#include "CayaMessages.h" -#include "CayaPreferences.h" -#include "CayaProtocolMessages.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "AppPreferences.h" +#include "ChatProtocolMessages.h" +#include "Utils.h" #include "RosterItem.h" #include "RosterListView.h" #include "RosterView.h" diff --git a/application/windows/TemplateWindow.cpp b/application/windows/TemplateWindow.cpp index 9e1ec3b..818f1eb 100644 --- a/application/windows/TemplateWindow.cpp +++ b/application/windows/TemplateWindow.cpp @@ -17,8 +17,8 @@ #include #include -#include "CayaProtocolMessages.h" -#include "CayaUtils.h" +#include "ChatProtocolMessages.h" +#include "Utils.h" #include "TemplateView.h" diff --git a/application/windows/TemplateWindow.h b/application/windows/TemplateWindow.h index a24df36..0ad38db 100644 --- a/application/windows/TemplateWindow.h +++ b/application/windows/TemplateWindow.h @@ -23,7 +23,7 @@ class TemplateView; class TemplateWindow : public BWindow { public: /*! Get template from selected account's protocol - * via CayaProtocol::SettingsTemplate() */ + * via ChatProtocol::SettingsTemplate() */ TemplateWindow(const char* title, const char* templateType, BMessage* msg, Server* server, bigtime_t instance = -1); diff --git a/application/windows/UserInfoWindow.cpp b/application/windows/UserInfoWindow.cpp index eb0e2c4..91a2d4a 100644 --- a/application/windows/UserInfoWindow.cpp +++ b/application/windows/UserInfoWindow.cpp @@ -22,11 +22,11 @@ #include -#include "CayaMessages.h" -#include "CayaProtocolMessages.h" -#include "CayaConstants.h" -#include "CayaRenderView.h" -#include "CayaUtils.h" +#include "AppMessages.h" +#include "ChatProtocolMessages.h" +#include "AppConstants.h" +#include "RenderView.h" +#include "Utils.h" #include "NotifyMessage.h" #include "User.h" @@ -48,7 +48,7 @@ UserInfoWindow::UserInfoWindow(User* user) fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BString status(fUser->GetName()); - status << CayaStatusToString(fUser->GetNotifyStatus()); + status << UserStatusToString(fUser->GetNotifyStatus()); status << "\n\n ID : "; status << fUser->GetId(); diff --git a/application/windows/UserInfoWindow.h b/application/windows/UserInfoWindow.h index a009989..d8f9d9c 100644 --- a/application/windows/UserInfoWindow.h +++ b/application/windows/UserInfoWindow.h @@ -13,7 +13,7 @@ #include #include "Observer.h" -#include "CayaConstants.h" +#include "AppConstants.h" class BitmapView; class User; diff --git a/data/icons/misc/Person.rdef b/data/icons/misc/Person.rdef index 1d87a05..be81ec9 100644 --- a/data/icons/misc/Person.rdef +++ b/data/icons/misc/Person.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kPersonIcon) #'VICN' array { $"6E636966080500020006023CADF43D104EBF02CA3EA2224AF02046648D00FFDB" diff --git a/data/icons/misc/Search.rdef b/data/icons/misc/Search.rdef index 50969a1..b970e37 100644 --- a/data/icons/misc/Search.rdef +++ b/data/icons/misc/Search.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kSearchIcon) #'VICN' array { $"6E6369660805010200060338D2F73CD163BF82B23B84A94B88504870C900FFEF" diff --git a/data/icons/misc/Tool.rdef b/data/icons/misc/Tool.rdef index 09586a7..03df0ff 100644 --- a/data/icons/misc/Tool.rdef +++ b/data/icons/misc/Tool.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kToolIcon) #'VICN' array { $"6E63696602030100000200160239F20638AB65BE3DD63F501B4A4E27488B2600" diff --git a/data/icons/replicant/Away.rdef b/data/icons/replicant/Away.rdef index 0e6260a..0927833 100644 --- a/data/icons/replicant/Away.rdef +++ b/data/icons/replicant/Away.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kAwayReplicant) #'VICN' array { $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900FFEC" diff --git a/data/icons/replicant/Busy.rdef b/data/icons/replicant/Busy.rdef index d39a994..295410b 100644 --- a/data/icons/replicant/Busy.rdef +++ b/data/icons/replicant/Busy.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kBusyReplicant) #'VICN' array { $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900EC66" diff --git a/data/icons/replicant/ExitMenu.rdef b/data/icons/replicant/ExitMenu.rdef index 1412f8c..7c10d47 100644 --- a/data/icons/replicant/ExitMenu.rdef +++ b/data/icons/replicant/ExitMenu.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kExitMenuReplicant) #'VICN' array { $"6E63696606040165020006023B17A83B6361BEF4563EB24E4B75B044DE8200F3" diff --git a/data/icons/replicant/Icon.rdef b/data/icons/replicant/Icon.rdef index 004c02a..76f1967 100644 --- a/data/icons/replicant/Icon.rdef +++ b/data/icons/replicant/Icon.rdef @@ -1,6 +1,6 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" -resource(kCayaIconReplicant) #'VICN' array { +resource(kIconReplicant) #'VICN' array { $"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7" $"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900" $"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF" diff --git a/data/icons/replicant/MessageReceived.rdef b/data/icons/replicant/MessageReceived.rdef index 6528fed..8fd164e 100644 --- a/data/icons/replicant/MessageReceived.rdef +++ b/data/icons/replicant/MessageReceived.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kReplicantMessageReceived) #'VICN' array { $"6E636966050500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFCE" diff --git a/data/icons/replicant/Offline.rdef b/data/icons/replicant/Offline.rdef index 5735a6c..6a17f13 100644 --- a/data/icons/replicant/Offline.rdef +++ b/data/icons/replicant/Offline.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kOfflineReplicant) #'VICN' array { $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA190062F3" diff --git a/data/icons/replicant/Online.rdef b/data/icons/replicant/Online.rdef index dc665c4..d25cb72 100644 --- a/data/icons/replicant/Online.rdef +++ b/data/icons/replicant/Online.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kOnlineReplicant) #'VICN' array { $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900647F" diff --git a/data/icons/status/Away.rdef b/data/icons/status/Away.rdef index b1c4e9f..29700f4 100644 --- a/data/icons/status/Away.rdef +++ b/data/icons/status/Away.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kAwayIcon) #'VICN' array { $"6E636966010201040400FFBA0055FFFFFFA9E8B732FFB891270102044030C345" diff --git a/data/icons/status/Busy.rdef b/data/icons/status/Busy.rdef index 11f61a5..f89b235 100644 --- a/data/icons/status/Busy.rdef +++ b/data/icons/status/Busy.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kBusyIcon) #'VICN' array { $"6E636966010201040400E9060655E1CECEA9C43A3AFF752F2F0102044030C345" diff --git a/data/icons/status/Offline.rdef b/data/icons/status/Offline.rdef index 2a3b2eb..19d18ea 100644 --- a/data/icons/status/Offline.rdef +++ b/data/icons/status/Offline.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kOfflineIcon) #'VICN' array { $"6E63696601020104040000337F558B9097A92D3541FF0F12160102044030C345" diff --git a/data/icons/status/Online.rdef b/data/icons/status/Online.rdef index 90e02d6..4354404 100644 --- a/data/icons/status/Online.rdef +++ b/data/icons/status/Online.rdef @@ -1,4 +1,4 @@ -#include "application/CayaResources.h" +#include "application/AppResources.h" resource(kOnlineIcon) #'VICN' array { $"6E63696601020104040050B96455B9D6BEA917932FFF2766210102044030C345" diff --git a/protocols/xmpp/JabberHandler.cpp b/protocols/xmpp/JabberHandler.cpp index 843ef50..42088a6 100644 --- a/protocols/xmpp/JabberHandler.cpp +++ b/protocols/xmpp/JabberHandler.cpp @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -72,7 +72,7 @@ JabberHandler::~JabberHandler() status_t -JabberHandler::Init(CayaProtocolMessengerInterface* messenger) +JabberHandler::Init(ChatProtocolMessengerInterface* messenger) { fServerMessenger = messenger; @@ -96,11 +96,11 @@ JabberHandler::Process(BMessage* msg) BString status_msg = msg->FindString("message"); switch (status) { - case CAYA_ONLINE: + case STATUS_ONLINE: // Log in if we still need to resume_thread(fRecvThread); break; - case CAYA_OFFLINE: + case STATUS_OFFLINE: kill_thread(fRecvThread); break; default: @@ -436,7 +436,7 @@ JabberHandler::GetEncoding() } -CayaProtocolMessengerInterface* +ChatProtocolMessengerInterface* JabberHandler::MessengerInterface() const { return fServerMessenger; @@ -906,7 +906,7 @@ JabberHandler::_StatusSetMsg(const char* user_id, gloox::Presence::PresenceType BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_STATUS_SET); msg.AddString("user_id", user_id); - msg.AddInt32("status", _GlooxStatusToCaya(type)); + msg.AddInt32("status", _GlooxStatusToApp(type)); if (BString(resource).IsEmpty() == false) msg.AddString("resource", resource); @@ -1060,26 +1060,26 @@ JabberHandler::_AvatarChanged(const char* id, const char* filename) } -CayaStatus -JabberHandler::_GlooxStatusToCaya(gloox::Presence::PresenceType type) +UserStatus +JabberHandler::_GlooxStatusToApp(gloox::Presence::PresenceType type) { switch (type) { case gloox::Presence::Available: case gloox::Presence::Chat: - return CAYA_ONLINE; + return STATUS_ONLINE; case gloox::Presence::Away: - return CAYA_AWAY; + return STATUS_AWAY; case gloox::Presence::XA: - return CAYA_CUSTOM_STATUS; + return STATUS_CUSTOM_STATUS; case gloox::Presence::DND: - return CAYA_DO_NOT_DISTURB; + return STATUS_DO_NOT_DISTURB; case gloox::Presence::Unavailable: - return CAYA_OFFLINE; + return STATUS_OFFLINE; default: break; } - return CAYA_OFFLINE; + return STATUS_OFFLINE; } @@ -1308,7 +1308,7 @@ JabberHandler::onConnect() // We are online BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_OWN_STATUS_SET); - msg.AddInt32("status", CAYA_ONLINE); + msg.AddInt32("status", STATUS_ONLINE); _SendMessage(&msg); fVCardManager->fetchVCard(fJid, this); @@ -1321,7 +1321,7 @@ JabberHandler::onDisconnect(gloox::ConnectionError e) // We are offline BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_OWN_STATUS_SET); - msg.AddInt32("status", CAYA_OFFLINE); + msg.AddInt32("status", STATUS_OFFLINE); _SendMessage(&msg); if (e == gloox::ConnNoError) { @@ -1373,7 +1373,7 @@ JabberHandler::handleRoster(const gloox::Roster& roster) infoMsg.AddInt32("im_what", IM_CONTACT_INFO); infoMsg.AddString("user_id", jid); infoMsg.AddString("user_name", name); - infoMsg.AddInt32("status", CAYA_OFFLINE); + infoMsg.AddInt32("status", STATUS_OFFLINE); // Groups gloox::StringList g = (*it).second->groups(); @@ -1767,7 +1767,7 @@ JabberHandler::handleSelfPresence(const gloox::RosterItem& item, const std::stri msg.AddString("user_id", item.jidJID().full().c_str()); msg.AddString("user_name", item.name().c_str()); msg.AddInt32("subscription", item.subscription()); - msg.AddInt32("status", _GlooxStatusToCaya(type)); + msg.AddInt32("status", _GlooxStatusToApp(type)); msg.AddString("message", presenceMsg.c_str()); // Groups diff --git a/protocols/xmpp/JabberHandler.h b/protocols/xmpp/JabberHandler.h index 64ac4fd..4427777 100644 --- a/protocols/xmpp/JabberHandler.h +++ b/protocols/xmpp/JabberHandler.h @@ -32,8 +32,8 @@ #include #include -#include -#include +#include +#include #include class BList; @@ -43,7 +43,7 @@ class InviteHandler; typedef KeyMap RoomMap; -class JabberHandler : public CayaProtocol, gloox::RosterListener, gloox::ConnectionListener, +class JabberHandler : public ChatProtocol, gloox::RosterListener, gloox::ConnectionListener, gloox::LogHandler, gloox::MessageSessionHandler, gloox::MessageHandler, gloox::MessageEventHandler, gloox::ChatStateHandler, gloox::VCardHandler, @@ -52,8 +52,8 @@ public: JabberHandler(); virtual ~JabberHandler(); - // CayaProtocol inheritance - virtual status_t Init(CayaProtocolMessengerInterface*); + // ChatProtocol inheritance + virtual status_t Init(ChatProtocolMessengerInterface*); virtual status_t Process(BMessage* msg); @@ -77,7 +77,7 @@ public: virtual uint32 GetEncoding(); - virtual CayaProtocolMessengerInterface* + virtual ChatProtocolMessengerInterface* MessengerInterface() const; // Functions for gloox @@ -105,7 +105,7 @@ protected: BMessage _RosterTemplate(); private: - CayaProtocolMessengerInterface* + ChatProtocolMessengerInterface* fServerMessenger; gloox::Client* fClient; @@ -148,7 +148,7 @@ private: void _CacheAvatar(const char* id, const char* binval, size_t length); void _AvatarChanged(const char*id, const char* filename); - CayaStatus _GlooxStatusToCaya(gloox::Presence::PresenceType type); + UserStatus _GlooxStatusToApp(gloox::Presence::PresenceType type); BString _MUCChatId(gloox::MUCRoom* room); bool _MUCUserId(BString chat_id, const char* nick, BString* id); diff --git a/protocols/xmpp/JabberMain.cpp b/protocols/xmpp/JabberMain.cpp index 8113875..df20087 100644 --- a/protocols/xmpp/JabberMain.cpp +++ b/protocols/xmpp/JabberMain.cpp @@ -13,23 +13,23 @@ #include "JabberProtocol.h" -extern "C" _EXPORT CayaProtocol* protocol_at(int32 i); +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(); -CayaProtocol* +ChatProtocol* protocol_at(int32 i) { switch(i) { case 0: - return (CayaProtocol*)new JabberProtocol(); + return (ChatProtocol*)new JabberProtocol(); case 1: - return (CayaProtocol*)new FacebookProtocol(); + return (ChatProtocol*)new FacebookProtocol(); case 2: - return (CayaProtocol*)new GoogleTalkProtocol(); + return (ChatProtocol*)new GoogleTalkProtocol(); } return NULL; } @@ -59,7 +59,7 @@ friendly_signature() uint32 version() { - return CAYA_VERSION_1_PRE_ALPHA_1; + return APP_VERSION_1_PRE_ALPHA_1; }