Chat-O-Matic/application/windows/TemplateWindow.h
Jaidyn Ann f4342d9310 Roster management, adding new contacts
The base for roster management (RosterEditWindow) has been made, and
adding new contacts works. Up next is contact removal and editing.

This leverages a new template (as defined in a protocol's
CayaProtocol::SettingsTemplate()), "roster," which should contain all
slots pertinent to editing/adding a contact member.

Two new API messages were added for this― IM_CONTACT_LIST_CONTACT_ADDED
and IM_CONTACT_LIST_CONTACT_REMOVED. The former will functionally just
be IM_CONTACT_INFO, but with some semantical meaning.

A new CayaMessage (CAYA_EDIT_ROSTER) was also added.

TemplateWindow was also edited to this end: Now, like RosterWindow/View,
it can be given a specific accounts' instance id, and it will prevent
the selection of another account. A new constructor was also added, to
allow a ProtocolTemplate to be explicitly passed to it― probably from
the program itself.
2021-06-19 18:25:58 -05:00

60 lines
1.3 KiB
C++

/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Copyright 2021, Jaidyn Levesque. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TEMPLATE_WINDOW_H
#define _TEMPLATE_WINDOW_H
#include <String.h>
#include <Window.h>
#include "ProtocolTemplate.h"
#include "Server.h"
class BAlert;
class BMenu;
class BMenuField;
class BTextControl;
class ProtocolSettings;
class TemplateView;
class TemplateWindow : public BWindow {
public:
/*! Get template from selected account's protocol
* via CayaProtocol::SettingsTemplate() */
TemplateWindow(const char* title,
const char* templateType, BMessage* msg,
Server* server, bigtime_t instance = -1);
/*! Use only the given template. */
TemplateWindow(const char* title,
ProtocolTemplate* temp, BMessage* msg,
Server* server, bigtime_t instance = -1);
virtual void MessageReceived(BMessage* msg);
void SetTarget(BHandler* target);
private:
void _InitInterface(bigtime_t instance);
void _LoadTemplate();
Server* fServer;
AccountInstances fAccounts;
int32 fSelectedAcc;
BMenuField* fMenuField;
ProtocolTemplate* fTemplate;
BString fTemplateType;
TemplateView* fTemplateView;
BButton* fOkButton;
BMessage* fMessage;
BHandler* fTarget;
};
#endif // _TEMPLATE_WINDOW_H