Remove extraneous semicolons from end of macro uses.
[srvx.git] / src / mod-memoserv.c
index 0a0ee697fbee5b329651cb83044df93d9ae322e0..7b1dc3df4ade77077fce32b303f62c2b3d55c9b1 100644 (file)
@@ -1,11 +1,12 @@
-/* memoserv.c - MemoServ module for srvx
+/* mod-memoserv.c - MemoServ module for srvx
  * Copyright 2003-2004 Martijn Smit and srvx Development Team
  *
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of srvx.
+ *
+ * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.  Important limitations are
- * listed in the COPYING file that accompanies this software.
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -13,7 +14,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, email srvx-maintainers@srvx.net.
+ * along with srvx; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
 /* Adds new section to srvx.conf:
@@ -54,6 +56,7 @@
 #define KEY_RECIPIENT "to"
 #define KEY_FROM "from"
 #define KEY_MESSAGE "msg"
+#undef KEY_READ /* thanks microsoft! */
 #define KEY_READ "read"
 
 static const struct message_entry msgtab[] = {
@@ -88,12 +91,12 @@ struct memo {
     struct memo_account *recipient;
     struct memo_account *sender;
     char *message;
-    time_t sent;
+    unsigned long sent;
     unsigned int is_read : 1;
 };
 
 DECLARE_LIST(memoList, struct memo*);
-DEFINE_LIST(memoList, struct memo*);
+DEFINE_LIST(memoList, struct memo*)
 
 /* memo_account.flags fields */
 #define MEMO_NOTIFY_NEW   1
@@ -109,7 +112,7 @@ struct memo_account {
 
 static struct {
     struct userNode *bot;
-    int message_expiry;
+    unsigned long message_expiry;
 } memoserv_conf;
 
 const char *memoserv_module_deps[] = { NULL };
@@ -187,7 +190,7 @@ expire_memos(UNUSED_ARG(void *data))
 }
 
 static struct memo*
-add_memo(time_t sent, struct memo_account *recipient, struct memo_account *sender, char *message)
+add_memo(unsigned long sent, struct memo_account *recipient, struct memo_account *sender, char *message)
 {
     struct memo *memo;
 
@@ -272,15 +275,15 @@ static MODCMD_FUNC(cmd_list)
     struct memo *memo;
     unsigned int ii;
     char posted[24];
-    struct tm tm;
+    time_t feh;
 
     if (!(ma = memoserv_get_account(user->handle_info)))
         return 0;
     reply("MSMSG_LIST_HEAD");
     for (ii = 0; (ii < ma->recvd.used) && (ii < 15); ++ii) {
         memo = ma->recvd.list[ii];
-        localtime_r(&memo->sent, &tm);
-        strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", &tm);
+        feh = memo->sent;
+        strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", localtime(&feh));
         reply("MSMSG_LIST_FORMAT", ii, memo->sender->handle->handle, posted);
     }
     if (ii == 0)
@@ -298,14 +301,13 @@ static MODCMD_FUNC(cmd_read)
     unsigned int memoid;
     struct memo *memo;
     char posted[24];
-    struct tm tm;
+    time_t feh;
 
     if (!(ma = memoserv_get_account(user->handle_info)))
         return 0;
     if (!(memo = find_memo(user, cmd, ma, argv[1], &memoid)))
         return 0;
-    localtime_r(&memo->sent, &tm);
-    strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", &tm);
+    strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", localtime(&feh));
     reply("MSMSG_MEMO_HEAD", memoid, memo->sender->handle->handle, posted);
     send_message_type(4, user, cmd->parent->bot, "%s", memo->message);
     memo->is_read = 1;
@@ -355,7 +357,7 @@ static MODCMD_FUNC(cmd_expiry)
         return 1;
     }
 
-    intervalString(interval, memoserv_conf.message_expiry);
+    intervalString(interval, memoserv_conf.message_expiry, user->handle_info);
     reply("MSMSG_EXPIRY", interval, memoserv_conf.message_expiry);
     return 1;
 }
@@ -464,7 +466,7 @@ memoserv_saxdb_read(struct dict *db)
     struct record_data *hir;
     struct memo *memo;
     dict_iterator_t it;
-    time_t sent;
+    unsigned long sent;
 
     for (it = dict_first(db); it; it = iter_next(it)) {
         hir = iter_data(it);
@@ -477,7 +479,7 @@ memoserv_saxdb_read(struct dict *db)
             log_module(MS_LOG, LOG_ERROR, "Date sent not present in memo %s; skipping", iter_key(it));
             continue;
         }
-        sent = atoi(str);
+        sent = strtoul(str, NULL, 0);
 
         if (!(str = database_get_data(hir->d.object, KEY_RECIPIENT, RECDB_QSTRING))) {
             log_module(MS_LOG, LOG_ERROR, "Recipient not present in memo %s; skipping", iter_key(it));