Anope IRC Services  Version 1.8
ns_saset.c
Go to the documentation of this file.
1 /* NickServ core functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 /*************************************************************************/
14 
15 #include "module.h"
16 #include "encrypt.h"
17 
18 static int do_saset(User * u);
19 static int do_saset_display(User * u, NickCore * nc, char *param);
20 static int do_saset_password(User * u, NickCore * nc, char *param);
21 static int do_saset_url(User * u, NickCore * nc, char *param);
22 static int do_saset_email(User * u, NickCore * nc, char *param);
23 static int do_saset_greet(User * u, NickCore * nc, char *param);
24 static int do_saset_icq(User * u, NickCore * nc, char *param);
25 static int do_saset_kill(User * u, NickCore * nc, char *param);
26 static int do_saset_secure(User * u, NickCore * nc, char *param);
27 static int do_saset_private(User * u, NickCore * nc, char *param);
28 static int do_saset_msg(User * u, NickCore * nc, char *param);
29 static int do_saset_hide(User * u, NickCore * nc, char *param);
30 static int do_saset_noexpire(User * u, NickAlias * nc, char *param);
31 static int do_saset_autoop(User * u, NickCore * nc, char *param);
32 static int do_saset_language(User * u, NickCore * nc, char *param);
33 static void myNickServHelp(User * u);
34 
41 int AnopeInit(int argc, char **argv)
42 {
43  Command *c;
44 
45  moduleAddAuthor("Anope");
46  moduleAddVersion(VERSION_STRING);
48 
49  c = createCommand("SASET", do_saset, is_services_oper, -1, -1,
50  NICK_HELP_SASET, NICK_HELP_SASET, NICK_HELP_SASET);
52  c = createCommand("SASET DISPLAY", NULL, is_services_oper,
53  -1, -1, NICK_HELP_SASET_DISPLAY, NICK_HELP_SASET_DISPLAY, NICK_HELP_SASET_DISPLAY);
55  c = createCommand("SASET PASSWORD", NULL, is_services_oper,
56  -1, -1, NICK_HELP_SASET_PASSWORD, NICK_HELP_SASET_PASSWORD, NICK_HELP_SASET_PASSWORD);
58  c = createCommand("SASET URL", NULL, is_services_oper,
59  -1, -1, NICK_HELP_SASET_URL, NICK_HELP_SASET_URL, NICK_HELP_SASET_URL);
61  c = createCommand("SASET EMAIL", NULL, is_services_oper,
62  -1, -1, NICK_HELP_SASET_EMAIL, NICK_HELP_SASET_EMAIL, NICK_HELP_SASET_EMAIL);
64  c = createCommand("SASET ICQ", NULL, is_services_oper,
65  -1, -1, NICK_HELP_SASET_ICQ, NICK_HELP_SASET_ICQ, NICK_HELP_SASET_ICQ);
67  c = createCommand("SASET GREET", NULL, is_services_oper,
68  -1, -1, NICK_HELP_SASET_GREET, NICK_HELP_SASET_GREET, NICK_HELP_SASET_GREET);
70  c = createCommand("SASET KILL", NULL, is_services_oper,
71  -1, -1, NICK_HELP_SASET_KILL, NICK_HELP_SASET_KILL, NICK_HELP_SASET_KILL);
73  c = createCommand("SASET SECURE", NULL, is_services_oper,
74  -1, -1, NICK_HELP_SASET_SECURE, NICK_HELP_SASET_SECURE, NICK_HELP_SASET_SECURE);
76  c = createCommand("SASET PRIVATE", NULL, is_services_oper,
77  -1, -1, NICK_HELP_SASET_PRIVATE, NICK_HELP_SASET_PRIVATE, NICK_HELP_SASET_PRIVATE);
79  c = createCommand("SASET MSG", NULL, is_services_oper,
80  -1, -1, NICK_HELP_SASET_MSG, NICK_HELP_SASET_MSG, NICK_HELP_SASET_MSG);
82  c = createCommand("SASET HIDE", NULL, is_services_oper,
83  -1, -1, NICK_HELP_SASET_HIDE, NICK_HELP_SASET_HIDE, NICK_HELP_SASET_HIDE);
85  c = createCommand("SASET NOEXPIRE", NULL, is_services_oper, -1, -1,
86  NICK_HELP_SASET_NOEXPIRE, NICK_HELP_SASET_NOEXPIRE,
87  NICK_HELP_SASET_NOEXPIRE);
89  c = createCommand("SASET AUTOOP", NULL, is_services_oper, -1, -1,
90  NICK_HELP_SASET_AUTOOP, NICK_HELP_SASET_AUTOOP, NICK_HELP_SASET_AUTOOP);
92  c = createCommand("SASET LANGUAGE", NULL, is_services_oper,
93  -1, -1, NICK_HELP_SASET_LANGUAGE, NICK_HELP_SASET_LANGUAGE, NICK_HELP_SASET_LANGUAGE);
95 
97 
98  return MOD_CONT;
99 }
100 
104 void AnopeFini(void)
105 {
106 
107 }
108 
109 
110 
115 static void myNickServHelp(User * u)
116 {
117  if (is_services_oper(u))
118  notice_lang(s_NickServ, u, NICK_HELP_CMD_SASET);
119 }
120 
126 static int do_saset(User * u)
127 {
128  char *nick = strtok(NULL, " ");
129  char *cmd = strtok(NULL, " ");
130  char *param = strtok(NULL, " ");
131 
132  NickAlias *na;
133 
134  if (readonly) {
135  notice_lang(s_NickServ, u, NICK_SASET_DISABLED);
136  return MOD_CONT;
137  }
138  if (!nick) {
139  syntax_error(s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
140  return MOD_CONT;
141  }
142  if (!(na = findnick(nick))) {
143  notice_lang(s_NickServ, u, NICK_SASET_BAD_NICK, nick);
144  return MOD_CONT;
145  }
146 
147  if (!param
148  && (!cmd
149  || (stricmp(cmd, "URL") != 0 && stricmp(cmd, "EMAIL") != 0
150  && stricmp(cmd, "GREET") != 0
151  && stricmp(cmd, "ICQ") != 0))) {
152  syntax_error(s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
153  } else if (!na) {
154  notice_lang(s_NickServ, u, NICK_NOT_REGISTERED, nick);
155  } else if (na->status & NS_VERBOTEN) {
156  notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
157  } else if (na->nc->flags & NI_SUSPENDED) {
158  notice_lang(s_NickServ, u, NICK_X_SUSPENDED, na->nick);
159  } else if (stricmp(cmd, "DISPLAY") == 0) {
160  do_saset_display(u, na->nc, param);
161  } else if (stricmp(cmd, "PASSWORD") == 0) {
162  do_saset_password(u, na->nc, param);
163  } else if (stricmp(cmd, "URL") == 0) {
164  do_saset_url(u, na->nc, param);
165  } else if (stricmp(cmd, "EMAIL") == 0) {
166  do_saset_email(u, na->nc, param);
167  } else if (stricmp(cmd, "ICQ") == 0) {
168  do_saset_icq(u, na->nc, param);
169  } else if (stricmp(cmd, "GREET") == 0) {
170  do_saset_greet(u, na->nc, param);
171  } else if (stricmp(cmd, "KILL") == 0) {
172  do_saset_kill(u, na->nc, param);
173  } else if (stricmp(cmd, "SECURE") == 0) {
174  do_saset_secure(u, na->nc, param);
175  } else if (stricmp(cmd, "PRIVATE") == 0) {
176  do_saset_private(u, na->nc, param);
177  } else if (stricmp(cmd, "MSG") == 0) {
178  do_saset_msg(u, na->nc, param);
179  } else if (stricmp(cmd, "HIDE") == 0) {
180  do_saset_hide(u, na->nc, param);
181  } else if (stricmp(cmd, "NOEXPIRE") == 0) {
182  do_saset_noexpire(u, na, param);
183  } else if (stricmp(cmd, "AUTOOP") == 0) {
184  do_saset_autoop(u, na->nc, param);
185  } else if (stricmp(cmd, "LANGUAGE") == 0) {
186  do_saset_language(u, na->nc, param);
187  } else {
188  notice_lang(s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd);
189  }
190  return MOD_CONT;
191 }
192 
193 static int do_saset_display(User * u, NickCore * nc, char *param)
194 {
195  int i;
196  NickAlias *na;
197 
198  /* First check whether param is a valid nick of the group */
199  for (i = 0; i < nc->aliases.count; i++) {
200  na = nc->aliases.list[i];
201  if (stricmp(na->nick, param) == 0) {
202  param = na->nick; /* Because case may differ */
203  break;
204  }
205  }
206 
207  if (i == nc->aliases.count) {
208  notice_lang(s_NickServ, u, NICK_SASET_DISPLAY_INVALID,
209  nc->display);
210  return MOD_CONT;
211  }
212 
213  alog("%s: %s!%s@%s set the display of %s to: %s",
214  s_NickServ, u->nick, u->username, u->host, nc->display, param);
215  change_core_display(nc, param);
216  notice_lang(s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display);
217 
218  if (NSNickTracking) {
219  for (i = 0; i < nc->aliases.count; ++i) {
220  na = nc->aliases.list[i];
221  if (na->u && nick_identified(na->u))
222  nsStartNickTracking(na->u);
223  }
224  }
225 
226  return MOD_CONT;
227 }
228 
229 static int do_saset_password(User * u, NickCore * nc, char *param)
230 {
231  int len = strlen(param);
232  char tmp_pass[PASSMAX];
233 
234  if (NSSecureAdmins && u->na->nc != nc && nick_is_services_admin(nc)
235  && !is_services_root(u)) {
236  notice_lang(s_NickServ, u, PERMISSION_DENIED);
237  return MOD_CONT;
238  } else if (stricmp(nc->display, param) == 0
239  || (StrictPasswords && len < 5)) {
240  notice_lang(s_NickServ, u, MORE_OBSCURE_PASSWORD);
241  return MOD_CONT;
242  } else if (enc_encrypt_check_len(len ,PASSMAX - 1)) {
243  notice_lang(s_NickServ, u, PASSWORD_TOO_LONG);
244  return MOD_CONT;
245  }
246 
247  if (enc_encrypt(param, len, nc->pass, PASSMAX - 1) < 0) {
248  memset(param, 0, len);
249  alog("%s: Failed to encrypt password for %s (set)", s_NickServ,
250  nc->display);
251  notice_lang(s_NickServ, u, NICK_SASET_PASSWORD_FAILED,
252  nc->display);
253  return MOD_CONT;
254  }
255  memset(param, 0, len);
256 
257  if(enc_decrypt(nc->pass,tmp_pass,PASSMAX - 1)==1) {
258  notice_lang(s_NickServ, u, NICK_SASET_PASSWORD_CHANGED_TO, nc->display,
259  tmp_pass);
260  } else {
261  notice_lang(s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display);
262  }
263 
264  alog("%s: %s!%s@%s used SASET PASSWORD on %s (e-mail: %s)", s_NickServ,
265  u->nick, u->username, u->host, nc->display,
266  (nc->email ? nc->email : "none"));
267  if (WallSetpass)
269  "\2%s\2 used SASET PASSWORD on \2%s\2",
270  u->nick, nc->display);
271  return MOD_CONT;
272 }
273 
274 static int do_saset_url(User * u, NickCore * nc, char *param)
275 {
276  if (nc->url)
277  free(nc->url);
278 
279  if (param) {
280  nc->url = sstrdup(param);
281  alog("%s: %s!%s@%s set the url of %s to: %s",
282  s_NickServ, u->nick, u->username, u->host, nc->display, nc->url);
283  notice_lang(s_NickServ, u, NICK_SASET_URL_CHANGED, nc->display,
284  param);
285  } else {
286  nc->url = NULL;
287  alog("%s: %s!%s@%s unset the url of %s",
288  s_NickServ, u->nick, u->username, u->host, nc->display);
289  notice_lang(s_NickServ, u, NICK_SASET_URL_UNSET, nc->display);
290  }
291  return MOD_CONT;
292 }
293 
294 static int do_saset_email(User * u, NickCore * nc, char *param)
295 {
296  if (!param && NSForceEmail) {
297  notice_lang(s_NickServ, u, NICK_SASET_EMAIL_UNSET_IMPOSSIBLE);
298  return MOD_CONT;
299  } else if (NSSecureAdmins && u->na->nc != nc
301  && !is_services_root(u)) {
302  notice_lang(s_NickServ, u, PERMISSION_DENIED);
303  return MOD_CONT;
304  } else if (param && !MailValidate(param)) {
305  notice_lang(s_NickServ, u, MAIL_X_INVALID, param);
306  return MOD_CONT;
307  }
308 
309  alog("%s: %s!%s@%s used SASET EMAIL on %s (e-mail: %s)", s_NickServ,
310  u->nick, u->username, u->host, nc->display,
311  (nc->email ? nc->email : "none"));
312 
313  if (nc->email)
314  free(nc->email);
315 
316  if (param) {
317  nc->email = sstrdup(param);
318  notice_lang(s_NickServ, u, NICK_SASET_EMAIL_CHANGED, nc->display,
319  param);
320  } else {
321  nc->email = NULL;
322  notice_lang(s_NickServ, u, NICK_SASET_EMAIL_UNSET, nc->display);
323  }
324  return MOD_CONT;
325 }
326 
327 static int do_saset_icq(User * u, NickCore * nc, char *param)
328 {
329  if (param) {
330  int32 tmp = atol(param);
331  if (tmp == 0) {
332  notice_lang(s_NickServ, u, NICK_SASET_ICQ_INVALID, param);
333  } else {
334  nc->icq = tmp;
335  alog("%s: %s!%s@%s set the icq of %s to: %d",
336  s_NickServ, u->nick, u->username, u->host, nc->display, nc->icq);
337  notice_lang(s_NickServ, u, NICK_SASET_ICQ_CHANGED, nc->display,
338  param);
339  }
340  } else {
341  nc->icq = 0;
342  alog("%s: %s!%s@%s unset the icq of %s",
343  s_NickServ, u->nick, u->username, u->host, nc->display);
344  notice_lang(s_NickServ, u, NICK_SASET_ICQ_UNSET, nc->display);
345  }
346  return MOD_CONT;
347 }
348 
349 static int do_saset_greet(User * u, NickCore * nc, char *param)
350 {
351  if (nc->greet)
352  free(nc->greet);
353 
354  if (param) {
355  char buf[BUFSIZE];
356  char *end = strtok(NULL, "");
357 
358  snprintf(buf, sizeof(buf), "%s%s%s", param, (end ? " " : ""),
359  (end ? end : ""));
360 
361  nc->greet = sstrdup(buf);
362  alog("%s: %s!%s@%s set the greet of %s to: %s",
363  s_NickServ, u->nick, u->username, u->host, nc->display, nc->greet);
364  notice_lang(s_NickServ, u, NICK_SASET_GREET_CHANGED, nc->display,
365  buf);
366  } else {
367  nc->greet = NULL;
368  alog("%s: %s!%s@%s unset the greet of %s",
369  s_NickServ, u->nick, u->username, u->host, nc->display);
370  notice_lang(s_NickServ, u, NICK_SASET_GREET_UNSET, nc->display);
371  }
372  return MOD_CONT;
373 }
374 
375 static int do_saset_kill(User * u, NickCore * nc, char *param)
376 {
377  if (stricmp(param, "ON") == 0) {
378  nc->flags |= NI_KILLPROTECT;
379  nc->flags &= ~(NI_KILL_QUICK | NI_KILL_IMMED);
380  alog("%s: %s!%s@%s set kill ON for %s",
381  s_NickServ, u->nick, u->username, u->host, nc->display);
382  notice_lang(s_NickServ, u, NICK_SASET_KILL_ON, nc->display);
383  } else if (stricmp(param, "QUICK") == 0) {
385  nc->flags &= ~NI_KILL_IMMED;
386  alog("%s: %s!%s@%s set kill QUICK for %s",
387  s_NickServ, u->nick, u->username, u->host, nc->display);
388  notice_lang(s_NickServ, u, NICK_SASET_KILL_QUICK, nc->display);
389  } else if (stricmp(param, "IMMED") == 0) {
390  if (NSAllowKillImmed) {
392  nc->flags &= ~NI_KILL_QUICK;
393  alog("%s: %s!%s@%s set kill IMMED for %s",
394  s_NickServ, u->nick, u->username, u->host, nc->display);
395  notice_lang(s_NickServ, u, NICK_SASET_KILL_IMMED, nc->display);
396  } else {
397  notice_lang(s_NickServ, u, NICK_SASET_KILL_IMMED_DISABLED);
398  }
399  } else if (stricmp(param, "OFF") == 0) {
401  alog("%s: %s!%s@%s set kill OFF for %s",
402  s_NickServ, u->nick, u->username, u->host, nc->display);
403  notice_lang(s_NickServ, u, NICK_SASET_KILL_OFF, nc->display);
404  } else {
405  syntax_error(s_NickServ, u, "SASET KILL",
406  NSAllowKillImmed ? NICK_SASET_KILL_IMMED_SYNTAX :
407  NICK_SASET_KILL_SYNTAX);
408  }
409  return MOD_CONT;
410 }
411 
412 static int do_saset_secure(User * u, NickCore * nc, char *param)
413 {
414  if (stricmp(param, "ON") == 0) {
415  nc->flags |= NI_SECURE;
416  alog("%s: %s!%s@%s set secure ON for %s",
417  s_NickServ, u->nick, u->username, u->host, nc->display);
418  notice_lang(s_NickServ, u, NICK_SASET_SECURE_ON, nc->display);
419  } else if (stricmp(param, "OFF") == 0) {
420  nc->flags &= ~NI_SECURE;
421  alog("%s: %s!%s@%s set secure OFF for %s",
422  s_NickServ, u->nick, u->username, u->host, nc->display);
423  notice_lang(s_NickServ, u, NICK_SASET_SECURE_OFF, nc->display);
424  } else {
425  syntax_error(s_NickServ, u, "SASET SECURE",
426  NICK_SASET_SECURE_SYNTAX);
427  }
428  return MOD_CONT;
429 }
430 
431 static int do_saset_private(User * u, NickCore * nc, char *param)
432 {
433  if (stricmp(param, "ON") == 0) {
434  nc->flags |= NI_PRIVATE;
435  alog("%s: %s!%s@%s set private ON for %s",
436  s_NickServ, u->nick, u->username, u->host, nc->display);
437  notice_lang(s_NickServ, u, NICK_SASET_PRIVATE_ON, nc->display);
438  } else if (stricmp(param, "OFF") == 0) {
439  nc->flags &= ~NI_PRIVATE;
440  alog("%s: %s!%s@%s set private OFF for %s",
441  s_NickServ, u->nick, u->username, u->host, nc->display);
442  notice_lang(s_NickServ, u, NICK_SASET_PRIVATE_OFF, nc->display);
443  } else {
444  syntax_error(s_NickServ, u, "SASET PRIVATE",
445  NICK_SASET_PRIVATE_SYNTAX);
446  }
447  return MOD_CONT;
448 }
449 
450 static int do_saset_msg(User * u, NickCore * nc, char *param)
451 {
452  if (!UsePrivmsg) {
453  notice_lang(s_NickServ, u, NICK_SASET_OPTION_DISABLED, "MSG");
454  return MOD_CONT;
455  }
456 
457  if (stricmp(param, "ON") == 0) {
458  nc->flags |= NI_MSG;
459  alog("%s: %s!%s@%s set msg ON for %s",
460  s_NickServ, u->nick, u->username, u->host, nc->display);
461  notice_lang(s_NickServ, u, NICK_SASET_MSG_ON, nc->display);
462  } else if (stricmp(param, "OFF") == 0) {
463  nc->flags &= ~NI_MSG;
464  alog("%s: %s!%s@%s set msg OFF for %s",
465  s_NickServ, u->nick, u->username, u->host, nc->display);
466  notice_lang(s_NickServ, u, NICK_SASET_MSG_OFF, nc->display);
467  } else {
468  syntax_error(s_NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX);
469  }
470  return MOD_CONT;
471 }
472 
473 static int do_saset_hide(User * u, NickCore * nc, char *param)
474 {
475  int flag, onmsg, offmsg;
476  char *param2;
477 
478  if (stricmp(param, "EMAIL") == 0) {
479  flag = NI_HIDE_EMAIL;
480  onmsg = NICK_SASET_HIDE_EMAIL_ON;
481  offmsg = NICK_SASET_HIDE_EMAIL_OFF;
482  } else if (stricmp(param, "USERMASK") == 0) {
483  flag = NI_HIDE_MASK;
484  onmsg = NICK_SASET_HIDE_MASK_ON;
485  offmsg = NICK_SASET_HIDE_MASK_OFF;
486  } else if (stricmp(param, "STATUS") == 0) {
487  flag = NI_HIDE_STATUS;
488  onmsg = NICK_SASET_HIDE_STATUS_ON;
489  offmsg = NICK_SASET_HIDE_STATUS_OFF;
490  } else if (stricmp(param, "QUIT") == 0) {
491  flag = NI_HIDE_QUIT;
492  onmsg = NICK_SASET_HIDE_QUIT_ON;
493  offmsg = NICK_SASET_HIDE_QUIT_OFF;
494  } else {
495  syntax_error(s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX);
496  return MOD_CONT;
497  }
498 
499  param2 = strtok(NULL, " ");
500  if (!param2) {
501  syntax_error(s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX);
502  } else if (stricmp(param2, "ON") == 0) {
503  nc->flags |= flag;
504  alog("%s: %s!%s@%s set hide %s ON for %s",
505  s_NickServ, u->nick, u->username, u->host, param, nc->display);
506  notice_lang(s_NickServ, u, onmsg, nc->display, s_NickServ);
507  } else if (stricmp(param2, "OFF") == 0) {
508  nc->flags &= ~flag;
509  alog("%s: %s!%s@%s set hide %s OFF for %s",
510  s_NickServ, u->nick, u->username, u->host, param, nc->display);
511  notice_lang(s_NickServ, u, offmsg, nc->display, s_NickServ);
512  } else {
513  syntax_error(s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX);
514  }
515 
516  return MOD_CONT;
517 }
518 
519 static int do_saset_noexpire(User * u, NickAlias * na, char *param)
520 {
521  if (!param) {
522  syntax_error(s_NickServ, u, "SASET NOEXPIRE",
523  NICK_SASET_NOEXPIRE_SYNTAX);
524  return MOD_CONT;
525  }
526  if (stricmp(param, "ON") == 0) {
527  na->status |= NS_NO_EXPIRE;
528  alog("%s: %s!%s@%s set noexpire ON for %s",
529  s_NickServ, u->nick, u->username, u->host, na->nick);
530  notice_lang(s_NickServ, u, NICK_SASET_NOEXPIRE_ON, na->nick);
531  } else if (stricmp(param, "OFF") == 0) {
532  na->status &= ~NS_NO_EXPIRE;
533  alog("%s: %s!%s@%s set noexpire OFF for %s",
534  s_NickServ, u->nick, u->username, u->host, na->nick);
535  notice_lang(s_NickServ, u, NICK_SASET_NOEXPIRE_OFF, na->nick);
536  } else {
537  syntax_error(s_NickServ, u, "SASET NOEXPIRE",
538  NICK_SASET_NOEXPIRE_SYNTAX);
539  }
540  return MOD_CONT;
541 }
542 
543 static int do_saset_autoop(User * u, NickCore * nc, char *param)
544 {
545  if (stricmp(param, "ON") == 0) {
546  nc->flags &= ~NI_AUTOOP;
547  alog("%s: %s!%s@%s set autoop ON for %s",
548  s_NickServ, u->nick, u->username, u->host, nc->display);
549  notice_lang(s_NickServ, u, NICK_SASET_AUTOOP_ON, nc->display);
550  } else if (stricmp(param, "OFF") == 0) {
551  nc->flags |= NI_AUTOOP;
552  alog("%s: %s!%s@%s set autoop OFF for %s",
553  s_NickServ, u->nick, u->username, u->host, nc->display);
554  notice_lang(s_NickServ, u, NICK_SASET_AUTOOP_OFF, nc->display);
555  } else {
556  syntax_error(s_NickServ, u, "SET AUTOOP", NICK_SASET_AUTOOP_SYNTAX);
557  }
558 
559  return MOD_CONT;
560 }
561 
562 static int do_saset_language(User * u, NickCore * nc, char *param)
563 {
564  int langnum;
565 
566  if (param[strspn(param, "0123456789")] != 0) { /* i.e. not a number */
567  syntax_error(s_NickServ, u, "SASET LANGUAGE",
568  NICK_SASET_LANGUAGE_SYNTAX);
569  return MOD_CONT;
570  }
571  langnum = atoi(param) - 1;
572  if (langnum < 0 || langnum >= NUM_LANGS || langlist[langnum] < 0) {
573  notice_lang(s_NickServ, u, NICK_SASET_LANGUAGE_UNKNOWN, langnum + 1,
574  s_NickServ);
575  return MOD_CONT;
576  }
577  nc->language = langlist[langnum];
578  alog("%s: %s!%s@%s set the language of %s to %s",
579  s_NickServ, u->nick, u->username, u->host, nc->display, getstring2(nc, LANG_NAME));
580  notice_lang(s_NickServ, u, NICK_SASET_LANGUAGE_CHANGED, nc->display, getstring2(nc, LANG_NAME));
581 
582  return MOD_CONT;
583 }
584 
585 /* EOF */
E size_t strspn(const char *s, const char *accept)
Definition: compat.c:106
static int do_saset_password(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:229
static int do_saset_url(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:274
E int nick_is_services_admin(NickCore *nc)
Definition: operserv.c:636
static int do_saset_noexpire(User *u, NickAlias *nc, char *param)
Definition: ns_saset.c:519
#define NI_KILL_IMMED
Definition: services.h:1301
E int readonly
Definition: extern.h:776
char nick[NICKMAX]
Definition: services.h:875
E int snprintf(char *buf, size_t size, const char *fmt,...)
Definition: compat.c:37
E NickAlias * findnick(const char *nick)
Definition: db-merger.c:1857
char * url
Definition: services.h:547
#define NI_SUSPENDED
Definition: services.h:1308
static int do_saset(User *u)
Definition: ns_saset.c:126
E int nick_identified(User *u)
Definition: nickserv.c:1111
E int NSNickTracking
Definition: extern.h:399
E int NSSecureAdmins
Definition: extern.h:394
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
#define NS_VERBOTEN
Definition: services.h:1273
uint16 language
Definition: services.h:549
char * host
Definition: services.h:878
E int langlist[NUM_LANGS]
Definition: extern.h:728
#define getstring2(nc, index)
Definition: extern.h:733
#define NI_HIDE_QUIT
Definition: services.h:1299
#define NI_KILLPROTECT
Definition: services.h:1290
#define NUM_LANGS
Definition: services.h:1333
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
E void syntax_error(char *service, User *u, const char *command, int msgnum)
Definition: language.c:295
E void notice_lang(char *source, User *dest, int message,...)
Definition: send.c:169
MDE void moduleSetType(MODType type)
Definition: modules.c:818
#define NI_PRIVATE
Definition: services.h:1296
E char * sstrdup(const char *s)
Definition: memory.c:105
NickCore * nc
Definition: services.h:533
static int do_saset_secure(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:412
char * display
Definition: services.h:542
E int is_services_root(User *u)
Definition: operserv.c:577
static int do_saset_email(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:294
#define NI_HIDE_EMAIL
Definition: services.h:1297
void ** list
Definition: slist.h:21
E int enc_encrypt(const char *src, int len, char *dest, int size)
Definition: encrypt.c:50
int16 count
Definition: slist.h:23
#define NI_HIDE_STATUS
Definition: services.h:1307
E int WallSetpass
Definition: extern.h:469
#define PASSMAX
Definition: config.h:65
int32_t int32
Definition: db-merger.c:122
uint16 status
Definition: services.h:532
#define NI_HIDE_MASK
Definition: services.h:1298
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
static int do_saset_icq(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:327
static int do_saset_kill(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:375
Command * c
Definition: ns_recover.c:17
E void alog(const char *fmt,...) FORMAT(printf
static int do_saset_hide(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:473
#define MOD_CONT
Definition: modules.h:54
#define NI_MSG
Definition: services.h:1292
E int enc_encrypt_check_len(int passlen, int bufsize)
Definition: encrypt.c:66
static int do_saset_language(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:562
#define NI_AUTOOP
Definition: services.h:1309
char * nick
Definition: services.h:526
char * username
Definition: services.h:877
#define NI_SECURE
Definition: services.h:1291
MDE void moduleSetNickHelp(void(*func)(User *u))
Definition: modules.c:2078
E int NSAllowKillImmed
Definition: extern.h:389
static int do_saset_display(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:193
Definition: modules.h:99
int AnopeInit(int argc, char **argv)
Definition: ns_saset.c:41
MDE Command * createCommand(const char *name, int(*func)(User *u), int(*has_priv)(User *u), int help_all, int help_reg, int help_oper, int help_admin, int help_root)
Definition: modules.c:987
char pass[PASSMAX]
Definition: services.h:543
static int do_saset_autoop(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:543
static int do_saset_private(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:431
E int StrictPasswords
Definition: extern.h:341
SList aliases
Definition: services.h:559
E int is_services_oper(User *u)
Definition: operserv.c:606
static void myNickServHelp(User *u)
Definition: ns_saset.c:115
static int do_saset_msg(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:450
uint32 flags
Definition: services.h:548
E int enc_decrypt(const char *src, char *dest, int size)
Definition: encrypt.c:80
E void change_core_display(NickCore *nc, char *newdisplay)
Definition: nickserv.c:1416
char * greet
Definition: services.h:545
#define NS_NO_EXPIRE
Definition: services.h:1274
static int do_saset_greet(User *u, NickCore *nc, char *param)
Definition: ns_saset.c:349
void AnopeFini(void)
Definition: ns_saset.c:104
User * u
Definition: services.h:536
E char * s_NickServ
Definition: extern.h:284
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
E int NSForceEmail
Definition: extern.h:383
uint32 icq
Definition: services.h:546
E int UsePrivmsg
Definition: extern.h:352
E int MailValidate(const char *email)
Definition: mail.c:296
#define BUFSIZE
Definition: config.h:47
#define NI_KILL_QUICK
Definition: services.h:1300
#define NICKSERV
Definition: modules.h:59
NickAlias * na
Definition: services.h:892
#define MOD_UNIQUE
Definition: module.h:11
char * email
Definition: services.h:544
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506
E void nsStartNickTracking(User *u)
Definition: nickserv.c:1962