Retrieve Gmail Labels with Indy? - delphi

According to this thread (and various hints in the source code like variable names) Indy supports fetching gmail labels but not setting or removing them. However, as of yet, this functionality appears to be undocumented. Can anyone help me with filling in the details about how to retrieve Gmail labels with Imap?
Which function(s) should I call to retrieve the labels and have Indy parse out the results for me? Although I could certainly manually call SendCmd() to request the labels ('C2 UID FETCH 92 (X-GM-LABELS)') similar to how I'm manually setting/removing labels (which Indy doesn't yet do), parsing FETCH results is something that I know is already built into Indy, so I don't want to re-invent the wheel here to decode the FETCH results. For now, to keep things simple, presume I just want the labels and not other envelopes/headers/message parts.
There do appear to be quite a few functions that might (or might not) be relevant, but with so many to choose from, and so many of them only having auto-generated documentation, figuring out which one to try, and which property (or sub-property) or function to find the actual labels is a little daunting. Can anyone point me in the right direction here?

Indy supports fetching gmail labels but not setting or removing them.
Not quite. TIdIMAP4 supports searching for emails by Gmail label, but does not yet support retrieving Gmail labels for specific emails.
However, as of yet, this functionality appears to be undocumented.
A lot of functionality added to Indy in the past several years is still undocumented.
Can anyone help me with filling in the details about how to retrieve Gmail labels with Imap?
Some GMail IMAP extensions added to TIdIMAP4
The TIdIMAP4SearchKey enum has been updated with new items to support the X-GM-RAW, X-GM-MSGID, X-GM-THRID, and X-GM-LABELS extensions in SEARCH commands issued by the SearchMailBox() and UIDSearchMailBox() methods.
The TIdIMAP4FetchDataItem enum has been updated with new items to support the X-GM-MSGID, X-GM-THRID, and X-GM-LABELS extensions in the FETCH command, however no TIdIMAP methods currently use these new items yet.
Support for the X-GM-LABELS extension in the STORE command has not been implemented yet.
Which function(s) should I call to retrieve the labels and have Indy parse out the results for me?
The only methods that support GMail labels at this time are TIdIMAP4.SearchMailBox() and TIdIMAP4.UIDSearchMailBox().
Although I could certainly manually call SendCmd() to request the labels ('C2 UID FETCH 92 (X-GM-LABELS)') similar to how I'm manually setting/removing labels (which Indy doesn't yet do), parsing FETCH results is something that I know is already built into Indy, so I don't want to re-invent the wheel here to decode the FETCH results.
Sorry, but you will have to. Although TIdIMAP4 does parse flags in FETCH responses, it discards any flag that is not supported by TIdMessageFlagsSet (Answered, Flagged, Deleted, Draft, Seen, Recent). So while Gmail labels can be parsed automatically, TIdIMAP4 has nowhere to save them yet.
Can anyone point me in the right direction here?
At this time, you have to implement it manually.

Related

Firebase chat backup/export like whatsapp in SWIFT

i implemented a chat app in swift using firebase real time db, there user can send images, emojis and Text.Now i have a requirement of export chat or get the conversation's backup with media and text as per whatsApp.help me to solving it out.
While Firebase offers a backup for the Realtime Database, this doesn't fit your needs here, since you'll want a per-user export of the data.
Since this is specific to your application, you will have to code it yourself, just like the good folks at WhatsApp have probably done. It should be a matter of iterating over all data sources for the user, getting the data through the relevant API (that you're already using to display that data), and then writing to a local file). You can do this either client-side in your Swift code, or server-side on a server you already may have, or using Cloud Functions.
If you're looking for some inspiration for the latter, there is a sample repository that shows how to clean up a user's data, based on a set of wipe-out rules. You'll need to significantly modify this example though, so I'm not convinced this will be less work than rolling your own from scratch.

SurveyMonkey API v3 GET Responses fields

In my app I used the get_respondent_list API in API v2 to get an overview of the responses and to allow me to select those responses which were relevant to download in greater detail - fields of interest to me included date_modified, status .
I had hoped that /surveys/{ID}/responses would give a similar facility but all it returns for each response is href and id. The parameters of the call enable me to filter the list in various ways but I would need to make several calls to identify the different categories that I am interested in.
When I made a similar point about the survey list it turned out there was an incorrectly documented include parameter which I could use to get additional fields in the response. I tried that for /surveys/{id}/responses but that was rejected. Could such a facility be added?
If not I guess I will go for /surveys/{id}/responses/bulk and do all the work in the app.
The bulk endpoint is the correct choice. It is basically a call to /surveys/{ID}/responses with 'include' covering every field. The only downside is is the smaller maximum page size. Not sure sure what additional work you are referring to, since you would need to handle pagination at /surveys/{ID}/responses for more than 1000 responses, and all the fields you are looking for are available at the top level of the returned response dictionary.
This wrapper for the API (not written by me) makes it fairly easy to get all the responses from a survey paired with the relevant question details.
In order to get the data structured in a way that resembles the output from the manual export, a bit of gymnastics is needed (I can recommend Pandas' .pivot_table(). Which columns that contain the actual answers vary depending on questions type, adding further complications depending on the complexity of the survey.

How can I modify the labels using Gmail Query

Is there any way to modify the label using gmail query (GTLQueryGmail).
I had gone through the api documentations the api which perform this is:- https://www.googleapis.com/auth/gmail.modify
I want this to be done through gmail Query in iOS
Thanks in advance
I don't know what GTL Query is specifically, I imagine some iOS client object. the "https://www.googleapis.com/auth/gmail.modify" you mention is just the auth scope name you need in your oauth2 token in to be allowed to make the call (there are a few that'll work for modifying labels actually).
What you want to do is use the message modify() operation, I don't know what that translates to in iOS but here are docs on it:
https://developers.google.com/gmail/api/v1/reference/users/messages/modify
Or to change labels on all messages in a thread, use thread modify:
https://developers.google.com/gmail/api/v1/reference/users/threads/modify

Erlang: query more than 1000 LDAP elements using "eldap" library

I am using ejabberd, a jabber daemon written in Erlang. It is connected to our Active Directory using its LDAP interface and Erlang's eldap library.
Everything works so far with a small limitation causing a big problem:
A normal LDAP query receives up to 1000 elements and then stops.
We have more than 1000 employees and therefore receiver only a part of the whole query
Using *nix' ldapsearch tool, I can use the option -E pr=1000/noprompt for receiving multiple pages (which finally get concatenated to a single one) without any limitation.
How could I use this function using Erlang's eldap library?
I already read through the source code, but don't seem to find anything obvious.
#erlang had some nice ideas about this:
emauton: It looks to me like you're out of luck. Paged results are supplied by an LDAP extension, described in http://www.rfc-editor.org/rfc/rfc2696.txt. If you look at ldapsearch, you can see this being added to the query at http://goo.gl/lemNOS
emauton: Reading through the eldap source, this extension doesn't make an appearance. The good news is that it shouldn't be too hard to add, I think, by messing about with the 'controls' part of the LDAPMessage.
emauton: You should be able to set up your request according to the RFC using the right controlType & contents (referencing the ldapsearch code) and use it to make a paginating version of eldap:search

Display twitter feeds

For an event in a couple of weeks I'd like to make an web page/app which display tweets from a specific user, a specific hashtag and all #reply's at the first user in 3 boxes on the screen.
However I've never tried this. I want to use either .NET (C#) or HTML/CSS/JS since I'm proficient in those. Are there any libraries/API's I can use? Or is there an readily available freeware/open-source app I can use?
Have you seen TweetSharp?
Use Twitter's profile and search widgets. Profile for the first box, a search of the hash tag for the second box, and a search of to:username for the third box.
I actually just posted this as an answer to another question:
I just updated a plugin to work with the Twitter 1.1 API. Unfortunately, per Twitter's urging, you will have to perform the actual request from server-side code. However, you can pass the response to the plugin and it will take care of the rest. I don't know what framework you are running, but I have already added sample code for making the request in C#, and will be adding sample code for PHP, shortly.
The plugin makes a call to statuses/user_timeline, but you will likely want to look at statuses/filter or statuses/search, instead. All you will have to do is add your desired parameters (hashtag, replies, etc.) to the server-side code and it should work (with the addition of your security keys and tokens, of course).
Good luck! :)

Resources