Ticket #1442732 (assigned Patches: None)

Opened 2 years ago

Last modified 6 months ago

Global addressbook (per domain)

Reported by: nobody Owned by: nobody
Priority: 5 Milestone: 0.2-beta
Component: Core functionality Version: 0.1-beta
Severity: minor Keywords: addressbook
Cc:

Description (last modified by thomasb) (diff)

Although I have already hacked it into .1 beta...

One of the biggest reasons I was unhappy with SquirrelMail? was their lack of a globally available, on a per domain basis level, address book.

I was easily able to integrate this into the beta release of RoundCube and would hope to see it in the future.

Great program thus far though.

Change History

Changed 2 years ago by smueller72

Logged In: YES 
user_id=1158189

I am looking for this same type of functionality.  Care to
share your hack?  

Is this something that is planned to be included in an
upcoming release?  I would prefer to wait for the 'official'
release rather than hack.  

Changed 2 years ago by nobody

Logged In: NO 

Supply a patch for your hack?

Changed 2 years ago by nobody

Logged In: NO 

First off, added a column to the contacts table, user_domain
varchar(255).
Then, when someone logs in, I use pregs to strip off the
domain name from the email address and add that to a
$_SESSION["user_domain"]
The files I had to change were:
index.php
program/steps/addressbook/func.inc
program/steps/addressbook/list.inc
program/steps/addressbook/show.inc
program/steps/mail/compose.inc

***index.php around line 191:***
//see the else clause:
// log in to imap server
if (!empty($_SESSION['user_id']) && $_task=='mail')
  {
  $conn = $IMAP->connect($_SESSION['imap_host'],
$_SESSION['username'],
decrypt_passwd($_SESSION['password']), $_SESSION['imap_port
  if (!$conn)
    {
    show_message('imaperror', 'error');
    $_SESSION['user_id'] = '';
    }
  else {
    //  20060303 PS - Get the user's domain they typed in. 
For use with address book functionality.
    $parts = explode("@", $_SESSION['username']);
    $_SESSION['user_domain'] = $parts[1];
    rcmail_set_imap_prop();
    }
  }

Then in the 3 address book folder's files I changed the
query that was called.  This query is called once or twice
in each of these 3 files.  My query is only slightly
different, it searches the user_domain col. I made in the
contacts table.
My query:
 $DB->query("SELECT * FROM ".get_table_name('contacts')."
              WHERE  contact_id=?
              AND    ( user_id=? OR
user_domain='{$_SESSION["user_domain"]}' )
              AND    del<>1",
              $cid,
              $_SESSION['user_id']);

The same query is made in the program/steps/mail/compose.inc
Basically whenever you see the userid=?, just add the OR
clause I put in there.  Pretty basic really.

Sorry I didnt post it sooner.

Changed 2 years ago by mrsticks1982

Logged In: YES 
user_id=540609

OK, Ive logged in now.  I created this thread, and it's my
hack Ive posted.  

I neglected to go into a little more detail.

At the moment, since I havent started using roundcube
exclusively, I never actually coded the process whereby the
user's domain ACTUALLY gets inserted into the DB.  I just
logged in once, manually updated that user's DB entry to
include his domain in the user_domain col.

And at this point, the code of roundcube is written so that
you cant delete these domain global addresses.  This has to
do with the user_id being set to 0 in the contacts table and
the user_domain field filled in.

I think thats about it.

-peter

Changed 2 years ago by thomasb

  • severity changed from critical to minor
  • version deleted
  • description modified (diff)
  • milestone deleted

Later...

Changed 2 years ago by thomasb

  • version set to 0.1-beta
  • milestone set to later

Changed 6 months ago by seansan

  • keywords addressbook added
  • summary changed from Per Domain Global Contacts/Address Book to Global addressbook (per domain)
  • type changed from Feature Requests to Patches
  • milestone changed from later to 0.2-beta

Review as part of update to AB in Milestone: 0.2-beta

Note: See TracTickets for help on using tickets.