-/* 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
* 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:
#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[] = {
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
static struct {
struct userNode *bot;
- int message_expiry;
+ unsigned long message_expiry;
} memoserv_conf;
const char *memoserv_module_deps[] = { NULL };
}
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;
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)
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;
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;
}
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);
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));