Patch for two or much global or local address books in SquirrelMail

View: New views
3 Messages — Rating Filter:   Alert me  

Patch for two or much global or local address books in SquirrelMail

by Fabel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

1. in our company is mail client with 10 global address books.
2. my users have in mail client many address books, one for every project.

But in SquirrelMail is only one global address book and only one users address
book. I'am create trivial patch for resloving this situation.

This patch is for SqurrelMail version from Debian Etch (2:1.4.9a-3).

Please where is right way for commit this patch to project?

Thank You
DF

[squirrelmail-configure.diff]

548,552c548,552
<         print "2.  Use Javascript Address Book Search          : $WHT$default_use_javascript_addr_book$NRM\n";
<         print "3.  Global file address book                    : $WHT$abook_global_file$NRM\n";
<         print "4.  Allow writing into global file address book : $WHT$abook_global_file_writeable$NRM\n";
<         print "5.  Allow listing of global file address book   : $WHT$abook_global_file_listing$NRM\n";
<         print "6.  Allowed address book line length            : $WHT$abook_file_line_length$NRM\n";
---
>         print "2.  Use Javascript Address Book Search             : $WHT$default_use_javascript_addr_book$NRM\n";
>         print "3.  Global file address book(s)                    : $WHT$abook_global_file$NRM\n";
>         print "4.  Allow writing into global file address book(s) : $WHT$abook_global_file_writeable$NRM\n";
>         print "5.  Allow listing of global file address book(s)   : $WHT$abook_global_file_listing$NRM\n";
>         print "6.  Allowed address book(s) line length            : $WHT$abook_file_line_length$NRM\n";
2682a2683,2687
>     print "If you want two or much global adress books, write it in one\n";
>     print "row with delimiter ';' or create file with name begining '\@'.\n";
>     print "Every row in this \@list_file is relative name of global\n";
>     print "address book.\n";
>     print "Row begining '#' in addressbook is use for his name.\n";
2698c2703
<     print "book options. Address book file must be writeable by\n";
---
>     print "book(s) options. Address book file must be writeable by\n";
2708c2713
<     print "Allow writing into global file address book (y/n) [$WHT$default_value$NRM]: $WHT";
---
>     print "Allow writing into global file address book(s) (y/n) [$WHT$default_value$NRM]: $WHT";
2720c2725
<     print "This setting controls listing of global file address book.\n";
---
>     print "This setting controls listing of global file address book(s).\n";
2729c2734
<     print "Allow listing of global file address book (y/n) [$WHT$default_value$NRM]: $WHT";
---
>     print "Allow listing of global file address book(s) (y/n) [$WHT$default_value$NRM]: $WHT";
2741c2746
<     print "This setting controls space allocated to file based address book records.\n";
---
>     print "This setting controls space allocated to file based address book(s) records.\n";
2753c2758
<     print "Enter allowed address book line length [$abook_file_line_length]: ";
---
>     print "Enter allowed address book(s) line length [$abook_file_line_length]: ";


[update2.diff]

diff -r orig/functions/abook_local_file.php new/functions/abook_local_file.php
93d92
<
291,294c290,298
<                 /** address book is corrupted. */
<                 global $color;
<                 error_box(_("Address book is corrupted. Required fields are missing."),$color);
<                 die('</body></html>');
---
>                 if (preg_match("/^#/",$row[0])) {
>                     /** get address book name */
>                     $this->sname=ereg_replace(": .*","",$this->sname).": ".ereg_replace("# *","",$row[0]);
>                 } else {
>                     /** address book is corrupted. */
>            global $color;
>                error_box(_("Address book is corrupted. Required fields are missing."),$color);
>            die('</body></html>');
>                 }
330,333c334,342
<                 /** address book is corrupted. */
<                 global $color;
<                 error_box(_("Address book is corrupted. Required fields are missing."),$color);
<                 die('</body></html>');
---
>                 if (preg_match("/^#/",$row[0])) {
>                     /** get address book name */
>                     $this->sname=ereg_replace(": .*","",$this->sname).": ".ereg_replace("# *","",$row[0]);
>                 } else {
>                     /** address book is corrupted. */
>            global $color;
>        error_box(_("Address book is corrupted. Required fields are missing."),$color);
>                die('</body></html>');
>                 }
360d368
<
367,370c375,383
<                 /** address book is corrupted. */
<                 global $color;
<                 error_box(_("Address book is corrupted. Required fields are missing."),$color);
<                 die('</body></html>');
---
>                 if (preg_match("/^#/",$row[0])) {
>                     /** get address book name */
>                     $this->sname=ereg_replace(": .*","",$this->sname).": ".ereg_replace("# *","",$row[0]);
>                 } else {
>                     /** address book is corrupted. */
>            global $color;
>                error_box(_("Address book is corrupted. Required fields are missing."),$color);
>            die('</body></html>');
>                 }
diff -r orig/functions/addressbook.php new/functions/addressbook.php
66,71c66,94
<         $filename = getHashedFile($username, $data_dir, "$username.abook");
<         $r = $abook->add_backend('local_file', Array('filename' => $filename,
<                                                      'line_length' => $abook_file_line_length,
<                                                      'create'   => true));
<         if(!$r && $showerr) {
<             $abook_init_error.=sprintf( _("Error opening file %s"), $filename );
---

>         $abooks_list_handle = @fopen("$data_dir/@$username.abook", "r");
>         if ($abooks_list_handle) {
>             /* read list of addressbooks from file @username.abook */
>             $abooks_counter=0;
>             while (!feof($abooks_list_handle)) {
>                 $row=ereg_replace("[\r\n]*$","",fgets($abooks_list_handle, 128));
>                 /* is reading row addressbook? */
>                 if ($abook_test_handle=@fopen("$data_dir$row", "r")) {
>                     $abooks_list[$abooks_counter++]=$row;
>                     fclose($abook_test_handle);
>                 }
>             }
>             fclose($abooks_list_handle);
>         } else {
>             /* not exist list of addressbooks */
>             $abooks_list[0] = "$username.abook";
>         }
>
>         if (is_array($abooks_list)) {
>             foreach ($abooks_list as &$abook_filename) {
>                     /* read list of addressbooks and add it on backend */
>                     $filename = getHashedFile($username, $data_dir, $abook_filename);
>                     $r = $abook->add_backend('local_file', Array('filename' => $filename,
>                                                                  'line_length' => $abook_file_line_length,
>                                                                  'create'   => true));
>                     if(!$r && $showerr) {
>                 $abook_init_error.=sprintf( _("Error opening file %s"), $filename );
>                     }
>             }
75,91c98,110
<     /* This would be for the global addressbook */
<     if (isset($abook_global_file) && isset($abook_global_file_writeable)
<         && trim($abook_global_file)!=''){
<         // Detect place of address book
<         if (! preg_match("/[\/\\\]/",$abook_global_file)) {
<             /* no path chars, address book stored in data directory
<              * make sure that there is a slash between data directory
<              * and address book file name
<              */
<             $abook_global_filename=$data_dir
<                 . ((substr($data_dir, -1) != '/') ? '/' : '')
<                 . $abook_global_file;
<         } elseif (preg_match("/^\/|\w:/",$abook_global_file)) {
<             // full path is set in options (starts with slash or x:)
<             $abook_global_filename=$abook_global_file;
<         } else {
<             $abook_global_filename=SM_PATH . $abook_global_file;
---

>     if (preg_match("/^@/",$abook_global_file)) {
>         $abooks_global_list_handle = @fopen("$data_dir/$abook_global_file", "r");
>         if ($abooks_global_list_handle) {
>             /* read list of addressbooks from file @abook_global_file */
>             $abooks_global_counter=0;
>             while (!feof($abooks_global_list_handle)) {
>                 $row=ereg_replace("[\r\n]*$","",fgets($abooks_global_list_handle, 128));
>                 /* is reading row addressbook? */
>                 if ($abook_global_test_handle=@fopen("$data_dir$row", "r")) {
>                     $abooks_global_list[$abooks_global_counter++]=$row;
>                     fclose($abook_global_test_handle);
>                 }
>             }
93,101c112,151
<         $r = $abook->add_backend('local_file',array('filename'=>$abook_global_filename,
<                                                     'name' => _("Global address book"),
<                                                     'detect_writeable' => false,
<                                                     'line_length' => $abook_file_line_length,
<                                                     'writeable'=> $abook_global_file_writeable,
<                                                     'listing' => $abook_global_file_listing));
<         if (!$r && $showerr) {
<             if ($abook_init_error!='') $abook_init_error.="\n";
<             $abook_init_error.=_("Error initializing global address book.") . "\n" . $abook->error;
---

>         fclose($abooks_global_list_handle);
>     } elseif (preg_match("/;/",$abook_global_file)) {
>         /* exists two or more global addressbooks */
>         $abooks_global_list = split(";", $abook_global_file);
>     } else {
>         /* exists only one global addressbook */
>         $abooks_global_list[0] = $abook_global_file;
>     }
>
>     if (is_array($abooks_global_list)) {
>         foreach ($abooks_global_list as &$abook_global_file) {
>             /* This would be for the global addressbooks */
>             if (isset($abook_global_file) && isset($abook_global_file_writeable)
>                 && trim($abook_global_file)!=''){
>                 // Detect place of address book
>                 if (! preg_match("/[\/\\\]/",$abook_global_file)) {
>                     /* no path chars, address book stored in data directory
>                      * make sure that there is a slash between data directory
>                      * and address book file name
>                      */
>                     $abook_global_filename=$data_dir
>                         . ((substr($data_dir, -1) != '/') ? '/' : '')
>                         . $abook_global_file;
>                 } elseif (preg_match("/^\/|\w:/",$abook_global_file)) {
>                     // full path is set in options (starts with slash or x:)
>                     $abook_global_filename=$abook_global_file;
>                 } else {
>                     $abook_global_filename=SM_PATH . $abook_global_file;
>                 }
>                 $r = $abook->add_backend('local_file',array('filename'=>$abook_global_filename,
>                                                             'name' => _("Global address book"),
>                                                             'detect_writeable' => false,
>                                                             'line_length' => $abook_file_line_length,
>                                                             'writeable'=> $abook_global_file_writeable,
>                                                             'listing' => $abook_global_file_listing));
>                 if (!$r && $showerr) {
>                     if ($abook_init_error!='') $abook_init_error.="\n";
>                     $abook_init_error.=_("Error initializing global address book.") . "\n" . $abook->error;
>                 }
>             }
diff -r orig/src/addrbook_search_html.php new/src/addrbook_search_html.php
210a211
>     $ret = $abook->list_addr();
diff -r orig/src/addrbook_search.php new/src/addrbook_search.php
218a219
>         $ret = $abook->list_addr();        


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
-----
squirrelmail-i18n mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
Information about translations: http://squirrelmail.org/wiki/LanguageTranslation
Statistics for translations: http://l10n-stats.squirrelmail.org/
List address: squirrelmail-i18n@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.internationalization
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-i18n

Re: Patch for two or much global or local address books in SquirrelMail

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 1. in our company is mail client with 10 global address books.
> 2. my users have in mail client many address books, one for every project.
>
> But in SquirrelMail is only one global address book and only one users address
> book. I'am create trivial patch for resloving this situation.
>
> This patch is for SqurrelMail version from Debian Etch (2:1.4.9a-3).
>
> Please where is right way for commit this patch to project?

You can send it to the squirrelmail-devel mailing list or open a
tracker item for it.  The i18n list is certainly not the place for
this.

However, note that all patch/diff files should be in unified output
format and you should explain your methodology (the idea behind the
implementation).  You should also explain why the Address Book
Grouping and Pagination plugin won't work, since it sounds like you
are simply needing groups functionality.  Finally, we probably won't
accept changes that are so pervasive in our stable code stream -
you're more likely to have success getting a patch accepted if it's
against our development stream (currently 1.5.2SVN).

Thanks a lot for your help!

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
-----
squirrelmail-i18n mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
Information about translations: http://squirrelmail.org/wiki/LanguageTranslation
Statistics for translations: http://l10n-stats.squirrelmail.org/
List address: squirrelmail-i18n@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.internationalization
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-i18n

Re: Patch for two or much global or local address books in SquirrelMail

by Tomas Kuliavas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Fabel-2 wrote:
Hi all,

1. in our company is mail client with 10 global address books.
2. my users have in mail client many address books, one for every project.

But in SquirrelMail is only one global address book and only one users address
book. I'am create trivial patch for resloving this situation.

This patch is for SqurrelMail version from Debian Etch (2:1.4.9a-3).

Please where is right way for commit this patch to project?
SquirrelMail allows more than one global address book. You can create multiple address books with plugins.