mbox = $mbox; $this->domain = $domain; $this->address = "$mbox@$domain"; if ($user instanceof PlUser) { $this->mmclient = new MMList($user, $this->domain); } else { $this->mmclient = new MMList($user, $pass, $this->domain); } } /** Instantiate a MailingList from its address. * * $user and $pass are connection parameters for MailMan. */ public static function fromAddress($address, $user, $pass='') { if (strstr($address, '@') !== false) { list($mbox, $domain) = explode('@', $address); } else { global $globals; $mbox = $address; $domain = $globals->mail->domain; } return new MailingList($mbox, $domain, $user, $pass); } /** Retrieve the MailingList associated with a given promo. * * $user and $pass are connection parameters for MailMan. */ public static function promo($promo, $user, $pass='') { global $globals; $mail_domain = $globals->mail->domain; return new MailingList('promo', "$promo.$mail_domain", $user, $pass); } /** Subscribe the current user to the list */ public function subscribe() { return $this->mmclient->subscribe($this->mbox); } /** Unsubscribe the current user from the list */ public function unsubscribe() { return $this->mmclient->unsubscribe($this->mbox); } /** Retrieve owners for the list. * * TODO: document the return type */ public function getOwners() { return $this->mmclient->get_owners($this->mbox); } /** Retrieve members of the list. * * TODO: document the return type */ public function getMembers() { return $this->mmclient->get_members($this->mbox); } /** Retrieve a subset of list members. * * TODO: document the return type */ public function getMembersLimit($page, $number_per_page) { return $this->mmclient->get_members_limit($this->mbox, $page, $number_per_page); } /** Create a list */ public function create($description, $advertise, $moderation_level, $subscription_level, $owners, $members) { return $this->mmclient->create_list($this->mbox, utf8_decode($description), $advertise, $moderation_level, $subscription_level, $owners, $members); } } // }}} // vim:set et sw=4 sts=4 sws=4 enc=utf-8: ?>