Chat-O-Matic/application/windows/PreferencesWindow.cpp
Jaidyn Ann 5b5840a79e Explicitly tie Conversations, Contacts, and Users to their ProtocolLoopers
Previously, all Conversations/Contacts/Users were stored in the Server,
each in their respective KeyMaps, identified solely by their
identifiers. This leads to the glaring problem of overlap― if the user
has multiple accounts, some users/rooms might be used or present in multiple
accounts at the same time.

Now, each accounts' Contacts, Conversations, and Users are stored in
its ProtocolLooper, making this overlap impossible. An oversight of only
allowing one user identifier to be stored (fMySelf) in Server was also fixed
this way.

This is the bulk of the work required for multi-account support― now,
the user can join the same XMPP room on two seperate accounts, and it
works perfectly.
2021-06-10 15:16:43 -05:00

61 lines
1.2 KiB
C++

/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/
#include "PreferencesWindow.h"
#include <Button.h>
#include <ControlLook.h>
#include <LayoutBuilder.h>
#include <TabView.h>
#include "PreferencesAccounts.h"
#include "PreferencesBehavior.h"
#include "PreferencesChatWindow.h"
#include "PreferencesReplicant.h"
const uint32 kApply = 'SAVE';
PreferencesWindow::PreferencesWindow()
: BWindow(BRect(0, 0, 500, 615), "Preferences", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE)
{
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);
tabView->AddTab(new PreferencesAccounts());
tabView->AddTab(new PreferencesBehavior());
tabView->AddTab(new PreferencesChatWindow());
tabView->AddTab(new PreferencesReplicant());
BButton* ok = new BButton("OK", new BMessage(kApply));
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(tabView)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(ok)
.End();
CenterOnScreen();
}
void
PreferencesWindow::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case kApply:
Close();
break;
default:
BWindow::MessageReceived(msg);
}
}