Mutt: Saving a message as a text file - mutt

I would like to save a message in Mutt as a text file somewhere outside of my maildir. For example, ~/documents/notes. I have found instructions for Saving Messages to Files which says that I should press either C or esc-C (depending on if I want headers or not) and then enter the directory I want to save to. When I do this and enter ~/documents/notes, Mutt says: "/home/user/documents/notes is not a mailbox".
I want to save the message to a plain directory, not a mailbox. How can I do this?

Use C (copy-message) or <Esc>C (decode-copy) if you want to save the mail as a mail message, necessarily in a mailbox. This mailbox can contain only one message if you want, but it won't be a text/plain file. If the mailbox (file or directory) doesn't exist yet, you shouldn't get an error: Mutt will propose you to create the mailbox.
If you just want to save the text of the body, then:
Type v (view-attachments).
Select the text/plain body (this is often the part that is selected by default, so that you won't have to do anything special here in most cases).
Type s (save-entry) to save the body to a file.

You might try something like this: Start a reply to the message which will open the message in your chosen editor whereupon you can save what you have in your editor to a local file.

Related

Check status of file during sftp

I want to write a C++ code to get a file from server B via server A using password less sftp.The file on server B is infact being copied (via sftp ) from another server C. I was able to retreive the file from server B , however even if the file was still being copied, I was still able to get the file(incomplete file as it was still being transferred to server B from server C). I want to put a check if the file is being copied then i should not get it using sftp and wait till it it is completely moved. As far as i know sftp prompt does not support lot of commands. Can somebody please give me some inputs on how can i achieve this?
A traditional way to do this is to transfer the (big) "paydata" file, and a (small / empty) "flag" file after that. You (on the receiving end) wait until the flag file exists. If it does, the transfer of the paydata file has finished; delete the flag file, and do whatever you do with the paydata file.

Mini-Filter intercept drag & drop file(s) to disk?

I am developing a mini-filter to intercept files and get the name of files which are dragged & dropped to a specific disk and get the file names.
If I drag & drop a file, I can get this file name and intercept it successfully (That's mean this file is not created on disk).
If I drag & drop multiple files, I can only get the first file name and other is not. But when I open the disk, I don't see any file here (That's mean Mini-Filter intercept them successfully). So I can not get the file names (except the first file)
I intercept drag & drop by redirect them:
Get file name by FltGetFileNameInformation() then FltParseFileNameInformation()
Split it two part
First is: \Device\HarddiskVolume1\folder\
Second is: file.ext
Append a file name for first part: \Device\HarddiskVolume1\folder\new_file.ext
Intercept create on disk
Release this buffer: Data->Iopb->TargetFileObject->FileName.Buffer
Assign first part to Data->Iopb->TargetFileObject->FileName
Set this: Data->Iopb->TargetFileObject->RelatedFileObject = NULL;
Data->IoStatus.Information = IO_REPARSE;
Data->IoStatus.Status = STATUS_REPARSE;
return FLT_PREOP_SUCCESS_NO_CALLBACK;
Above code can only intercept all files and get the first file name.
How can I do to intercept each file when I drag & drop multiple file?
I found myself that:
Get file name from Data->Iopb->TargetFileObject->FileName
Slipt it two part: file path and file name
Change file name to a redirect file name
Delete redirect file name. This step can be run before step #1
If redirect file name is not exist, It return STATUS_OBJECT_NAME_NOT_FOUND (0xC0000034). It is not problem for system.
If redirect file name is exist. It is OK.
Make sure you check the simrep sample from Microsoft they show you how to properly do this.
I would not base my assumption that Drag&Drop has a correspondence in the kernel and in the file-system. It can be implemented in user-mode in many ways especially if you are doing it on the same volume. It can be as simple as a rename. Also keep in mind hard-links and symboliclinks and alternate data streams.
Good luck.

Using Firefox website information in C++ program

I am trying to extract information from "about:plugins" website when you use Firefox web browser. I want to be able to use the contents of the website in my C++ program. Only way I know how to use content from another location is reading from a file.
What I am trying to do is read the file name and file path for each plugin from about:plugin'
Not sure if I could send this information to a file and then read it from there, but that seems like double work since if it output to file, I could just read it from there.
Needed to know how to extract information from the Firefox website in order to be used in a C++ program.
Just parse the pluginreg.dat file, you can find it in:
C:\Users\xxxxxxx\AppData\Roaming\Mozilla\Firefox\Profiles\xxxxxx.default
To obtain the AppData
char cAppData[MAX_PATH];
if(SHGetSpecialFolderPathA(NULL, cAppData, CSIDL_APPDATA, false))
{
// To obtain the profile name, parse the profiles.ini file in the folder
// ...AppData\Roaming\Mozilla\Firefox
// ...
}

determine file type c

I am trying to write a client/server program in C++ with Visual Studio 2008. So far the project runs does the following:
Run the webserver on cmd prompt - webserver 8080
open web browser - localhost 8080
to open local html file - localhost:8080/demo.html
But now... let's say the client requests for a gif file, then the server should send gif file.
client request for txt file, then the server should send .txt file. Similarly for .html and .xbm files.
I don't know how to do it.. Any help greatly appreciated.
On UNIX systems you'd use the file command: it uses a set of known "magic number" which are used to identify different file types. anda few heuristics to address the remaining files. Most file formats have some sort of identifier embedded, often in the first couple of bytes. Especially text files normally don't have a magic number but use only printable characters instead (with UTF8 and UTF16 being popular, classifying text files became a bit harder).
Once the file type is determined, you'd just set ghe corresponding HTTP header(s).
okay, because we're in the same class, I'll give you a clue :)
In the header part, put some if-else like this:
if(strcmp(type,"html")==0){
(void) sprintf(buff,"Content-Type:text/html\r\n");
(void) send(conn,buff,strlen(buff),0);
}
else if(strcmp(type,"gif")==0){
(void) sprintf(buff,"Content-Type:image/gif\r\n");
(void) send(conn,buff,strlen(buff),0);
}
Got it? And by the way, you need to get the extension (check path using endsWith function), compare the extension with file type then give out the right header. Test it with gif file :) I have it works already :) Going to submit now. Remember to vote up for me :)

How to get a message request from its sequence number?

Given a sequence number, I need to find the corresponding request message string.
I can't find a way to it easily do that with quickFix lib.
To be short, I've had the idea to use the FileStore "body" file to help me retrieve the message request string from a sequence number,as the FileStore class exposes a convenient method:
get(int begin, int end, std::vector result)
But I am facing an issue: as those files are accessed by another FileStore instance (from the Initiator instance) those files are inaccessible from any other part of my application under Windows OS: as it forbids a second owner on the those files.
Do I need to rewrite my own mechanism to get request message string form their sequence number?
I'm not sure why are you trying to get the 'message string' based on sequence number.
Is this during trading? Can you modify your application code? Your application gets the messages from the server/client so you can just dump the message as string (in c++ they have methods something to do with ToString() or similar).
You could keep the string in a dictionary with the sequence number as id and so on. The library gets you to peek at the outgoing messages as well.
If it is after traiding the messages you can set the engine to create data files and then just process the data file, it has all the messages received and sent.
Sorry, I just can't figure out what exactly you are trying to use.