Rename AccountManager to StatusManager

This commit is contained in:
Jaidyn Ann 2021-08-16 10:40:18 -05:00
parent 60ad595d5d
commit c492a46a65
8 changed files with 35 additions and 35 deletions

View File

@ -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.
SRCS = \
application/Account.cpp \
application/AccountManager.cpp \
application/ChatProtocolAddOn.cpp \
application/ChatCommand.cpp \
application/Contact.cpp \
@ -45,6 +44,7 @@ SRCS = \
application/ProtocolSettings.cpp \
application/ProtocolTemplate.cpp \
application/Server.cpp \
application/StatusManager.cpp \
application/TheApp.cpp \
application/User.cpp \
application/Utils.cpp \

View File

@ -26,7 +26,6 @@
#include <TranslationUtils.h>
#include "Account.h"
#include "AccountManager.h"
#include "AppMessages.h"
#include "AppPreferences.h"
#include "Cardie.h"
@ -41,6 +40,7 @@
#include "ProtocolLooper.h"
#include "ProtocolManager.h"
#include "RosterItem.h"
#include "StatusManager.h"
#include "UserInfoWindow.h"
#include "Utils.h"
@ -171,9 +171,9 @@ Server::Filter(BMessage* message, BHandler **target)
printf("err %s\n", strerror(ret));
break;
}
AccountManager* accountManager = AccountManager::Get();
accountManager->SetReplicantMessenger(messenger);
accountManager->ReplicantStatusNotify(accountManager->Status());
StatusManager* statusMan = StatusManager::Get();
statusMan->SetReplicantMessenger(messenger);
statusMan->ReplicantStatusNotify(statusMan->Status());
break;
}
case APP_ROOM_INFO:

View File

@ -6,19 +6,21 @@
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/
#include "AccountManager.h"
#include "StatusManager.h"
#include <stdio.h>
#include "ChatProtocolMessages.h"
#include "MainWindow.h"
#include "NotifyMessage.h"
#include "Server.h"
#include "TheApp.h"
#include <stdio.h>
static AccountManager* fInstance = NULL;
static StatusManager* fInstance = NULL;
AccountManager::AccountManager()
StatusManager::StatusManager()
:
fStatus(STATUS_OFFLINE),
fReplicantMessenger(NULL)
@ -26,23 +28,23 @@ AccountManager::AccountManager()
}
AccountManager::~AccountManager()
StatusManager::~StatusManager()
{
delete fReplicantMessenger;
}
AccountManager*
AccountManager::Get()
StatusManager*
StatusManager::Get()
{
if (fInstance == NULL)
fInstance = new AccountManager();
fInstance = new StatusManager();
return fInstance;
}
void
AccountManager::SetNickname(BString nick, int64 instance)
StatusManager::SetNickname(BString nick, int64 instance)
{
// Create message
BMessage* msg = new BMessage(IM_MESSAGE);
@ -62,21 +64,21 @@ AccountManager::SetNickname(BString nick, int64 instance)
void
AccountManager::SetReplicantMessenger(BMessenger* messenger)
StatusManager::SetReplicantMessenger(BMessenger* messenger)
{
fReplicantMessenger = messenger;
}
UserStatus
AccountManager::Status() const
StatusManager::Status() const
{
return fStatus;
}
void
AccountManager::SetStatus(UserStatus status, const char* str, int64 instance)
StatusManager::SetStatus(UserStatus status, const char* str, int64 instance)
{
if (fStatus == status && instance == -1)
return;
@ -107,14 +109,14 @@ AccountManager::SetStatus(UserStatus status, const char* str, int64 instance)
void
AccountManager::SetStatus(UserStatus status, int64 instance)
StatusManager::SetStatus(UserStatus status, int64 instance)
{
SetStatus(status, NULL, instance);
}
void
AccountManager::ReplicantStatusNotify(UserStatus status, bool wait)
StatusManager::ReplicantStatusNotify(UserStatus status, bool wait)
{
if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) {
printf("notification sent\n");

View File

@ -2,8 +2,8 @@
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ACCOUNT_MANAGER_H
#define _ACCOUNT_MANAGER_H
#ifndef _STATUS_MANAGER_H
#define _STATUS_MANAGER_H
#include <Messenger.h>
@ -11,9 +11,9 @@
#include "Notifier.h"
class AccountManager : public Notifier {
class StatusManager : public Notifier {
public:
static AccountManager* Get();
static StatusManager* Get();
void SetNickname(BString nick, int64 instance = -1);
@ -26,12 +26,12 @@ public:
void ReplicantStatusNotify(UserStatus status,
bool wait = false);
private:
AccountManager();
~AccountManager();
StatusManager();
~StatusManager();
UserStatus fStatus;
BMessenger* fReplicantMessenger;
};
#endif // _ACCOUNT_MANAGER_H
#endif // _STATUS_MANAGER_H

View File

@ -13,7 +13,6 @@
#include <ControlLook.h>
#include <LayoutBuilder.h>
#include "AccountManager.h"
#include "AppPreferences.h"

View File

@ -27,10 +27,9 @@
#include <libinterface/BitmapUtils.h>
#include <libinterface/BitmapView.h>
#include "AccountManager.h"
#include "Cardie.h"
#include "AppMessages.h"
#include "AppPreferences.h"
#include "Cardie.h"
#include "ChatProtocolMessages.h"
#include "ReplicantMenuItem.h"
#include "Utils.h"

View File

@ -21,13 +21,13 @@
#include <libinterface/EnterTextView.h>
#include <libinterface/MenuButton.h>
#include "AccountManager.h"
#include "AccountsMenu.h"
#include "ChatProtocolMessages.h"
#include "Contact.h"
#include "ImageCache.h"
#include "NotifyMessage.h"
#include "Server.h"
#include "StatusManager.h"
#include "StatusMenuItem.h"
#include "Utils.h"
@ -123,7 +123,7 @@ StatusView::MessageReceived(BMessage* msg)
{
BString nick;
if (msg->FindString("nick", &nick) == B_OK)
AccountManager::Get()->SetNickname(nick, fAccount);
StatusManager::Get()->SetNickname(nick, fAccount);
_SetToAccount();
break;
}
@ -131,7 +131,7 @@ StatusView::MessageReceived(BMessage* msg)
{
int32 status;
if (msg->FindInt32("status", &status) == B_OK)
AccountManager::Get()->SetStatus((UserStatus)status, "",
StatusManager::Get()->SetStatus((UserStatus)status, "",
fAccount);
_SetToAccount();
break;

View File

@ -18,7 +18,6 @@
#include <TranslationUtils.h>
#include "AccountDialog.h"
#include "AccountManager.h"
#include "AccountsWindow.h"
#include "AppMessages.h"
#include "AppPreferences.h"
@ -36,6 +35,7 @@
#include "ReplicantStatusView.h"
#include "RosterEditWindow.h"
#include "RosterWindow.h"
#include "StatusManager.h"
#include "StatusView.h"
#include "TemplateWindow.h"
@ -231,8 +231,8 @@ MainWindow::MessageReceived(BMessage* message)
{
int32 status;
message->FindInt32("status", &status);
AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((UserStatus)status);
StatusManager* statusMan = StatusManager::Get();
statusMan->SetStatus((UserStatus)status);
break;
}
case APP_REPLICANT_SHOW_WINDOW: