Add vmail command for changing password when you know the current password
[hcoop/domtool2.git] / src / msg.sml
index f6b0051..eb04648 100644 (file)
@@ -1,5 +1,6 @@
 (* HCoop Domtool (http://hcoop.sourceforge.net/)
  * Copyright (c) 2006, Adam Chlipala
+ * Copyright (c) 2011,2014 Clinton Ebadi <clinton@unknownlamer.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -248,6 +249,13 @@ fun send (bio, m) =
       | MsgAptQuery {section, description} => (OpenSSL.writeInt (bio, 44);
                                               OpenSSL.writeString (bio, section);
                                               OpenSSL.writeString (bio, description))
+      | MsgSaChanged => OpenSSL.writeInt (bio, 45)
+      | MsgPortalPasswdMailbox {domain : string, user : string, oldpasswd : string, newpasswd : string} =>
+       (OpenSSL.writeInt (bio, 46);
+        OpenSSL.writeString (bio, domain);
+        OpenSSL.writeString (bio, user);
+        OpenSSL.writeString (bio, oldpasswd);
+        OpenSSL.writeString (bio, newpasswd))
 
 fun checkIt v =
     case v of
@@ -366,6 +374,11 @@ fun recv bio =
                   | 44 => (case (OpenSSL.readString bio, OpenSSL.readString bio) of
                                (SOME section, SOME description) => SOME (MsgAptQuery {section = section, description = description})
                              | _ => NONE)
+                  | 45 => SOME MsgSaChanged
+                  | 46 => (case (OpenSSL.readString bio, OpenSSL.readString bio, OpenSSL.readString bio, OpenSSL.readString bio) of
+                               (SOME domain, SOME user, SOME oldpasswd, SOME newpasswd) =>
+                               SOME (MsgPortalPasswdMailbox {domain = domain, user = user, oldpasswd = oldpasswd, newpasswd = newpasswd})
+                             | _ => NONE)
                   | _ => NONE)
         
 end