Move command/menu-item registration to call
Registration of custom chat commands and menu-items for protocols was done by the IM_REGISTER_* messages, and is now done through direct calls to the CayaProtocol object. The new model for call/message for protocols is this: Temporary information (chat messages, roster members, etc.) should be accessed through messages. Relatively static data (protocol name, commands) should be accessed through direct calls to the protocol object.
This commit is contained in:
parent
d4f82dccc6
commit
b1920dad47
|
@ -8,6 +8,7 @@
|
||||||
#define _CAYA_PROTOCOL_H
|
#define _CAYA_PROTOCOL_H
|
||||||
|
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
|
#include <ObjectList.h>
|
||||||
|
|
||||||
class BBitmap;
|
class BBitmap;
|
||||||
|
|
||||||
|
@ -39,10 +40,38 @@ public:
|
||||||
virtual status_t UpdateSettings(BMessage*) = 0;
|
virtual status_t UpdateSettings(BMessage*) = 0;
|
||||||
|
|
||||||
//! Return a settings template
|
//! Return a settings template
|
||||||
// Currently there are two: "account" (used when creating/editing
|
// Currently there are three: "account" (used when creating/editing
|
||||||
// the user's account) and "room" (used when creating a room).
|
// the user's account), "room" (used when creating a room), and "roster"
|
||||||
|
// (used when adding or editing a roster member.
|
||||||
virtual BMessage SettingsTemplate(const char* name) = 0;
|
virtual BMessage SettingsTemplate(const char* name) = 0;
|
||||||
|
|
||||||
|
//! Custom chat commands― archived ChatCommand objects
|
||||||
|
// Requires: String "_name", String "_desc", Bool "_proto",
|
||||||
|
// Message "_msg", int32s "_argtype",
|
||||||
|
// String "class" = "ChatCommand"
|
||||||
|
virtual BObjectList<BMessage> Commands() {
|
||||||
|
return BObjectList<BMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Custom menu items used in the userlist right-click menu.
|
||||||
|
// Archived BMenuItem with some extra slots.
|
||||||
|
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
||||||
|
// Bool "x_to_protocol", Bool "x_priority", int32 "x_perms",
|
||||||
|
// int32 "x_target_perms", int32 "x_target_antiperms"
|
||||||
|
virtual BObjectList<BMessage> UserPopUpItems() = 0;
|
||||||
|
|
||||||
|
//! Custom menu items used in the conversation-list right-click menu.
|
||||||
|
// Archived BMenuItem with some extra slots.
|
||||||
|
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
||||||
|
// Bool "x_to_protocol", int32 "x_perms"
|
||||||
|
virtual BObjectList<BMessage> ChatPopUpItems() = 0;
|
||||||
|
|
||||||
|
//! Custom menubar items (in the "Protocol" menu).
|
||||||
|
// Archived BMenuItem with some extra slots.
|
||||||
|
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
||||||
|
// Bool "x_to_protocol"
|
||||||
|
virtual BObjectList<BMessage> MenuBarItems() = 0;
|
||||||
|
|
||||||
//! Protocol signature
|
//! Protocol signature
|
||||||
virtual const char* Signature() const = 0;
|
virtual const char* Signature() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -388,44 +388,6 @@ enum im_what_code {
|
||||||
|
|
||||||
//! Protocol is ready to receive messages
|
//! Protocol is ready to receive messages
|
||||||
IM_PROTOCOL_READY = 1002,
|
IM_PROTOCOL_READY = 1002,
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GUI-related messages
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Register a chat command →Caya
|
|
||||||
// Just an archived ChatCommand; if "instance" isn't specified, the command
|
|
||||||
// is global, rather than protocol-only.
|
|
||||||
// Requires: String "_name", String "_desc", Bool "_proto",
|
|
||||||
// Message "_msg", int32s "_argtype",
|
|
||||||
// String "class" = "ChatCommand"
|
|
||||||
// Allowed: int64 "instance"
|
|
||||||
IM_REGISTER_COMMAND = 1100,
|
|
||||||
|
|
||||||
//! Register a pop-up item →Caya
|
|
||||||
// Just an archived BMenuItem with extra slots; if "instance" isn't
|
|
||||||
// specified, the item is global, rather than protocol-only.
|
|
||||||
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
|
||||||
// Bool "x_to_protocol", Bool "x_priority", int32 "x_perms",
|
|
||||||
// int32 "x_target_perms", int32 "x_target_antiperms"
|
|
||||||
// Allowed: int64 "instance"
|
|
||||||
IM_REGISTER_USERLIST_ITEM = 1101,
|
|
||||||
|
|
||||||
//! Register a pop-up item →Caya
|
|
||||||
// Just an archived BMenuItem with extra slots; if "instance" isn't
|
|
||||||
// specified, the item is global, rather than protocol-only.
|
|
||||||
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
|
||||||
// Bool "x_to_protocol", int32 "x_perms"
|
|
||||||
// Allowed: int64 "instance"
|
|
||||||
IM_REGISTER_CHATLIST_ITEM = 1102,
|
|
||||||
|
|
||||||
//! Register a "Protocol" menu item →Caya
|
|
||||||
// Just an archived BMenuItem with extra slots; it adds a menu item to
|
|
||||||
// the menubar's "Protocol" menu.
|
|
||||||
// Requires: String "_label", Message "_msg", String "class" = "BMenuItem"
|
|
||||||
// Bool "x_to_protocol", int64 "instance"
|
|
||||||
IM_REGISTER_MENUBAR_ITEM = 1103
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include "Role.h"
|
#include "Role.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
BObjectList<BMessage>
|
||||||
DefaultCommands(BLooper* target)
|
DefaultCommands()
|
||||||
{
|
{
|
||||||
List<int32> roomUser;
|
List<int32> roomUser;
|
||||||
roomUser.AddItem(CMD_ROOM_PARTICIPANT);
|
roomUser.AddItem(CMD_ROOM_PARTICIPANT);
|
||||||
|
@ -85,71 +85,75 @@ DefaultCommands(BLooper* target)
|
||||||
help->SetDesc("List all current commands, or get help for certain command.");
|
help->SetDesc("List all current commands, or get help for certain command.");
|
||||||
commands.AddItem("help", help);
|
commands.AddItem("help", help);
|
||||||
|
|
||||||
|
BObjectList<BMessage> cmds;
|
||||||
for (int i = 0; i < commands.CountItems(); i++) {
|
for (int i = 0; i < commands.CountItems(); i++) {
|
||||||
BMessage* item = new BMessage(IM_MESSAGE);
|
|
||||||
item->AddInt32("im_what", IM_REGISTER_COMMAND);
|
|
||||||
ChatCommand* cmd = commands.ValueAt(i);
|
ChatCommand* cmd = commands.ValueAt(i);
|
||||||
|
BMessage* item = new BMessage();
|
||||||
cmd->Archive(item);
|
cmd->Archive(item);
|
||||||
target->PostMessage(item);
|
cmds.AddItem(item);
|
||||||
}
|
}
|
||||||
|
return cmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
BObjectList<BMessage>
|
||||||
DefaultChatPopUpItems(BLooper* target)
|
DefaultChatPopUpItems()
|
||||||
{
|
{
|
||||||
|
BObjectList<BMessage> items;
|
||||||
|
|
||||||
BMessage* leave = new BMessage(IM_MESSAGE);
|
BMessage* leave = new BMessage(IM_MESSAGE);
|
||||||
leave->AddInt32("im_what", IM_LEAVE_ROOM);
|
leave->AddInt32("im_what", IM_LEAVE_ROOM);
|
||||||
|
|
||||||
BMessage* item = new BMessage(IM_MESSAGE);
|
BMessage* item = new BMessage(IM_MESSAGE);
|
||||||
item->AddInt32("im_what", IM_REGISTER_CHATLIST_ITEM);
|
|
||||||
item->AddString("class", "BMenuItem");
|
item->AddString("class", "BMenuItem");
|
||||||
item->AddString("_label", "Leave chat");
|
item->AddString("_label", "Leave chat");
|
||||||
item->AddMessage("_msg", leave);
|
item->AddMessage("_msg", leave);
|
||||||
item->AddBool("x_to_protocol", true);
|
item->AddBool("x_to_protocol", true);
|
||||||
|
items.AddItem(item);
|
||||||
target->PostMessage(item);
|
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
BObjectList<BMessage>
|
||||||
DefaultUserPopUpItems(BLooper* target)
|
DefaultUserPopUpItems()
|
||||||
{
|
{
|
||||||
BObjectList<BMessage> items;
|
BObjectList<BMessage> items;
|
||||||
|
|
||||||
BMessage* infoMsg = new BMessage(CAYA_USER_INFO);
|
BMessage* infoMsg = new BMessage(CAYA_USER_INFO);
|
||||||
target->PostMessage(_UserMenuItem("User info" B_UTF8_ELLIPSIS, infoMsg, 0,
|
items.AddItem(_UserMenuItem("User info" B_UTF8_ELLIPSIS, infoMsg, 0,
|
||||||
0, 0, false, false));
|
0, 0, false, false));
|
||||||
|
|
||||||
BMessage* kickMsg = new BMessage(IM_MESSAGE);
|
BMessage* kickMsg = new BMessage(IM_MESSAGE);
|
||||||
kickMsg->AddInt32("im_what", IM_ROOM_KICK_PARTICIPANT);
|
kickMsg->AddInt32("im_what", IM_ROOM_KICK_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Kick user", kickMsg, PERM_KICK, 0, 0,
|
items.AddItem(_UserMenuItem("Kick user", kickMsg, PERM_KICK, 0, 0,
|
||||||
false, true));
|
false, true));
|
||||||
|
|
||||||
BMessage* banMsg = new BMessage(IM_MESSAGE);
|
BMessage* banMsg = new BMessage(IM_MESSAGE);
|
||||||
banMsg->AddInt32("im_what", IM_ROOM_BAN_PARTICIPANT);
|
banMsg->AddInt32("im_what", IM_ROOM_BAN_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Ban user", banMsg, PERM_BAN, 0, 0, false,
|
items.AddItem(_UserMenuItem("Ban user", banMsg, PERM_BAN, 0, 0, false,
|
||||||
true));
|
true));
|
||||||
|
|
||||||
BMessage* muteMsg = new BMessage(IM_MESSAGE);
|
BMessage* muteMsg = new BMessage(IM_MESSAGE);
|
||||||
muteMsg->AddInt32("im_what", IM_ROOM_MUTE_PARTICIPANT);
|
muteMsg->AddInt32("im_what", IM_ROOM_MUTE_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Mute user", muteMsg, PERM_MUTE,
|
items.AddItem(_UserMenuItem("Mute user", muteMsg, PERM_MUTE,
|
||||||
PERM_WRITE, 0, false, true));
|
PERM_WRITE, 0, false, true));
|
||||||
|
|
||||||
BMessage* unmuteMsg = new BMessage(IM_MESSAGE);
|
BMessage* unmuteMsg = new BMessage(IM_MESSAGE);
|
||||||
unmuteMsg->AddInt32("im_what", IM_ROOM_UNMUTE_PARTICIPANT);
|
unmuteMsg->AddInt32("im_what", IM_ROOM_UNMUTE_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Unmute user", unmuteMsg, PERM_MUTE, 0,
|
items.AddItem(_UserMenuItem("Unmute user", unmuteMsg, PERM_MUTE, 0,
|
||||||
PERM_WRITE, false, true));
|
PERM_WRITE, false, true));
|
||||||
|
|
||||||
BMessage* deafenMsg = new BMessage(IM_MESSAGE);
|
BMessage* deafenMsg = new BMessage(IM_MESSAGE);
|
||||||
deafenMsg->AddInt32("im_what", IM_ROOM_DEAFEN_PARTICIPANT);
|
deafenMsg->AddInt32("im_what", IM_ROOM_DEAFEN_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Deafen user", deafenMsg, PERM_DEAFEN,
|
items.AddItem(_UserMenuItem("Deafen user", deafenMsg, PERM_DEAFEN,
|
||||||
PERM_READ, 0, false, true));
|
PERM_READ, 0, false, true));
|
||||||
|
|
||||||
BMessage* undeafenMsg = new BMessage(IM_MESSAGE);
|
BMessage* undeafenMsg = new BMessage(IM_MESSAGE);
|
||||||
undeafenMsg->AddInt32("im_what", IM_ROOM_UNDEAFEN_PARTICIPANT);
|
undeafenMsg->AddInt32("im_what", IM_ROOM_UNDEAFEN_PARTICIPANT);
|
||||||
target->PostMessage(_UserMenuItem("Undeafen user", undeafenMsg, PERM_DEAFEN,
|
items.AddItem(_UserMenuItem("Undeafen user", undeafenMsg, PERM_DEAFEN,
|
||||||
0, PERM_READ, false, true));
|
0, PERM_READ, false, true));
|
||||||
|
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,8 +163,6 @@ _UserMenuItem(const char* label, BMessage* msg, int32 user_perms,
|
||||||
bool toProtocol)
|
bool toProtocol)
|
||||||
{
|
{
|
||||||
BMessage* item = new BMessage(IM_MESSAGE);
|
BMessage* item = new BMessage(IM_MESSAGE);
|
||||||
item->AddInt32("im_what", IM_REGISTER_USERLIST_ITEM);
|
|
||||||
|
|
||||||
item->AddString("class", "BMenuItem");
|
item->AddString("class", "BMenuItem");
|
||||||
item->AddString("_label", label);
|
item->AddString("_label", label);
|
||||||
item->AddMessage("_msg", msg);
|
item->AddMessage("_msg", msg);
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
|
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
|
||||||
class BLooper;
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
|
|
||||||
|
|
||||||
void DefaultCommands(BLooper* target);
|
BObjectList<BMessage> DefaultCommands();
|
||||||
void DefaultChatPopUpItems(BLooper* target);
|
BObjectList<BMessage> DefaultChatPopUpItems();
|
||||||
void DefaultUserPopUpItems(BLooper* target);
|
BObjectList<BMessage> DefaultUserPopUpItems();
|
||||||
BMessage* _UserMenuItem(const char* label, BMessage* msg,
|
BMessage* _UserMenuItem(const char* label, BMessage* msg,
|
||||||
int32 user_perms, int32 target_perms,
|
int32 user_perms, int32 target_perms,
|
||||||
int32 target_lacks, bool ignorePriority,
|
int32 target_lacks, bool ignorePriority,
|
||||||
|
|
|
@ -29,6 +29,8 @@ ProtocolLooper::ProtocolLooper(CayaProtocol* protocol, int64 instance)
|
||||||
Account* account = reinterpret_cast<Account*>(
|
Account* account = reinterpret_cast<Account*>(
|
||||||
protocol->MessengerInterface());
|
protocol->MessengerInterface());
|
||||||
|
|
||||||
|
_InitCommands();
|
||||||
|
|
||||||
BString name(protocol->FriendlySignature());
|
BString name(protocol->FriendlySignature());
|
||||||
name << " - " << account->Name();
|
name << " - " << account->Name();
|
||||||
|
|
||||||
|
@ -165,55 +167,6 @@ ProtocolLooper::CommandById(BString id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ProtocolLooper::AddCommand(ChatCommand* cmd)
|
|
||||||
{
|
|
||||||
fCommands.AddItem(cmd->GetName(), cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
ProtocolLooper::UserPopUpItems() const
|
|
||||||
{
|
|
||||||
return fUserItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ProtocolLooper::AddUserPopUpItem(BMessage* archived)
|
|
||||||
{
|
|
||||||
fUserItems.AddItem(archived);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
ProtocolLooper::ChatPopUpItems() const
|
|
||||||
{
|
|
||||||
return fChatItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ProtocolLooper::AddChatPopUpItem(BMessage* archived)
|
|
||||||
{
|
|
||||||
fChatItems.AddItem(archived);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
ProtocolLooper::MenuBarItems() const
|
|
||||||
{
|
|
||||||
return fMenuItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ProtocolLooper::AddMenuBarItem(BMessage* archived)
|
|
||||||
{
|
|
||||||
fMenuItems.AddItem(archived);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BString
|
BString
|
||||||
ProtocolLooper::GetOwnId()
|
ProtocolLooper::GetOwnId()
|
||||||
{
|
{
|
||||||
|
@ -245,3 +198,12 @@ ProtocolLooper::GetListItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ProtocolLooper::_InitCommands()
|
||||||
|
{
|
||||||
|
BObjectList<BMessage> commands = fProtocol->Commands();
|
||||||
|
for (int i = 0; i < commands.CountItems(); i++) {
|
||||||
|
ChatCommand* cmd = new ChatCommand(commands.ItemAt(i));
|
||||||
|
fCommands.AddItem(cmd->GetName(), cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -52,19 +52,6 @@ public:
|
||||||
|
|
||||||
CommandMap Commands() const;
|
CommandMap Commands() const;
|
||||||
ChatCommand* CommandById(BString id);
|
ChatCommand* CommandById(BString id);
|
||||||
void AddCommand(ChatCommand* cmd);
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
UserPopUpItems() const;
|
|
||||||
void AddUserPopUpItem(BMessage* archived);
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
ChatPopUpItems() const;
|
|
||||||
void AddChatPopUpItem(BMessage* archived);
|
|
||||||
|
|
||||||
BObjectList<BMessage>
|
|
||||||
MenuBarItems() const;
|
|
||||||
void AddMenuBarItem(BMessage* archived);
|
|
||||||
|
|
||||||
BString GetOwnId();
|
BString GetOwnId();
|
||||||
void SetOwnId(BString user_id);
|
void SetOwnId(BString user_id);
|
||||||
|
@ -75,6 +62,8 @@ public:
|
||||||
GetListItem();
|
GetListItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _InitCommands();
|
||||||
|
|
||||||
CayaProtocol* fProtocol;
|
CayaProtocol* fProtocol;
|
||||||
int64 fInstance;
|
int64 fInstance;
|
||||||
|
|
||||||
|
@ -83,11 +72,7 @@ private:
|
||||||
ChatMap fChatMap;
|
ChatMap fChatMap;
|
||||||
RosterMap fRosterMap;
|
RosterMap fRosterMap;
|
||||||
UserMap fUserMap;
|
UserMap fUserMap;
|
||||||
|
|
||||||
CommandMap fCommands;
|
CommandMap fCommands;
|
||||||
BObjectList<BMessage> fUserItems;
|
|
||||||
BObjectList<BMessage> fChatItems;
|
|
||||||
BObjectList<BMessage> fMenuItems;
|
|
||||||
|
|
||||||
ConversationAccountItem*
|
ConversationAccountItem*
|
||||||
fListItem;
|
fListItem;
|
||||||
|
|
|
@ -42,8 +42,15 @@
|
||||||
|
|
||||||
Server::Server()
|
Server::Server()
|
||||||
:
|
:
|
||||||
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE)
|
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
||||||
|
fChatItems(DefaultChatPopUpItems()),
|
||||||
|
fUserItems(DefaultUserPopUpItems())
|
||||||
{
|
{
|
||||||
|
BObjectList<BMessage> commands = DefaultCommands();
|
||||||
|
for (int i = 0; i < commands.CountItems(); i++) {
|
||||||
|
ChatCommand* cmd = new ChatCommand(commands.ItemAt(i));
|
||||||
|
fCommands.AddItem(cmd->GetName(), cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -535,43 +542,6 @@ Server::ImMessage(BMessage* msg)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IM_REGISTER_COMMAND:
|
|
||||||
{
|
|
||||||
ChatCommand* cmd = new ChatCommand(msg);
|
|
||||||
if (cmd == NULL) break;
|
|
||||||
|
|
||||||
ProtocolLooper* looper = _LooperFromMessage(msg);
|
|
||||||
if (looper == NULL)
|
|
||||||
fCommands.AddItem(cmd->GetName(), cmd);
|
|
||||||
else
|
|
||||||
looper->AddCommand(cmd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IM_REGISTER_USERLIST_ITEM:
|
|
||||||
{
|
|
||||||
ProtocolLooper* looper = _LooperFromMessage(msg);
|
|
||||||
if (looper == NULL)
|
|
||||||
fUserItems.AddItem(new BMessage(*msg));
|
|
||||||
else
|
|
||||||
looper->AddUserPopUpItem(new BMessage(*msg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IM_REGISTER_CHATLIST_ITEM:
|
|
||||||
{
|
|
||||||
ProtocolLooper* looper = _LooperFromMessage(msg);
|
|
||||||
if (looper == NULL)
|
|
||||||
fChatItems.AddItem(new BMessage(*msg));
|
|
||||||
else
|
|
||||||
looper->AddChatPopUpItem(new BMessage(*msg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IM_REGISTER_MENUBAR_ITEM:
|
|
||||||
{
|
|
||||||
ProtocolLooper* looper = _LooperFromMessage(msg);
|
|
||||||
if (looper != NULL)
|
|
||||||
looper->AddMenuBarItem(new BMessage(*msg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IM_PROTOCOL_READY:
|
case IM_PROTOCOL_READY:
|
||||||
{
|
{
|
||||||
// Ready notification
|
// Ready notification
|
||||||
|
@ -956,5 +926,3 @@ Server::_GetRole(BMessage* msg)
|
||||||
|
|
||||||
return new Role(title, perms, priority);
|
return new Role(title, perms, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ ConversationListView::_ConversationPopUp()
|
||||||
|
|
||||||
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
||||||
BObjectList<BMessage> items = server->ChatPopUpItems();
|
BObjectList<BMessage> items = server->ChatPopUpItems();
|
||||||
BObjectList<BMessage> protoItems = looper->ChatPopUpItems();
|
BObjectList<BMessage> protoItems = looper->Protocol()->ChatPopUpItems();
|
||||||
items.AddList(&protoItems);
|
items.AddList(&protoItems);
|
||||||
|
|
||||||
for (int i = 0; i < items.CountItems(); i++) {
|
for (int i = 0; i < items.CountItems(); i++) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ UserListView::_UserPopUp()
|
||||||
|
|
||||||
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
||||||
BObjectList<BMessage> items = server->UserPopUpItems();
|
BObjectList<BMessage> items = server->UserPopUpItems();
|
||||||
BObjectList<BMessage> protoItems = fChat->GetProtocolLooper()->UserPopUpItems();
|
BObjectList<BMessage> protoItems = fChat->GetProtocolLooper()->Protocol()->UserPopUpItems();
|
||||||
items.AddList(&protoItems);
|
items.AddList(&protoItems);
|
||||||
|
|
||||||
for (int i = 0; i < items.CountItems(); i++) {
|
for (int i = 0; i < items.CountItems(); i++) {
|
||||||
|
|
|
@ -54,11 +54,6 @@ MainWindow::MainWindow()
|
||||||
fServer = new Server();
|
fServer = new Server();
|
||||||
AddFilter(fServer);
|
AddFilter(fServer);
|
||||||
|
|
||||||
// Register default commands & items
|
|
||||||
DefaultCommands(this);
|
|
||||||
DefaultUserPopUpItems(this);
|
|
||||||
DefaultChatPopUpItems(this);
|
|
||||||
|
|
||||||
// Also through the editing filter (enter to send)
|
// Also through the editing filter (enter to send)
|
||||||
AddCommonFilter(new EditingFilter(fSendView));
|
AddCommonFilter(new EditingFilter(fSendView));
|
||||||
fSendView->MakeFocus(true);
|
fSendView->MakeFocus(true);
|
||||||
|
@ -382,7 +377,7 @@ MainWindow::SetConversation(Conversation* chat)
|
||||||
// Add and populate "Protocol" menu, if appropriate
|
// Add and populate "Protocol" menu, if appropriate
|
||||||
if (fConversation != NULL) {
|
if (fConversation != NULL) {
|
||||||
ProtocolLooper* looper = fConversation->GetProtocolLooper();
|
ProtocolLooper* looper = fConversation->GetProtocolLooper();
|
||||||
BObjectList<BMessage> menuItems = looper->MenuBarItems();
|
BObjectList<BMessage> menuItems = looper->Protocol()->MenuBarItems();
|
||||||
for (int i = 0; i < menuItems.CountItems(); i++) {
|
for (int i = 0; i < menuItems.CountItems(); i++) {
|
||||||
BMessage* itemMsg = menuItems.ItemAt(i);
|
BMessage* itemMsg = menuItems.ItemAt(i);
|
||||||
BMessage* msg = new BMessage(*itemMsg);
|
BMessage* msg = new BMessage(*itemMsg);
|
||||||
|
|
|
@ -345,6 +345,34 @@ JabberHandler::GetName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BObjectList<BMessage>
|
||||||
|
JabberHandler::Commands()
|
||||||
|
{
|
||||||
|
return BObjectList<BMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BObjectList<BMessage>
|
||||||
|
JabberHandler::ChatPopUpItems()
|
||||||
|
{
|
||||||
|
return BObjectList<BMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BObjectList<BMessage>
|
||||||
|
JabberHandler::UserPopUpItems()
|
||||||
|
{
|
||||||
|
return BObjectList<BMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BObjectList<BMessage>
|
||||||
|
JabberHandler::MenuBarItems()
|
||||||
|
{
|
||||||
|
return BObjectList<BMessage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
JabberHandler::UpdateSettings(BMessage* msg)
|
JabberHandler::UpdateSettings(BMessage* msg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,11 @@ public:
|
||||||
virtual void SetName(const char* name);
|
virtual void SetName(const char* name);
|
||||||
virtual const char* GetName();
|
virtual const char* GetName();
|
||||||
|
|
||||||
|
virtual BObjectList<BMessage> Commands();
|
||||||
|
virtual BObjectList<BMessage> ChatPopUpItems();
|
||||||
|
virtual BObjectList<BMessage> UserPopUpItems();
|
||||||
|
virtual BObjectList<BMessage> MenuBarItems();
|
||||||
|
|
||||||
virtual status_t UpdateSettings(BMessage* msg);
|
virtual status_t UpdateSettings(BMessage* msg);
|
||||||
|
|
||||||
virtual uint32 GetEncoding();
|
virtual uint32 GetEncoding();
|
||||||
|
|
Ŝarĝante…
Reference in New Issue