How to store extra header value with MailCore2? - objective-c

I add an extra header value with MailCore2:
MCOMessageHeader *messageHeader = message.header;
[messageHeader setExtraHeaderValue:spamScoreString forName:#"Spam Score"];
How can I save this new header value to the IMAP server?
I have already searched for sample code and I have also read the class reference for MCOMessageHeader (which, by the way, states the wrong method name - (void)addHeaderValue:(NSString *)value forName:(NSString *)name)

editWith the help of dinhviethoa in the MailCore2 forum on GitHub (https://github.com/MailCore/mailcore2/issues/680), the question could be answered:
It is not possible to edit the header of an existing email.
However, it is possible to remove the existing message from the server and append a new message (with extra headers).

Related

Is there a recommended way to skip first line of a CSV file in Moqui?

I have a CSV file generated by another programme that is uploaded to Moqui as a FileItem without any editing done on the CSV file.
So it has a header that I don't want to use, therefore I manually specify csvEntityName and csvFieldNames for the entity data loader. But the header is taken as the first record. - Is there a recommended way to skip the first line?
Digging deeper, in EntityDataLoaderImpl.groovy we have:
CSVParser parser = CSVFormat.newFormat(edli.csvDelimiter)
.withCommentMarker(edli.csvCommentStart)
.withQuote(edli.csvQuoteChar)
.withSkipHeaderRecord(true) // TODO: remove this? does it even do anything?
.withIgnoreEmptyLines(true)
.withIgnoreSurroundingSpaces(true)
.parse(reader)
The reason .withSkipHeaderRecord(true) currently does nothing is you first have to specify that the file has a header to skip using .withHeader(). ( https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html#withFirstRecordAsHeader--)
If you add that, the .withSkipHeaderRecord(boolean) will skip the header record if passed 'true'.
(I think this needs to be made an issue, so I will do that.)

I want to pass the header value in methods

Scenario : I need to verify the logs response on server on the basis of Tracking-Id.
I had passed the tracking-id using 'header.js' file, here i define metod which get the unique UUID for every request and passed in header.
Now I need that header value to passed in some method to get logs only for specific Tracking-Id
Is there any way to achieve this in karate?
Yes, you can use karate.set('someVarName', uuidValue) in JS and then back in the feature you will be able to: * print someVarName.
EDIT: please see this commit for an example: link

How do I just add a custome variable to a Survey Monkey?

I am handling existing surveys via the API.
As part of this, I need each survey to have a custom variable defined for it.
I would like to use the API to add the custom variable, but the documentation states the FETCH would not do that, and PUT will replace rather than update the survey.
I am handling existing surveys, which I would not like to delete and replace, or am I miss-reading the docs?
Can I just send via PUT the following structure and it will keep everything else in place?
{
id : 112223333, //id of survey
custom_variables: {
'custom1':'custom1',
'custom2':'custom2'
}
}
I do see it resets the title, so, is this method safe? (i.e. wont remove any other data associated to this survey).
You're on the right track. You're going to want to use a PATCH HTTP request. That will only make updates, whereas a PUT request will replace the survey with the content you provide.
So your request will likely look something like this:
PATCH /v3/surveys/<survey_id>
{
"custom_variables": {
"custom1_name": "custom1_label",
"custom2_name": "custom2_label"
}
}
And that should only update your custom variables to the values you set. The docs do appear to suggest custom_variables won't get updated with a PATCH request but I think it does work.

Update existing header field in asterisk

I am new to and working on asterisk. I have a question.
How to extend a string to an existing header field in asterisk?
For example, after calling:
add_header(req, "User_Note", "swim fast");
User_Note has value "swim fast". I want to add "run quickly" to the value of "User_Note". So "User_Note" will be "swim fast, run quickly".
If you're referring to Asterisk dialplan code, you can't remove a SIP header that comes in with the call. You can add another instance of the same header using SIPAddHeader(), and change the code on the far end to interpret multiple values correctly.
The example you have up there is not Asterisk dialplan though.

How to add a HTTP header field in Openacs?

I need to add a HTTP header field in the responses of a section of my site, the package instace (my section) is being viewed in a IFRAME and I want to declare a p3p field in order to be able to store cockies in IE 6/7/8 (login doesn't work well), I have an idea of how to do it in PHP and is quite simple:
<?php
header('P3P: CP="CAO PSA OUR"');
?>
but I didn't found how to do it in TCL/openacs, thanks for the help.
Based on Jim Lynch's response when you asked this question elsewhere, you just need to add it to the set of headers being produced for the page.
I'd guess that something like this is probably easiest (assuming you don't want to hard-code the contents of the header; if you did, you could simplify a little):
set cpflags "CAO PSA OUR"
ns_set cput [ns_conn outputheaders] "P3P" "CP=\"$cpflags\""
To understand it, you need to read about ns_conn and ns_set from the AOLserver docs, as well as set from the standard Tcl documentation.