/** * The /ms sendall command. * @param u The user who issued the command * @param MOD_CONT to continue processing other modules, MOD_STOP to stop processing. **/ int do_sendall(User * u) { int i, z = 1; NickCore *nc; char *text = strtok(NULL, ""); if (readonly) { notice_lang(s_MemoServ, u, MEMO_SEND_DISABLED); return MOD_CONT; } else if (checkDefCon(DEFCON_NO_NEW_MEMOS)) { notice_lang(s_MemoServ, u, OPER_DEFCON_DENIED); return MOD_CONT; } else if (!text) { syntax_error(s_MemoServ, u, "SENDALL", MEMO_SEND_SYNTAX); return MOD_CONT; } for (i = 0; i < 1024; i++) { for (nc = nclists[i]; nc; nc = nc->next) { if (stricmp(u->nick, nc->display) != 0) memo_send(u, nc->display, text, z); } /* /nc */ } /* /i */ notice_lang(s_MemoServ, u, MEMO_MASS_SENT); return MOD_CONT; }
static void my_memo_lang(User * u, char *name, int z, char *source, int number, ...) { va_list va; char buffer[4096], outbuf[4096]; char *fmt = NULL; int lang = LANG_EN_US; char *s, *t, *buf; User *u2; if ((mod_current_module_name) && (!mod_current_module || strcmp(mod_current_module_name, mod_current_module->name))) mod_current_module = findModule(mod_current_module_name); u2 = finduser(name); /* Find the users lang, and use it if we cant */ if (u2 && u2->na && u2->na->nc) lang = u2->na->nc->language; /* If the users lang isnt supported, drop back to enlgish */ if (mod_current_module->lang[lang].argc == 0) lang = LANG_EN_US; /* If the requested lang string exists for the language */ if (mod_current_module->lang[lang].argc > number) { fmt = mod_current_module->lang[lang].argv[number]; buf = sstrdup(fmt); s = buf; while (*s) { t = s; s += strcspn(s, "\n"); if (*s) *s++ = '\0'; strscpy(outbuf, t, sizeof(outbuf)); va_start(va, number); vsnprintf(buffer, 4095, outbuf, va); va_end(va); if (source) memo_send_from(u, name, buffer, z, source); else memo_send(u, name, buffer, z); } free(buf); } else { alog("%s: INVALID language string call, language: [%d], String [%d]", mod_current_module->name, lang, number); } }
void rsend_notify(User * u, Memo * m, const char *chan) { NickAlias *na; NickCore *nc; char text[256]; const char *fmt; /* Only send receipt if memos are allowed */ if ((!readonly) && (!checkDefCon(DEFCON_NO_NEW_MEMOS))) { /* Get nick alias for sender */ na = findnick(m->sender); if (!na) { return; } /* Get nick core for sender */ nc = na->nc; if (!nc) { return; } /* Text of the memo varies if the recepient was a nick or channel */ if (chan) { fmt = getstring(na, MEMO_RSEND_CHAN_MEMO_TEXT); snprintf(text, sizeof(text), fmt, chan); } else { fmt = getstring(na, MEMO_RSEND_NICK_MEMO_TEXT); snprintf(text, sizeof(text), "%s", fmt); } /* Send notification */ memo_send(u, m->sender, text, 2); /* Notify recepient of the memo that a notification has been sent to the sender */ notice_lang(s_MemoServ, u, MEMO_RSEND_USER_NOTIFICATION, nc->display); } /* Remove receipt flag from the original memo */ m->flags &= ~MF_RECEIPT; return; }