summaryrefslogtreecommitdiff
path: root/src/modules/os_info.c
blob: acfc54e250b5e8cfb52b5dff5954620e52a95ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
/* os_info.c - Adds oper information lines to nicks/channels
 *
 * (C) 2003-2013 Anope Team
 * Contact us at team@anope.org
 *
 * Based on the original module by Rob <rob@anope.org>
 * Included in the Anope module pack since Anope 1.7.9
 * Anope Coder: DrStein <drstein@anope.org>
 *
 * Please read COPYING and README for further details.
 *
 * Send bug reports to the Anope Coder instead of the module
 * author, because any changes since the inclusion into anope
 * are not supported by the original author.
 *
 */
/*************************************************************************/

#include "module.h"

#define AUTHOR "Rob"
#define VERSION VERSION_STRING

/* Default database name */
#define DEFAULT_DB_NAME "os_info.db"

/* Multi-language stuff */
#define LANG_NUM_STRINGS   10

#define OINFO_SYNTAX        0
#define OINFO_ADD_SUCCESS   1
#define OINFO_DEL_SUCCESS   2
#define OCINFO_SYNTAX       3
#define OCINFO_ADD_SUCCESS  4
#define OCINFO_DEL_SUCCESS  5
#define OINFO_HELP          6
#define OCINFO_HELP         7
#define OINFO_HELP_CMD      8
#define OCINFO_HELP_CMD     9

/*************************************************************************/

char *OSInfoDBName = NULL;

static int myAddNickInfo(User * u);
static int myAddChanInfo(User * u);
static int myNickInfo(User * u);
static int myChanInfo(User * u);

static int mNickHelp(User * u);
static int mChanHelp(User * u);
static void mMainChanHelp(User * u);
static void mMainNickHelp(User * u);
static void m_AddLanguages(void);

static int mLoadData(void);
static int mSaveData(int argc, char **argv);
static int mBackupData(int argc, char **argv);
static int mLoadConfig();
static int mEventReload(int argc, char **argv);

/*************************************************************************/

/**
 * AnopeInit is called when the module is loaded
 * @param argc Argument count
 * @param argv Argument list
 * @return MOD_CONT to allow the module, MOD_STOP to stop it
 **/
int AnopeInit(int argc, char **argv)
{
    Command *c;
    EvtHook *hook = NULL;

    moduleAddAuthor(AUTHOR);
    moduleAddVersion(VERSION);
    moduleSetType(SUPPORTED);

    alog("os_info: Loading configuration directives...");
    if (mLoadConfig()) {
        return MOD_STOP;
    }

    c = createCommand("oInfo", myAddNickInfo, is_oper, -1, -1, -1, -1, -1);
    moduleAddHelp(c, mNickHelp);
    moduleAddCommand(NICKSERV, c, MOD_HEAD);

    c = createCommand("Info", myNickInfo, NULL, -1, -1, -1, -1, -1);
    moduleAddCommand(NICKSERV, c, MOD_TAIL);

    c = createCommand("oInfo", myAddChanInfo, is_oper, -1, -1, -1, -1, -1);
    moduleAddHelp(c, mChanHelp);
    moduleAddCommand(CHANSERV, c, MOD_HEAD);

    c = createCommand("Info", myChanInfo, NULL, -1, -1, -1, -1, -1);
    moduleAddCommand(CHANSERV, c, MOD_TAIL);

    hook = createEventHook(EVENT_DB_SAVING, mSaveData);
    moduleAddEventHook(hook);

    hook = createEventHook(EVENT_DB_BACKUP, mBackupData);
    moduleAddEventHook(hook);

    hook = createEventHook(EVENT_RELOAD, mEventReload);
    moduleAddEventHook(hook);

    moduleSetNickHelp(mMainNickHelp);
    moduleSetChanHelp(mMainChanHelp);

    mLoadData();
    m_AddLanguages();

    return MOD_CONT;
}

/**
 * Unload the module
 **/
void AnopeFini(void)
{
    char *av[1];

    av[0] = sstrdup(EVENT_START);
    mSaveData(1, av);
    free(av[0]);

    if (OSInfoDBName)
        free(OSInfoDBName);
}

/*************************************************************************/

/**
 * Provide the user interface to add/remove/update oper information
 * about a nick.
 * We are going to assume that anyone who gets this far is an oper;
 * the createCommand should have handled this checking for us and its 
 * tedious / a waste to do it twice.
 * @param u The user who executed this command
 * @return MOD_CONT if we want to process other commands in this command
 * stack, MOD_STOP if we dont
 **/
static int myAddNickInfo(User * u)
{
    char *text = NULL;
    char *cmd = NULL;
    char *nick = NULL;
    char *info = NULL;
    NickAlias *na = NULL;

    /* Get the last buffer anope recived */
    text = moduleGetLastBuffer();
    if (text) {
        cmd = myStrGetToken(text, ' ', 0);
        nick = myStrGetToken(text, ' ', 1);
        info = myStrGetTokenRemainder(text, ' ', 2);
        if (cmd && nick) {
            if (strcasecmp(cmd, "ADD") == 0) {
                /* Syntax error, again! */
                if (info) {
                    /* ok we've found the user */
                    if ((na = findnick(nick))) {
                        /* Add the module data to the user */
                        moduleAddData(&na->nc->moduleData, "info", info);
                        moduleNoticeLang(s_NickServ, u,
                                         OINFO_ADD_SUCCESS, nick);
                        /* NickCore not found! */
                    } else {
                        notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED,
                                    nick);
                    }
                    free(info);
                }
            } else if (strcasecmp(cmd, "DEL") == 0) {
                /* ok we've found the user */
                if ((na = findnick(nick))) {
                    moduleDelData(&na->nc->moduleData, "info");
                    moduleNoticeLang(s_NickServ, u,
                                     OINFO_DEL_SUCCESS, nick);
                    /* NickCore not found! */
                } else {
                    notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED,
                                nick);
                }
                /* another syntax error! */
            } else {
                moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX);
            }
            free(cmd);
            free(nick);
            /* Syntax error */
        } else if (cmd) {
            moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX);
            free(cmd);
            /* Syntax error */
        } else {
            moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX);
        }
    } else {
        moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX);
    }
    return MOD_CONT;
}

/**
 * Provide the user interface to add/remove/update oper information
 * about a channel.
 * We are going to assume that anyone who gets this far is an oper; 
 * the createCommand should have handled this checking for us and 
 * its tedious / a waste to do it twice.
 * @param u The user who executed this command
 * @return MOD_CONT if we want to process other commands in this command
 * stack, MOD_STOP if we dont
 **/
static int myAddChanInfo(User * u)
{
    char *text = NULL;
    char *cmd = NULL;
    char *chan = NULL;
    char *info = NULL;
    ChannelInfo *ci = NULL;

    /* Get the last buffer anope recived */
    text = moduleGetLastBuffer();
    if (text) {
        cmd = myStrGetToken(text, ' ', 0);
        chan = myStrGetToken(text, ' ', 1);
        info = myStrGetTokenRemainder(text, ' ', 2);
        if (cmd && chan) {
            if (strcasecmp(cmd, "ADD") == 0) {
                if (info) {
                    if ((ci = cs_findchan(chan))) {
                        /* Add the module data to the channel */
                        moduleAddData(&ci->moduleData, "info", info);
                        moduleNoticeLang(s_ChanServ, u,
                                         OCINFO_ADD_SUCCESS, chan);
                        /* ChanInfo */
                    } else {
                        notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED,
                                    chan);
                    }
                    free(info);
                }
            } else if (strcasecmp(cmd, "DEL") == 0) {
                if ((ci = cs_findchan(chan))) {
                    /* Del the module data from the channel */
                    moduleDelData(&ci->moduleData, "info");
                    moduleNoticeLang(s_ChanServ, u,
                                     OCINFO_DEL_SUCCESS, chan);
                    /* ChanInfo */
                } else {
                    notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED,
                                chan);
                }
                /* another syntax error! */
            } else {
                moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX);
            }
            free(cmd);
            free(chan);
            /* Syntax error */
        } else if (cmd) {
            moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX);
            free(cmd);
            /* Syntax error */
        } else {
            moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX);
        }
    } else {
        moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX);
    }
    return MOD_CONT;
}

/*************************************************************************/

/**
 * Called after a user does a /msg nickserv info [nick] 
 * @param u The user who requested info
 * @return MOD_CONT to continue processing commands or MOD_STOP to stop
 **/
static int myNickInfo(User * u)
{
    char *text = NULL;
    char *nick = NULL;
	char *info = NULL;
    NickAlias *na = NULL;

    /* Only show our goodies to opers */
    if (is_oper(u)) {
        /* Get the last buffer anope recived */
        text = moduleGetLastBuffer();
        if (text) {
            nick = myStrGetToken(text, ' ', 0);
            if (nick) {
                /* ok we've found the user */
                if ((na = findnick(nick))) {
                    /* If we have any info on this user */
                    if ((info = moduleGetData(&na->nc->moduleData, "info"))) {
                        notice_user(s_NickServ, u, " OperInfo: %s", info);
						free(info);
                    }
                    /* NickCore not found! */
                } else {
                    /* we dont care! */
                }
                free(nick);
            }
        }
    }
    return MOD_CONT;
}

/**
 * Called after a user does a /msg chanserv info chan 
 * @param u The user who requested info
 * @return MOD_CONT to continue processing commands or MOD_STOP to stop
 **/
static int myChanInfo(User * u)
{
    char *text = NULL;
    char *chan = NULL;
	char *info = NULL;
    ChannelInfo *ci = NULL;

    /* Only show our goodies to opers */
    if (is_oper(u)) {
        /* Get the last buffer anope recived */
        text = moduleGetLastBuffer();
        if (text) {
            chan = myStrGetToken(text, ' ', 0);
            if (chan) {
                if ((ci = cs_findchan(chan))) {
                    /* If we have any info on this channel */
                    if ((info = moduleGetData(&ci->moduleData, "info"))) {
                        notice_user(s_ChanServ, u, " OperInfo: %s", info);
						free(info);
                    }
                }
                free(chan);
            }
        }
    }
    return MOD_CONT;
}

/*************************************************************************/

/** 
 * Load data from the db file, and populate our OperInfo lines
 * @return 0 for success
 **/
static int mLoadData(void)
{
    int ret = 0;
    FILE *in;

    char *type = NULL;
    char *name = NULL;
    char *info = NULL;
    int len = 0;

    ChannelInfo *ci = NULL;
    NickAlias *na = NULL;

    /* will _never_ be this big thanks to the 512 limit of a message */
    char buffer[2000];
    if ((in = fopen(OSInfoDBName, "r")) == NULL) {
        alog("os_info: WARNING: can not open the database file! (it might not exist, this is not fatal)");
        ret = 1;
    } else {
        while (fgets(buffer, 1500, in)) {
            type = myStrGetToken(buffer, ' ', 0);
            name = myStrGetToken(buffer, ' ', 1);
            info = myStrGetTokenRemainder(buffer, ' ', 2);
            if (type) {
                if (name) {
                    if (info) {
                        len = strlen(info);
                        /* Take the \n from the end of the line */
                        info[len - 1] = '\0';
                        if (stricmp(type, "C") == 0) {
                            if ((ci = cs_findchan(name))) {
                                moduleAddData(&ci->moduleData, "info",
                                              info);
                            }
                        } else if (stricmp(type, "N") == 0) {
                            if ((na = findnick(name))) {
                                moduleAddData(&na->nc->moduleData, "info",
                                              info);
                            }
                        }
                        free(info);
                    }
                    free(name);
                }
                free(type);
            }
        }
        fclose(in);
    }
    return ret;
}

/** 
 * Save all our data to our db file
 * First walk through the nick CORE list, and any nick core which has
 * oper info attached to it, write to the file.
 * Next do the same again for ChannelInfos
 * @return 0 for success
 **/
static int mSaveData(int argc, char **argv)
{
    ChannelInfo *ci = NULL;
    NickCore *nc = NULL;
    int i = 0;
    int ret = 0;
    FILE *out;
    char *info = NULL;

    if (argc >= 1) {
        if (!stricmp(argv[0], EVENT_START)) {
            if ((out = fopen(OSInfoDBName, "w")) == NULL) {
                alog("os_info: ERROR: can not open the database file!");
                anope_cmd_global(s_OperServ,
                                 "os_info: ERROR: can not open the database file!");
                ret = 1;
            } else {
                for (i = 0; i < 1024; i++) {
                    for (nc = nclists[i]; nc; nc = nc->next) {
                        /* If we have any info on this user */
                        if ((info = moduleGetData(&nc->moduleData, "info"))) {
                            fprintf(out, "N %s %s\n", nc->display, info);
							free(info);
                        }
                    }
                }


                for (i = 0; i < 256; i++) {
                    for (ci = chanlists[i]; ci; ci = ci->next) {
                        /* If we have any info on this channel */
                        if ((info = moduleGetData(&ci->moduleData, "info"))) {
                            fprintf(out, "C %s %s\n", ci->name, info);
							free(info);
                        }
                    }
                }
                fclose(out);
            }
        } else {
            ret = 0;
        }
    }

    return ret;
}

/** 
 * Backup our databases using the commands provided by Anope
 * @return MOD_CONT
 **/
static int mBackupData(int argc, char **argv)
{
	if (argc >= 1 && !stricmp(argv[0], EVENT_START))
		ModuleDatabaseBackup(OSInfoDBName);
	
	return MOD_CONT;
}

/** 
 * Load the configuration directives from Services configuration file.
 * @return 0 for success
 **/
static int mLoadConfig(void)
{
    char *tmp = NULL;

    Directive directivas[] = {
        {"OSInfoDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}},
    };

    Directive *d = &directivas[0];
    moduleGetConfigDirective(d);

    if (OSInfoDBName)
        free(OSInfoDBName);

    if (tmp) {
        OSInfoDBName = tmp;
    } else {
        OSInfoDBName = sstrdup(DEFAULT_DB_NAME);
        alog("os_info: OSInfoDBName is not defined in Services configuration file, using default %s", OSInfoDBName);
    }

    alog("os_info: Directive OSInfoDBName loaded (%s)...", OSInfoDBName);

    return 0;
}

/** 
 * Manage the RELOAD EVENT
 * @return MOD_CONT
 **/
static int mEventReload(int argc, char **argv)
{
    int ret = 0;
    if (argc >= 1) {
        if (!stricmp(argv[0], EVENT_START)) {
            alog("os_info: Reloading configuration directives...");
            ret = mLoadConfig();
        } else {
            /* Nothing for now */
        }
    }

    if (ret)
        alog("os_info.c: ERROR: An error has occured while reloading the configuration file");

    return MOD_CONT;
}

/*************************************************************************/

/**
 * manages the multilanguage stuff
 **/
static void m_AddLanguages(void)
{
    char *langtable_en_us[] = {
        /* OINFO_SYNTAX */
        "Syntax: OINFO [ADD|DEL] nick <info>",
        /* OINFO_ADD_SUCCESS */
        "OperInfo line has been added to nick %s",
        /* OINFO_DEL_SUCCESS */
        "OperInfo line has been removed from nick %s",
        /* OCINFO_SYNTAX */
        "Syntax: OINFO [ADD|DEL] chan <info>",
        /* OCINFO_ADD_SUCCESS */
        "OperInfo line has been added to channel %s",
        /* OCINFO_DEL_SUCCESS */
        "OperInfo line has been removed from channel %s",
        /* OINFO_HELP */
        "Syntax: OINFO [ADD|DEL] nick <info>\n"
            "Add or Delete Oper information for the given nick\n"
            "This will show up when any oper uses /ns info nick on the user.\n"
            "and can be used for 'tagging' users etc....",
        /* OCINFO_HELP */
        "Syntax: OINFO [ADD|DEL] chan <info>\n"
            "Add or Delete Oper information for the given channel\n"
            "This will show up when any oper uses /cs info on the channel.\n"
            "and can be used for 'tagging' channels etc....",
        /* OINFO_HELP_CMD */
        "    OINFO         Add / Del an OperInfo line to a nick",
        /* OCINFO_HELP_CMD */
        "    OINFO         Add / Del an OperInfo line to a channel"
    };

    char *langtable_es[] = {
        /* OINFO_SYNTAX */
        "Sintaxis: OINFO [ADD|DEL] nick <info>",
        /* OINFO_ADD_SUCCESS */
        "Una linea OperInfo ha sido agregada al nick %s",
        /* OINFO_DEL_SUCCESS */
        "La linea OperInfo ha sido removida del nick %s",
        /* OCINFO_SYNTAX */
        "Sintaxis: OINFO [ADD|DEL] chan <info>",
        /* OCINFO_ADD_SUCCESS */
        "Linea OperInfo ha sido agregada al canal %s",
        /* OCINFO_DEL_SUCCESS */
        "La linea OperInfo ha sido removida del canal %s",
        /* OINFO_HELP */
        "Sintaxis: OINFO [ADD|DEL] nick <info>\n"
            "Agrega o elimina informacion para Operadores al nick dado\n"
            "Esto se mostrara cuando cualquier operador haga /ns info nick\n"
            "y puede ser usado para 'marcado' de usuarios, etc....",
        /* OCINFO_HELP */
        "Sintaxis: OINFO [ADD|DEL] chan <info>\n"
            "Agrega o elimina informacion para Operadores al canal dado\n"
            "Esto se mostrara cuando cualquier operador haga /cs info canal\n"
            "y puede ser usado para 'marcado' de canales, etc....",
        /* OINFO_HELP_CMD */
        "    OINFO         Agrega / Elimina una linea OperInfo al nick",
        /* OCINFO_HELP_CMD */
        "    OINFO         Agrega / Elimina una linea OperInfo al canal"
    };

    char *langtable_nl[] = {
        /* OINFO_SYNTAX */
        "Gebruik: OINFO [ADD|DEL] nick <info>",
        /* OINFO_ADD_SUCCESS */
        "OperInfo regel is toegevoegd aan nick %s",
        /* OINFO_DEL_SUCCESS */
        "OperInfo regel is weggehaald van nick %s",
        /* OCINFO_SYNTAX */
        "Gebruik: OINFO [ADD|DEL] kanaal <info>",
        /* OCINFO_ADD_SUCCESS */
        "OperInfo regel is toegevoegd aan kanaal %s",
        /* OCINFO_DEL_SUCCESS */
        "OperInfo regel is weggehaald van kanaal %s",
        /* OINFO_HELP */
        "Gebruik: OINFO [ADD|DEL] nick <info>\n"
            "Voeg een Oper informatie regel toe aan de gegeven nick, of\n"
            "verwijder deze. Deze regel zal worden weergegeven wanneer\n"
            "een oper /ns info nick doet voor deze gebruiker, en kan worden\n"
            "gebruikt om een gebruiker te 'markeren' etc...",
        /* OCINFO_HELP */
        "Gebruik: OINFO [ADD|DEL] kanaal <info>\n"
            "Voeg een Oper informatie regel toe aan de gegeven kanaal, of\n"
            "verwijder deze. Deze regel zal worden weergegeven wanneer\n"
            "een oper /cs info kanaal doet voor dit kanaal, en kan worden\n"
            "gebruikt om een kanaal te 'markeren' etc...",
        /* OINFO_HELP_CMD */
        "    OINFO         Voeg een OperInfo regel toe aan een nick of verwijder deze",
        /* OCINFO_HELP_CMD */
        "    OINFO         Voeg een OperInfo regel toe aan een kanaal of verwijder deze"
    };

    char *langtable_de[] = {
        /* OINFO_SYNTAX */
        "Syntax: OINFO [ADD|DEL] Nickname <Information>",
        /* OINFO_ADD_SUCCESS */
        "Eine OperInfo Linie wurde zu den Nicknamen %s hinzugefügt",
        /* OINFO_DEL_SUCCESS */
        "Die OperInfo Linie wurde von den Nicknamen %s enfernt",
        /* OCINFO_SYNTAX */
        "Syntax: OINFO [ADD|DEL] Channel <Information>",
        /* OCINFO_ADD_SUCCESS */
        "Eine OperInfo Linie wurde zu den Channel %s hinzugefügt",
        /* OCINFO_DEL_SUCCESS */
        "Die OperInfo Linie wurde von den Channel %s enfernt",
        /* OINFO_HELP */
        "Syntax: OINFO [ADD|DEL] Nickname <Information>\n"
            "Addiert oder löscht eine OperInfo Linie zu den angegebenen\n"
            "Nicknamen.Sie wird angezeigt wenn ein Oper mit /ns info sich\n"
            "über den Nicknamen informiert.",
        /* OCINFO_HELP */
        "Syntax: OINFO [ADD|DEL] chan <info>\n"
            "Addiert oder löscht eine OperInfo Linie zu den angegebenen\n"
            "Channel.Sie wird angezeigt wenn ein Oper mit /cs info sich\n"
            "über den Channel informiert.",
        /* OINFO_HELP_CMD */
        "    OINFO         Addiert / Löscht eine OperInfo Linie zu / von einen Nicknamen",
        /* OCINFO_HELP_CMD */
        "    OINFO         Addiert / Löscht eine OperInfo Linie zu / von einen Channel"
    };

    char *langtable_pt[] = {
        /* OINFO_SYNTAX */
        "Sintaxe: OINFO [ADD|DEL] nick <informação>",
        /* OINFO_ADD_SUCCESS */
        "A linha OperInfo foi adicionada ao nick %s",
        /* OINFO_DEL_SUCCESS */
        "A linha OperInfo foi removida do nick %s",
        /* OCINFO_SYNTAX */
        "Sintaxe: OINFO [ADD|DEL] canal <informação>",
        /* OCINFO_ADD_SUCCESS */
        "A linha OperInfo foi adicionada ao canal %s",
        /* OCINFO_DEL_SUCCESS */
        "A linha OperInfo foi removida do canal %s",
        /* OINFO_HELP */
        "Sintaxe: OINFO [ADD|DEL] nick <informação>\n"
            "Adiciona ou apaga informação para Operadores ao nick fornecido\n"
            "Isto será mostrado quando qualquer Operador usar /ns info nick\n"
            "e pode ser usado para 'etiquetar' usuários etc...",
        /* OCINFO_HELP */
        "Sintaxe: OINFO [ADD|DEL] canal <informação>\n"
            "Adiciona ou apaga informação para Operadores ao canal fornecido\n"
            "Isto será mostrado quando qualquer Operador usar /cs info canal\n"
            "e pode ser usado para 'etiquetar' canais etc...",
        /* OINFO_HELP_CMD */
        "    OINFO      Adiciona ou Apaga a linha OperInfo para um nick",
        /* OCINFO_HELP_CMD */
        "    OINFO      Adiciona ou Apaga a linha OperInfo para um canal"
    };

    char *langtable_ru[] = {
        /* OINFO_SYNTAX */
        "Ñèíòàêñèñ: OINFO ADD|DEL íèê òåñò",
        /* OINFO_ADD_SUCCESS */
        "Îïåð-Èíôîðìàöèÿ äëÿ íèêà %s äîáàâëåíà",
        /* OINFO_DEL_SUCCESS */
        "Îïåð-Èíôîðìàöèÿ äëÿ íèêà %s áûëà óäàëåíà",
        /* OCINFO_SYNTAX */
        "Ñèíòàêñèñ: OINFO ADD|DEL #êàíàë òåêñò",
        /* OCINFO_ADD_SUCCESS */
        "Îïåð-Èíôîðìàöèÿ äëÿ êàíàëà %s óñïåøíî óñòàíîâëåíà",
        /* OCINFO_DEL_SUCCESS */
        "Îïåð-Èíôîðìàöèÿ äëÿ êàíàëà %s áûëà óäàëåíà",
        /* OINFO_HELP */
        "Ñèíòàêñèñ: OINFO ADD|DEL íèê òåêñò\n"
            "Óñòàíàâëèâàåò èëè óäàëÿåò Îïåð-Èíôîðìàöèþ äëÿ óêàçàííîãî íèêà,\n"
            "êîòîðàÿ áóäåò ïîêàçàíà ëþáîìó îïåðàòîðó, çàïðàøèâàþùåìó INFO íèêà.\n"
            "Ìîæåò áûòü èñïîëüçîâàíà äëÿ 'ïîìåòêè' ïîëüçîâàòåëåé è ò. ä...",
        /* OCINFO_HELP */
        "Ñèíòàêñèñ: OINFO ADD|DEL #êàíàë òåêñò\n"
            "Óñòàíàâëèâàåò èëè óäàëÿåò Îïåð-Èíôîðìàöèþ äëÿ óêàçàííîãî êàíàëà,\n"
            "êîòîðàÿ áóäåò ïîêàçàíà ëþáîìó îïåðàòîðó, çàïðàøèâàþùåìó INFO êàíàëà.\n"
            "Ìîæåò áûòü èñïîëüçîâàíà äëÿ 'ïîìåòêè' êàíàëîâ è ò. ä...",
        /* OINFO_HELP_CMD */
        "    OINFO      Äîáàâëÿåò/Óäàëÿåò îïåð-èíôî äëÿ íèêà",
        /* OCINFO_HELP_CMD */
        "    OINFO      Äîáàâëÿåò/Óäàëÿåò îïåð-èíôî äëÿ êàíàëà"
    };

	char *langtable_it[] = {
        /* OINFO_SYNTAX */
        "Sintassi: OINFO [ADD|DEL] nick <info>",
        /* OINFO_ADD_SUCCESS */
        "Linea OperInfo aggiunta al nick %s",
        /* OINFO_DEL_SUCCESS */
        "Linea OperInfo rimossa dal nick %s",
        /* OCINFO_SYNTAX */
        "Sintassi: OINFO [ADD|DEL] chan <info>",
        /* OCINFO_ADD_SUCCESS */
        "Linea OperInfo aggiunta al canale %s",
        /* OCINFO_DEL_SUCCESS */
        "Linea OperInfo rimossa dal canale %s",
        /* OINFO_HELP */
        "Sintassi: OINFO [ADD|DEL] nick <info>\n"
            "Aggiunge o rimuove informazioni Oper per il nick specificato\n"
            "Queste vengono mostrate quando un oper esegue il comando /ns info <nick>\n"
            "e possono essere utilizzate per 'marchiare' gli utenti ecc...",
        /* OCINFO_HELP */
        "Sintassi: OINFO [ADD|DEL] chan <info>\n"
            "Aggiunge o rimuove informazioni Oper per il canale specificato\n"
            "Queste vengono mostrate quando un oper esegue il comando /cs info <canale>\n"
            "e possono essere utilizzate per 'marchiare' i canali ecc...",
        /* OINFO_HELP_CMD */
        "    OINFO         Aggiunge/Rimuove una linea OperInfo ad/da un nick",
        /* OCINFO_HELP_CMD */
        "    OINFO         Aggiunge/Rimuove una linea OperInfo ad/da un canale"
    };

    char *langtable_fr[] = {
        /* OINFO_SYNTAX */
        "Syntaxe: \002OINFO [ADD|DEL] \037pseudo\037 \037<info>\037\002",
        /* OINFO_ADD_SUCCESS */
        "Ligne OperInfo ajoutée au pseudo %s",
        /* OINFO_DEL_SUCCESS */
        "Ligne OperInfo retirée au pseudo %s",
        /* OCINFO_SYNTAX */
        "Syntaxe: \002OINFO [ADD|DEL] \037canal\037 \037<info>\037\002",
        /* OCINFO_ADD_SUCCESS */
        "Ligne OperInfo ajoutée au canal %s",
        /* OCINFO_DEL_SUCCESS */
        "Ligne OperInfo retirée au canal %s",
        /* OINFO_HELP */
        "Syntaxe: \002OINFO [ADD|DEL] \037pseudo\037 \037info\037\002\n"
            "Ajoute ou supprime une information Oper au pseudo spécifié\n"
            "Elle sera vue par un oper avec la commande /ns info pseudo pour l'utilisateur\n"
            "et peut être utilisée pour 'taguer' les utilisateurs etc....",
        /* OCINFO_HELP */
        "Syntax: \002OINFO [ADD|DEL] \037canal\037 \037info\037\002\n"
            "Ajoute ou supprime une information Oper au canal spécifié\n"
            "Elle sera vue par un oper avec la commande /ns info canal pour le canal.\n"
            "et peut être utilisée pour 'taguer' les canaux etc....",
        /* OINFO_HELP_CMD */
        "    OINFO         Ajoute / Supprime une ligne OperInfo à un pseudo",
        /* OCINFO_HELP_CMD */
        "    OINFO         Ajoute / Supprime une ligne OperInfo à un canal"
    };

    moduleInsertLanguage(LANG_EN_US, LANG_NUM_STRINGS, langtable_en_us);
    moduleInsertLanguage(LANG_ES, LANG_NUM_STRINGS, langtable_es);
    moduleInsertLanguage(LANG_NL, LANG_NUM_STRINGS, langtable_nl);
    moduleInsertLanguage(LANG_DE, LANG_NUM_STRINGS, langtable_de);
    moduleInsertLanguage(LANG_PT, LANG_NUM_STRINGS, langtable_pt);
    moduleInsertLanguage(LANG_RU, LANG_NUM_STRINGS, langtable_ru);
    moduleInsertLanguage(LANG_IT, LANG_NUM_STRINGS, langtable_it);
    moduleInsertLanguage(LANG_FR, LANG_NUM_STRINGS, langtable_fr);
}

/*************************************************************************/

static int mNickHelp(User * u)
{
    if (is_oper(u)) {
        moduleNoticeLang(s_NickServ, u, OINFO_HELP);
    } else {
        notice_lang(s_NickServ, u, NO_HELP_AVAILABLE, "OINFO");
    }
    return MOD_CONT;
}

static int mChanHelp(User * u)
{
    if (is_oper(u)) {
        moduleNoticeLang(s_ChanServ, u, OCINFO_HELP);
    } else {
        notice_lang(s_ChanServ, u, NO_HELP_AVAILABLE, "OINFO");
    }
    return MOD_CONT;
}

/* This help will be added to the main NickServ list */
static void mMainNickHelp(User * u)
{
    if (is_oper(u)) {
        moduleNoticeLang(s_NickServ, u, OINFO_HELP_CMD);
    }
}

/* This help will be added to the main NickServ list */
static void mMainChanHelp(User * u)
{
    if (is_oper(u)) {
        moduleNoticeLang(s_ChanServ, u, OCINFO_HELP_CMD);
    }
}

/*************************************************************************/

/* EOF */