Rename AccountManager to StatusManager
This commit is contained in:
parent
60ad595d5d
commit
c492a46a65
|
@ -33,7 +33,6 @@ APP_MIME_SIG = application/x-vnd.cardie
|
||||||
# Also note that spaces in folder names do not work well with this Makefile.
|
# Also note that spaces in folder names do not work well with this Makefile.
|
||||||
SRCS = \
|
SRCS = \
|
||||||
application/Account.cpp \
|
application/Account.cpp \
|
||||||
application/AccountManager.cpp \
|
|
||||||
application/ChatProtocolAddOn.cpp \
|
application/ChatProtocolAddOn.cpp \
|
||||||
application/ChatCommand.cpp \
|
application/ChatCommand.cpp \
|
||||||
application/Contact.cpp \
|
application/Contact.cpp \
|
||||||
|
@ -45,6 +44,7 @@ SRCS = \
|
||||||
application/ProtocolSettings.cpp \
|
application/ProtocolSettings.cpp \
|
||||||
application/ProtocolTemplate.cpp \
|
application/ProtocolTemplate.cpp \
|
||||||
application/Server.cpp \
|
application/Server.cpp \
|
||||||
|
application/StatusManager.cpp \
|
||||||
application/TheApp.cpp \
|
application/TheApp.cpp \
|
||||||
application/User.cpp \
|
application/User.cpp \
|
||||||
application/Utils.cpp \
|
application/Utils.cpp \
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "AppMessages.h"
|
#include "AppMessages.h"
|
||||||
#include "AppPreferences.h"
|
#include "AppPreferences.h"
|
||||||
#include "Cardie.h"
|
#include "Cardie.h"
|
||||||
|
@ -41,6 +40,7 @@
|
||||||
#include "ProtocolLooper.h"
|
#include "ProtocolLooper.h"
|
||||||
#include "ProtocolManager.h"
|
#include "ProtocolManager.h"
|
||||||
#include "RosterItem.h"
|
#include "RosterItem.h"
|
||||||
|
#include "StatusManager.h"
|
||||||
#include "UserInfoWindow.h"
|
#include "UserInfoWindow.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
@ -171,9 +171,9 @@ Server::Filter(BMessage* message, BHandler **target)
|
||||||
printf("err %s\n", strerror(ret));
|
printf("err %s\n", strerror(ret));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AccountManager* accountManager = AccountManager::Get();
|
StatusManager* statusMan = StatusManager::Get();
|
||||||
accountManager->SetReplicantMessenger(messenger);
|
statusMan->SetReplicantMessenger(messenger);
|
||||||
accountManager->ReplicantStatusNotify(accountManager->Status());
|
statusMan->ReplicantStatusNotify(statusMan->Status());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case APP_ROOM_INFO:
|
case APP_ROOM_INFO:
|
||||||
|
|
|
@ -6,19 +6,21 @@
|
||||||
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
|
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AccountManager.h"
|
#include "StatusManager.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "ChatProtocolMessages.h"
|
#include "ChatProtocolMessages.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "NotifyMessage.h"
|
#include "NotifyMessage.h"
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
#include "TheApp.h"
|
#include "TheApp.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static AccountManager* fInstance = NULL;
|
static StatusManager* fInstance = NULL;
|
||||||
|
|
||||||
|
|
||||||
AccountManager::AccountManager()
|
StatusManager::StatusManager()
|
||||||
:
|
:
|
||||||
fStatus(STATUS_OFFLINE),
|
fStatus(STATUS_OFFLINE),
|
||||||
fReplicantMessenger(NULL)
|
fReplicantMessenger(NULL)
|
||||||
|
@ -26,23 +28,23 @@ AccountManager::AccountManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AccountManager::~AccountManager()
|
StatusManager::~StatusManager()
|
||||||
{
|
{
|
||||||
delete fReplicantMessenger;
|
delete fReplicantMessenger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AccountManager*
|
StatusManager*
|
||||||
AccountManager::Get()
|
StatusManager::Get()
|
||||||
{
|
{
|
||||||
if (fInstance == NULL)
|
if (fInstance == NULL)
|
||||||
fInstance = new AccountManager();
|
fInstance = new StatusManager();
|
||||||
return fInstance;
|
return fInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountManager::SetNickname(BString nick, int64 instance)
|
StatusManager::SetNickname(BString nick, int64 instance)
|
||||||
{
|
{
|
||||||
// Create message
|
// Create message
|
||||||
BMessage* msg = new BMessage(IM_MESSAGE);
|
BMessage* msg = new BMessage(IM_MESSAGE);
|
||||||
|
@ -62,21 +64,21 @@ AccountManager::SetNickname(BString nick, int64 instance)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountManager::SetReplicantMessenger(BMessenger* messenger)
|
StatusManager::SetReplicantMessenger(BMessenger* messenger)
|
||||||
{
|
{
|
||||||
fReplicantMessenger = messenger;
|
fReplicantMessenger = messenger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UserStatus
|
UserStatus
|
||||||
AccountManager::Status() const
|
StatusManager::Status() const
|
||||||
{
|
{
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountManager::SetStatus(UserStatus status, const char* str, int64 instance)
|
StatusManager::SetStatus(UserStatus status, const char* str, int64 instance)
|
||||||
{
|
{
|
||||||
if (fStatus == status && instance == -1)
|
if (fStatus == status && instance == -1)
|
||||||
return;
|
return;
|
||||||
|
@ -107,14 +109,14 @@ AccountManager::SetStatus(UserStatus status, const char* str, int64 instance)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountManager::SetStatus(UserStatus status, int64 instance)
|
StatusManager::SetStatus(UserStatus status, int64 instance)
|
||||||
{
|
{
|
||||||
SetStatus(status, NULL, instance);
|
SetStatus(status, NULL, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountManager::ReplicantStatusNotify(UserStatus status, bool wait)
|
StatusManager::ReplicantStatusNotify(UserStatus status, bool wait)
|
||||||
{
|
{
|
||||||
if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) {
|
if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) {
|
||||||
printf("notification sent\n");
|
printf("notification sent\n");
|
|
@ -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 _ACCOUNT_MANAGER_H
|
#ifndef _STATUS_MANAGER_H
|
||||||
#define _ACCOUNT_MANAGER_H
|
#define _STATUS_MANAGER_H
|
||||||
|
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
||||||
#include "Notifier.h"
|
#include "Notifier.h"
|
||||||
|
|
||||||
|
|
||||||
class AccountManager : public Notifier {
|
class StatusManager : public Notifier {
|
||||||
public:
|
public:
|
||||||
static AccountManager* Get();
|
static StatusManager* Get();
|
||||||
|
|
||||||
void SetNickname(BString nick, int64 instance = -1);
|
void SetNickname(BString nick, int64 instance = -1);
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ public:
|
||||||
void ReplicantStatusNotify(UserStatus status,
|
void ReplicantStatusNotify(UserStatus status,
|
||||||
bool wait = false);
|
bool wait = false);
|
||||||
private:
|
private:
|
||||||
AccountManager();
|
StatusManager();
|
||||||
~AccountManager();
|
~StatusManager();
|
||||||
|
|
||||||
UserStatus fStatus;
|
UserStatus fStatus;
|
||||||
BMessenger* fReplicantMessenger;
|
BMessenger* fReplicantMessenger;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ACCOUNT_MANAGER_H
|
#endif // _STATUS_MANAGER_H
|
|
@ -13,7 +13,6 @@
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
|
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "AppPreferences.h"
|
#include "AppPreferences.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,9 @@
|
||||||
#include <libinterface/BitmapUtils.h>
|
#include <libinterface/BitmapUtils.h>
|
||||||
#include <libinterface/BitmapView.h>
|
#include <libinterface/BitmapView.h>
|
||||||
|
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "Cardie.h"
|
|
||||||
#include "AppMessages.h"
|
#include "AppMessages.h"
|
||||||
#include "AppPreferences.h"
|
#include "AppPreferences.h"
|
||||||
|
#include "Cardie.h"
|
||||||
#include "ChatProtocolMessages.h"
|
#include "ChatProtocolMessages.h"
|
||||||
#include "ReplicantMenuItem.h"
|
#include "ReplicantMenuItem.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#include <libinterface/EnterTextView.h>
|
#include <libinterface/EnterTextView.h>
|
||||||
#include <libinterface/MenuButton.h>
|
#include <libinterface/MenuButton.h>
|
||||||
|
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "AccountsMenu.h"
|
#include "AccountsMenu.h"
|
||||||
#include "ChatProtocolMessages.h"
|
#include "ChatProtocolMessages.h"
|
||||||
#include "Contact.h"
|
#include "Contact.h"
|
||||||
#include "ImageCache.h"
|
#include "ImageCache.h"
|
||||||
#include "NotifyMessage.h"
|
#include "NotifyMessage.h"
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
|
#include "StatusManager.h"
|
||||||
#include "StatusMenuItem.h"
|
#include "StatusMenuItem.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ StatusView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
BString nick;
|
BString nick;
|
||||||
if (msg->FindString("nick", &nick) == B_OK)
|
if (msg->FindString("nick", &nick) == B_OK)
|
||||||
AccountManager::Get()->SetNickname(nick, fAccount);
|
StatusManager::Get()->SetNickname(nick, fAccount);
|
||||||
_SetToAccount();
|
_SetToAccount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ StatusView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
int32 status;
|
int32 status;
|
||||||
if (msg->FindInt32("status", &status) == B_OK)
|
if (msg->FindInt32("status", &status) == B_OK)
|
||||||
AccountManager::Get()->SetStatus((UserStatus)status, "",
|
StatusManager::Get()->SetStatus((UserStatus)status, "",
|
||||||
fAccount);
|
fAccount);
|
||||||
_SetToAccount();
|
_SetToAccount();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
|
||||||
#include "AccountDialog.h"
|
#include "AccountDialog.h"
|
||||||
#include "AccountManager.h"
|
|
||||||
#include "AccountsWindow.h"
|
#include "AccountsWindow.h"
|
||||||
#include "AppMessages.h"
|
#include "AppMessages.h"
|
||||||
#include "AppPreferences.h"
|
#include "AppPreferences.h"
|
||||||
|
@ -36,6 +35,7 @@
|
||||||
#include "ReplicantStatusView.h"
|
#include "ReplicantStatusView.h"
|
||||||
#include "RosterEditWindow.h"
|
#include "RosterEditWindow.h"
|
||||||
#include "RosterWindow.h"
|
#include "RosterWindow.h"
|
||||||
|
#include "StatusManager.h"
|
||||||
#include "StatusView.h"
|
#include "StatusView.h"
|
||||||
#include "TemplateWindow.h"
|
#include "TemplateWindow.h"
|
||||||
|
|
||||||
|
@ -231,8 +231,8 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
int32 status;
|
int32 status;
|
||||||
message->FindInt32("status", &status);
|
message->FindInt32("status", &status);
|
||||||
AccountManager* accountManager = AccountManager::Get();
|
StatusManager* statusMan = StatusManager::Get();
|
||||||
accountManager->SetStatus((UserStatus)status);
|
statusMan->SetStatus((UserStatus)status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case APP_REPLICANT_SHOW_WINDOW:
|
case APP_REPLICANT_SHOW_WINDOW:
|
||||||
|
|
Ŝarĝante…
Reference in New Issue