0326cee687
The roster list is now split from MainWindow into RosterWindow, which can be used arbitrarily for selecting something from contacts. The im_what, title, and target can be specified. Right now it's in use under the Chat menu, "New chat…". Chats can only have two members (DM/PM), so "New chat…" directly leads to the roster list. In the future, roster list might be extended to allow specification of non-contact users based on their identifiers, or filtering based on protocol/account― this could help it with "invites" to future rooms, etc. IM_CREATE_CHAT and IM_CHAT_CREATED were also added to the protocol API, allowing a new chat to be explicitly created from Caya or the protocol.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
/*
|
|
* 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.
|
|
*
|
|
* Authors:
|
|
* Andrea Anzani, andrea.anzani@gmail.com
|
|
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
|
|
*/
|
|
#ifndef ROSTERWINDOW_H
|
|
#define ROSTERWINDOW_H
|
|
|
|
#include <Window.h>
|
|
|
|
class RosterItem;
|
|
class RosterListView;
|
|
class Server;
|
|
|
|
|
|
/* A window with the a list of the user's contacts, will send a message to
|
|
the server with contact info, once a contact is selected. */
|
|
class RosterWindow : public BWindow {
|
|
public:
|
|
RosterWindow(const char* title, int32 selectMsg, BMessenger* messenger,
|
|
Server* server);
|
|
|
|
void MessageReceived(BMessage* message);
|
|
void ImMessage(BMessage* msg);
|
|
|
|
int32 CountItems() const;
|
|
RosterItem* ItemAt(int index);
|
|
void AddItem(RosterItem*);
|
|
bool HasItem(RosterItem*);
|
|
void RemoveItem(RosterItem*);
|
|
|
|
void UpdateListItem(RosterItem* item);
|
|
|
|
private:
|
|
void _PopulateRosterList();
|
|
|
|
Server* fServer;
|
|
RosterListView* fListView;
|
|
BMessenger* fTarget;
|
|
BMessage* fMessage;
|
|
};
|
|
|
|
|
|
#endif // ROSTERWINDOW_H
|
|
|