Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: Vlad on October 28, 2010, 03:49:13 AM

Title: Recipient To Contacts Plugin
Post by: Vlad on October 28, 2010, 03:49:13 AM
We've created a new plugin for RoundCube called 'Recipient To Contact'. The idea is somewhat similar to automatic_addressbook plugin: after the email has been sent, it checks whether recipients (To/Cc/Bcc) already exist in address book, and if not, it shows a from to quickly add selected contacts to or different address books.

The plugin doesn't require additional database table (unlike automatic_addressbook) and uses address books, which are set in the config file.

Recipient To Contact requires jQuery UI plugin and is compatible with RoundCube v0.4.

You can obtain it from GitHub namesco's Roundcube-Plugin-Recipient-To-Contact at master - GitHub (http://github.com/namesco/Roundcube-Plugin-Recipient-To-Contact)

This is a first release, so feedback and patches are very welcome.
Title: Recipient To Contacts Plugin
Post by: Vlad on November 09, 2010, 05:37:19 AM
Recipient to contact v0.1.2 is released now. Primaraly it's a bugfix release. Full changelog: https://github.com/namesco/Roundcube-Plugin-Recipient-To-Contact/blob/master/recipient_to_contact/CHANGELOG
Title: Possibility
Post by: timtraver on December 01, 2010, 09:06:14 PM
Hi!

I like this plugin. It works great.

Is there a way to have the groups that have been created in that list of address books so that you can automatically add them to a group?

I would imagine if a user added it to a group, that you would first have to add the contact to the parent address book, and then add it into the group...

That would be a great addition to this plugin!

Let me know if that is possible.

Thanks,

Tim
Title: Recipient To Contacts Plugin
Post by: chichi on December 02, 2010, 07:43:27 AM
Thanks for this exellent Plugin.

Adding the contact to the adressbook is great, .. It would be awesome to add them to a specific group, as mentioned.
Title: Recipient To Contacts Plugin
Post by: Vlad on December 02, 2010, 09:43:36 AM
Hi!

Yes, I can do it. There shouldn't be any problems with that.
Title: Recipient To Contacts Plugin
Post by: toootooo on December 06, 2010, 05:20:49 AM
Hi Vlad!

I'am using '0.1.2' version and I have such PHP Warning in error_log file:

Missing argument 1 for recipient_to_contact::add_contact() in /usr/local/etc/httpd/webmail/plugins/recipient_to_contact/recipient_to_contact.php on line 210, referer: /?_task=mail&_mbox=mail%2FSent&_refresh=1
Title: Recipient To Contacts Plugin
Post by: Vlad on December 12, 2010, 07:44:48 AM
Hi toootooo,

this has been fixed in master branch. Actually, I'll probably rollout a new 0.1.3 release very soon.
Title: Recipient To Contacts Plugin
Post by: Vlad on December 13, 2010, 04:41:03 AM
v0.1.3 is out.
https://github.com/namesco/Roundcube-Plugin-Recipient-To-Contact/blob/master/recipient_to_contact/CHANGELOG

This is a minor bugifix release. Fixes a bug with warning in logs and handles properly 'read reciept' emails.

A new version, supporting contact groups, will be released soon as well.
Title: Recipient To Contacts Plugin
Post by: rosali on December 29, 2010, 09:28:34 AM
Any news on this?
Title: Recipient To Contacts Plugin
Post by: toootooo on December 30, 2010, 04:33:54 AM
It works fine now. Have no warnings in logs.
Title: Recipient To Contacts Plugin
Post by: rosali on December 30, 2010, 05:51:40 AM
Sorry, I was unprecise.

Vlad, are there any news about ...

Quote

A new version, supporting contact groups, will be released soon as well.


... ?
Title: Recipient To Contacts Plugin
Post by: ericpepin on December 30, 2010, 06:56:54 AM
Quote from: Vlad;31155
Recipient to contact v0.1.2 is released now. Primaraly it's a bugfix release. Full changelog: https://github.com/namesco/Roundcube-Plugin-Recipient-To-Contact/blob/master/recipient_to_contact/CHANGELOG


Thanks alot, its really helpful.
Title: Recipient To Contacts Plugin
Post by: rosali on December 31, 2010, 12:11:57 AM
The plugin is incompatible with keyboard_shortcurts plugin. Shortcuts have to be disabled when adding contact dialog appears.

It also does not work properly along compose_newwindow plugin.
Title: Recipient To Contacts Plugin
Post by: Vlad on December 31, 2010, 04:25:23 AM
Sorry for the delay. Christmas, New Year, holidays => total chaos at work. However, the plugin hasn't been abandoned and new versions are coming.

And thanks for pointing out incompatibility bugs. I'll have a look
Title: Recipient To Contacts Plugin
Post by: rosali on December 31, 2010, 04:46:09 AM
keyboard_shortcuts:
You should disable shortcuts when dialog is openend. Otherwise shortcuts are executed when filling the form.

compose_newwindow:
message_list hook does not work because composing goes in a popup window and message list stays without being refreshed as usual when composing in the main screen.

Everything else looks fine to me. Thanks for the great plugin.

EDIT: Your plugin will be a great replacement for my automatic_addressbook plugin!
Title: Recipient To Contacts Plugin
Post by: diablo81 on January 08, 2011, 08:43:15 AM
I modified recipient_to_contact plugin in order to have some more capabilities:

1) you can now select an addressbook for each contact
2) you can now select a group for each contact
3) you can now write down a firstname for each contact
4) you can now write down a surname for each contact

This is a "very first release", so at now the plugin has some limitations:

1) it has the same problems of original recipient_to_contact plugin about compatibility so it doesnt work fine with compose_newwindow and keyboard_shortcuts
2) I stressed it only with SQL addressbook, so I dont know if it will work with ldap addressbook. At now I dont have time to setup a new enviroment for testing, but if someone is interested in ldap maybe I will do it in the future (or someone else could add the feature). I used Roundcube API, so I think there's no problem with ldap, but before I say anything I want to try it.
3) It doesnt work with global_addressbook plugin, or better it cannot recognize the "id" of the global addressbook: you can use globaladdressbook, but recipient_to_contact's dialog box doesnt show it as addressbook. This will be next develop step.

I want to emphasize that this is not "my plugin". This is Vladimir Minakov's plugin, modified by me. I sent a mail to the author of recipient_to_contact two days ago in order to inform him about the mods to his plugin.
The author (Vladimir) will decide if he want introduce my mods to his plugin.

Ps. Users' feedbacks are the most important help to develop, so please test it and post here your comments. Thank you very much.
PPs. if someone is interested I will try to solve problems about keyboard_shortcuts and compose_newwindow.
PPPs. sorry for my english
Title: Recipient To Contacts Plugin
Post by: rosali on January 09, 2011, 12:15:43 AM
I'm very interested in getting it work work with compose_newwindow and keyboardshortcuts!
Title: Recipient To Contacts Plugin
Post by: diablo81 on January 09, 2011, 05:28:46 AM
Quote from: rosali;32303
I'm very interested in getting it work work with compose_newwindow and keyboardshortcuts!


Ok rosali. In the next week I will work on the plugin.
Title: Recipient To Contacts Plugin
Post by: Vlad on January 10, 2011, 07:38:32 AM
Hi guys,

I very welcome all contributions and I've already suggested diablo81 to push his changes to plugin's repo on github.

The only thing I'm concerned about are the input fields. I personally find it overcomplicated for plugin's main purpose: quickly add contacts. When I had sent an email, I want to get back to work/inbox as soon as I can, whereas a need to fill dozen of fields prevents me from that. So, the quicker the process is, the better. On the other hand, if you wish to manage contacts after email has been sent (in other words fill all relevant fields), we might make the displayed columns configurable from the user settings menu.

Apart from that, a compatibility fix for the keyboard_shortcuts is in trunk/master on github.
With compose_newwindow things aren't so clear for me. I include the needed javascript file only after the email has been sent. Compose_newwindow doesn't reload the page, that is, the JS isn't even loaded. And I don't feel that including recipient_to_contact's JS on every page is a good idea. Any thoughts on that?

UPDATE: Gianfelice's changes we'll make into trunk very soon. Great :)
Title: Recipient To Contacts Plugin
Post by: diablo81 on January 14, 2011, 10:04:57 AM
I'm totally agree with Vlad about "quick add". I will make changes to my code in order to obtain customization about which fields a user want to add.
I will commit changes to github repository.

Unfortunately I didnt have time in this week because of my job, but I will do it in the we or in the next week.

Thank you Vlad!
Title: Recipient To Contacts Plugin
Post by: rosali on January 16, 2011, 03:08:37 AM
Plugin compose_newwindow incompatibility

I have fixed it in the compose_newwindow plugin and will release it soon.
IMO, it is the best way to fix it there, because I needed a hack
in compose_newwindow.js which can't be injected by your plugin.

Two suggestions:

#1-
The loading message does not disappear from message list when adding a new contact (since v0.5).
I think ...

reciepient_to_contact.js ::: line 181

... should be removed or you should use set_busy with lock identifier (have a look on compose_addressbook plugin by Cor Bosman).

#2-
I'd appreciate to have a save button in the jquery dialog instead of saving the contact 'onchange' event of the selector.
Title: Recipient To Contacts Plugin
Post by: rosali on January 16, 2011, 04:51:16 AM
Forgot to mention:

The method to save new contacts on change allows to add duplicates. IMO, a save button would solve this issue too.
Title: Recipient To Contacts Plugin
Post by: diablo81 on January 17, 2011, 04:14:32 PM
I sent a pull request to Vladimir on github about my mods on recipient_to_contact.

As I said now users can select a firstname, surname and a group when they add new contacts. By Vladimir's suggestions I made firstname, surname and group not required, so if someone want to add a contact quickly he still can.

I also added a "Save" button in the dialog box.

I used the last version released by Vladimir, so we could not have problems with keyboard_shortcuts.

I'm reading now what rosali wrote down...

I will correct the problem with roundcube 0.5 soon as I can (I was really busy because of my job) and I will check the problem about duplicates. I thought that the api function insert take care of duplicate...maybe I didnt understand what rosali would say :D .

Actually plugin has another problem: global_addressbook plugin is not compatible. I will solve that soon as I can.

Again thanks to Vladimir for his kindness.

Ps. any test/suggestion is really desired!
Title: Recipient To Contacts Plugin
Post by: lacri on February 07, 2011, 07:43:26 AM
Nice plugin ... plugin is broken in the current RC svn0.6

the issue is session checking in rc index.php fails ...
this is a new function in rc 0.6
if (!$RCMAIL->session->check_auth()) {
...

the check is indicated from recipient_to_contact.js line 32
rcmail.http_post('plugin.recipient_to_contact_get_contacts', {});
Title: Recipient To Contacts Plugin
Post by: lacri on February 07, 2011, 08:33:28 AM
i found the issue...

in recipient_to_contact.php
public function get_contacts()
$this->rcmail->session->regenerate_id();
add after this line
$this->rcmail->session->set_auth_cookie();
to set new auth cookie

the issue is thats rc check the session and the regenerated session from recipient_to_contact plugin is not the same as in cookie set new auth cookie and all is fine :)
Title: Recipient To Contacts Plugin
Post by: lacri on February 07, 2011, 08:49:44 AM
related to rosalis post loading message does not disappear

replace in recipient_to_contact.js in get_addressbook_groups: function(event) this line
Code: [Select]
rcmail.display_message(rcmail.gettext('loading'), 'loading', true);with
Code: [Select]
var lock = rcmail.set_busy(true, 'loading');
and this line
Code: [Select]
rcmail.http_post('plugin.recipient_to_contact_get_addressbook_groups', 'address_book_id=' + address_book_id + '&key=' + event.data.k);with
Code: [Select]
rcmail.http_post('plugin.recipient_to_contact_get_addressbook_groups', 'address_book_id=' + address_book_id + '&key=' + event.data.k, lock);
and remove in get_addressbook_groups_handler: function(response) this lines

Code: [Select]
// disable the "loading" message
rcmail.display_message(rcmail.gettext('loading'), 'loading', false);

i have used the last version from recipient_to_contact plugin from git ...

many greetz ;)
Title: Recipient To Contacts Plugin
Post by: rosali on February 22, 2011, 12:14:24 AM
Any updates yet?

Issue 153 - myroundcube - recipient_to_contact: ajax wait keeps spinning / overlay doesn't close on save event - Project Hosting on Google Code (http://code.google.com/p/myroundcube/issues/detail?id=153)
Title: What have I done wrong?
Post by: dmcleman on April 12, 2011, 04:42:08 AM
Is there something basic missing from the instructions that a newbie could not be expected to know?

After sending to a new contact the 'loading' message appears but nothing further.

I have placed the jqueryui folder in the plugins directory - there are no instructions for a newbie to say where to load it.
Title: Recipient To Contacts Plugin
Post by: rosali on April 12, 2011, 04:58:38 AM
*** BUMP ***

Vlad, are you still working on your plugin?
Title: Loading message
Post by: billstif on April 26, 2011, 09:13:00 AM
I tried Lacri's fix for the loading message, but when I made the changes, the plugin quit working (no error messages in the log, however).

Also, the plugin does not work with the latest update to Roundcube (0.5.2).

I really like this plugin.  Will there be an updated version any time soon?
Title: Bug fix for .5.2?
Post by: billstif on May 01, 2011, 07:09:40 PM
This plugin does not work in .5.2.  Is there an upgrade available?
Title: Recipient To Contacts Plugin
Post by: lacri on June 08, 2011, 06:33:14 AM
i have found the issue
remove this two lines in recipient_to_contact.php

in function get_contacts()
$this->rcmail->session->regenerate_id();
$this->rcmail->session->set_auth_cookie();now works in my rc 0.5.3 installation.

i hope this helps ;)

and the second issue is in recipient_to_contact.js
in the save_contacts: function()
search
Code: [Select]
rcmail.display_message(rcmail.gettext('loading'), 'loading', true);and replace with
Code: [Select]
var lock = rcmail.set_busy(true, 'loading');and search
Code: [Select]
rcmail.http_post('plugin.recipient_to_contact_save_contacts', data);and replace with
Code: [Select]
rcmail.http_post('plugin.recipient_to_contact_save_contacts', data, lock);
now works fine for me
Title: Recipient To Contacts Plugin
Post by: billstif on June 08, 2011, 10:22:40 PM
I made the changes.  The loading message still remained, and the plugin was caught in an endless loop.  Whenver I went to the e-mail page, the dialog box for saving the contact would appear.
Title: Recipient To Contacts Plugin
Post by: billstif on June 09, 2011, 12:50:48 PM
The version of the plugin that I have did not have the line

$this->rcmail->session->set_auth_cookie();

Would you consider posting your version of the plugin as a zip file here?
Title: Recipient To Contacts Plugin
Post by: projectmyst on June 09, 2011, 07:35:42 PM
I all so have this problem, i made the changes. The loading message still remained, and the plugin is caught in an endless loop.

Any one know how to fix it?
Title: Recipient To Contacts Plugin
Post by: rosali on November 04, 2011, 12:35:25 AM
A question:

Why is the regenerate_id on line 189?
Title: Recipient To Contacts Plugin
Post by: billstif on November 20, 2011, 10:56:30 PM
Following Rosali's lead, I disabled the regenerated_id line.  The plugin now works, but I still cannot get rid of the Loading message that continues after the dialog box closes.  I made the adjustments Lacri suggested and even tried disabling the loading lines in the js file, but no luck.
Title: just noticed this thread
Post by: cornfeed on December 13, 2011, 05:43:36 PM
I solved it for me at least: https://github.com/namesco/Roundcube-Plugin-Recipient-To-Contact/issues/9
Title: Recipient To Contacts Plugin
Post by: billstif on December 13, 2011, 08:39:18 PM
The package I downloaded must be numbered differently.  Line 202 in the php file (regenerate_id) was line 200.

Can you tell me what is in the lines in the js file to remove, and what should precede the new lines to be added so I can be sure of making the correct changes?
Title: Recipient To Contacts Plugin
Post by: cornfeed on December 13, 2011, 11:04:31 PM
recipient_to_contact.js diff patch
Code: [Select]
212c212
<             rcmail.display_message(rcmail.gettext('loading'), 'loading', true);
---
>             var msgid = rcmail.set_busy(true, 'loading');
214c214
<             rcmail.http_post('plugin.recipient_to_contact_save_contacts', data);
---
>             rcmail.http_post('plugin.recipient_to_contact_save_contacts', data+'&_unlock='+msgid);
266d265
<
319,320d317
<         // enable the &quot;loading&quot; message
<         rcmail.display_message(rcmail.gettext('loading'), 'loading', true);
345,347d341
<
<         // disable the &quot;loading&quot; message
<         rcmail.display_message(rcmail.gettext('loading'), 'loading', false);


recipient_to_contact.php diff patch
Code: [Select]
202d201
<             $this->rcmail->session->regenerate_id();


If you don't know how to apply/read diff patches, or just don't have access to the shell, read How to read a patch or diff and understand its structure to apply it manually ยป markusbe.com (http://goo.gl/LtZf4). It will explain the basics of reading patch files.
These patches were made from a fresh download of the plugin.
Title: rouncube 0.7
Post by: kionez on January 03, 2012, 08:45:58 AM
Hi all,

is there anyone who use this plugin with the new roundcube (0.7)?

Thanks in advance

k.
Title: Re: Recipient To Contacts Plugin
Post by: cornfeed on July 18, 2012, 02:13:41 PM
I do, works fine. but needs updating