Change class names

This commit is contained in:
Jaidyn Ann 2021-06-20 12:44:20 -05:00
parent 4905d95787
commit fbe6e66743
89 changed files with 721 additions and 722 deletions

View File

@ -15,10 +15,10 @@
#include <Path.h> #include <Path.h>
#include "Account.h" #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) const char* name, const char* addOnSignature, BHandler* target)
: :
fIdentifier(instanceId), fIdentifier(instanceId),
@ -30,7 +30,7 @@ Account::Account(bigtime_t instanceId, CayaProtocol* cayap,
fProtocol->Init(this); fProtocol->Init(this);
// Find user's settings path // Find user's settings path
BPath path(CayaAccountPath(addOnSignature, fProtocol->Signature())); BPath path(AccountPath(addOnSignature, fProtocol->Signature()));
if (path.InitCheck() == B_OK) { if (path.InitCheck() == B_OK) {
path.Append(name); path.Append(name);

View File

@ -10,11 +10,11 @@
#include <Messenger.h> #include <Messenger.h>
#include <String.h> #include <String.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
class Account : public CayaProtocolMessengerInterface { class Account : public ChatProtocolMessengerInterface {
public: public:
Account(bigtime_t instanceId, CayaProtocol* cayap, Account(bigtime_t instanceId, ChatProtocol* cayap,
const char* name, const char* addOnSignature, const char* name, const char* addOnSignature,
BHandler* target); BHandler* target);
virtual ~Account(); virtual ~Account();
@ -26,7 +26,7 @@ public:
private: private:
bigtime_t fIdentifier; bigtime_t fIdentifier;
CayaProtocol* fProtocol; ChatProtocol* fProtocol;
BString fName; BString fName;
BMessenger fMessenger; BMessenger fMessenger;
BMessage* fSettings; BMessage* fSettings;

View File

@ -7,7 +7,7 @@
*/ */
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "Server.h" #include "Server.h"
@ -20,7 +20,7 @@ static AccountManager* fInstance = NULL;
AccountManager::AccountManager() AccountManager::AccountManager()
: :
fStatus(CAYA_OFFLINE), fStatus(STATUS_OFFLINE),
fReplicantMessenger(NULL) fReplicantMessenger(NULL)
{ {
TheApp* theApp = reinterpret_cast<TheApp*>(be_app); TheApp* theApp = reinterpret_cast<TheApp*>(be_app);
@ -67,7 +67,7 @@ AccountManager::SetReplicantMessenger(BMessenger* messenger)
} }
CayaStatus UserStatus
AccountManager::Status() const AccountManager::Status() const
{ {
return fStatus; return fStatus;
@ -75,7 +75,7 @@ AccountManager::Status() const
void void
AccountManager::SetStatus(CayaStatus status, const char* str) AccountManager::SetStatus(UserStatus status, const char* str)
{ {
if (fStatus != status) { if (fStatus != status) {
// Create status change message // Create status change message
@ -93,13 +93,13 @@ AccountManager::SetStatus(CayaStatus status, const char* str)
// Notify status change // Notify status change
fStatus = status; fStatus = status;
NotifyInteger(INT_ACCOUNT_STATUS, (int32)fStatus); NotifyInteger(INT_ACCOUNT_STATUS, (int32)fStatus);
ReplicantStatusNotify((CayaStatus)status); ReplicantStatusNotify((UserStatus)status);
} }
} }
void void
AccountManager::ReplicantStatusNotify(CayaStatus status, bool wait) AccountManager::ReplicantStatusNotify(UserStatus status, bool wait)
{ {
if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) { if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) {
printf("notification sent\n"); printf("notification sent\n");

View File

@ -7,7 +7,7 @@
#include <Messenger.h> #include <Messenger.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "Notifier.h" #include "Notifier.h"
@ -17,18 +17,18 @@ public:
void SetNickname(BString nick); void SetNickname(BString nick);
CayaStatus Status() const; UserStatus Status() const;
void SetStatus(CayaStatus status, void SetStatus(UserStatus status,
const char* str = NULL); const char* str = NULL);
void SetReplicantMessenger(BMessenger* messenger); void SetReplicantMessenger(BMessenger* messenger);
void ReplicantStatusNotify(CayaStatus status, void ReplicantStatusNotify(UserStatus status,
bool wait = false); bool wait = false);
private: private:
AccountManager(); AccountManager();
~AccountManager(); ~AccountManager();
CayaStatus fStatus; UserStatus fStatus;
BMessenger* fReplicantMessenger; BMessenger* fReplicantMessenger;
}; };

View File

@ -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 <GraphicsDefs.h>
/**
* 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

62
application/AppMessages.h Normal file
View File

@ -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

View File

@ -2,8 +2,8 @@
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_RESOURCES_H #ifndef _APP_RESOURCES_H
#define _CAYA_RESOURCES_H #define _APP_RESOURCES_H
enum { enum {
kOnlineIcon = 10, kOnlineIcon = 10,
@ -17,7 +17,7 @@ enum {
kProtocolSettingsTemplate = 1000, kProtocolSettingsTemplate = 1000,
kOnlineReplicant = 1200, kOnlineReplicant = 1200,
kCayaIconReplicant = 1220, kIconReplicant = 1220,
kOfflineReplicant = 1300, kOfflineReplicant = 1300,
kBusyReplicant = 1333, kBusyReplicant = 1333,
kAwayReplicant = 1400, kAwayReplicant = 1400,
@ -27,4 +27,4 @@ enum {
kPersonIcon = 1500 kPersonIcon = 1500
}; };
#endif // _CAYA_RESOURCES_H #endif // _APP_RESOURCES_H

View File

@ -2,9 +2,9 @@
* Copyright 2009-2011, Andrea Anzani. All rights reserved. * Copyright 2009-2011, Andrea Anzani. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_H #ifndef _APP_H
#define _CAYA_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

View File

@ -1,6 +1,6 @@
#include "Caya.h" #include "Caya.h"
resource app_signature CAYA_SIGNATURE; resource app_signature APP_SIGNATURE;
resource app_version { resource app_version {
major = 0, major = 0,

View File

@ -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 <GraphicsDefs.h>
/**
* 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

View File

@ -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

View File

@ -4,8 +4,8 @@
* Copyright 2021, Jaidyn Levesque. All rights reserved. * Copyright 2021, Jaidyn Levesque. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_PROTOCOL_H #ifndef _APP_PROTOCOL_H
#define _CAYA_PROTOCOL_H #define _APP_PROTOCOL_H
#include <Messenger.h> #include <Messenger.h>
#include <ObjectList.h> #include <ObjectList.h>
@ -14,21 +14,21 @@ class BBitmap;
// Caya protocol interface version // Caya protocol interface version
#define CAYA_VERSION_1_PRE_ALPHA_1 0x00000001 #define APP_VERSION_1_PRE_ALPHA_1 0x00000001
#define CAYA_VERSION_1_ALPHA_1 0x00000100 #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: public:
virtual status_t SendMessage(BMessage* message) = 0; virtual status_t SendMessage(BMessage* message) = 0;
}; };
class CayaProtocol { class ChatProtocol {
public: public:
//! Messenger //! Messenger
virtual status_t Init(CayaProtocolMessengerInterface*) = 0; virtual status_t Init(ChatProtocolMessengerInterface*) = 0;
//! Called before unloading from memory //! Called before unloading from memory
virtual status_t Shutdown() = 0; virtual status_t Shutdown() = 0;
@ -93,7 +93,7 @@ public:
virtual uint32 GetEncoding() = 0; virtual uint32 GetEncoding() = 0;
//! Messenger interface used //! Messenger interface used
virtual CayaProtocolMessengerInterface* MessengerInterface() const = 0; virtual ChatProtocolMessengerInterface* MessengerInterface() const = 0;
}; };
#endif // _CAYA_PROTOCOL_H #endif // _APP_PROTOCOL_H

View File

@ -12,11 +12,11 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "CayaProtocolAddOn.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), fImage(image),
fPath(path), fPath(path),
@ -28,67 +28,67 @@ CayaProtocolAddOn::CayaProtocolAddOn(image_id image, const char* path, int32 sub
status_t status_t
CayaProtocolAddOn::InitCheck() const ChatProtocolAddOn::InitCheck() const
{ {
return fStatus; return fStatus;
} }
const char* const char*
CayaProtocolAddOn::Path() const ChatProtocolAddOn::Path() const
{ {
return fPath.String(); return fPath.String();
} }
CayaProtocol* ChatProtocol*
CayaProtocolAddOn::Protocol() const ChatProtocolAddOn::Protocol() const
{ {
return ProtocolAt(fProtoIndex); return ProtocolAt(fProtoIndex);
} }
CayaProtocol* ChatProtocol*
CayaProtocolAddOn::ProtocolAt(int32 i) const ChatProtocolAddOn::ProtocolAt(int32 i) const
{ {
CayaProtocol* proto = fGetProtocol(i); ChatProtocol* proto = fGetProtocol(i);
proto->SetAddOnPath(BPath(fPath.String())); proto->SetAddOnPath(BPath(fPath.String()));
return proto; return proto;
} }
int32 int32
CayaProtocolAddOn::CountProtocols() const ChatProtocolAddOn::CountProtocols() const
{ {
return fCountProtocols(); return fCountProtocols();
} }
const char* const char*
CayaProtocolAddOn::Signature() const ChatProtocolAddOn::Signature() const
{ {
return fSignature.String(); return fSignature.String();
} }
const char* const char*
CayaProtocolAddOn::FriendlySignature() const ChatProtocolAddOn::FriendlySignature() const
{ {
return fFriendlySignature.String(); return fFriendlySignature.String();
} }
BBitmap* BBitmap*
CayaProtocolAddOn::Icon() const ChatProtocolAddOn::Icon() const
{ {
return ReadNodeIcon(fPath, B_LARGE_ICON, true); return ReadNodeIcon(fPath, B_LARGE_ICON, true);
} }
const char* const char*
CayaProtocolAddOn::ProtoSignature() const ChatProtocolAddOn::ProtoSignature() const
{ {
CayaProtocol* proto = Protocol(); ChatProtocol* proto = Protocol();
const char* signature = proto->Signature(); const char* signature = proto->Signature();
delete proto; delete proto;
return signature; return signature;
@ -96,9 +96,9 @@ CayaProtocolAddOn::ProtoSignature() const
const char* const char*
CayaProtocolAddOn::ProtoFriendlySignature() const ChatProtocolAddOn::ProtoFriendlySignature() const
{ {
CayaProtocol* proto = Protocol(); ChatProtocol* proto = Protocol();
const char* signature = proto->FriendlySignature(); const char* signature = proto->FriendlySignature();
delete proto; delete proto;
return signature; return signature;
@ -106,9 +106,9 @@ CayaProtocolAddOn::ProtoFriendlySignature() const
BBitmap* BBitmap*
CayaProtocolAddOn::ProtoIcon() const ChatProtocolAddOn::ProtoIcon() const
{ {
CayaProtocol* proto = Protocol(); ChatProtocol* proto = Protocol();
BBitmap* icon = proto->Icon(); BBitmap* icon = proto->Icon();
delete proto; delete proto;
return icon; return icon;
@ -116,14 +116,14 @@ CayaProtocolAddOn::ProtoIcon() const
uint32 uint32
CayaProtocolAddOn::Version() const ChatProtocolAddOn::Version() const
{ {
return fVersion; return fVersion;
} }
void void
CayaProtocolAddOn::_Init() ChatProtocolAddOn::_Init()
{ {
const char* (*signature)(); const char* (*signature)();
const char* (*friendly_signature)(); const char* (*friendly_signature)();

View File

@ -2,28 +2,28 @@
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_PROTOCOL_ADDON_H #ifndef _APP_PROTOCOL_ADDON_H
#define _CAYA_PROTOCOL_ADDON_H #define _APP_PROTOCOL_ADDON_H
#include <image.h> #include <image.h>
#include <String.h> #include <String.h>
class BBitmap; class BBitmap;
class CayaProtocol; class ChatProtocol;
class CayaProtocolAddOn { class ChatProtocolAddOn {
public: public:
CayaProtocolAddOn(image_id image, const char* path, ChatProtocolAddOn(image_id image, const char* path,
int32 subProto=0); int32 subProto=0);
status_t InitCheck() const; status_t InitCheck() const;
const char* Path() const; const char* Path() const;
CayaProtocol* Protocol() const; ChatProtocol* Protocol() const;
CayaProtocol* ProtocolAt(int32 i) const; ChatProtocol* ProtocolAt(int32 i) const;
int32 CountProtocols() const; int32 CountProtocols() const;
@ -40,7 +40,7 @@ public:
private: private:
image_id fImage; image_id fImage;
BString fPath; BString fPath;
CayaProtocol* (*fGetProtocol)(int32 i); ChatProtocol* (*fGetProtocol)(int32 i);
int32 (*fCountProtocols)(); int32 (*fCountProtocols)();
int32 fProtoIndex; int32 fProtoIndex;
uint32 fVersion; uint32 fVersion;
@ -52,4 +52,4 @@ private:
void _Init(); void _Init();
}; };
#endif // _CAYA_PROTOCOL_ADDON_H #endif // _APP_PROTOCOL_ADDON_H

View File

@ -4,8 +4,8 @@
* Copyright 2021, Jaidyn Levesque. All rights reserved. * Copyright 2021, Jaidyn Levesque. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_PROTOCOL_MESSAGES_H #ifndef _CHAT_PROTOCOL_MESSAGES_H
#define _CAYA_PROTOCOL_MESSAGES_H #define _CHAT_PROTOCOL_MESSAGES_H
/** /**
* What-codes for messages. * What-codes for messages.
@ -32,26 +32,26 @@ enum im_what_code {
//! Request a server-side contact list from protocol →Protocol //! Request a server-side contact list from protocol →Protocol
IM_GET_CONTACT_LIST = 1, IM_GET_CONTACT_LIST = 1,
//! Server-side contact list received →Caya //! Server-side contact list received →App
// Requires: Stringlist "user_id" // Requires: Stringlist "user_id"
IM_CONTACT_LIST = 2, IM_CONTACT_LIST = 2,
//! Add a contact to the roster →Protocol //! Add a contact to the roster →Protocol
// The slots for this message are determined by the protocol's // 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, IM_CONTACT_LIST_ADD_CONTACT = 3,
//! Remove a contact →Protocol //! Remove a contact →Protocol
// Requires: String "user_id" // Requires: String "user_id"
IM_CONTACT_LIST_REMOVE_CONTACT = 4, 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" // Requires: String "user_id"
IM_CONTACT_LIST_CONTACT_REMOVED = 5, IM_CONTACT_LIST_CONTACT_REMOVED = 5,
//! Edit some data on contact →Protocol //! Edit some data on contact →Protocol
// The slots for this message are determined by the protocol's // 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, IM_CONTACT_LIST_EDIT_CONTACT = 6,
@ -63,27 +63,27 @@ enum im_what_code {
// Requires: String "user_id", String "body" // Requires: String "user_id", String "body"
IM_SEND_MESSAGE = 20, 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 // If no user_id is specified, it's treated as a system message
// Requires: String "chat_id", String "body" // Requires: String "chat_id", String "body"
// Allows: String "user_id" // Allows: String "user_id"
IM_MESSAGE_SENT = 21, IM_MESSAGE_SENT = 21,
//! Chat message received →Caya //! Chat message received →App
// Requires: String "chat_id", String "user_id", String "body" // Requires: String "chat_id", String "user_id", String "body"
IM_MESSAGE_RECEIVED = 22, IM_MESSAGE_RECEIVED = 22,
//! Logs received →Caya //! Logs received →App
// Without "when" (a time_t), the logged message will lack a timestamp // Without "when" (a time_t), the logged message will lack a timestamp
// Requires: Strings "chat_id", Strings "user_id", Strings "body" // Requires: Strings "chat_id", Strings "user_id", Strings "body"
// Accepts: in64s "when" // Accepts: in64s "when"
IM_LOGS_RECEIVED = 23, IM_LOGS_RECEIVED = 23,
//! User started typing →Caya //! User started typing →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
IM_USER_STARTED_TYPING = 24, IM_USER_STARTED_TYPING = 24,
//! User stopped typing →Caya //! User stopped typing →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
IM_USER_STOPPED_TYPING = 25, IM_USER_STOPPED_TYPING = 25,
@ -95,7 +95,7 @@ enum im_what_code {
//! Change contact's status →Protocol //! Change contact's status →Protocol
IM_SET_NICKNAME = 40, IM_SET_NICKNAME = 40,
//! Contact's status has changed →Caya //! Contact's status has changed →App
IM_NICKNAME_SET = 41, IM_NICKNAME_SET = 41,
@ -103,26 +103,26 @@ enum im_what_code {
* Messages related to contact's information received from protocols. * Messages related to contact's information received from protocols.
*/ */
//! Received contact new status →Caya //! Received contact new status →App
// Requires: String "user_id", int32/CayaStatus "status" // Requires: String "user_id", int32/UserStatus "status"
IM_STATUS_SET = 60, IM_STATUS_SET = 60,
//! User's avatar icon was changed →Caya //! User's avatar icon was changed →App
// Requires: String "user_id", Ref "ref" // Requires: String "user_id", Ref "ref"
IM_AVATAR_SET = 61, IM_AVATAR_SET = 61,
//! Get contact information →Protocol //! Get contact information →Protocol
IM_GET_CONTACT_INFO = 62, IM_GET_CONTACT_INFO = 62,
//! Received contact information →Caya //! Received contact information →App
// Requires: String "user_id" // 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, IM_CONTACT_INFO = 63,
//! Request contact information →Protocol //! Request contact information →Protocol
IM_GET_EXTENDED_CONTACT_INFO = 64, IM_GET_EXTENDED_CONTACT_INFO = 64,
//! Received contact information →Caya //! Received contact information →App
// Requires: String "user_id", // Requires: String "user_id",
// non-standard slots used by "roster" template // non-standard slots used by "roster" template
// Accepts: String "user_name", String "full_name" // Accepts: String "user_name", String "full_name"
@ -137,15 +137,15 @@ enum im_what_code {
// Requires: String "user_name" // Requires: String "user_name"
IM_SET_OWN_NICKNAME = 80, IM_SET_OWN_NICKNAME = 80,
//! Own nickname was changed →Caya //! Own nickname was changed →App
IM_OWN_NICKNAME_SET = 81, IM_OWN_NICKNAME_SET = 81,
//! Change own status →Protocol //! Change own status →Protocol
// Requires: int32/CayaStatus "status" // Requires: int32/UserStatus "status"
IM_SET_OWN_STATUS = 82, IM_SET_OWN_STATUS = 82,
// Own status was changed →Caya // Own status was changed →App
// Requires: int32/CayaStatus "status" // Requires: int32/UserStatus "status"
IM_OWN_STATUS_SET = 83, IM_OWN_STATUS_SET = 83,
//! Get own contact information //! Get own contact information
@ -208,14 +208,14 @@ enum im_what_code {
//! Create an individual chat →Protocol //! Create an individual chat →Protocol
// Individual chats and rooms are really the same thing (at least according // 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 // 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 // should be derivable from the user's ID (when sent back from
// CHAT_CREATED). It doesn't matter how you get this done, really. // CHAT_CREATED). It doesn't matter how you get this done, really.
// Requires: String "user_id" // Requires: String "user_id"
IM_CREATE_CHAT = 150, IM_CREATE_CHAT = 150,
//! Chat has been created →Caya //! Chat has been created →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
IM_CHAT_CREATED = 151, IM_CHAT_CREATED = 151,
@ -223,10 +223,10 @@ enum im_what_code {
// The required slots for this message are completely determined by the // The required slots for this message are completely determined by the
// protocol itself― the protocol will just receive data from the // protocol itself― the protocol will just receive data from the
// "room" template (which is fetched via // "room" template (which is fetched via
// CayaProtocol::SettingsTemplate("room") // ChatProtocol::SettingsTemplate("room")
IM_CREATE_ROOM = 152, IM_CREATE_ROOM = 152,
//! Inform Caya room was created →Caya //! Inform App room was created →App
// Just a semantically-dressed IM_ROOM_JOINED // Just a semantically-dressed IM_ROOM_JOINED
// Requires: String "chat_id" // Requires: String "chat_id"
IM_ROOM_CREATED = 153, IM_ROOM_CREATED = 153,
@ -235,7 +235,7 @@ enum im_what_code {
// Requires: String "chat_id" // Requires: String "chat_id"
IM_JOIN_ROOM = 154, IM_JOIN_ROOM = 154,
//! Confirm the room's been joined →Caya //! Confirm the room's been joined →App
// Requires: String "chat_id" // Requires: String "chat_id"
IM_ROOM_JOINED = 155, IM_ROOM_JOINED = 155,
@ -243,7 +243,7 @@ enum im_what_code {
// Requires: String "chat_id" // Requires: String "chat_id"
IM_LEAVE_ROOM = 156, IM_LEAVE_ROOM = 156,
//! User left the room →Caya //! User left the room →App
// Requires: String "chat_id" // Requires: String "chat_id"
IM_ROOM_LEFT = 157, IM_ROOM_LEFT = 157,
@ -251,18 +251,18 @@ enum im_what_code {
// Requires: String "chat_id" // Requires: String "chat_id"
IM_GET_ROOM_PARTICIPANTS = 158, 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. // Shouldn't be sent automatically on joining a room.
// Requires: String "chat_id", StringList "user_id" // Requires: String "chat_id", StringList "user_id"
// Accepts: StringList "user_name" // Accepts: StringList "user_name"
IM_ROOM_PARTICIPANTS = 159, IM_ROOM_PARTICIPANTS = 159,
//! User has explicitly joined →Caya //! User has explicitly joined →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
// Accepts: String "body" // Accepts: String "body"
IM_ROOM_PARTICIPANT_JOINED = 160, IM_ROOM_PARTICIPANT_JOINED = 160,
//! A user left the room →Caya //! A user left the room →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
// Accepts: String "user_name", String "body" // Accepts: String "user_name", String "body"
IM_ROOM_PARTICIPANT_LEFT = 161, IM_ROOM_PARTICIPANT_LEFT = 161,
@ -273,12 +273,12 @@ enum im_what_code {
// Accepts: String "body" // Accepts: String "body"
IM_ROOM_SEND_INVITE = 162, IM_ROOM_SEND_INVITE = 162,
//! Invitee explicitly refused →Caya //! Invitee explicitly refused →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
// Accepts: String "user_name", String "body" // Accepts: String "user_name", String "body"
IM_ROOM_INVITE_REFUSED = 163, IM_ROOM_INVITE_REFUSED = 163,
//! User was invited to a room →Caya //! User was invited to a room →App
// Requires: String "chat_id" // Requires: String "chat_id"
// Accepts: String "user_id", String "chat_name", String "body" // Accepts: String "user_id", String "chat_name", String "body"
IM_ROOM_INVITE_RECEIVED = 164, IM_ROOM_INVITE_RECEIVED = 164,
@ -300,7 +300,7 @@ enum im_what_code {
// Requires: String "chat_id" // Requires: String "chat_id"
IM_GET_ROOM_METADATA = 170, 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 // The idea is that all other metadata-related messages should only be
// called either from a request, or from a change. // called either from a request, or from a change.
// This shouldn't be sent automatically upon joining a room. // 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" // Requires: String "chat_id", String "chat_name"
IM_ROOM_NAME_SET = 173, IM_ROOM_NAME_SET = 173,
//! Set the room subject →Caya //! Set the room subject →App
// Requires: String "chat_id", String "subject" // Requires: String "chat_id", String "subject"
IM_SET_ROOM_SUBJECT = 174, IM_SET_ROOM_SUBJECT = 174,
//! Subject has been changed →Caya //! Subject has been changed →App
// Requires: String "chat_id", String "subject" // Requires: String "chat_id", String "subject"
IM_ROOM_SUBJECT_SET = 175, IM_ROOM_SUBJECT_SET = 175,
@ -330,7 +330,7 @@ enum im_what_code {
* Room moderation * 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" // Requires: String "role_title", int32 "role_perms", int32 "role_priority"
IM_ROOM_ROLECHANGED = 190, IM_ROOM_ROLECHANGED = 190,
@ -338,7 +338,7 @@ enum im_what_code {
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
IM_ROOM_KICK_PARTICIPANT = 191, IM_ROOM_KICK_PARTICIPANT = 191,
//! A user was kicked →Caya //! A user was kicked →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
// Accepts: String "user_name", String "body" // Accepts: String "user_name", String "body"
IM_ROOM_PARTICIPANT_KICKED = 192, IM_ROOM_PARTICIPANT_KICKED = 192,
@ -347,7 +347,7 @@ enum im_what_code {
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
IM_ROOM_BAN_PARTICIPANT = 193, IM_ROOM_BAN_PARTICIPANT = 193,
//! A user was banned →Caya //! A user was banned →App
// Requires: String "chat_id", String "user_id" // Requires: String "chat_id", String "user_id"
// Accepts: String "user_name", String "body" // Accepts: String "user_name", String "body"
IM_ROOM_PARTICIPANT_BANNED = 194, IM_ROOM_PARTICIPANT_BANNED = 194,
@ -390,6 +390,4 @@ enum im_what_code {
IM_PROTOCOL_READY = 1002, IM_PROTOCOL_READY = 1002,
}; };
#endif // _CHAT_PROTOCOL_MESSAGES_H
#endif // _CAYA_PROTOCOL_MESSAGES_H

View File

@ -9,7 +9,7 @@
*/ */
#include "Contact.h" #include "Contact.h"
#include "CayaUtils.h" #include "Utils.h"
#include "ProtocolLooper.h" #include "ProtocolLooper.h"
#include "RosterItem.h" #include "RosterItem.h"
@ -44,7 +44,7 @@ Contact::_EnsureCachePath()
{ {
if (fCachePath.InitCheck() == B_OK) if (fCachePath.InitCheck() == B_OK)
return; return;
fCachePath.SetTo(CayaContactCachePath(fLooper->Protocol()->GetName(), fCachePath.SetTo(ContactCachePath(fLooper->Protocol()->GetName(),
fID.String())); fID.String()));
} }

View File

@ -11,7 +11,7 @@
#include <Messenger.h> #include <Messenger.h>
#include <Path.h> #include <Path.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "User.h" #include "User.h"
class BBitmap; class BBitmap;

View File

@ -9,10 +9,9 @@
#include <Locale.h> #include <Locale.h>
#include <StringList.h> #include <StringList.h>
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaRenderView.h" #include "RenderView.h"
#include "CayaUtils.h"
#include "ChatCommand.h" #include "ChatCommand.h"
#include "ConversationItem.h" #include "ConversationItem.h"
#include "ConversationView.h" #include "ConversationView.h"
@ -23,6 +22,7 @@
#include "RoomFlags.h" #include "RoomFlags.h"
#include "Server.h" #include "Server.h"
#include "TheApp.h" #include "TheApp.h"
#include "Utils.h"
Conversation::Conversation(BString id, BMessenger msgn) Conversation::Conversation(BString id, BMessenger msgn)
@ -235,8 +235,8 @@ Conversation::SetProtocolLooper(ProtocolLooper* looper)
BBitmap* BBitmap*
Conversation::ProtocolBitmap() const Conversation::ProtocolBitmap() const
{ {
CayaProtocol* protocol = fLooper->Protocol(); ChatProtocol* protocol = fLooper->Protocol();
CayaProtocolAddOn* addOn ChatProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol->Signature()); = ProtocolManager::Get()->ProtocolAddOn(protocol->Signature());
return addOn->ProtoIcon(); return addOn->ProtoIcon();
@ -405,7 +405,7 @@ Conversation::_LogChatMessage(BMessage* msg)
newLogMsg.AddInt64("when", times[i]); newLogMsg.AddInt64("when", times[i]);
BFile logFile(fCachePath.Path(), B_READ_WRITE | B_OPEN_AT_END | B_CREATE_FILE); 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 // Plain-text logs
BString uname; BString uname;
@ -428,7 +428,7 @@ Conversation::_GetChatLogs(BMessage* msg)
BFile logFile(fCachePath.Path(), B_READ_WRITE | B_CREATE_FILE); 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) if (cacheFile.InitCheck() != B_OK)
return; 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) if (cacheFile.InitCheck() != B_OK)
return; 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) if (fCachePath.InitCheck() == B_OK)
return; return;
fCachePath.SetTo(CayaRoomCachePath(fLooper->Protocol()->GetName(), fCachePath.SetTo(RoomCachePath(fLooper->Protocol()->GetName(),
fID.String())); fID.String()));
} }

View File

@ -8,8 +8,8 @@
#include <Looper.h> #include <Looper.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "ChatCommand.h" #include "ChatCommand.h"
#include "Role.h" #include "Role.h"
@ -80,7 +80,7 @@ DefaultCommands()
invite->SetDesc("Invite a user to the current room."); invite->SetDesc("Invite a user to the current room.");
commands.AddItem("invite", invite); commands.AddItem("invite", invite);
BMessage helpMsg(CAYA_REQUEST_HELP); BMessage helpMsg(APP_REQUEST_HELP);
ChatCommand* help = new ChatCommand("help", helpMsg, false, List<int>()); ChatCommand* help = new ChatCommand("help", helpMsg, false, List<int>());
help->SetDesc("List all current commands, or get help for certain command."); help->SetDesc("List all current commands, or get help for certain command.");
commands.AddItem("help", help); commands.AddItem("help", help);
@ -119,7 +119,7 @@ DefaultUserPopUpItems()
{ {
BObjectList<BMessage> items; BObjectList<BMessage> 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, items.AddItem(_UserMenuItem("User info" B_UTF8_ELLIPSIS, infoMsg, 0,
0, 0, false, false)); 0, 0, false, false));

View File

@ -10,7 +10,7 @@
#include <Message.h> #include <Message.h>
#include <Window.h> #include <Window.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "EditingFilter.h" #include "EditingFilter.h"
@ -39,7 +39,7 @@ EditingFilter::Filter(BMessage* message, BHandler** target)
fView->Insert("\n"); fView->Insert("\n");
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
} else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) { } else if ((modifiers & B_COMMAND_KEY) == 0 && byte == B_ENTER) {
fView->Window()->PostMessage(CAYA_CHAT); fView->Window()->PostMessage(APP_CHAT);
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
} }

View File

@ -17,8 +17,8 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include "CayaResources.h" #include "AppResources.h"
#include "CayaUtils.h" #include "Utils.h"
ImageCache* ImageCache::fInstance = NULL; ImageCache* ImageCache::fInstance = NULL;
@ -93,7 +93,7 @@ ImageCache::Release()
void void
ImageCache::_LoadResource(int identifier, const char* key) ImageCache::_LoadResource(int identifier, const char* key)
{ {
BResources* res = CayaResources(); BResources* res = ChatResources();
BBitmap* bitmap = IconFromResources(res, identifier, B_LARGE_ICON); BBitmap* bitmap = IconFromResources(res, identifier, B_LARGE_ICON);
if (bitmap != NULL && bitmap->IsValid() == true) if (bitmap != NULL && bitmap->IsValid() == true)
fBitmaps.AddItem(BString(key), bitmap); fBitmaps.AddItem(BString(key), bitmap);

View File

@ -34,8 +34,7 @@ APP_MIME_SIG = application/x-vnd.caya.Caya
SRCS = \ SRCS = \
application/Account.cpp \ application/Account.cpp \
application/AccountManager.cpp \ application/AccountManager.cpp \
application/CayaProtocolAddOn.cpp \ application/ChatProtocolAddOn.cpp \
application/CayaUtils.cpp \
application/ChatCommand.cpp \ application/ChatCommand.cpp \
application/Contact.cpp \ application/Contact.cpp \
application/Conversation.cpp \ application/Conversation.cpp \
@ -51,14 +50,15 @@ SRCS = \
application/Server.cpp \ application/Server.cpp \
application/TheApp.cpp \ application/TheApp.cpp \
application/User.cpp \ application/User.cpp \
application/Utils.cpp \
application/preferences/AccountDialog.cpp \ application/preferences/AccountDialog.cpp \
application/preferences/AccountListItem.cpp \ application/preferences/AccountListItem.cpp \
application/preferences/CayaPreferences.cpp \ application/preferences/AppPreferences.cpp \
application/preferences/PreferencesChatWindow.cpp \ application/preferences/PreferencesChatWindow.cpp \
application/preferences/PreferencesAccounts.cpp \ application/preferences/PreferencesAccounts.cpp \
application/preferences/PreferencesBehavior.cpp \ application/preferences/PreferencesBehavior.cpp \
application/preferences/PreferencesReplicant.cpp \ application/preferences/PreferencesReplicant.cpp \
application/views/CayaRenderView.cpp \ application/views/RenderView.cpp \
application/views/ConversationAccountItem.cpp \ application/views/ConversationAccountItem.cpp \
application/views/ConversationItem.cpp \ application/views/ConversationItem.cpp \
application/views/ConversationListView.cpp \ application/views/ConversationListView.cpp \

View File

@ -19,7 +19,7 @@
#include "ConversationAccountItem.h" #include "ConversationAccountItem.h"
ProtocolLooper::ProtocolLooper(CayaProtocol* protocol, int64 instance) ProtocolLooper::ProtocolLooper(ChatProtocol* protocol, int64 instance)
: :
BLooper(), BLooper(),
fProtocol(protocol), fProtocol(protocol),
@ -54,7 +54,7 @@ ProtocolLooper::MessageReceived(BMessage* msg)
} }
CayaProtocol* ChatProtocol*
ProtocolLooper::Protocol() ProtocolLooper::Protocol()
{ {
return fProtocol; return fProtocol;

View File

@ -13,7 +13,7 @@
#include <libsupport/KeyMap.h> #include <libsupport/KeyMap.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "ChatCommand.h" #include "ChatCommand.h"
class Contact; class Contact;
@ -29,12 +29,12 @@ typedef KeyMap<BString, User*> UserMap;
class ProtocolLooper : public BLooper { class ProtocolLooper : public BLooper {
public: public:
ProtocolLooper(CayaProtocol* protocol, int64 instance); ProtocolLooper(ChatProtocol* protocol, int64 instance);
~ProtocolLooper(); ~ProtocolLooper();
void MessageReceived(BMessage* msg); void MessageReceived(BMessage* msg);
CayaProtocol* Protocol(); ChatProtocol* Protocol();
ChatMap Conversations() const; ChatMap Conversations() const;
Conversation* ConversationById(BString id); Conversation* ConversationById(BString id);
@ -64,7 +64,7 @@ public:
private: private:
void _InitCommands(); void _InitCommands();
CayaProtocol* fProtocol; ChatProtocol* fProtocol;
int64 fInstance; int64 fInstance;
BString fMySelf; BString fMySelf;

View File

@ -15,11 +15,11 @@
#include "Account.h" #include "Account.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "CayaUtils.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "Server.h" #include "Server.h"
#include "TheApp.h" #include "TheApp.h"
#include "Utils.h"
static ProtocolManager* fInstance = NULL; static ProtocolManager* fInstance = NULL;
@ -41,17 +41,17 @@ ProtocolManager::Init(BDirectory dir, BHandler* target)
continue; continue;
// If add-on's API version fits then load accounts... // If add-on's API version fits then load accounts...
CayaProtocolAddOn* addOn = new CayaProtocolAddOn(id, path.Path()); ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, path.Path());
if (addOn->Version() != CAYA_VERSION) if (addOn->Version() != APP_VERSION)
continue; continue;
// If add-on has multiple protocols, also load them // If add-on has multiple protocols, also load them
for (int32 i = 0; i < addOn->CountProtocols(); i++) { for (int32 i = 0; i < addOn->CountProtocols(); i++) {
CayaProtocolAddOn* subAddOn = addOn; ChatProtocolAddOn* subAddOn = addOn;
if (i > 0) 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); fAddOnMap.AddItem(proto->Signature(), subAddOn);
_LoadAccounts(path.Path(), subAddOn, i, target); _LoadAccounts(path.Path(), subAddOn, i, target);
@ -82,14 +82,14 @@ ProtocolManager::CountProtocolAddOns() const
} }
CayaProtocolAddOn* ChatProtocolAddOn*
ProtocolManager::ProtocolAddOnAt(uint32 i) const ProtocolManager::ProtocolAddOnAt(uint32 i) const
{ {
return fAddOnMap.ValueAt(i); return fAddOnMap.ValueAt(i);
} }
CayaProtocolAddOn* ChatProtocolAddOn*
ProtocolManager::ProtocolAddOn(const char* signature) ProtocolManager::ProtocolAddOn(const char* signature)
{ {
return fAddOnMap.ValueFor(signature); return fAddOnMap.ValueFor(signature);
@ -103,14 +103,14 @@ ProtocolManager::CountProtocolInstances() const
} }
CayaProtocol* ChatProtocol*
ProtocolManager::ProtocolInstanceAt(uint32 i) const ProtocolManager::ProtocolInstanceAt(uint32 i) const
{ {
return fProtocolMap.ValueAt(i); return fProtocolMap.ValueAt(i);
} }
CayaProtocol* ChatProtocol*
ProtocolManager::ProtocolInstance(bigtime_t identifier) ProtocolManager::ProtocolInstance(bigtime_t identifier)
{ {
return fProtocolMap.ValueFor(identifier); return fProtocolMap.ValueFor(identifier);
@ -118,11 +118,11 @@ ProtocolManager::ProtocolInstance(bigtime_t identifier)
void void
ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account, ProtocolManager::AddAccount(ChatProtocolAddOn* addOn, const char* account,
BHandler* target) BHandler* target)
{ {
bigtime_t instanceId = system_time(); bigtime_t instanceId = system_time();
CayaProtocol* cayap = addOn->Protocol(); ChatProtocol* cayap = addOn->Protocol();
(void)new Account(instanceId, cayap, account, addOn->Signature(), target); (void)new Account(instanceId, cayap, account, addOn->Signature(), target);
fProtocolMap.AddItem(instanceId, cayap); fProtocolMap.AddItem(instanceId, cayap);
@ -133,11 +133,11 @@ ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account,
void void
ProtocolManager::_LoadAccounts(const char* image_path, CayaProtocolAddOn* addOn, ProtocolManager::_LoadAccounts(const char* image_path, ChatProtocolAddOn* addOn,
int protoIndex, BHandler* target) int protoIndex, BHandler* target)
{ {
// Find accounts path for this protocol // 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) if (path.InitCheck() != B_OK)
return; return;
@ -160,8 +160,8 @@ ProtocolManager::_LoadAccount(const char* imagePath, BEntry accountEntry,
return; return;
// If add-on's API version fits then load accounts... // If add-on's API version fits then load accounts...
CayaProtocolAddOn* addOn = new CayaProtocolAddOn(id, imagePath, protoIndex); ChatProtocolAddOn* addOn = new ChatProtocolAddOn(id, imagePath, protoIndex);
if (addOn->Version() != CAYA_VERSION) if (addOn->Version() != APP_VERSION)
return; return;
_LoadAccount(addOn, accountEntry, target); _LoadAccount(addOn, accountEntry, target);
@ -169,7 +169,7 @@ ProtocolManager::_LoadAccount(const char* imagePath, BEntry accountEntry,
void void
ProtocolManager::_LoadAccount(CayaProtocolAddOn* addOn, BEntry accountEntry, ProtocolManager::_LoadAccount(ChatProtocolAddOn* addOn, BEntry accountEntry,
BHandler* target) BHandler* target)
{ {
BFile file(&accountEntry, B_READ_ONLY); BFile file(&accountEntry, B_READ_ONLY);

View File

@ -11,8 +11,8 @@
#include <libsupport/KeyMap.h> #include <libsupport/KeyMap.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "CayaProtocolAddOn.h" #include "ChatProtocolAddOn.h"
class BBitmap; class BBitmap;
class BDirectory; class BDirectory;
@ -25,30 +25,30 @@ public:
static ProtocolManager* Get(); static ProtocolManager* Get();
uint32 CountProtocolAddOns() const; uint32 CountProtocolAddOns() const;
CayaProtocolAddOn* ProtocolAddOnAt(uint32 i) const; ChatProtocolAddOn* ProtocolAddOnAt(uint32 i) const;
CayaProtocolAddOn* ProtocolAddOn(const char* signature); ChatProtocolAddOn* ProtocolAddOn(const char* signature);
uint32 CountProtocolInstances() const; uint32 CountProtocolInstances() const;
CayaProtocol* ProtocolInstanceAt(uint32 i) const; ChatProtocol* ProtocolInstanceAt(uint32 i) const;
CayaProtocol* ProtocolInstance(bigtime_t identifier); ChatProtocol* ProtocolInstance(bigtime_t identifier);
void AddAccount(CayaProtocolAddOn* addOn, void AddAccount(ChatProtocolAddOn* addOn,
const char* account, const char* account,
BHandler* target); BHandler* target);
private: private:
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap; typedef KeyMap<BString, ChatProtocolAddOn*> AddOnMap;
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap; typedef KeyMap<bigtime_t, ChatProtocol*> ProtocolMap;
ProtocolManager(); ProtocolManager();
void _LoadAccounts(const char* image_path, void _LoadAccounts(const char* image_path,
CayaProtocolAddOn* addOn, int protoIndex, ChatProtocolAddOn* addOn, int protoIndex,
BHandler* target); BHandler* target);
void _LoadAccount(const char* imagePath, void _LoadAccount(const char* imagePath,
BEntry accountEntry, int protoIndex, BEntry accountEntry, int protoIndex,
BHandler* target); BHandler* target);
void _LoadAccount(CayaProtocolAddOn* addOn, void _LoadAccount(ChatProtocolAddOn* addOn,
BEntry accountEntry, BHandler* target); BEntry accountEntry, BHandler* target);
AddOnMap fAddOnMap; AddOnMap fAddOnMap;

View File

@ -18,11 +18,11 @@
#include <ObjectList.h> #include <ObjectList.h>
#include <Path.h> #include <Path.h>
#include "CayaProtocolAddOn.h" #include "ChatProtocolAddOn.h"
#include "CayaUtils.h" #include "Utils.h"
ProtocolSettings::ProtocolSettings(CayaProtocolAddOn* addOn) ProtocolSettings::ProtocolSettings(ChatProtocolAddOn* addOn)
: :
fTemplate(addOn->Protocol(), "account"), fTemplate(addOn->Protocol(), "account"),
fAddOn(addOn) fAddOn(addOn)
@ -37,7 +37,7 @@ ProtocolSettings::InitCheck() const
} }
CayaProtocolAddOn* ChatProtocolAddOn*
ProtocolSettings::AddOn() const ProtocolSettings::AddOn() const
{ {
return fAddOn; return fAddOn;
@ -49,7 +49,7 @@ ProtocolSettings::Accounts() const
{ {
BObjectList<BString> list(true); BObjectList<BString> list(true);
BPath path(CayaAccountPath(fAddOn->Signature(), fAddOn->ProtoSignature())); BPath path(AccountPath(fAddOn->Signature(), fAddOn->ProtoSignature()));
if (path.InitCheck() != B_OK) if (path.InitCheck() != B_OK)
return list; return list;
@ -99,7 +99,7 @@ ProtocolSettings::Save(const char* account, BView* parent, BString* errorText)
status_t ret = B_ERROR; status_t ret = B_ERROR;
// Find user's settings path // 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) if ((ret = path.InitCheck()) != B_OK)
return ret; return ret;
@ -117,7 +117,7 @@ ProtocolSettings::Rename(const char* from, const char* to)
status_t ret = B_ERROR; status_t ret = B_ERROR;
// Find user's settings path // 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) if ((ret = path.InitCheck()) != B_OK)
return ret; return ret;
@ -139,7 +139,7 @@ ProtocolSettings::Delete(const char* account)
status_t ret = B_ERROR; status_t ret = B_ERROR;
// Find user's settings path // 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) if ((ret = path.InitCheck()) != B_OK)
return ret; return ret;
@ -166,7 +166,7 @@ ProtocolSettings::_Load(const char* account, BMessage** settings)
status_t ret = B_ERROR; status_t ret = B_ERROR;
// Find user's settings path // 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) if ((ret = path.InitCheck()) != B_OK)
return ret; return ret;

View File

@ -13,15 +13,15 @@
#include "ProtocolTemplate.h" #include "ProtocolTemplate.h"
class BMessage; class BMessage;
class CayaProtocolAddOn; class ChatProtocolAddOn;
class ProtocolSettings { class ProtocolSettings {
public: public:
ProtocolSettings(CayaProtocolAddOn* addOn); ProtocolSettings(ChatProtocolAddOn* addOn);
status_t InitCheck() const; status_t InitCheck() const;
CayaProtocolAddOn* AddOn() const; ChatProtocolAddOn* AddOn() const;
BObjectList<BString> Accounts() const; BObjectList<BString> Accounts() const;
status_t Load(const char* account, BView* parent); status_t Load(const char* account, BView* parent);
@ -34,7 +34,7 @@ public:
private: private:
status_t _Load(const char* account, BMessage** settings); status_t _Load(const char* account, BMessage** settings);
CayaProtocolAddOn* fAddOn; ChatProtocolAddOn* fAddOn;
ProtocolTemplate fTemplate; ProtocolTemplate fTemplate;
status_t fStatus; status_t fStatus;
}; };

View File

@ -25,14 +25,14 @@
#include <libinterface/NotifyingTextView.h> #include <libinterface/NotifyingTextView.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "CayaProtocolAddOn.h" #include "ChatProtocolAddOn.h"
const float kDividerWidth = 1.0f; const float kDividerWidth = 1.0f;
ProtocolTemplate::ProtocolTemplate(CayaProtocol* protocol, const char* type) ProtocolTemplate::ProtocolTemplate(ChatProtocol* protocol, const char* type)
: :
fProtocol(protocol), fProtocol(protocol),
fTemplate(new BMessage()) fTemplate(new BMessage())
@ -58,7 +58,7 @@ ProtocolTemplate::~ProtocolTemplate()
} }
CayaProtocol* ChatProtocol*
ProtocolTemplate::Protocol() const ProtocolTemplate::Protocol() const
{ {
return fProtocol; return fProtocol;

View File

@ -12,25 +12,25 @@
class BMessage; class BMessage;
class BString; class BString;
class BView; class BView;
class CayaProtocol; class ChatProtocol;
class ProtocolTemplate { class ProtocolTemplate {
public: public:
ProtocolTemplate(CayaProtocol* protocol, ProtocolTemplate(ChatProtocol* protocol,
const char* type); const char* type);
ProtocolTemplate(BMessage pTemplate); ProtocolTemplate(BMessage pTemplate);
~ProtocolTemplate(); ~ProtocolTemplate();
status_t InitCheck() const; status_t InitCheck() const;
CayaProtocol* Protocol() const; ChatProtocol* Protocol() const;
status_t Load(BView* parent, BMessage* settings = NULL); status_t Load(BView* parent, BMessage* settings = NULL);
status_t Save(BView* parent, BMessage* settings, status_t Save(BView* parent, BMessage* settings,
BString* errorText = NULL); BString* errorText = NULL);
private: private:
CayaProtocol* fProtocol; ChatProtocol* fProtocol;
BMessage* fTemplate; BMessage* fTemplate;
}; };

View File

@ -25,11 +25,10 @@
#include "Account.h" #include "Account.h"
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaUtils.h"
#include "DefaultItems.h" #include "DefaultItems.h"
#include "ImageCache.h" #include "ImageCache.h"
#include "InviteDialogue.h" #include "InviteDialogue.h"
@ -38,6 +37,7 @@
#include "RoomFlags.h" #include "RoomFlags.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "UserInfoWindow.h" #include "UserInfoWindow.h"
#include "Utils.h"
Server::Server() Server::Server()
@ -70,7 +70,7 @@ Server::LoginAll()
BMessage* msg = new BMessage(IM_MESSAGE); BMessage* msg = new BMessage(IM_MESSAGE);
msg->AddInt32("im_what", IM_SET_OWN_STATUS); msg->AddInt32("im_what", IM_SET_OWN_STATUS);
msg->AddInt32("status", CAYA_ONLINE); msg->AddInt32("status", STATUS_ONLINE);
looper->PostMessage(msg); looper->PostMessage(msg);
} }
} }
@ -82,7 +82,7 @@ Server::Filter(BMessage* message, BHandler **target)
filter_result result = B_DISPATCH_MESSAGE; filter_result result = B_DISPATCH_MESSAGE;
switch (message->what) { switch (message->what) {
case CAYA_CLOSE_CHAT_WINDOW: case APP_CLOSE_CHAT_WINDOW:
{ {
BString id = message->FindString("chat_id"); BString id = message->FindString("chat_id");
if (id.Length() > 0) { if (id.Length() > 0) {
@ -96,7 +96,7 @@ Server::Filter(BMessage* message, BHandler **target)
result = ImMessage(message); result = ImMessage(message);
break; break;
case CAYA_REPLICANT_MESSENGER: case APP_REPLICANT_MESSENGER:
{ {
BMessenger* messenger = new BMessenger(); BMessenger* messenger = new BMessenger();
@ -113,7 +113,7 @@ Server::Filter(BMessage* message, BHandler **target)
break; break;
} }
case CAYA_DISABLE_ACCOUNT: case APP_DISABLE_ACCOUNT:
{ {
int64 instance = 0; int64 instance = 0;
if (message->FindInt64("instance", &instance) != B_OK) { if (message->FindInt64("instance", &instance) != B_OK) {
@ -124,7 +124,7 @@ Server::Filter(BMessage* message, BHandler **target)
break; break;
} }
case CAYA_USER_INFO: case APP_USER_INFO:
{ {
User* user = _EnsureUser(message); User* user = _EnsureUser(message);
if (user != NULL) { if (user != NULL) {
@ -134,7 +134,7 @@ Server::Filter(BMessage* message, BHandler **target)
break; break;
} }
case CAYA_REQUEST_HELP: case APP_REQUEST_HELP:
{ {
BString body; BString body;
BString cmd_name = message->FindString("misc_str"); BString cmd_name = message->FindString("misc_str");
@ -222,7 +222,7 @@ Server::ImMessage(BMessage* msg)
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
AccountManager* accountManager = AccountManager::Get(); AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((CayaStatus)status); accountManager->SetStatus((UserStatus)status);
break; break;
} }
@ -237,7 +237,7 @@ Server::ImMessage(BMessage* msg)
if (!user) if (!user)
break; break;
user->SetNotifyStatus((CayaStatus)status); user->SetNotifyStatus((UserStatus)status);
BString statusMsg; BString statusMsg;
if (msg->FindString("message", &statusMsg) == B_OK) { if (msg->FindString("message", &statusMsg) == B_OK) {
user->SetNotifyPersonalStatus(statusMsg); user->SetNotifyPersonalStatus(statusMsg);
@ -495,10 +495,10 @@ Server::ImMessage(BMessage* msg)
if (msg->FindFloat("progress", &progress) != B_OK) if (msg->FindFloat("progress", &progress) != B_OK)
return result; return result;
if (!CayaPreferences::Item()->NotifyProtocolStatus) if (!AppPreferences::Item()->NotifyProtocolStatus)
break; break;
CayaProtocolAddOn* addOn ChatProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol); = ProtocolManager::Get()->ProtocolAddOn(protocol);
BNotification notification(B_PROGRESS_NOTIFICATION); BNotification notification(B_PROGRESS_NOTIFICATION);
@ -527,10 +527,10 @@ Server::ImMessage(BMessage* msg)
if (msg->FindString("message", &message) != B_OK) if (msg->FindString("message", &message) != B_OK)
return result; return result;
if (!CayaPreferences::Item()->NotifyProtocolStatus) if (!AppPreferences::Item()->NotifyProtocolStatus)
break; break;
CayaProtocolAddOn* addOn ChatProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol); = ProtocolManager::Get()->ProtocolAddOn(protocol);
BNotification notification((notification_type)type); BNotification notification((notification_type)type);
@ -548,7 +548,7 @@ Server::ImMessage(BMessage* msg)
ProtocolLooper* looper = _LooperFromMessage(msg); ProtocolLooper* looper = _LooperFromMessage(msg);
if (looper == NULL) if (looper == NULL)
break; break;
CayaProtocol* proto = looper->Protocol(); ChatProtocol* proto = looper->Protocol();
BString content("%user% has connected!"); BString content("%user% has connected!");
content.ReplaceAll("%user%", looper->Protocol()->GetName()); content.ReplaceAll("%user%", looper->Protocol()->GetName());
@ -563,7 +563,7 @@ Server::ImMessage(BMessage* msg)
// Join cached rooms // Join cached rooms
BEntry entry; BEntry entry;
char fileName[B_FILE_NAME_LENGTH] = {'\0'}; char fileName[B_FILE_NAME_LENGTH] = {'\0'};
BDirectory dir(CayaRoomsCachePath(proto->GetName())); BDirectory dir(RoomsCachePath(proto->GetName()));
while (dir.GetNextEntry(&entry, true) == B_OK) while (dir.GetNextEntry(&entry, true) == B_OK)
if (entry.GetName(fileName) == B_OK) { if (entry.GetName(fileName) == B_OK) {
@ -572,7 +572,7 @@ Server::ImMessage(BMessage* msg)
if (file.InitCheck() != B_OK) if (file.InitCheck() != B_OK)
continue; continue;
if (file.ReadAttr("Caya:flags", B_INT32_TYPE, 0, &flags, if (file.ReadAttr("Chat:flags", B_INT32_TYPE, 0, &flags,
sizeof(int32)) < 0) sizeof(int32)) < 0)
continue; continue;
@ -601,7 +601,7 @@ Server::ImMessage(BMessage* msg)
void void
Server::AddProtocolLooper(bigtime_t instanceId, CayaProtocol* cayap) Server::AddProtocolLooper(bigtime_t instanceId, ChatProtocol* cayap)
{ {
ProtocolLooper* looper = new ProtocolLooper(cayap, instanceId); ProtocolLooper* looper = new ProtocolLooper(cayap, instanceId);
fLoopers.AddItem(instanceId, looper); fLoopers.AddItem(instanceId, looper);

View File

@ -11,14 +11,14 @@
#include <libsupport/KeyMap.h> #include <libsupport/KeyMap.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "ChatCommand.h" #include "ChatCommand.h"
#include "Contact.h" #include "Contact.h"
#include "Conversation.h" #include "Conversation.h"
#include "ProtocolLooper.h" #include "ProtocolLooper.h"
#include "User.h" #include "User.h"
class CayaProtocol; class ChatProtocol;
class RosterItem; class RosterItem;
class ProtocolLooper; class ProtocolLooper;
@ -37,7 +37,7 @@ public:
filter_result ImMessage(BMessage* msg); filter_result ImMessage(BMessage* msg);
void AddProtocolLooper(bigtime_t instanceId, void AddProtocolLooper(bigtime_t instanceId,
CayaProtocol* cayap); ChatProtocol* cayap);
void RemoveProtocolLooper(bigtime_t instanceId); void RemoveProtocolLooper(bigtime_t instanceId);
ProtocolLooper* GetProtocolLooper(bigtime_t instanceId); ProtocolLooper* GetProtocolLooper(bigtime_t instanceId);
@ -74,7 +74,7 @@ private:
Role* _GetRole(BMessage* msg); Role* _GetRole(BMessage* msg);
void _ReplicantStatusNotify(CayaStatus status); void _ReplicantStatusNotify(UserStatus status);
ProtocolLoopers fLoopers; ProtocolLoopers fLoopers;
AccountInstances AccountInstances

View File

@ -20,7 +20,7 @@
#include "AboutWindow.h" #include "AboutWindow.h"
#include "Caya.h" #include "Caya.h"
#include "CayaMessages.h" #include "AppMessages.h"
#include "FilePanel.h" #include "FilePanel.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
@ -30,7 +30,7 @@
TheApp::TheApp() TheApp::TheApp()
: :
BApplication(CAYA_SIGNATURE), BApplication(APP_SIGNATURE),
fMainWin(NULL) fMainWin(NULL)
{ {
} }
@ -100,6 +100,7 @@ TheApp::AboutRequested()
"Andrea Anzani", "Andrea Anzani",
"Dario Casalinuovo", "Dario Casalinuovo",
"Pier Luigi Fiorini", "Pier Luigi Fiorini",
"Jaidyn Levesque",
NULL NULL
}; };
@ -126,14 +127,14 @@ void
TheApp::MessageReceived(BMessage* message) TheApp::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case CAYA_REPLICANT_STATUS_SET: case APP_REPLICANT_STATUS_SET:
case CAYA_REPLICANT_SHOW_WINDOW: case APP_REPLICANT_SHOW_WINDOW:
case CAYA_SHOW_SETTINGS: case APP_SHOW_SETTINGS:
case CAYA_REPLICANT_MESSENGER: case APP_REPLICANT_MESSENGER:
DetachCurrentMessage(); DetachCurrentMessage();
fMainWin->PostMessage(message); fMainWin->PostMessage(message);
break; break;
case CAYA_REPLICANT_EXIT: case APP_REPLICANT_EXIT:
// TODO BAlert here // TODO BAlert here
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
break; break;

View File

@ -15,9 +15,8 @@
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include <TranslatorRoster.h> #include <TranslatorRoster.h>
#include "CayaProtocolAddOn.h" #include "ChatProtocolAddOn.h"
#include "CayaResources.h" #include "AppResources.h"
#include "CayaUtils.h"
#include "Conversation.h" #include "Conversation.h"
#include "ImageCache.h" #include "ImageCache.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
@ -25,6 +24,7 @@
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "UserItem.h" #include "UserItem.h"
#include "UserPopUp.h" #include "UserPopUp.h"
#include "Utils.h"
User::User(BString id, BMessenger msgn) User::User(BString id, BMessenger msgn)
@ -34,8 +34,8 @@ User::User(BString id, BMessenger msgn)
fMessenger(msgn), fMessenger(msgn),
fLooper(NULL), fLooper(NULL),
fListItem(NULL), fListItem(NULL),
fItemColor(CayaForegroundColor(ui_color(B_LIST_BACKGROUND_COLOR))), fItemColor(ForegroundColor(ui_color(B_LIST_BACKGROUND_COLOR))),
fStatus(CAYA_OFFLINE), fStatus(STATUS_OFFLINE),
fAvatarBitmap(NULL), fAvatarBitmap(NULL),
fPopUp(NULL) fPopUp(NULL)
{ {
@ -140,8 +140,8 @@ User::AvatarBitmap() const
BBitmap* BBitmap*
User::ProtocolBitmap() const User::ProtocolBitmap() const
{ {
CayaProtocol* protocol = fLooper->Protocol(); ChatProtocol* protocol = fLooper->Protocol();
CayaProtocolAddOn* addOn ChatProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol->Signature()); = ProtocolManager::Get()->ProtocolAddOn(protocol->Signature());
return addOn->ProtoIcon(); return addOn->ProtoIcon();
@ -159,7 +159,7 @@ User::GetListItem()
} }
CayaStatus UserStatus
User::GetNotifyStatus() const User::GetNotifyStatus() const
{ {
return fStatus; return fStatus;
@ -209,7 +209,7 @@ User::SetNotifyAvatarBitmap(BBitmap* bitmap)
void void
User::SetNotifyStatus(CayaStatus status) User::SetNotifyStatus(UserStatus status)
{ {
if (fStatus != status) { if (fStatus != status) {
fStatus = status; fStatus = status;
@ -240,7 +240,7 @@ User::_EnsureCachePath()
{ {
if (fCachePath.InitCheck() == B_OK) if (fCachePath.InitCheck() == B_OK)
return; return;
fCachePath.SetTo(CayaUserCachePath(fLooper->Protocol()->GetName(), fCachePath.SetTo(UserCachePath(fLooper->Protocol()->GetName(),
fID.String())); fID.String()));
} }

View File

@ -15,7 +15,7 @@
#include <libsupport/KeyMap.h> #include <libsupport/KeyMap.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "Notifier.h" #include "Notifier.h"
class BBitmap; class BBitmap;
@ -55,12 +55,12 @@ public:
BString GetName() const; BString GetName() const;
BBitmap* AvatarBitmap() const; BBitmap* AvatarBitmap() const;
CayaStatus GetNotifyStatus() const; UserStatus GetNotifyStatus() const;
BString GetNotifyPersonalStatus() const; BString GetNotifyPersonalStatus() const;
void SetNotifyName(BString name); void SetNotifyName(BString name);
void SetNotifyAvatarBitmap(BBitmap* bitmap); void SetNotifyAvatarBitmap(BBitmap* bitmap);
void SetNotifyStatus(CayaStatus status); void SetNotifyStatus(UserStatus status);
void SetNotifyPersonalStatus(BString personalStatus); void SetNotifyPersonalStatus(BString personalStatus);
ChatMap Conversations(); ChatMap Conversations();
@ -84,7 +84,7 @@ protected:
BString fPersonalStatus; BString fPersonalStatus;
BBitmap* fAvatarBitmap; BBitmap* fAvatarBitmap;
BPath fCachePath; BPath fCachePath;
CayaStatus fStatus; UserStatus fStatus;
UserPopUp* fPopUp; UserPopUp* fPopUp;
ChatMap fConversations; ChatMap fConversations;
}; };

View File

@ -18,24 +18,24 @@
#include <kernel/fs_attr.h> #include <kernel/fs_attr.h>
#include "CayaUtils.h" #include "Utils.h"
const char* const char*
CayaStatusToString(CayaStatus status) UserStatusToString(UserStatus status)
{ {
switch (status) { switch (status) {
case CAYA_ONLINE: case STATUS_ONLINE:
return "Available"; return "Available";
case CAYA_AWAY: case STATUS_AWAY:
return "Away"; return "Away";
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
return "Busy"; return "Busy";
case CAYA_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
return "Custom Status"; return "Custom Status";
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
return "Invisible"; return "Invisible";
case CAYA_OFFLINE: case STATUS_OFFLINE:
return "Offline"; return "Offline";
default: default:
return NULL; return NULL;
@ -70,7 +70,7 @@ CommandArgs(BString line)
BResources* BResources*
CayaResources() ChatResources()
{ {
image_info info; image_info info;
if (our_image(info) != B_OK) if (our_image(info) != B_OK)
@ -111,7 +111,7 @@ CreateAccountMenu(AccountInstances accounts, BMessage msg, BMessage* allMsg)
const char* const char*
CayaAccountsPath() AccountsPath()
{ {
BPath path; BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
@ -126,12 +126,12 @@ CayaAccountsPath()
const char* const char*
CayaAccountPath(const char* signature) AccountPath(const char* signature)
{ {
if (!signature) if (!signature)
return NULL; return NULL;
BPath path(CayaAccountsPath()); BPath path(AccountsPath());
if (path.InitCheck() != B_OK) if (path.InitCheck() != B_OK)
return NULL; return NULL;
@ -144,13 +144,13 @@ CayaAccountPath(const char* signature)
const char* const char*
CayaAccountPath(const char* signature, const char* subsignature) AccountPath(const char* signature, const char* subsignature)
{ {
if (BString(signature) == BString(subsignature) if (BString(signature) == BString(subsignature)
|| BString(subsignature).IsEmpty() == true) || BString(subsignature).IsEmpty() == true)
return CayaAccountPath(signature); return AccountPath(signature);
BPath path(CayaAccountPath(signature)); BPath path(AccountPath(signature));
path.Append(subsignature); path.Append(subsignature);
if (create_directory(path.Path(), 0755) != B_OK) if (create_directory(path.Path(), 0755) != B_OK)
@ -161,7 +161,7 @@ CayaAccountPath(const char* signature, const char* subsignature)
const char* const char*
CayaCachePath() CachePath()
{ {
BPath path; BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
@ -174,9 +174,9 @@ CayaCachePath()
const char* const char*
CayaAccountCachePath(const char* accountName) AccountCachePath(const char* accountName)
{ {
BPath path(CayaCachePath()); BPath path(CachePath());
if (path.InitCheck() != B_OK) if (path.InitCheck() != B_OK)
return NULL; return NULL;
path.Append(accountName); path.Append(accountName);
@ -187,9 +187,9 @@ CayaAccountCachePath(const char* accountName)
const char* const char*
CayaRoomsCachePath(const char* accountName) RoomsCachePath(const char* accountName)
{ {
BPath path(CayaAccountCachePath(accountName)); BPath path(AccountCachePath(accountName));
if (path.InitCheck() != B_OK) if (path.InitCheck() != B_OK)
return NULL; return NULL;
path.Append("Rooms"); path.Append("Rooms");
@ -200,9 +200,9 @@ CayaRoomsCachePath(const char* accountName)
const char* 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; if (path.InitCheck() != B_OK) return NULL;
path.Append(roomIdentifier); path.Append(roomIdentifier);
return path.Path(); return path.Path();
@ -210,9 +210,9 @@ CayaRoomCachePath(const char* accountName, const char* roomIdentifier)
const char* 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; if (path.InitCheck() != B_OK) return NULL;
path.Append("Users"); path.Append("Users");
if (create_directory(path.Path(), 0755) != B_OK) return NULL; if (create_directory(path.Path(), 0755) != B_OK) return NULL;
@ -222,9 +222,9 @@ CayaUserCachePath(const char* accountName, const char* userIdentifier)
const char* 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; if (path.InitCheck() != B_OK) return NULL;
path.Append("People"); path.Append("People");
if (create_directory(path.Path(), 0755) != B_OK) return NULL; if (create_directory(path.Path(), 0755) != B_OK) return NULL;
@ -234,7 +234,7 @@ CayaContactCachePath(const char* accountName, const char* userIdentifier)
rgb_color rgb_color
CayaTintColor(rgb_color color, int severity) TintColor(rgb_color color, int severity)
{ {
bool dark = false; bool dark = false;
if (color.Brightness() < 127) if (color.Brightness() < 127)
@ -263,7 +263,7 @@ CayaTintColor(rgb_color color, int severity)
rgb_color rgb_color
CayaForegroundColor(rgb_color background) ForegroundColor(rgb_color background)
{ {
rgb_color foreground; rgb_color foreground;
int32 brighter; int32 brighter;

View File

@ -4,8 +4,8 @@
* Copyright 2021, Jaidyn Levesque * Copyright 2021, Jaidyn Levesque
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_UTILS_H #ifndef _APP_UTILS_H
#define _CAYA_UTILS_H #define _APP_UTILS_H
#include <image.h> #include <image.h>
@ -13,36 +13,36 @@
#include <Mime.h> #include <Mime.h>
#include <Resources.h> #include <Resources.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "Server.h" #include "Server.h"
class BMenu; class BMenu;
const char* CayaStatusToString(CayaStatus status); const char* UserStatusToString(UserStatus status);
bool IsCommand(BString line); bool IsCommand(BString line);
BString CommandName(BString line); BString CommandName(BString line);
BString CommandArgs(BString line); BString CommandArgs(BString line);
BResources* CayaResources(); BResources* ChatResources();
BMenu* CreateAccountMenu(AccountInstances accounts, BMessage msg, BMenu* CreateAccountMenu(AccountInstances accounts, BMessage msg,
BMessage* allMsg = NULL); BMessage* allMsg = NULL);
const char* CayaAccountsPath(); const char* AccountsPath();
const char* CayaAccountPath(const char* signature); const char* AccountPath(const char* signature);
const char* CayaAccountPath(const char* signature, const char* subsignature); const char* AccountPath(const char* signature, const char* subsignature);
const char* CayaCachePath(); const char* CachePath();
const char* CayaAccountCachePath(const char* accountName); const char* AccountCachePath(const char* accountName);
const char* CayaRoomsCachePath(const char* accountName); const char* RoomsCachePath(const char* accountName);
const char* CayaRoomCachePath(const char* accountName, const char* roomIdentifier); const char* RoomCachePath(const char* accountName, const char* roomIdentifier);
const char* CayaUserCachePath(const char* accountName, const char* userIdentifier); const char* UserCachePath(const char* accountName, const char* userIdentifier);
const char* CayaContactCachePath(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 TintColor(rgb_color color, int severity);
rgb_color CayaForegroundColor(rgb_color background); rgb_color ForegroundColor(rgb_color background);
// Borrowed from BePodder's own libfunky. Groovy B) // Borrowed from BePodder's own libfunky. Groovy B)
status_t ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size); 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); extern "C" status_t our_image(image_info& image);
#endif // _CAYA_UTILS_H #endif // _APP_UTILS_H

View File

@ -2,13 +2,13 @@
* Copyright 2012, Casalinuovo Dario. All rights reserved. * Copyright 2012, Casalinuovo Dario. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include "CayaPreferences.h" #include "AppPreferences.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
template<> const char* CayaPreferences::fFolder = "Caya"; template<> const char* AppPreferences::fFolder = "Caya";
template<> const char* CayaPreferences::fFilename = "preferences"; template<> const char* AppPreferences::fFilename = "preferences";
/* TODO update _Add* methods to /* TODO update _Add* methods to
don't take the BPositionIO argument don't take the BPositionIO argument
@ -23,13 +23,13 @@ template<> const char* CayaPreferences::fFilename = "preferences";
size become very minimal : ). size become very minimal : ).
*/ */
CayaPreferencesData::CayaPreferencesData() AppPreferencesData::AppPreferencesData()
: :
MoveToCurrentWorkspace(true), MoveToCurrentWorkspace(true),
RaiseOnMessageReceived(false), RaiseOnMessageReceived(false),
RaiseUserIsTyping(false), RaiseUserIsTyping(false),
MarkUnreadWindow(true), MarkUnreadWindow(true),
HideCayaDeskbar(false), HideDeskbar(false),
DisableReplicant(false), DisableReplicant(false),
IgnoreEmoticons(false), IgnoreEmoticons(false),
NotifyProtocolStatus(true), NotifyProtocolStatus(true),
@ -41,29 +41,29 @@ CayaPreferencesData::CayaPreferencesData()
} }
CayaPreferencesData::~CayaPreferencesData() AppPreferencesData::~AppPreferencesData()
{ {
} }
bool bool
CayaPreferencesData::IsFixedSize() const AppPreferencesData::IsFixedSize() const
{ {
return false; return false;
} }
type_code type_code
CayaPreferencesData::TypeCode() const AppPreferencesData::TypeCode() const
{ {
return CAYA_PREFERENCES_TYPE; return APP_PREFERENCES_TYPE;
} }
bool 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 true;
return false; return false;
@ -71,7 +71,7 @@ CayaPreferencesData::AllowsTypeCode(type_code code) const
ssize_t ssize_t
CayaPreferencesData::FlattenedSize() const AppPreferencesData::FlattenedSize() const
{ {
// NOTE add the size of every settings // NOTE add the size of every settings
// you added. // you added.
@ -83,13 +83,13 @@ CayaPreferencesData::FlattenedSize() const
status_t status_t
CayaPreferencesData::Flatten(BPositionIO* flatData) const AppPreferencesData::Flatten(BPositionIO* flatData) const
{ {
if (flatData == NULL) if (flatData == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
// Write our type code // Write our type code
type_code code = CAYA_PREFERENCES_TYPE; type_code code = APP_PREFERENCES_TYPE;
flatData->Write(&code, sizeof(type_code)); flatData->Write(&code, sizeof(type_code));
// Behaviour // Behaviour
@ -104,7 +104,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const
_AddBool(flatData, DisableQuitConfirm); _AddBool(flatData, DisableQuitConfirm);
// Replicant // Replicant
_AddBool(flatData, HideCayaDeskbar); _AddBool(flatData, HideDeskbar);
_AddBool(flatData, DisableReplicant); _AddBool(flatData, DisableReplicant);
// Chat window // Chat window
@ -124,7 +124,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const
status_t status_t
CayaPreferencesData::Flatten(void* buffer, ssize_t size) const AppPreferencesData::Flatten(void* buffer, ssize_t size) const
{ {
if (buffer == NULL) if (buffer == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@ -136,7 +136,7 @@ CayaPreferencesData::Flatten(void* buffer, ssize_t size) const
status_t 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) if (buffer == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@ -147,9 +147,9 @@ CayaPreferencesData::Unflatten(type_code code, const void* buffer, ssize_t size)
status_t 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; return B_BAD_VALUE;
// Reading our type code // Reading our type code
@ -172,7 +172,7 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData)
DisableQuitConfirm = _ReadBool(flatData); DisableQuitConfirm = _ReadBool(flatData);
// Replicant // Replicant
HideCayaDeskbar = _ReadBool(flatData); HideDeskbar = _ReadBool(flatData);
DisableReplicant = _ReadBool(flatData); DisableReplicant = _ReadBool(flatData);
// Chat window // Chat window
@ -193,14 +193,14 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData)
void void
CayaPreferencesData::_AddBool(BPositionIO* data, bool value) const AppPreferencesData::_AddBool(BPositionIO* data, bool value) const
{ {
data->Write(&value, sizeof(value)); data->Write(&value, sizeof(value));
} }
void void
CayaPreferencesData::_AddString(BPositionIO* data, const char* value) const AppPreferencesData::_AddString(BPositionIO* data, const char* value) const
{ {
size_t len = strlen(value); size_t len = strlen(value);
data->Write(&len, sizeof(size_t)); data->Write(&len, sizeof(size_t));
@ -209,7 +209,7 @@ CayaPreferencesData::_AddString(BPositionIO* data, const char* value) const
bool bool
CayaPreferencesData::_ReadBool(BPositionIO* data) AppPreferencesData::_ReadBool(BPositionIO* data)
{ {
bool ret; bool ret;
data->Read(&ret, sizeof(bool)); data->Read(&ret, sizeof(bool));
@ -218,7 +218,7 @@ CayaPreferencesData::_ReadBool(BPositionIO* data)
const char* const char*
CayaPreferencesData::_ReadString(BPositionIO* data) AppPreferencesData::_ReadString(BPositionIO* data)
{ {
size_t len; size_t len;
data->Read(&len, sizeof(size_t)); data->Read(&len, sizeof(size_t));

View File

@ -3,16 +3,16 @@
* Copyright 2012, Casalinuovo Dario. All rights reserved. * Copyright 2012, Casalinuovo Dario. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _CAYA_PREFERENCES_H #ifndef _APP_PREFERENCES_H
#define _CAYA_PREFERENCES_H #define _APP_PREFERENCES_H
#include "PreferencesContainer.h" #include "PreferencesContainer.h"
class CayaPreferencesData : public BFlattenable { class AppPreferencesData : public BFlattenable {
public: public:
CayaPreferencesData(); AppPreferencesData();
virtual ~CayaPreferencesData(); virtual ~AppPreferencesData();
virtual bool IsFixedSize() const; virtual bool IsFixedSize() const;
virtual type_code TypeCode() const; virtual type_code TypeCode() const;
@ -33,7 +33,7 @@ public:
bool NotifyContactStatus; bool NotifyContactStatus;
bool NotifyNewMessage; bool NotifyNewMessage;
bool HideCayaDeskbar; bool HideDeskbar;
bool DisableReplicant; bool DisableReplicant;
bool DisableQuitConfirm; bool DisableQuitConfirm;
@ -49,6 +49,6 @@ private:
const char* _ReadString(BPositionIO* data); const char* _ReadString(BPositionIO* data);
}; };
typedef PreferencesContainer<CayaPreferencesData> CayaPreferences; typedef PreferencesContainer<AppPreferencesData> AppPreferences;
#endif // _CAYA_PREFERENCES_H #endif // _APP_PREFERENCES_H

View File

@ -18,8 +18,8 @@
#include "AccountDialog.h" #include "AccountDialog.h"
#include "AccountListItem.h" #include "AccountListItem.h"
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "PreferencesAccounts.h" #include "PreferencesAccounts.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "ProtocolSettings.h" #include "ProtocolSettings.h"
@ -59,7 +59,7 @@ PreferencesAccounts::PreferencesAccounts()
fProtosMenu = new BPopUpMenu(NULL, true); fProtosMenu = new BPopUpMenu(NULL, true);
for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) { for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) {
CayaProtocolAddOn* addOn = pm->ProtocolAddOnAt(i); ChatProtocolAddOn* addOn = pm->ProtocolAddOnAt(i);
ProtocolSettings* settings = new ProtocolSettings(addOn); ProtocolSettings* settings = new ProtocolSettings(addOn);
// Add accounts to list view // Add accounts to list view
@ -197,7 +197,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
if (found == false) if (found == false)
return; return;
BMessage* remove = new BMessage(CAYA_DISABLE_ACCOUNT); BMessage* remove = new BMessage(APP_DISABLE_ACCOUNT);
remove->AddInt64("instance", instance); remove->AddInt64("instance", instance);
((TheApp*)be_app)->GetMainWindow()->PostMessage(remove); ((TheApp*)be_app)->GetMainWindow()->PostMessage(remove);

View File

@ -14,9 +14,9 @@
#include <StringView.h> #include <StringView.h>
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "PreferencesBehavior.h" #include "PreferencesBehavior.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "ProtocolSettings.h" #include "ProtocolSettings.h"
#include "MainWindow.h" #include "MainWindow.h"
@ -139,23 +139,23 @@ PreferencesBehavior::AttachedToWindow()
fDisableQuitConfirm->SetTarget(this); fDisableQuitConfirm->SetTarget(this);
fHideOffline->SetValue( fHideOffline->SetValue(
CayaPreferences::Item()->HideOffline); AppPreferences::Item()->HideOffline);
fToCurrentWorkspace->SetValue( fToCurrentWorkspace->SetValue(
CayaPreferences::Item()->MoveToCurrentWorkspace); AppPreferences::Item()->MoveToCurrentWorkspace);
fRaiseUserIsTyping->SetValue( fRaiseUserIsTyping->SetValue(
CayaPreferences::Item()->RaiseUserIsTyping); AppPreferences::Item()->RaiseUserIsTyping);
fRaiseOnMessageReceived->SetValue( fRaiseOnMessageReceived->SetValue(
CayaPreferences::Item()->RaiseOnMessageReceived); AppPreferences::Item()->RaiseOnMessageReceived);
fMarkUnreadWindow->SetValue( fMarkUnreadWindow->SetValue(
CayaPreferences::Item()->MarkUnreadWindow); AppPreferences::Item()->MarkUnreadWindow);
fNotifyProtocols->SetValue( fNotifyProtocols->SetValue(
CayaPreferences::Item()->NotifyProtocolStatus); AppPreferences::Item()->NotifyProtocolStatus);
fNotifyContactStatus->SetValue( fNotifyContactStatus->SetValue(
CayaPreferences::Item()->NotifyContactStatus); AppPreferences::Item()->NotifyContactStatus);
fNotifyNewMessage->SetValue( fNotifyNewMessage->SetValue(
CayaPreferences::Item()->NotifyNewMessage); AppPreferences::Item()->NotifyNewMessage);
fDisableQuitConfirm->SetValue( fDisableQuitConfirm->SetValue(
CayaPreferences::Item()->DisableQuitConfirm); AppPreferences::Item()->DisableQuitConfirm);
} }
@ -164,39 +164,39 @@ PreferencesBehavior::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case kHideOffline: case kHideOffline:
CayaPreferences::Item()->HideOffline AppPreferences::Item()->HideOffline
= fHideOffline->Value(); = fHideOffline->Value();
break; break;
case kToCurrentWorkspace: case kToCurrentWorkspace:
CayaPreferences::Item()->MoveToCurrentWorkspace AppPreferences::Item()->MoveToCurrentWorkspace
= fToCurrentWorkspace->Value(); = fToCurrentWorkspace->Value();
break; break;
case kRaiseOnMessageReceived: case kRaiseOnMessageReceived:
CayaPreferences::Item()->RaiseOnMessageReceived AppPreferences::Item()->RaiseOnMessageReceived
= fRaiseOnMessageReceived->Value(); = fRaiseOnMessageReceived->Value();
break; break;
case kRaiseUserIsTyping: case kRaiseUserIsTyping:
CayaPreferences::Item()->RaiseUserIsTyping AppPreferences::Item()->RaiseUserIsTyping
= fRaiseUserIsTyping->Value(); = fRaiseUserIsTyping->Value();
break; break;
case kNotifyProtocolsLogin: case kNotifyProtocolsLogin:
CayaPreferences::Item()->NotifyProtocolStatus AppPreferences::Item()->NotifyProtocolStatus
= fNotifyProtocols->Value(); = fNotifyProtocols->Value();
break; break;
case kNotifyContactStatus: case kNotifyContactStatus:
CayaPreferences::Item()->NotifyContactStatus AppPreferences::Item()->NotifyContactStatus
= fNotifyContactStatus->Value(); = fNotifyContactStatus->Value();
break; break;
case kNotifyNewMessage: case kNotifyNewMessage:
CayaPreferences::Item()->NotifyNewMessage AppPreferences::Item()->NotifyNewMessage
= fNotifyNewMessage->Value(); = fNotifyNewMessage->Value();
break; break;
case kMarkUnreadWindow: case kMarkUnreadWindow:
CayaPreferences::Item()->MarkUnreadWindow AppPreferences::Item()->MarkUnreadWindow
= fMarkUnreadWindow->Value(); = fMarkUnreadWindow->Value();
break; break;
case kDisablePrompt: case kDisablePrompt:
CayaPreferences::Item()->DisableQuitConfirm AppPreferences::Item()->DisableQuitConfirm
= fDisableQuitConfirm->Value(); = fDisableQuitConfirm->Value();
break; break;
default: default:

View File

@ -10,9 +10,9 @@
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <StringView.h> #include <StringView.h>
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "PreferencesChatWindow.h" #include "PreferencesChatWindow.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "ProtocolSettings.h" #include "ProtocolSettings.h"
#include "MainWindow.h" #include "MainWindow.h"
@ -55,7 +55,7 @@ PreferencesChatWindow::AttachedToWindow()
{ {
fIgnoreEmoticons->SetTarget(this); fIgnoreEmoticons->SetTarget(this);
fIgnoreEmoticons->SetValue( fIgnoreEmoticons->SetValue(
CayaPreferences::Item()->IgnoreEmoticons); AppPreferences::Item()->IgnoreEmoticons);
} }
@ -65,7 +65,7 @@ PreferencesChatWindow::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case kIgnoreEmoticons: case kIgnoreEmoticons:
CayaPreferences::Item()->IgnoreEmoticons AppPreferences::Item()->IgnoreEmoticons
= fIgnoreEmoticons->Value(); = fIgnoreEmoticons->Value();
break; break;
default: default:

View File

@ -14,23 +14,23 @@
#include <Path.h> #include <Path.h>
enum { enum {
CAYA_PREFERENCES_TYPE = 'CPTY' APP_PREFERENCES_TYPE = 'CPTY'
}; };
// TODO: added to main singleton class? // TODO: added to main singleton class?
template<typename T> T* Singleton<T>::fInstance = 0; template<typename T> T* Singleton<T>::fInstance = 0;
template<class CayaPreferencesData> template<class AppPreferencesData>
class PreferencesContainer class PreferencesContainer
: public Singleton<PreferencesContainer<CayaPreferencesData> > { : public Singleton<PreferencesContainer<AppPreferencesData> > {
public: public:
static CayaPreferencesData* static AppPreferencesData*
Item() Item()
{ {
return &(Singleton<PreferencesContainer<CayaPreferencesData> > return &(Singleton<PreferencesContainer<AppPreferencesData> >
::Get()->fSettings); ::Get()->fSettings);
} }
@ -40,7 +40,7 @@ public:
if (fPreferencesFile.SetTo(&fDirectory, fFilename, if (fPreferencesFile.SetTo(&fDirectory, fFilename,
B_READ_WRITE | B_FAIL_IF_EXISTS) == B_OK) { B_READ_WRITE | B_FAIL_IF_EXISTS) == B_OK) {
return fSettings.Unflatten(CAYA_PREFERENCES_TYPE, return fSettings.Unflatten(APP_PREFERENCES_TYPE,
&fPreferencesFile); &fPreferencesFile);
} }
return B_ERROR; return B_ERROR;
@ -58,8 +58,8 @@ public:
} }
private: private:
PreferencesContainer<CayaPreferencesData>() PreferencesContainer<AppPreferencesData>()
: Singleton<PreferencesContainer<CayaPreferencesData> >() : Singleton<PreferencesContainer<AppPreferencesData> >()
{ {
BPath path; BPath path;
@ -70,14 +70,14 @@ private:
Load(); Load();
} }
CayaPreferencesData fSettings; AppPreferencesData fSettings;
BFile fPreferencesFile; BFile fPreferencesFile;
BDirectory fDirectory; BDirectory fDirectory;
static const char* fFilename; static const char* fFilename;
static const char* fFolder; static const char* fFolder;
friend class Singleton<PreferencesContainer<CayaPreferencesData> >; friend class Singleton<PreferencesContainer<AppPreferencesData> >;
}; };

View File

@ -12,9 +12,9 @@
#include <StringView.h> #include <StringView.h>
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaProtocol.h" #include "ChatProtocol.h"
#include "PreferencesReplicant.h" #include "PreferencesReplicant.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "ProtocolSettings.h" #include "ProtocolSettings.h"
#include "MainWindow.h" #include "MainWindow.h"
@ -23,7 +23,7 @@
const uint32 kDisableReplicant = 'DSrp'; const uint32 kDisableReplicant = 'DSrp';
const uint32 kPermanentReplicant ='PRpt'; const uint32 kPermanentReplicant ='PRpt';
const uint32 kHideCayaDeskbar = 'HCtk'; const uint32 kHideDeskbar = 'HCtk';
PreferencesReplicant::PreferencesReplicant() PreferencesReplicant::PreferencesReplicant()
@ -40,16 +40,16 @@ PreferencesReplicant::PreferencesReplicant()
fDisableReplicant = new BCheckBox("DisableReplicant", fDisableReplicant = new BCheckBox("DisableReplicant",
"Disable Deskbar replicant", new BMessage(kDisableReplicant)); "Disable Deskbar replicant", new BMessage(kDisableReplicant));
if (!CayaPreferences::Item()->HideCayaDeskbar) if (!AppPreferences::Item()->HideDeskbar)
Looper()->PostMessage(new BMessage(kDisableReplicant)); Looper()->PostMessage(new BMessage(kDisableReplicant));
fPermanentReplicant = new BCheckBox("PermanentReplicant", fPermanentReplicant = new BCheckBox("PermanentReplicant",
"Permanent Deskbar Replicant", NULL); "Permanent Deskbar Replicant", NULL);
fPermanentReplicant->SetEnabled(false); fPermanentReplicant->SetEnabled(false);
fHideCayaDeskbar = new BCheckBox("HideCayaDeskbar", fHideDeskbar = new BCheckBox("HideDeskbar",
"Hide Caya field in Deskbar", new BMessage(kHideCayaDeskbar)); "Hide field in Deskbar", new BMessage(kHideDeskbar));
fHideCayaDeskbar->SetEnabled(false); fHideDeskbar->SetEnabled(false);
const float spacing = be_control_look->DefaultItemSpacing(); const float spacing = be_control_look->DefaultItemSpacing();
@ -59,7 +59,7 @@ PreferencesReplicant::PreferencesReplicant()
.AddGroup(B_VERTICAL, spacing) .AddGroup(B_VERTICAL, spacing)
.Add(fDisableReplicant) .Add(fDisableReplicant)
.Add(fPermanentReplicant) .Add(fPermanentReplicant)
.Add(fHideCayaDeskbar) .Add(fHideDeskbar)
.SetInsets(spacing * 2, spacing, spacing, spacing) .SetInsets(spacing * 2, spacing, spacing, spacing)
.End() .End()
.AddGlue() .AddGlue()
@ -72,13 +72,13 @@ PreferencesReplicant::PreferencesReplicant()
void void
PreferencesReplicant::AttachedToWindow() PreferencesReplicant::AttachedToWindow()
{ {
fHideCayaDeskbar->SetTarget(this); fHideDeskbar->SetTarget(this);
fDisableReplicant->SetTarget(this); fDisableReplicant->SetTarget(this);
fHideCayaDeskbar->SetValue( fHideDeskbar->SetValue(
CayaPreferences::Item()->HideCayaDeskbar); AppPreferences::Item()->HideDeskbar);
fDisableReplicant->SetValue( fDisableReplicant->SetValue(
CayaPreferences::Item()->DisableReplicant); AppPreferences::Item()->DisableReplicant);
} }
@ -86,12 +86,12 @@ void
PreferencesReplicant::MessageReceived(BMessage* message) PreferencesReplicant::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case kHideCayaDeskbar: case kHideDeskbar:
CayaPreferences::Item()->HideCayaDeskbar AppPreferences::Item()->HideDeskbar
= fHideCayaDeskbar->Value(); = fHideDeskbar->Value();
break; break;
case kDisableReplicant: case kDisableReplicant:
CayaPreferences::Item()->DisableReplicant AppPreferences::Item()->DisableReplicant
= fDisableReplicant->Value(); = fDisableReplicant->Value();
if (fDisableReplicant->Value() == true) if (fDisableReplicant->Value() == true)

View File

@ -22,7 +22,7 @@ private:
BStringView* fReplicantString; BStringView* fReplicantString;
BCheckBox* fDisableReplicant; BCheckBox* fDisableReplicant;
BCheckBox* fPermanentReplicant; BCheckBox* fPermanentReplicant;
BCheckBox* fHideCayaDeskbar; BCheckBox* fHideDeskbar;
}; };

View File

@ -9,8 +9,8 @@
#include <MenuItem.h> #include <MenuItem.h>
#include <Window.h> #include <Window.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "Conversation.h" #include "Conversation.h"
#include "ConversationAccountItem.h" #include "ConversationAccountItem.h"
#include "ConversationItem.h" #include "ConversationItem.h"
@ -201,7 +201,7 @@ ConversationListView::_BlankPopUp()
BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); BPopUpMenu* menu = new BPopUpMenu("blankPopUp");
BMenuItem* newChat = new BMenuItem("New chat" B_UTF8_ELLIPSIS, 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); newChat->SetEnabled(enabled);
menu->AddItem(newChat); menu->AddItem(newChat);

View File

@ -19,16 +19,16 @@
#include <libinterface/BitmapView.h> #include <libinterface/BitmapView.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaRenderView.h" #include "RenderView.h"
#include "CayaUtils.h"
#include "Conversation.h" #include "Conversation.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "User.h" #include "User.h"
#include "UserItem.h" #include "UserItem.h"
#include "UserListView.h" #include "UserListView.h"
#include "Utils.h"
ConversationView::ConversationView() ConversationView::ConversationView()
@ -52,7 +52,7 @@ ConversationView::ConversationView(Conversation* chat)
bool bool
ConversationView::QuitRequested() ConversationView::QuitRequested()
{ {
BMessage msg(CAYA_CLOSE_CHAT_WINDOW); BMessage msg(APP_CLOSE_CHAT_WINDOW);
msg.AddString("chat_id", fConversation->GetId()); msg.AddString("chat_id", fConversation->GetId());
fConversation->Messenger().SendMessage(&msg); fConversation->Messenger().SendMessage(&msg);
return false; return false;
@ -73,7 +73,7 @@ void
ConversationView::MessageReceived(BMessage* message) ConversationView::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case CAYA_CHAT: case APP_CHAT:
{ {
BString text = message->FindString("body"); BString text = message->FindString("body");
if (text == "") if (text == "")
@ -118,7 +118,7 @@ ConversationView::ImMessage(BMessage* msg)
// Send a notification, if it's appropriate // Send a notification, if it's appropriate
if ((Window() == NULL || Window()->IsActive() == false) if ((Window() == NULL || Window()->IsActive() == false)
&& (!CayaPreferences::Item()->NotifyNewMessage) && (!AppPreferences::Item()->NotifyNewMessage)
&& sender != NULL) && sender != NULL)
{ {
fMessageCount++; fMessageCount++;
@ -139,7 +139,7 @@ ConversationView::ImMessage(BMessage* msg)
notification.SetMessageID(sender->GetName()); notification.SetMessageID(sender->GetName());
notification.Send(); notification.Send();
// Check if the user want the notification // Check if the user want the notification
if (!CayaPreferences::Item()->NotifyNewMessage) if (!AppPreferences::Item()->NotifyNewMessage)
break; break;
} }
@ -260,7 +260,7 @@ ConversationView::ObserveString(int32 what, BString str)
void void
ConversationView::_InitInterface() ConversationView::_InitInterface()
{ {
fReceiveView = new CayaRenderView("fReceiveView"); fReceiveView = new RenderView("fReceiveView");
BScrollView* scrollViewReceive = new BScrollView("receiveScrollView", BScrollView* scrollViewReceive = new BScrollView("receiveScrollView",
fReceiveView, B_WILL_DRAW, false, true); fReceiveView, B_WILL_DRAW, false, true);

View File

@ -8,7 +8,7 @@
#include <GroupView.h> #include <GroupView.h>
#include <ObjectList.h> #include <ObjectList.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "Conversation.h" #include "Conversation.h"
#include "Observer.h" #include "Observer.h"
@ -16,7 +16,7 @@ class BStringView;
class BTextView; class BTextView;
class BitmapView; class BitmapView;
class CayaRenderView; class RenderView;
class User; class User;
class UserListView; class UserListView;
@ -62,7 +62,7 @@ private:
BitmapView* fProtocolView; BitmapView* fProtocolView;
BitmapView* fIcon; BitmapView* fIcon;
CayaRenderView* fReceiveView; RenderView* fReceiveView;
UserListView* fUserList; UserListView* fUserList;
}; };

View File

@ -6,7 +6,7 @@
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/ */
#include "CayaConstants.h" #include "AppConstants.h"
#include "NicknameTextControl.h" #include "NicknameTextControl.h"
#include <Font.h> #include <Font.h>

View File

@ -1,12 +1,12 @@
#include "CayaRenderView.h" #include "RenderView.h"
#include <librunview/RunView.h> #include <librunview/RunView.h>
#include <librunview/Theme.h> #include <librunview/Theme.h>
#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, RunView(BRect(0, 0, 1, 1), name,
fTheme = new Theme(name, COL_MAX_COLORS + 1, COL_MAX_COLORS + 1, 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 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 nameColor, time_t time)
{ {
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
@ -43,7 +43,7 @@ CayaRenderView::AppendMessage(const char* nick, const char* message,
void void
CayaRenderView::AppendGenericMessage(const char* message) RenderView::AppendGenericMessage(const char* message)
{ {
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color fg = ui_color(B_PANEL_TEXT_COLOR); rgb_color fg = ui_color(B_PANEL_TEXT_COLOR);
@ -54,9 +54,9 @@ CayaRenderView::AppendGenericMessage(const char* message)
void 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); Append(txt, fore, bg, fore);
else else
Emoticor::Get()->AddText(this, txt, fore, fore, bg, fore); 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 void
CayaRenderView::PrepareTheme(Theme *fTheme) RenderView::PrepareTheme(Theme *fTheme)
{ {
Theme::TimestampFore = COL_TIMESTAMP_DUMMY; Theme::TimestampFore = COL_TIMESTAMP_DUMMY;
Theme::TimestampBack = COL_TIMESTAMP_DUMMY; Theme::TimestampBack = COL_TIMESTAMP_DUMMY;

View File

@ -1,5 +1,5 @@
#ifndef _CayaRenderView_H #ifndef _RenderView_H
#define _CayaRenderView_H_ #define _RenderView_H_
#include <librunview/RunView.h> #include <librunview/RunView.h>
@ -9,7 +9,7 @@ class RunView;
class Theme; class Theme;
enum CayaRenderViewColors { enum RenderViewColors {
COL_URL = 0, COL_URL = 0,
COL_TIMESTAMP, COL_TIMESTAMP,
COL_TEXT, COL_TEXT,
@ -32,10 +32,10 @@ enum {
}; };
class CayaRenderView : public RunView class RenderView : public RunView
{ {
public: 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, void AppendMessage(const char* nick, const char* message,
rgb_color nameColor, time_t time = 0); rgb_color nameColor, time_t time = 0);

View File

@ -16,23 +16,23 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaResources.h" #include "AppResources.h"
#include "CayaUtils.h"
#include "ReplicantStatusView.h" #include "ReplicantStatusView.h"
#include "Utils.h"
const float kSize = 16; const float kSize = 16;
const float kCircle = 12; const float kCircle = 12;
ReplicantMenuItem::ReplicantMenuItem(const char* label, CayaStatus status, ReplicantMenuItem::ReplicantMenuItem(const char* label, UserStatus status,
bool custom, char shortcut, uint32 modifiers) bool custom, char shortcut, uint32 modifiers)
: :
BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
fStatus(status), fStatus(status),
fCustom(custom) fCustom(custom)
{ {
BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET); BMessage* msg = new BMessage(APP_REPLICANT_STATUS_SET);
msg->AddInt32("status", fStatus); msg->AddInt32("status", fStatus);
SetMessage(msg); SetMessage(msg);
@ -40,7 +40,7 @@ ReplicantMenuItem::ReplicantMenuItem(const char* label, CayaStatus status,
} }
CayaStatus UserStatus
ReplicantMenuItem::Status() const ReplicantMenuItem::Status() const
{ {
return fStatus; return fStatus;
@ -57,27 +57,27 @@ ReplicantMenuItem::IsCustom() const
void void
ReplicantMenuItem::SetIcon() ReplicantMenuItem::SetIcon()
{ {
BResources* res = CayaResources(); BResources* res = ChatResources();
if (!res) if (!res)
return; return;
int32 num = 0; int32 num = 0;
switch (fStatus) { switch (fStatus) {
case CAYA_ONLINE: case STATUS_ONLINE:
num = kOnlineReplicant; num = kOnlineReplicant;
break; break;
case CAYA_AWAY: case STATUS_AWAY:
num = kAwayReplicant; num = kAwayReplicant;
break; break;
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
num = kBusyReplicant; num = kBusyReplicant;
break; break;
case CAYA_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
num = kCayaIconReplicant; num = kIconReplicant;
break; break;
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
case CAYA_OFFLINE: case STATUS_OFFLINE:
num = kOfflineReplicant; num = kOfflineReplicant;
break; break;
default: default:

View File

@ -10,7 +10,7 @@
#include <libinterface/BitmapMenuItem.h> #include <libinterface/BitmapMenuItem.h>
#include "CayaConstants.h" #include "AppConstants.h"
class BBitmap; class BBitmap;
@ -18,14 +18,14 @@ const int32 kSetStatus = 'SEST';
class ReplicantMenuItem : public BitmapMenuItem { class ReplicantMenuItem : public BitmapMenuItem {
public: public:
ReplicantMenuItem(const char* label, CayaStatus status, ReplicantMenuItem(const char* label, UserStatus status,
bool custom = false, char shortcut = 0, uint32 modifiers = 0); bool custom = false, char shortcut = 0, uint32 modifiers = 0);
CayaStatus Status() const; UserStatus Status() const;
bool IsCustom() const; bool IsCustom() const;
private: private:
CayaStatus fStatus; UserStatus fStatus;
bool fCustom; bool fCustom;
void SetIcon(); void SetIcon();

View File

@ -28,12 +28,12 @@
#include "AccountManager.h" #include "AccountManager.h"
#include "Caya.h" #include "Caya.h"
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaUtils.h"
#include "NicknameTextControl.h" #include "NicknameTextControl.h"
#include "ReplicantMenuItem.h" #include "ReplicantMenuItem.h"
#include "Utils.h"
extern "C" _EXPORT BView *instantiate_deskbar_item(void); extern "C" _EXPORT BView *instantiate_deskbar_item(void);
@ -61,7 +61,7 @@ public:
if (message->FindInt32("status", &status) != B_OK) if (message->FindInt32("status", &status) != B_OK)
return; return;
fTarget->SetStatus((CayaStatus)status); fTarget->SetStatus((UserStatus)status);
break; break;
} }
default: default:
@ -100,7 +100,7 @@ ReplicantStatusView::~ReplicantStatusView()
// TODO: Use a list for that // TODO: Use a list for that
// maybe our List wrapper to std::list // maybe our List wrapper to std::list
delete fConnectingIcon; delete fConnectingIcon;
delete fCayaIcon; delete fIcon;
delete fOfflineIcon; delete fOfflineIcon;
delete fBusyIcon; delete fBusyIcon;
delete fAwayIcon; delete fAwayIcon;
@ -111,21 +111,21 @@ void
ReplicantStatusView::MessageReceived(BMessage* msg) ReplicantStatusView::MessageReceived(BMessage* msg)
{ {
switch (msg->what) { switch (msg->what) {
case CAYA_REPLICANT_STATUS_SET: case APP_REPLICANT_STATUS_SET:
{ {
int32 status; int32 status;
if (msg->FindInt32("status", &status) != B_OK) if (msg->FindInt32("status", &status) != B_OK)
return; return;
SetStatus((CayaStatus)status); SetStatus((UserStatus)status);
fCayaMsg->SendMessage(msg); fCayaMsg->SendMessage(msg);
break; break;
} }
case CAYA_REPLICANT_EXIT: case APP_REPLICANT_EXIT:
case CAYA_SHOW_SETTINGS: case APP_SHOW_SETTINGS:
case CAYA_REPLICANT_SHOW_WINDOW: case APP_REPLICANT_SHOW_WINDOW:
case CAYA_REPLICANT_MESSENGER: case APP_REPLICANT_MESSENGER:
fCayaMsg->SendMessage(msg); fCayaMsg->SendMessage(msg);
break; break;
default: default:
@ -135,7 +135,7 @@ ReplicantStatusView::MessageReceived(BMessage* msg)
void void
ReplicantStatusView::SetStatus(CayaStatus status) ReplicantStatusView::SetStatus(UserStatus status)
{ {
for (int32 i = 0; i < fReplicantMenu->CountItems(); i++) { for (int32 i = 0; i < fReplicantMenu->CountItems(); i++) {
ReplicantMenuItem* item ReplicantMenuItem* item
@ -152,21 +152,21 @@ ReplicantStatusView::SetStatus(CayaStatus status)
} }
switch (status) { switch (status) {
case CAYA_AWAY: case STATUS_AWAY:
fIcon = fAwayIcon; fIcon = fAwayIcon;
break; break;
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
fIcon = fBusyIcon; fIcon = fBusyIcon;
break; break;
case CAYA_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
fIcon = fCayaIcon; fIcon = fAppIcon;
break; break;
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
case CAYA_OFFLINE: case STATUS_OFFLINE:
fIcon = fOfflineIcon; fIcon = fOfflineIcon;
break; break;
default: default:
fIcon = fCayaIcon; fIcon = fIcon;
break; break;
} }
Invalidate(); Invalidate();
@ -199,7 +199,7 @@ ReplicantStatusView::Archive(BMessage* archive, bool deep) const
status_t status = BView::Archive(archive, deep); status_t status = BView::Archive(archive, deep);
if (status == B_OK) if (status == B_OK)
status = archive->AddString("add_on", CAYA_SIGNATURE); status = archive->AddString("add_on", APP_SIGNATURE);
if (status == B_OK) if (status == B_OK)
status = archive->AddString("class", "ReplicantStatusView"); status = archive->AddString("class", "ReplicantStatusView");
@ -225,7 +225,7 @@ ReplicantStatusView::AttachedToWindow()
Window()->Unlock(); Window()->Unlock();
} }
BMessage msg(CAYA_REPLICANT_MESSENGER); BMessage msg(APP_REPLICANT_MESSENGER);
BMessenger messenger(fReplicantHandler); BMessenger messenger(fReplicantHandler);
if (!messenger.IsValid()) if (!messenger.IsValid())
return; return;
@ -255,7 +255,7 @@ ReplicantStatusView::MouseDown(BPoint point)
} }
if (buttons & B_PRIMARY_MOUSE_BUTTON) { if (buttons & B_PRIMARY_MOUSE_BUTTON) {
// Show / Hide Window command // Show / Hide Window command
BMessage msg(CAYA_REPLICANT_SHOW_WINDOW); BMessage msg(APP_REPLICANT_SHOW_WINDOW);
fCayaMsg->SendMessage(&msg); fCayaMsg->SendMessage(&msg);
} else if(buttons & B_SECONDARY_MOUSE_BUTTON) { } else if(buttons & B_SECONDARY_MOUSE_BUTTON) {
// Build replicant menu // Build replicant menu
@ -273,13 +273,13 @@ ReplicantStatusView::_Init()
// a messenger targeting this to Caya. // a messenger targeting this to Caya.
// This will allow the Replicant to communicate // This will allow the Replicant to communicate
// whith Caya. // whith Caya.
fCayaMsg = new BMessenger(CAYA_SIGNATURE); fCayaMsg = new BMessenger(APP_SIGNATURE);
fResources = CayaResources(); fResources = ChatResources();
//Get icons from resources //Get icons from resources
fConnectingIcon = _GetIcon(kOnlineReplicant); fConnectingIcon = _GetIcon(kOnlineReplicant);
fCayaIcon = _GetIcon(kCayaIconReplicant); fAppIcon = _GetIcon(kIconReplicant);
fOfflineIcon = _GetIcon(kOfflineReplicant); fOfflineIcon = _GetIcon(kOfflineReplicant);
fIcon = fOfflineIcon; fIcon = fOfflineIcon;
fBusyIcon = _GetIcon(kBusyReplicant); fBusyIcon = _GetIcon(kBusyReplicant);
@ -307,17 +307,17 @@ ReplicantStatusView::_BuildMenu()
fReplicantMenu = new BPopUpMenu(" - ", false, false); fReplicantMenu = new BPopUpMenu(" - ", false, false);
// Add status menu items // Add status menu items
int32 s = CAYA_ONLINE; int32 s = STATUS_ONLINE;
while (s >= CAYA_ONLINE && s < CAYA_STATUSES) { while (s >= STATUS_ONLINE && s < STATUS_STATUSES) {
BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET); BMessage* msg = new BMessage(APP_REPLICANT_STATUS_SET);
msg->AddInt32("status", s); msg->AddInt32("status", s);
ReplicantMenuItem* item = new ReplicantMenuItem( ReplicantMenuItem* item = new ReplicantMenuItem(
CayaStatusToString((CayaStatus)s), (CayaStatus)s); UserStatusToString((UserStatus)s), (UserStatus)s);
fReplicantMenu->AddItem(item); fReplicantMenu->AddItem(item);
// Mark offline status by default // Mark offline status by default
if (s == CAYA_OFFLINE) if (s == STATUS_OFFLINE)
item->SetMarked(true); item->SetMarked(true);
s++; s++;
} }
@ -325,10 +325,10 @@ ReplicantStatusView::_BuildMenu()
fReplicantMenu->AddItem(new BSeparatorItem()); fReplicantMenu->AddItem(new BSeparatorItem());
fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ", fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ",
new BMessage(CAYA_SHOW_SETTINGS), fPreferencesIcon)); new BMessage(APP_SHOW_SETTINGS), fPreferencesIcon));
fReplicantMenu->AddItem(new BitmapMenuItem("Exit", fReplicantMenu->AddItem(new BitmapMenuItem("Exit",
new BMessage(CAYA_REPLICANT_EXIT), fExitMenuIcon)); new BMessage(APP_REPLICANT_EXIT), fExitMenuIcon));
fReplicantMenu->SetTargetForItems(this); fReplicantMenu->SetTargetForItems(this);
} }
@ -356,7 +356,7 @@ instantiate_deskbar_item(void)
status_t status_t
ReplicantStatusView::InstallReplicant() ReplicantStatusView::InstallReplicant()
{ {
if (CayaPreferences::Item()->DisableReplicant == true) if (AppPreferences::Item()->DisableReplicant == true)
return B_OK; return B_OK;
BDeskbar deskbar; BDeskbar deskbar;

View File

@ -13,8 +13,8 @@
#include <Resources.h> #include <Resources.h>
#include <View.h> #include <View.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "CayaResources.h" #include "AppResources.h"
class BPopUpMenu; class BPopUpMenu;
@ -36,7 +36,7 @@ public:
virtual void Draw(BRect rect); virtual void Draw(BRect rect);
void SetStatus(CayaStatus status); void SetStatus(UserStatus status);
virtual status_t Archive(BMessage* archive, bool deep) const; virtual status_t Archive(BMessage* archive, bool deep) const;
@ -53,10 +53,10 @@ private:
void _ShowMenu(BPoint point); void _ShowMenu(BPoint point);
BBitmap* _GetIcon(const uint32 id); BBitmap* _GetIcon(const uint32 id);
BBitmap* fIcon; BBitmap* fAppIcon;
BBitmap* fConnectingIcon; BBitmap* fConnectingIcon;
BBitmap* fCayaIcon; BBitmap* fIcon;
BBitmap* fOfflineIcon; BBitmap* fOfflineIcon;
BBitmap* fBusyIcon; BBitmap* fBusyIcon;
BBitmap* fAwayIcon; BBitmap* fAwayIcon;

View File

@ -11,17 +11,17 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include "CayaUtils.h" #include "AppResources.h"
#include "CayaResources.h"
#include "Contact.h" #include "Contact.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "Utils.h"
RosterItem::RosterItem(const char* name, Contact* contact) RosterItem::RosterItem(const char* name, Contact* contact)
: BStringItem(name), : BStringItem(name),
fBitmap(NULL), fBitmap(NULL),
fStatus(CAYA_OFFLINE), fStatus(STATUS_OFFLINE),
contactLinker(contact), contactLinker(contact),
fVisible(true) fVisible(true)
{ {
@ -85,7 +85,7 @@ RosterItem::ObserveInteger(int32 what, int32 val)
{ {
switch (what) { switch (what) {
case INT_CONTACT_STATUS: case INT_CONTACT_STATUS:
SetStatus((CayaStatus)val); SetStatus((UserStatus)val);
break; break;
} }
} }
@ -114,18 +114,18 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete)
// Draw contact status // Draw contact status
switch (fStatus) { switch (fStatus) {
case CAYA_ONLINE: case STATUS_ONLINE:
owner->SetHighColor(CAYA_GREEN_COLOR); owner->SetHighColor(APP_GREEN_COLOR);
break; break;
case CAYA_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
case CAYA_AWAY: case STATUS_AWAY:
owner->SetHighColor(CAYA_ORANGE_COLOR); owner->SetHighColor(APP_ORANGE_COLOR);
break; break;
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
owner->SetHighColor(CAYA_RED_COLOR); owner->SetHighColor(APP_RED_COLOR);
break; break;
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
case CAYA_OFFLINE: case STATUS_OFFLINE:
break; break;
default: default:
break; break;
@ -156,7 +156,7 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete)
fBaselineOffset + 3); fBaselineOffset + 3);
owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT)); owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
if (fPersonalStatus.Length() == 0) if (fPersonalStatus.Length() == 0)
owner->DrawString(CayaStatusToString(fStatus)); owner->DrawString(UserStatusToString(fStatus));
else else
owner->DrawString(fPersonalStatus); owner->DrawString(fPersonalStatus);
@ -193,7 +193,7 @@ RosterItem::Update(BView* owner, const BFont* font)
void void
RosterItem::SetStatus(CayaStatus status) RosterItem::SetStatus(UserStatus status)
{ {
if (fStatus != status) if (fStatus != status)
fStatus = status; fStatus = status;

View File

@ -11,7 +11,7 @@
#include <View.h> #include <View.h>
#include <String.h> #include <String.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "Contact.h" #include "Contact.h"
#include "Observer.h" #include "Observer.h"
@ -30,8 +30,8 @@ public:
Contact* GetContact() { return contactLinker;} Contact* GetContact() { return contactLinker;}
CayaStatus Status() const { return fStatus; } UserStatus Status() const { return fStatus; }
void SetStatus(CayaStatus status); void SetStatus(UserStatus status);
BString PersonalStatus() const { return fPersonalStatus; } BString PersonalStatus() const { return fPersonalStatus; }
void SetPersonalStatus(BString str) { fPersonalStatus = str; } void SetPersonalStatus(BString str) { fPersonalStatus = str; }
@ -48,7 +48,7 @@ private:
Contact* contactLinker; Contact* contactLinker;
float fBaselineOffset; float fBaselineOffset;
BString fPersonalStatus; BString fPersonalStatus;
CayaStatus fStatus; UserStatus fStatus;
BBitmap* fBitmap; BBitmap* fBitmap;
bool fVisible; bool fVisible;
BGradientLinear fGradient; BGradientLinear fGradient;

View File

@ -16,7 +16,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "Contact.h" #include "Contact.h"
#include "ProtocolLooper.h" #include "ProtocolLooper.h"
#include "RosterItem.h" #include "RosterItem.h"

View File

@ -16,9 +16,9 @@
#include <Notification.h> #include <Notification.h>
#include <ScrollView.h> #include <ScrollView.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "RosterListView.h" #include "RosterListView.h"
@ -113,9 +113,9 @@ RosterView::ImMessage(BMessage* msg)
// Add or remove item // Add or remove item
switch (status) { switch (status) {
/*case CAYA_OFFLINE: /*case STATUS_OFFLINE:
// By default offline contacts are hidden // By default offline contacts are hidden
if (!CayaPreferences::Item()->HideOffline) if (!AppPreferences::Item()->HideOffline)
break; break;
if (HasItem(rosterItem)) if (HasItem(rosterItem))
RemoveItem(rosterItem); RemoveItem(rosterItem);
@ -132,18 +132,18 @@ RosterView::ImMessage(BMessage* msg)
fListView->Sort(); fListView->Sort();
// Check if the user want the notification // Check if the user want the notification
if (!CayaPreferences::Item()->NotifyContactStatus) if (!AppPreferences::Item()->NotifyContactStatus)
break; break;
switch (status) { switch (status) {
case CAYA_ONLINE: case STATUS_ONLINE:
case CAYA_OFFLINE: case STATUS_OFFLINE:
// Notify when contact is online or offline // Notify when contact is online or offline
if (status == CAYA_ONLINE) { if (status == STATUS_ONLINE) {
BString message; BString message;
message << rosterItem->GetContact()->GetName(); message << rosterItem->GetContact()->GetName();
if (status == CAYA_ONLINE) if (status == STATUS_ONLINE)
message << " is available!"; message << " is available!";
else else
message << " is offline!"; message << " is offline!";

View File

@ -13,15 +13,15 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include "CayaResources.h" #include "AppResources.h"
#include "CayaUtils.h"
#include "StatusMenuItem.h" #include "StatusMenuItem.h"
#include "Utils.h"
const float kSize = 16; const float kSize = 16;
const float kCircle = 12; const float kCircle = 12;
StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status, StatusMenuItem::StatusMenuItem(const char* label, UserStatus status,
bool custom, char shortcut, uint32 modifiers) bool custom, char shortcut, uint32 modifiers)
: :
BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
@ -37,7 +37,7 @@ StatusMenuItem::StatusMenuItem(const char* label, CayaStatus status,
} }
CayaStatus UserStatus
StatusMenuItem::Status() const StatusMenuItem::Status() const
{ {
return fStatus; return fStatus;
@ -54,27 +54,27 @@ StatusMenuItem::IsCustom() const
void void
StatusMenuItem::SetIcon() StatusMenuItem::SetIcon()
{ {
BResources* res = CayaResources(); BResources* res = ChatResources();
if (!res) if (!res)
return; return;
int32 num = 0; int32 num = 0;
switch (fStatus) { switch (fStatus) {
case CAYA_ONLINE: case STATUS_ONLINE:
num = kOnlineReplicant; num = kOnlineReplicant;
break; break;
case CAYA_AWAY: case STATUS_AWAY:
num = kAwayReplicant; num = kAwayReplicant;
break; break;
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
num = kBusyReplicant; num = kBusyReplicant;
break; break;
case CAYA_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
num = kCayaIconReplicant; num = kIconReplicant;
break; break;
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
case CAYA_OFFLINE: case STATUS_OFFLINE:
num = kOfflineReplicant; num = kOfflineReplicant;
break; break;
default: default:

View File

@ -9,7 +9,7 @@
#include <libinterface/BitmapMenuItem.h> #include <libinterface/BitmapMenuItem.h>
#include "CayaConstants.h" #include "AppConstants.h"
class BBitmap; class BBitmap;
@ -17,15 +17,15 @@ const int32 kSetStatus = 'SEST';
class StatusMenuItem : public BitmapMenuItem { class StatusMenuItem : public BitmapMenuItem {
public: public:
StatusMenuItem(const char* label, CayaStatus status, StatusMenuItem(const char* label, UserStatus status,
bool custom = false, char shortcut = 0, bool custom = false, char shortcut = 0,
uint32 modifiers = 0); uint32 modifiers = 0);
CayaStatus Status() const; UserStatus Status() const;
bool IsCustom() const; bool IsCustom() const;
private: private:
CayaStatus fStatus; UserStatus fStatus;
bool fCustom; bool fCustom;
void SetIcon(); void SetIcon();

View File

@ -21,9 +21,9 @@
#include <libinterface/BitmapView.h> #include <libinterface/BitmapView.h>
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaUtils.h"
#include "NicknameTextControl.h" #include "NicknameTextControl.h"
#include "StatusMenuItem.h" #include "StatusMenuItem.h"
#include "Utils.h"
const int32 kSetNickname = 'stnk'; const int32 kSetNickname = 'stnk';
@ -41,21 +41,21 @@ StatusView::StatusView(const char* name)
fStatusMenu = new BPopUpMenu("-"); fStatusMenu = new BPopUpMenu("-");
// Add status menu items // Add status menu items
int32 s = CAYA_ONLINE; int32 s = STATUS_ONLINE;
while (s >= CAYA_ONLINE && s < CAYA_STATUSES) { while (s >= STATUS_ONLINE && s < STATUS_STATUSES) {
StatusMenuItem* item = new StatusMenuItem(CayaStatusToString( StatusMenuItem* item = new StatusMenuItem(UserStatusToString(
(CayaStatus)s), (CayaStatus)s); (UserStatus)s), (UserStatus)s);
fStatusMenu->AddItem(item); fStatusMenu->AddItem(item);
/*// Add items for custom messages /*// Add items for custom messages
if (s == CAYA_ONLINE || s == CAYA_DO_NOT_DISTURB) { if (s == STATUS_ONLINE || s == STATUS_DO_NOT_DISTURB) {
item = new StatusMenuItem("Custom...", (CayaStatus)s, true); item = new StatusMenuItem("Custom...", (UserStatus)s, true);
fStatusMenu->AddItem(item); fStatusMenu->AddItem(item);
fStatusMenu->AddItem(new BSeparatorItem()); fStatusMenu->AddItem(new BSeparatorItem());
}*/ }*/
// Mark offline status by default // Mark offline status by default
if (s == CAYA_OFFLINE) if (s == STATUS_OFFLINE)
item->SetMarked(true); item->SetMarked(true);
s++; s++;
@ -109,7 +109,7 @@ StatusView::MessageReceived(BMessage* msg)
return; return;
AccountManager* accountManager = AccountManager::Get(); AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((CayaStatus)status, ""); accountManager->SetStatus((UserStatus)status, "");
break; break;
} }
default: default:
@ -126,7 +126,7 @@ StatusView::SetName(BString name)
void void
StatusView::SetStatus(CayaStatus status) StatusView::SetStatus(UserStatus status)
{ {
for (int32 i = 0; i < fStatusMenu->CountItems(); i++) { for (int32 i = 0; i < fStatusMenu->CountItems(); i++) {
StatusMenuItem* item StatusMenuItem* item

View File

@ -7,7 +7,7 @@
#include <View.h> #include <View.h>
#include "CayaConstants.h" #include "AppConstants.h"
class BPopUpMenu; class BPopUpMenu;
@ -22,7 +22,7 @@ public:
virtual void MessageReceived(BMessage* msg); virtual void MessageReceived(BMessage* msg);
void SetName(BString name); void SetName(BString name);
void SetStatus(CayaStatus status); void SetStatus(UserStatus status);
void SetAvatarIcon(const BBitmap* bitmap); void SetAvatarIcon(const BBitmap* bitmap);
private: private:

View File

@ -8,10 +8,10 @@
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <View.h> #include <View.h>
#include "CayaConstants.h" #include "AppConstants.h"
#include "CayaUtils.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "User.h" #include "User.h"
#include "Utils.h"
UserItem::UserItem(const char* name, User* user, int32 status) UserItem::UserItem(const char* name, User* user, int32 status)
@ -71,13 +71,13 @@ UserItem::_GetTextColor(rgb_color highColor)
{ {
switch (fStatus) switch (fStatus)
{ {
case CAYA_AWAY: case STATUS_AWAY:
return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 1); return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 1);
case CAYA_INVISIBLE: case STATUS_INVISIBLE:
case CAYA_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2); return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2);
case CAYA_OFFLINE: case STATUS_OFFLINE:
return CayaTintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 3); return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 3);
} }
return highColor; return highColor;
} }

View File

@ -9,8 +9,8 @@
#include <MenuItem.h> #include <MenuItem.h>
#include <Window.h> #include <Window.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "Conversation.h" #include "Conversation.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ProtocolLooper.h" #include "ProtocolLooper.h"
@ -82,7 +82,7 @@ UserListView::_BlankPopUp()
BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); BPopUpMenu* menu = new BPopUpMenu("blankPopUp");
BMenuItem* invite = new BMenuItem("Invite user…" B_UTF8_ELLIPSIS, 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) if (fChat == NULL)
invite->SetEnabled(false); invite->SetEnabled(false);

View File

@ -18,9 +18,9 @@
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include "AccountManager.h" #include "AccountManager.h"
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "ConversationItem.h" #include "ConversationItem.h"
#include "ConversationListView.h" #include "ConversationListView.h"
#include "ConversationView.h" #include "ConversationView.h"
@ -77,7 +77,7 @@ bool
MainWindow::QuitRequested() MainWindow::QuitRequested()
{ {
int32 button_index = 0; int32 button_index = 0;
if(!CayaPreferences::Item()->DisableQuitConfirm) if(!AppPreferences::Item()->DisableQuitConfirm)
{ {
BAlert* alert = new BAlert("Closing", "Are you sure you want to quit?", BAlert* alert = new BAlert("Closing", "Are you sure you want to quit?",
"Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
@ -88,7 +88,7 @@ MainWindow::QuitRequested()
if(button_index == 0) { if(button_index == 0) {
fServer->Quit(); fServer->Quit();
CayaPreferences::Get()->Save(); AppPreferences::Get()->Save();
ReplicantStatusView::RemoveReplicant(); ReplicantStatusView::RemoveReplicant();
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
@ -101,13 +101,13 @@ void
MainWindow::MessageReceived(BMessage* message) MainWindow::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case CAYA_SHOW_SETTINGS: case APP_SHOW_SETTINGS:
{ {
PreferencesWindow* win = new PreferencesWindow(); PreferencesWindow* win = new PreferencesWindow();
win->Show(); win->Show();
break; break;
} }
case CAYA_NEW_CHAT: case APP_NEW_CHAT:
{ {
BMessage* newMsg = new BMessage(IM_MESSAGE); BMessage* newMsg = new BMessage(IM_MESSAGE);
newMsg->AddInt32("im_what", IM_CREATE_CHAT); newMsg->AddInt32("im_what", IM_CREATE_CHAT);
@ -117,7 +117,7 @@ MainWindow::MessageReceived(BMessage* message)
fRosterWindow->Show(); fRosterWindow->Show();
break; break;
} }
case CAYA_NEW_ROOM: case APP_NEW_ROOM:
{ {
BMessage* createMsg = new BMessage(IM_MESSAGE); BMessage* createMsg = new BMessage(IM_MESSAGE);
createMsg->AddInt32("im_what", IM_CREATE_ROOM); createMsg->AddInt32("im_what", IM_CREATE_ROOM);
@ -127,7 +127,7 @@ MainWindow::MessageReceived(BMessage* message)
win->Show(); win->Show();
break; break;
} }
case CAYA_JOIN_ROOM: case APP_JOIN_ROOM:
{ {
BMessage temp; BMessage temp;
BMessage roomId; BMessage roomId;
@ -146,7 +146,7 @@ MainWindow::MessageReceived(BMessage* message)
win->Show(); win->Show();
break; break;
} }
case CAYA_SEND_INVITE: case APP_SEND_INVITE:
{ {
if (fConversation == NULL) if (fConversation == NULL)
break; break;
@ -165,12 +165,12 @@ MainWindow::MessageReceived(BMessage* message)
fRosterWindow->Show(); fRosterWindow->Show();
break; break;
} }
case CAYA_EDIT_ROSTER: case APP_EDIT_ROSTER:
{ {
RosterEditWindow::Get(fServer)->Show(); RosterEditWindow::Get(fServer)->Show();
break; break;
} }
case CAYA_MOVE_UP: case APP_MOVE_UP:
{ {
if (fConversation == NULL) if (fConversation == NULL)
break; break;
@ -180,7 +180,7 @@ MainWindow::MessageReceived(BMessage* message)
fListView->SelectConversation(index - 1); fListView->SelectConversation(index - 1);
break; break;
} }
case CAYA_MOVE_DOWN: case APP_MOVE_DOWN:
{ {
if (fConversation == NULL) if (fConversation == NULL)
break; break;
@ -191,15 +191,15 @@ MainWindow::MessageReceived(BMessage* message)
fListView->SelectConversation(index + 1); fListView->SelectConversation(index + 1);
break; break;
} }
case CAYA_REPLICANT_STATUS_SET: case APP_REPLICANT_STATUS_SET:
{ {
int32 status; int32 status;
message->FindInt32("status", &status); message->FindInt32("status", &status);
AccountManager* accountManager = AccountManager::Get(); AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((CayaStatus)status); accountManager->SetStatus((UserStatus)status);
break; break;
} }
case CAYA_REPLICANT_SHOW_WINDOW: case APP_REPLICANT_SHOW_WINDOW:
{ {
if (LockLooper()) { if (LockLooper()) {
SetWorkspaces(B_CURRENT_WORKSPACE); SetWorkspaces(B_CURRENT_WORKSPACE);
@ -217,14 +217,14 @@ MainWindow::MessageReceived(BMessage* message)
} }
break; break;
} }
case CAYA_CHAT: case APP_CHAT:
{ {
message->AddString("body", fSendView->Text()); message->AddString("body", fSendView->Text());
fChatView->MessageReceived(message); fChatView->MessageReceived(message);
fSendView->SetText(""); fSendView->SetText("");
break; break;
} }
case CAYA_DISABLE_ACCOUNT: case APP_DISABLE_ACCOUNT:
_ToggleMenuItems(); _ToggleMenuItems();
break; break;
case IM_MESSAGE: case IM_MESSAGE:
@ -322,7 +322,7 @@ MainWindow::ObserveInteger(int32 what, int32 val)
{ {
switch (what) { switch (what) {
case INT_ACCOUNT_STATUS: case INT_ACCOUNT_STATUS:
fStatusView->SetStatus((CayaStatus)val); fStatusView->SetStatus((UserStatus)val);
break; break;
} }
} }
@ -462,7 +462,7 @@ MainWindow::_CreateMenuBar()
programMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, programMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
new BMessage(B_ABOUT_REQUESTED))); new BMessage(B_ABOUT_REQUESTED)));
programMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, 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 BSeparatorItem());
programMenu->AddItem(new BMenuItem("Quit", programMenu->AddItem(new BMenuItem("Quit",
new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY)); new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
@ -471,29 +471,29 @@ MainWindow::_CreateMenuBar()
// Chat // Chat
BMenu* chatMenu = new BMenu("Chat"); BMenu* chatMenu = new BMenu("Chat");
chatMenu->AddItem(new BMenuItem("Join room" B_UTF8_ELLIPSIS, 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->AddSeparatorItem();
chatMenu->AddItem(new BMenuItem("New room" B_UTF8_ELLIPSIS, 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, 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); chatMenu->SetTargetForItems(this);
// Roster // Roster
BMenu* rosterMenu = new BMenu("Roster"); BMenu* rosterMenu = new BMenu("Roster");
rosterMenu->AddItem(new BMenuItem("Edit roster" B_UTF8_ELLIPSIS, 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->AddSeparatorItem();
rosterMenu->AddItem(new BMenuItem("Invite user" B_UTF8_ELLIPSIS, 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); rosterMenu->SetTargetForItems(this);
// Window // Window
BMenu* windowMenu = new BMenu("Window"); BMenu* windowMenu = new BMenu("Window");
windowMenu->AddItem(new BMenuItem("Up", 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", 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); windowMenu->SetTargetForItems(this);
menuBar->AddItem(programMenu); menuBar->AddItem(programMenu);

View File

@ -19,14 +19,14 @@
#include <ScrollView.h> #include <ScrollView.h>
#include <SeparatorView.h> #include <SeparatorView.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaUtils.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "RosterListView.h" #include "RosterListView.h"
#include "RosterView.h" #include "RosterView.h"
#include "TemplateWindow.h" #include "TemplateWindow.h"
#include "Utils.h"
const uint32 kSendMessage = 'RWSM'; const uint32 kSendMessage = 'RWSM';

View File

@ -18,10 +18,10 @@
#include <Notification.h> #include <Notification.h>
#include <ScrollView.h> #include <ScrollView.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaPreferences.h" #include "AppPreferences.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaUtils.h" #include "Utils.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "RosterListView.h" #include "RosterListView.h"
#include "RosterView.h" #include "RosterView.h"

View File

@ -17,8 +17,8 @@
#include <TextControl.h> #include <TextControl.h>
#include <String.h> #include <String.h>
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaUtils.h" #include "Utils.h"
#include "TemplateView.h" #include "TemplateView.h"

View File

@ -23,7 +23,7 @@ class TemplateView;
class TemplateWindow : public BWindow { class TemplateWindow : public BWindow {
public: public:
/*! Get template from selected account's protocol /*! Get template from selected account's protocol
* via CayaProtocol::SettingsTemplate() */ * via ChatProtocol::SettingsTemplate() */
TemplateWindow(const char* title, TemplateWindow(const char* title,
const char* templateType, BMessage* msg, const char* templateType, BMessage* msg,
Server* server, bigtime_t instance = -1); Server* server, bigtime_t instance = -1);

View File

@ -22,11 +22,11 @@
#include <libinterface/BitmapView.h> #include <libinterface/BitmapView.h>
#include "CayaMessages.h" #include "AppMessages.h"
#include "CayaProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "CayaConstants.h" #include "AppConstants.h"
#include "CayaRenderView.h" #include "RenderView.h"
#include "CayaUtils.h" #include "Utils.h"
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "User.h" #include "User.h"
@ -48,7 +48,7 @@ UserInfoWindow::UserInfoWindow(User* user)
fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BString status(fUser->GetName()); BString status(fUser->GetName());
status << CayaStatusToString(fUser->GetNotifyStatus()); status << UserStatusToString(fUser->GetNotifyStatus());
status << "\n\n ID : "; status << "\n\n ID : ";
status << fUser->GetId(); status << fUser->GetId();

View File

@ -13,7 +13,7 @@
#include <StringView.h> #include <StringView.h>
#include "Observer.h" #include "Observer.h"
#include "CayaConstants.h" #include "AppConstants.h"
class BitmapView; class BitmapView;
class User; class User;

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kPersonIcon) #'VICN' array { resource(kPersonIcon) #'VICN' array {
$"6E636966080500020006023CADF43D104EBF02CA3EA2224AF02046648D00FFDB" $"6E636966080500020006023CADF43D104EBF02CA3EA2224AF02046648D00FFDB"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kSearchIcon) #'VICN' array { resource(kSearchIcon) #'VICN' array {
$"6E6369660805010200060338D2F73CD163BF82B23B84A94B88504870C900FFEF" $"6E6369660805010200060338D2F73CD163BF82B23B84A94B88504870C900FFEF"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kToolIcon) #'VICN' array { resource(kToolIcon) #'VICN' array {
$"6E63696602030100000200160239F20638AB65BE3DD63F501B4A4E27488B2600" $"6E63696602030100000200160239F20638AB65BE3DD63F501B4A4E27488B2600"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kAwayReplicant) #'VICN' array { resource(kAwayReplicant) #'VICN' array {
$"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900FFEC" $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900FFEC"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kBusyReplicant) #'VICN' array { resource(kBusyReplicant) #'VICN' array {
$"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900EC66" $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900EC66"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kExitMenuReplicant) #'VICN' array { resource(kExitMenuReplicant) #'VICN' array {
$"6E63696606040165020006023B17A83B6361BEF4563EB24E4B75B044DE8200F3" $"6E63696606040165020006023B17A83B6361BEF4563EB24E4B75B044DE8200F3"

View File

@ -1,6 +1,6 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kCayaIconReplicant) #'VICN' array { resource(kIconReplicant) #'VICN' array {
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7" $"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7"
$"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900" $"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900"
$"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF" $"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kReplicantMessageReceived) #'VICN' array { resource(kReplicantMessageReceived) #'VICN' array {
$"6E636966050500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFCE" $"6E636966050500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFCE"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kOfflineReplicant) #'VICN' array { resource(kOfflineReplicant) #'VICN' array {
$"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA190062F3" $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA190062F3"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kOnlineReplicant) #'VICN' array { resource(kOnlineReplicant) #'VICN' array {
$"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900647F" $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900647F"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kAwayIcon) #'VICN' array { resource(kAwayIcon) #'VICN' array {
$"6E636966010201040400FFBA0055FFFFFFA9E8B732FFB891270102044030C345" $"6E636966010201040400FFBA0055FFFFFFA9E8B732FFB891270102044030C345"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kBusyIcon) #'VICN' array { resource(kBusyIcon) #'VICN' array {
$"6E636966010201040400E9060655E1CECEA9C43A3AFF752F2F0102044030C345" $"6E636966010201040400E9060655E1CECEA9C43A3AFF752F2F0102044030C345"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kOfflineIcon) #'VICN' array { resource(kOfflineIcon) #'VICN' array {
$"6E63696601020104040000337F558B9097A92D3541FF0F12160102044030C345" $"6E63696601020104040000337F558B9097A92D3541FF0F12160102044030C345"

View File

@ -1,4 +1,4 @@
#include "application/CayaResources.h" #include "application/AppResources.h"
resource(kOnlineIcon) #'VICN' array { resource(kOnlineIcon) #'VICN' array {
$"6E63696601020104040050B96455B9D6BEA917932FFF2766210102044030C345" $"6E63696601020104040050B96455B9D6BEA917932FFF2766210102044030C345"

View File

@ -17,7 +17,7 @@
#include <libsupport/SHA1.h> #include <libsupport/SHA1.h>
#include <CayaProtocolMessages.h> #include <ChatProtocolMessages.h>
#include <Role.h> #include <Role.h>
#include <RoomFlags.h> #include <RoomFlags.h>
@ -72,7 +72,7 @@ JabberHandler::~JabberHandler()
status_t status_t
JabberHandler::Init(CayaProtocolMessengerInterface* messenger) JabberHandler::Init(ChatProtocolMessengerInterface* messenger)
{ {
fServerMessenger = messenger; fServerMessenger = messenger;
@ -96,11 +96,11 @@ JabberHandler::Process(BMessage* msg)
BString status_msg = msg->FindString("message"); BString status_msg = msg->FindString("message");
switch (status) { switch (status) {
case CAYA_ONLINE: case STATUS_ONLINE:
// Log in if we still need to // Log in if we still need to
resume_thread(fRecvThread); resume_thread(fRecvThread);
break; break;
case CAYA_OFFLINE: case STATUS_OFFLINE:
kill_thread(fRecvThread); kill_thread(fRecvThread);
break; break;
default: default:
@ -436,7 +436,7 @@ JabberHandler::GetEncoding()
} }
CayaProtocolMessengerInterface* ChatProtocolMessengerInterface*
JabberHandler::MessengerInterface() const JabberHandler::MessengerInterface() const
{ {
return fServerMessenger; return fServerMessenger;
@ -906,7 +906,7 @@ JabberHandler::_StatusSetMsg(const char* user_id, gloox::Presence::PresenceType
BMessage msg(IM_MESSAGE); BMessage msg(IM_MESSAGE);
msg.AddInt32("im_what", IM_STATUS_SET); msg.AddInt32("im_what", IM_STATUS_SET);
msg.AddString("user_id", user_id); msg.AddString("user_id", user_id);
msg.AddInt32("status", _GlooxStatusToCaya(type)); msg.AddInt32("status", _GlooxStatusToApp(type));
if (BString(resource).IsEmpty() == false) if (BString(resource).IsEmpty() == false)
msg.AddString("resource", resource); msg.AddString("resource", resource);
@ -1060,26 +1060,26 @@ JabberHandler::_AvatarChanged(const char* id, const char* filename)
} }
CayaStatus UserStatus
JabberHandler::_GlooxStatusToCaya(gloox::Presence::PresenceType type) JabberHandler::_GlooxStatusToApp(gloox::Presence::PresenceType type)
{ {
switch (type) { switch (type) {
case gloox::Presence::Available: case gloox::Presence::Available:
case gloox::Presence::Chat: case gloox::Presence::Chat:
return CAYA_ONLINE; return STATUS_ONLINE;
case gloox::Presence::Away: case gloox::Presence::Away:
return CAYA_AWAY; return STATUS_AWAY;
case gloox::Presence::XA: case gloox::Presence::XA:
return CAYA_CUSTOM_STATUS; return STATUS_CUSTOM_STATUS;
case gloox::Presence::DND: case gloox::Presence::DND:
return CAYA_DO_NOT_DISTURB; return STATUS_DO_NOT_DISTURB;
case gloox::Presence::Unavailable: case gloox::Presence::Unavailable:
return CAYA_OFFLINE; return STATUS_OFFLINE;
default: default:
break; break;
} }
return CAYA_OFFLINE; return STATUS_OFFLINE;
} }
@ -1308,7 +1308,7 @@ JabberHandler::onConnect()
// We are online // We are online
BMessage msg(IM_MESSAGE); BMessage msg(IM_MESSAGE);
msg.AddInt32("im_what", IM_OWN_STATUS_SET); msg.AddInt32("im_what", IM_OWN_STATUS_SET);
msg.AddInt32("status", CAYA_ONLINE); msg.AddInt32("status", STATUS_ONLINE);
_SendMessage(&msg); _SendMessage(&msg);
fVCardManager->fetchVCard(fJid, this); fVCardManager->fetchVCard(fJid, this);
@ -1321,7 +1321,7 @@ JabberHandler::onDisconnect(gloox::ConnectionError e)
// We are offline // We are offline
BMessage msg(IM_MESSAGE); BMessage msg(IM_MESSAGE);
msg.AddInt32("im_what", IM_OWN_STATUS_SET); msg.AddInt32("im_what", IM_OWN_STATUS_SET);
msg.AddInt32("status", CAYA_OFFLINE); msg.AddInt32("status", STATUS_OFFLINE);
_SendMessage(&msg); _SendMessage(&msg);
if (e == gloox::ConnNoError) { if (e == gloox::ConnNoError) {
@ -1373,7 +1373,7 @@ JabberHandler::handleRoster(const gloox::Roster& roster)
infoMsg.AddInt32("im_what", IM_CONTACT_INFO); infoMsg.AddInt32("im_what", IM_CONTACT_INFO);
infoMsg.AddString("user_id", jid); infoMsg.AddString("user_id", jid);
infoMsg.AddString("user_name", name); infoMsg.AddString("user_name", name);
infoMsg.AddInt32("status", CAYA_OFFLINE); infoMsg.AddInt32("status", STATUS_OFFLINE);
// Groups // Groups
gloox::StringList g = (*it).second->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_id", item.jidJID().full().c_str());
msg.AddString("user_name", item.name().c_str()); msg.AddString("user_name", item.name().c_str());
msg.AddInt32("subscription", item.subscription()); msg.AddInt32("subscription", item.subscription());
msg.AddInt32("status", _GlooxStatusToCaya(type)); msg.AddInt32("status", _GlooxStatusToApp(type));
msg.AddString("message", presenceMsg.c_str()); msg.AddString("message", presenceMsg.c_str());
// Groups // Groups

View File

@ -32,8 +32,8 @@
#include <gloox/vcardhandler.h> #include <gloox/vcardhandler.h>
#include <gloox/vcardmanager.h> #include <gloox/vcardmanager.h>
#include <CayaProtocol.h> #include <AppConstants.h>
#include <CayaConstants.h> #include <ChatProtocol.h>
#include <libsupport/KeyMap.h> #include <libsupport/KeyMap.h>
class BList; class BList;
@ -43,7 +43,7 @@ class InviteHandler;
typedef KeyMap<BString, gloox::MUCRoom*> RoomMap; typedef KeyMap<BString, gloox::MUCRoom*> RoomMap;
class JabberHandler : public CayaProtocol, gloox::RosterListener, gloox::ConnectionListener, class JabberHandler : public ChatProtocol, gloox::RosterListener, gloox::ConnectionListener,
gloox::LogHandler, gloox::MessageSessionHandler, gloox::LogHandler, gloox::MessageSessionHandler,
gloox::MessageHandler, gloox::MessageEventHandler, gloox::MessageHandler, gloox::MessageEventHandler,
gloox::ChatStateHandler, gloox::VCardHandler, gloox::ChatStateHandler, gloox::VCardHandler,
@ -52,8 +52,8 @@ public:
JabberHandler(); JabberHandler();
virtual ~JabberHandler(); virtual ~JabberHandler();
// CayaProtocol inheritance // ChatProtocol inheritance
virtual status_t Init(CayaProtocolMessengerInterface*); virtual status_t Init(ChatProtocolMessengerInterface*);
virtual status_t Process(BMessage* msg); virtual status_t Process(BMessage* msg);
@ -77,7 +77,7 @@ public:
virtual uint32 GetEncoding(); virtual uint32 GetEncoding();
virtual CayaProtocolMessengerInterface* virtual ChatProtocolMessengerInterface*
MessengerInterface() const; MessengerInterface() const;
// Functions for gloox // Functions for gloox
@ -105,7 +105,7 @@ protected:
BMessage _RosterTemplate(); BMessage _RosterTemplate();
private: private:
CayaProtocolMessengerInterface* ChatProtocolMessengerInterface*
fServerMessenger; fServerMessenger;
gloox::Client* fClient; gloox::Client* fClient;
@ -148,7 +148,7 @@ private:
void _CacheAvatar(const char* id, const char* binval, size_t length); void _CacheAvatar(const char* id, const char* binval, size_t length);
void _AvatarChanged(const char*id, const char* filename); 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); BString _MUCChatId(gloox::MUCRoom* room);
bool _MUCUserId(BString chat_id, const char* nick, BString* id); bool _MUCUserId(BString chat_id, const char* nick, BString* id);

View File

@ -13,23 +13,23 @@
#include "JabberProtocol.h" #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 int32 protocol_count();
extern "C" _EXPORT const char* signature(); extern "C" _EXPORT const char* signature();
extern "C" _EXPORT const char* friendly_signature(); extern "C" _EXPORT const char* friendly_signature();
extern "C" _EXPORT uint32 version(); extern "C" _EXPORT uint32 version();
CayaProtocol* ChatProtocol*
protocol_at(int32 i) protocol_at(int32 i)
{ {
switch(i) { switch(i) {
case 0: case 0:
return (CayaProtocol*)new JabberProtocol(); return (ChatProtocol*)new JabberProtocol();
case 1: case 1:
return (CayaProtocol*)new FacebookProtocol(); return (ChatProtocol*)new FacebookProtocol();
case 2: case 2:
return (CayaProtocol*)new GoogleTalkProtocol(); return (ChatProtocol*)new GoogleTalkProtocol();
} }
return NULL; return NULL;
} }
@ -59,7 +59,7 @@ friendly_signature()
uint32 uint32
version() version()
{ {
return CAYA_VERSION_1_PRE_ALPHA_1; return APP_VERSION_1_PRE_ALPHA_1;
} }