parent
5ecf254ada
commit
5723f55433
|
@ -139,7 +139,6 @@ UserListView::_BlankPopUp()
|
||||||
|
|
||||||
BMenuItem* invite = new BMenuItem("Invite user…" B_UTF8_ELLIPSIS,
|
BMenuItem* invite = new BMenuItem("Invite user…" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY);
|
new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY);
|
||||||
invite->SetEnabled(false);
|
|
||||||
|
|
||||||
menu->AddItem(invite);
|
menu->AddItem(invite);
|
||||||
menu->SetTargetForItems(Window());
|
menu->SetTargetForItems(Window());
|
||||||
|
|
|
@ -106,8 +106,11 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
|
|
||||||
case CAYA_NEW_CHAT:
|
case CAYA_NEW_CHAT:
|
||||||
{
|
{
|
||||||
|
BMessage* newMsg = new BMessage(IM_MESSAGE);
|
||||||
|
newMsg->AddInt32("im_what", IM_CREATE_CHAT);
|
||||||
|
|
||||||
fRosterWindow = new RosterWindow("Invite contact to chat"
|
fRosterWindow = new RosterWindow("Invite contact to chat"
|
||||||
B_UTF8_ELLIPSIS, IM_CREATE_CHAT, new BMessenger(this), fServer);
|
B_UTF8_ELLIPSIS, newMsg, new BMessenger(this), fServer);
|
||||||
fRosterWindow->Show();
|
fRosterWindow->Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -120,10 +123,28 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CAYA_SEND_INVITE:
|
||||||
|
{
|
||||||
|
if (fConversation == NULL)
|
||||||
|
break;
|
||||||
|
BString chat_id = fConversation->GetId();
|
||||||
|
|
||||||
|
BMessage* invite = new BMessage(IM_MESSAGE);
|
||||||
|
invite->AddInt32("im_what", IM_ROOM_SEND_INVITE);
|
||||||
|
invite->AddString("chat_id", chat_id);
|
||||||
|
|
||||||
|
BLooper* looper = (BLooper*)fConversation->GetProtocolLooper();
|
||||||
|
fRosterWindow = new RosterWindow("Invite contact to chat"
|
||||||
|
B_UTF8_ELLIPSIS, invite, new BMessenger(looper), fServer);
|
||||||
|
|
||||||
|
fRosterWindow->Show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CAYA_MOVE_UP:
|
case CAYA_MOVE_UP:
|
||||||
{
|
{
|
||||||
if (fConversation == NULL)
|
if (fConversation == NULL)
|
||||||
return;
|
break;
|
||||||
|
|
||||||
int32 index = fListView->IndexOf(fConversation->GetListItem());
|
int32 index = fListView->IndexOf(fConversation->GetListItem());
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
|
@ -134,7 +155,7 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
case CAYA_MOVE_DOWN:
|
case CAYA_MOVE_DOWN:
|
||||||
{
|
{
|
||||||
if (fConversation == NULL)
|
if (fConversation == NULL)
|
||||||
return;
|
break;
|
||||||
|
|
||||||
int32 index = fListView->IndexOf(fConversation->GetListItem());
|
int32 index = fListView->IndexOf(fConversation->GetListItem());
|
||||||
int32 count = fListView->CountItems();
|
int32 count = fListView->CountItems();
|
||||||
|
@ -372,7 +393,6 @@ MainWindow::_CreateMenuBar()
|
||||||
BMenu* chatMenu = new BMenu("Chat");
|
BMenu* chatMenu = new BMenu("Chat");
|
||||||
BMenuItem* invite = new BMenuItem("Invite user" B_UTF8_ELLIPSIS,
|
BMenuItem* invite = new BMenuItem("Invite user" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY);
|
new BMessage(CAYA_SEND_INVITE), 'I', B_COMMAND_KEY);
|
||||||
invite->SetEnabled(false);
|
|
||||||
BMenuItem* newRoom = new BMenuItem("New room" B_UTF8_ELLIPSIS,
|
BMenuItem* newRoom = new BMenuItem("New room" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(), 'N', B_COMMAND_KEY);
|
new BMessage(), 'N', B_COMMAND_KEY);
|
||||||
newRoom->SetEnabled(false);
|
newRoom->SetEnabled(false);
|
||||||
|
|
|
@ -28,16 +28,14 @@ const uint32 kSearchContact = 'RWSC';
|
||||||
const uint32 kSendMessage = 'RWSM';
|
const uint32 kSendMessage = 'RWSM';
|
||||||
|
|
||||||
|
|
||||||
RosterWindow::RosterWindow(const char* title, int32 selectMsg,
|
RosterWindow::RosterWindow(const char* title, BMessage* selectMsg,
|
||||||
BMessenger* messenger, Server* server)
|
BMessenger* messenger, Server* server)
|
||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 300, 400), title, B_FLOATING_WINDOW, 0),
|
BWindow(BRect(0, 0, 300, 400), title, B_FLOATING_WINDOW, 0),
|
||||||
fTarget(messenger),
|
fTarget(messenger),
|
||||||
|
fMessage(selectMsg),
|
||||||
fServer(server)
|
fServer(server)
|
||||||
{
|
{
|
||||||
fMessage = new BMessage(IM_MESSAGE);
|
|
||||||
fMessage->AddInt32("im_what", selectMsg);
|
|
||||||
|
|
||||||
SearchBarTextControl* searchBox =
|
SearchBarTextControl* searchBox =
|
||||||
new SearchBarTextControl(new BMessage(kSearchContact));
|
new SearchBarTextControl(new BMessage(kSearchContact));
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Server;
|
||||||
the server with contact info, once a contact is selected. */
|
the server with contact info, once a contact is selected. */
|
||||||
class RosterWindow : public BWindow {
|
class RosterWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
RosterWindow(const char* title, int32 selectMsg, BMessenger* messenger,
|
RosterWindow(const char* title, BMessage* selectMsg, BMessenger* messenger,
|
||||||
Server* server);
|
Server* server);
|
||||||
|
|
||||||
void MessageReceived(BMessage* message);
|
void MessageReceived(BMessage* message);
|
||||||
|
|
|
@ -181,6 +181,17 @@ JabberHandler::Process(BMessage* msg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IM_ROOM_SEND_INVITE: {
|
||||||
|
BString chat_id = msg->FindString("chat_id");
|
||||||
|
gloox::MUCRoom* room = fRooms.ValueFor(chat_id);
|
||||||
|
BString user_id;
|
||||||
|
if (room == NULL || msg->FindString("user_id", &user_id) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
room->invite(gloox::JID(user_id.String()), "");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IM_ROOM_KICK_PARTICIPANT:
|
case IM_ROOM_KICK_PARTICIPANT:
|
||||||
case IM_ROOM_BAN_PARTICIPANT:
|
case IM_ROOM_BAN_PARTICIPANT:
|
||||||
case IM_ROOM_UNBAN_PARTICIPANT:
|
case IM_ROOM_UNBAN_PARTICIPANT:
|
||||||
|
|
Ŝarĝante…
Reference in New Issue