summaryrefslogtreecommitdiff
path: root/src/encrypt.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-28 22:44:34 -0400
committerAdam <Adam@anope.org>2011-05-16 04:09:32 -0400
commit583954d3a1db658281a9afb7b7dd6773726c8c11 (patch)
tree6a00865d5738c6d0bc42efb35f3f468c5876eb3e /src/encrypt.cpp
parent8fb1604f649bec6f356770daf5df6bb8ab811bbf (diff)
Use module type to determine what type each module is instead of its location in the configuration file.
Diffstat (limited to 'src/encrypt.cpp')
-rw-r--r--src/encrypt.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/encrypt.cpp b/src/encrypt.cpp
index 2414bf7bc..0f3bd3d79 100644
--- a/src/encrypt.cpp
+++ b/src/encrypt.cpp
@@ -14,26 +14,22 @@
/******************************************************************************/
-/**
- * Encrypt string `src' of length `len', placing the result in buffer
- * `dest' of size `size'. Returns 0 on success, -1 on error.
- **/
-int enc_encrypt(const Anope::string &src, Anope::string &dest)
+/** Encrypt the string src into dest
+ * @param src The source string
+ * @param dest The destination strnig
+ */
+void enc_encrypt(const Anope::string &src, Anope::string &dest)
{
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnEncrypt, OnEncrypt(src, dest));
- if (MOD_RESULT == EVENT_ALLOW)
- return 0;
- return -1;
}
-/**
- * Decrypt encrypted string `src' into buffer `dest' of length `len'.
- * Returns 1 (not 0) on success, -1 if the encryption algorithm does not
- * allow decryption, and -1 if another failure occurred (e.g. destination
- * buffer too small).
- **/
-int enc_decrypt(const Anope::string &src, Anope::string &dest)
+/** Decrypt the encrypted string src into dest
+ * @param src The encrypted string
+ * @param desc The destination string
+ * @return true on success
+ */
+bool enc_decrypt(const Anope::string &src, Anope::string &dest)
{
size_t pos = src.find(':');
if (pos == Anope::string::npos)
@@ -46,7 +42,8 @@ int enc_decrypt(const Anope::string &src, Anope::string &dest)
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnDecrypt, OnDecrypt(hashm, src, dest));
if (MOD_RESULT == EVENT_ALLOW)
- return 1;
- return -1;
+ return true;
+
+ return false;
}