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