summaryrefslogtreecommitdiff
path: root/memoserv.c
diff options
context:
space:
mode:
authoratoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b <atoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-04-26 23:03:36 +0000
committeratoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b <atoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-04-26 23:03:36 +0000
commit4255f545d0c1e65652ebcc2e6c55fbba2a003dda (patch)
tree132e6b85305dfb249ab6610fa5a727add8ffe185 /memoserv.c
parent98167888fafe2793b9fded5b9af1eecc8efae0ba (diff)
BUILD : 1.7.2 (70) BUGS : NOTES : Modified RSEND to send receipt memo as user instead of MemoServ
git-svn-id: svn://svn.anope.org/anope/trunk@70 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@46 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'memoserv.c')
-rw-r--r--memoserv.c90
1 files changed, 18 insertions, 72 deletions
diff --git a/memoserv.c b/memoserv.c
index 587b65a59..ec7ec6599 100644
--- a/memoserv.c
+++ b/memoserv.c
@@ -1264,99 +1264,45 @@ static int do_rsend(User * u)
void rsend_notify(User *u, Memo *m, const char *chan)
{
- User *nu;
- Memo *nm;
- MemoInfo *nmi;
- NickAlias *nna;
- NickCore *nnc;
+ NickAlias *na;
+ NickCore *nc;
char text[256];
const char *fmt;
- int i;
/* Only send receipt if memos are allowed */
if ((!readonly) && (!checkDefCon(DEFCON_NO_NEW_MEMOS))) {
- /* Gather nick alias, nick core and memo info for sender */
- nna = findnick(m->sender);
- nnc = nna->nc;
- nmi = &nnc->memos;
-
- /* Increase the sender's memocount by one */
- nmi->memocount++;
-
- /* Allocate memory for the new memo */
- nmi->memos = srealloc(nmi->memos,
- sizeof(Memo) * nmi->memocount);
-
- /* Grab the new memo pointer to work on it */
- nm = &nmi->memos[nmi->memocount - 1];
+ /* Get nick alias for sender */
+ na = findnick(m->sender);
- /* Sender is MemoServ */
- strscpy(nm->sender, s_MemoServ, NICKMAX);
+ if (!na) {
+ return;
+ }
- /* If the user has more than one memo, assign the new
- memo the next available index */
- if (nmi->memocount > 1) {
- nm->number = nm[-1].number + 1;
+ /* Get nick core for sender */
+ nc = na->nc;
- /* If needed, reindex memos */
- if (nm->number < 1) {
- for (i = 0; i < nmi->memocount; i++) {
- nmi->memos[i].number = i + 1;
- }
- }
- } else {
- /* User has no memos. Use index 1 */
- nm->number = 1;
+ if (!nc) {
+ return;
}
- /* Populate memo structure and set text */
- nm->time = time(NULL);
-
/* Text of the memo varies if the recepient was a
nick or channel */
if (chan) {
- fmt = getstring(nna, MEMO_RSEND_CHAN_MEMO_TEXT);
- sprintf(text, fmt, chan, u->na->nc->display);
+ fmt = getstring(na, MEMO_RSEND_CHAN_MEMO_TEXT);
+ sprintf(text, fmt, chan);
} else {
- fmt = getstring(nna, MEMO_RSEND_NICK_MEMO_TEXT);
- sprintf(text, fmt, u->na->nc->display);
+ fmt = getstring(na, MEMO_RSEND_NICK_MEMO_TEXT);
+ sprintf(text, fmt);
}
- nm->text = sstrdup(text);
- nm->flags = MF_UNREAD;
+ /* Send notification */
+ memo_send(u, m->sender, text, 0);
/* Notify recepient of the memo that a notification has
been sent to the sender */
notice_lang(s_MemoServ, u, MEMO_RSEND_USER_NOTIFICATION,
- nnc->display);
-
- /* Check to see if we're notifying all aliases in the sender's
- group or just the sender */
- if (MSNotifyAll) {
- if ((nnc->flags & NI_MEMO_RECEIVE) &&
- get_ignore(m->sender) == NULL) {
- for (i = 0; i < nnc->aliases.count; i++) {
- nna = nnc->aliases.list[i];
- if (nna->u && nick_identified(nna->u)) {
- notice_lang(s_MemoServ, nna->u,
- MEMO_NEW_MEMO_ARRIVED,
- s_MemoServ, s_MemoServ,
- nm->number);
- }
- }
- } else {
- /* Find the sender user via the display nick */
- nu = finduser(nnc->display);
-
- if (nick_identified(nu)) {
- notice_lang(s_MemoServ, u,
- MEMO_NEW_MEMO_ARRIVED,
- s_MemoServ, s_MemoServ,
- nm->number);
- }
- }
- }
+ nc->display);
}
/* Remove receipt flag from the original memo */