diff --git a/application/windows/MainWindow.cpp b/application/windows/MainWindow.cpp index 7f63a63..8eab286 100644 --- a/application/windows/MainWindow.cpp +++ b/application/windows/MainWindow.cpp @@ -149,9 +149,11 @@ MainWindow::MessageReceived(BMessage* message) invite->AddInt32("im_what", IM_ROOM_SEND_INVITE); invite->AddString("chat_id", chat_id); - BLooper* looper = (BLooper*)fConversation->GetProtocolLooper(); + ProtocolLooper* plooper = fConversation->GetProtocolLooper(); + BLooper* looper = (BLooper*)plooper; fRosterWindow = new RosterWindow("Invite contact to chat" - B_UTF8_ELLIPSIS, invite, new BMessenger(looper), fServer); + B_UTF8_ELLIPSIS, invite, new BMessenger(looper), fServer, + plooper->GetInstance()); fRosterWindow->Show(); break; diff --git a/application/windows/RosterWindow.cpp b/application/windows/RosterWindow.cpp index 0b25646..39dd8f1 100644 --- a/application/windows/RosterWindow.cpp +++ b/application/windows/RosterWindow.cpp @@ -45,9 +45,28 @@ RosterWindow::RosterWindow(const char* title, BMessage* selectMsg, fRosterView->SetInvocationMessage(new BMessage(kSendMessage)); fOkButton = new BButton("OK", new BMessage(kSendMessage)); - fAccountField = new BMenuField("accountMenuField", NULL, - CreateAccountMenu(fAccounts, BMessage(kSelAccount), - new BMessage(kSelNoAccount))); + + BMenu* accountMenu; + + // If a specific instance is given, disallow selecting other accounts + if (instance > -1) { + accountMenu = new BMenu("accountMenu"); + BString name = "N/A"; + for (int i = 0; i < fAccounts.CountItems(); i++) + if (fAccounts.ValueAt(i) == instance) { + name = fAccounts.KeyAt(i); + break; + } + accountMenu->AddItem(new BMenuItem(name.String(), NULL)); + accountMenu->SetLabelFromMarked(true); + accountMenu->ItemAt(0)->SetMarked(true); + accountMenu->SetEnabled(false); + } + else + accountMenu = CreateAccountMenu(fAccounts, BMessage(kSelAccount), + new BMessage(kSelNoAccount)); + + fAccountField = new BMenuField("accountMenuField", NULL, accountMenu); BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f) .SetInsets(B_USE_DEFAULT_SPACING)