Searching through chat with TextSearch
This commit is contained in:
parent
e2d801b84b
commit
3689f6cee3
|
@ -62,6 +62,9 @@ const uint32 APP_USER_INFO = 'CYuw';
|
||||||
//! Display a "room info" window
|
//! Display a "room info" window
|
||||||
const uint32 APP_ROOM_INFO = 'CYrw';
|
const uint32 APP_ROOM_INFO = 'CYrw';
|
||||||
|
|
||||||
|
//! Open the room's logs with TextSearch
|
||||||
|
const uint32 APP_ROOM_SEARCH = 'CYrs';
|
||||||
|
|
||||||
//! Toggle a specific flag for a room
|
//! Toggle a specific flag for a room
|
||||||
const uint32 APP_ROOM_FLAG = 'Rlag';
|
const uint32 APP_ROOM_FLAG = 'Rlag';
|
||||||
|
|
||||||
|
|
|
@ -576,6 +576,10 @@ Conversation::_LogChatMessage(BMessage* msg)
|
||||||
BFile logFile(fCachePath.Path(), B_READ_WRITE | B_OPEN_AT_END | B_CREATE_FILE);
|
BFile logFile(fCachePath.Path(), B_READ_WRITE | B_OPEN_AT_END | B_CREATE_FILE);
|
||||||
WriteAttributeMessage(&logFile, "Chat:logs", &logMsg);
|
WriteAttributeMessage(&logFile, "Chat:logs", &logMsg);
|
||||||
|
|
||||||
|
BString mime = BString("text/plain");
|
||||||
|
logFile.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, mime.String(),
|
||||||
|
mime.CountChars() + 1);
|
||||||
|
|
||||||
// Plain-text logs
|
// Plain-text logs
|
||||||
// Gotta make sure the formatting's pretty!
|
// Gotta make sure the formatting's pretty!
|
||||||
BString date;
|
BString date;
|
||||||
|
|
|
@ -76,6 +76,8 @@ public:
|
||||||
void SetFlags(int32 flags);
|
void SetFlags(int32 flags);
|
||||||
int32 DisallowedFlags() { return fDisallowedFlags; }
|
int32 DisallowedFlags() { return fDisallowedFlags; }
|
||||||
|
|
||||||
|
BPath CachePath() { return fCachePath; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _WarnUser(BString message);
|
void _WarnUser(BString message);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <iostream>
|
||||||
/*
|
/*
|
||||||
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
||||||
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
|
#include <Roster.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
|
||||||
|
@ -211,6 +213,21 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
RoomListWindow::Get(fServer)->Show();
|
RoomListWindow::Get(fServer)->Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case APP_ROOM_SEARCH:
|
||||||
|
{
|
||||||
|
if (fConversation != NULL) {
|
||||||
|
entry_ref ref;
|
||||||
|
BEntry entry(fConversation->CachePath().Path());
|
||||||
|
if (entry.GetRef(&ref) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
BMessage msg(B_REFS_RECEIVED);
|
||||||
|
msg.AddRef("refs", &ref);
|
||||||
|
BRoster roster;
|
||||||
|
roster.Launch("application/x-vnd.Haiku.TextSearch", &msg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case APP_EDIT_ROSTER:
|
case APP_EDIT_ROSTER:
|
||||||
{
|
{
|
||||||
RosterEditWindow::Get(fServer)->Show();
|
RosterEditWindow::Get(fServer)->Show();
|
||||||
|
@ -518,15 +535,17 @@ MainWindow::_CreateMenuBar()
|
||||||
BMenu* chatMenu = new BMenu(B_TRANSLATE("Chat"));
|
BMenu* chatMenu = new BMenu(B_TRANSLATE("Chat"));
|
||||||
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Join room" B_UTF8_ELLIPSIS),
|
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Join room" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY));
|
new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY));
|
||||||
|
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Room directory" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(APP_ROOM_DIRECTORY)));
|
||||||
|
chatMenu->SetTargetForItems(this);
|
||||||
chatMenu->AddSeparatorItem();
|
chatMenu->AddSeparatorItem();
|
||||||
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New room" B_UTF8_ELLIPSIS),
|
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New room" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(APP_NEW_ROOM), 'N', B_COMMAND_KEY));
|
new BMessage(APP_NEW_ROOM), 'N', B_COMMAND_KEY));
|
||||||
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New chat" B_UTF8_ELLIPSIS),
|
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New chat" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY));
|
new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY));
|
||||||
chatMenu->AddSeparatorItem();
|
chatMenu->AddSeparatorItem();
|
||||||
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Room directory" B_UTF8_ELLIPSIS),
|
chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(APP_ROOM_DIRECTORY)));
|
new BMessage(APP_ROOM_SEARCH), 'F', B_COMMAND_KEY));
|
||||||
chatMenu->SetTargetForItems(this);
|
|
||||||
|
|
||||||
// Roster
|
// Roster
|
||||||
BMenu* rosterMenu = new BMenu(B_TRANSLATE("Roster"));
|
BMenu* rosterMenu = new BMenu(B_TRANSLATE("Roster"));
|
||||||
|
|
Ŝarĝante…
Reference in New Issue