diff options
author | thomascube <thomas@roundcube.net> | 2010-09-29 10:00:48 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2010-09-29 10:00:48 +0000 |
commit | 2baa16ae6d8355e0dfb38e400fd4115057b0680d (patch) | |
tree | 0e5790c0ff37980bfcdca26b1bfe4c392cf211b6 /plugins/password/drivers/hmail.php | |
parent | 717815c9a88222fc19989d6545134bb4d1df62c9 (diff) |
Copy plugins into 0.4.1 release branch
Diffstat (limited to 'plugins/password/drivers/hmail.php')
-rw-r--r-- | plugins/password/drivers/hmail.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php new file mode 100644 index 000000000..764b744fe --- /dev/null +++ b/plugins/password/drivers/hmail.php @@ -0,0 +1,44 @@ +<?php + +/** + * hMailserver password driver + * + * @version 1.1 + * @author Roland 'rosali' Liebl <myroundcube@mail4us.net> + * + */ + +function password_save($curpass, $passwd) +{ + $rcmail = rcmail::get_instance(); + + if($curpass == '' || $passwd == '') + return PASSWORD_ERROR; + + try { + $obApp = new COM('hMailServer.Application'); + } + catch (Exception $e) { + write_log('errors', "Plugin password (hmail driver):" . $e->getMessage() . ". This problem is often caused by DCOM permissions not being set."); + return PASSWORD_ERROR; + } + + $username = $rcmail->user->data['username']; + $temparr = explode('@', $username); + $domain = $temparr[1]; + $obApp->Authenticate($username, $curpass); + + try { + $obDomain = $obApp->Domains->ItemByName($domain); + $obAccount = $obDomain->Accounts->ItemByAddress($username); + $obAccount->Password = $passwd; + $obAccount->Save(); + return PASSWORD_SUCCESS; + } + catch(Exception $e) { + write_log('errors', "Plugin password (hmail driver):" . $e->getMessage()); + return PASSWORD_ERROR; + } +} + +?> |