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
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
|
//
// File : libkviserverdb.cpp
// Creation date : Tue Jul 1 01:48:49 2008 GMT by Elvio Basello
//
// This file is part of the KVirc irc client distribution
// Copyright (C) 2008 Szymon Stefanek (pragma at kvirc dot net)
//
// This program 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 opinion) 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
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the 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, write to the Free Software Foundation,
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include "kvi_module.h"
#include "kvi_app.h"
#include "kvi_locale.h"
#include "kvi_kvs_script.h"
#include "kvi_ircserver.h"
#include "kvi_ircserverdb.h"
#include <QString>
extern KVIRC_API KviServerDataBase * g_pServerDataBase;
/*
@doc: serverdb.networkExists
@type:
function
@title:
$serverdb.networkExists
@short:
Checks if the network already exists in the DB
@synthax:
<bool> $serverdb.networkExists
@description:
Checks if the network already exists in the DB.[br]
It returns 1 if the network exixts, 0 otherwise
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
static bool serverdb_kvs_fnc_networkExists(KviKvsModuleFunctionCall * c)
{
QString szNetwork;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetwork)
KVSM_PARAMETERS_END(c)
if(szNetwork.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb"));
return false;
}
KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szNetwork);
if(!pNetwork)
{
c->returnValue()->setBoolean(false);
return true;
}
c->returnValue()->setBoolean(true);
return true;
}
/*
@doc: serverdb.serverExists
@type:
function
@title:
$serverdb.serverExists
@short:
Checks if the network already exists in the DB
@synthax:
<bool> $serverdb.serverExists(<string:servername>[,<networkname>])
@description:
Checks if the server already exists for a network in the DB.[br]
If no network name is provided, the check is made globally.[br]
It returns 1 if the server exixts, 0 otherwise
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c)
{
QString szServer, szNetwork;
bool bCheckAllNets = true;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("server_name",KVS_PT_STRING,0,szServer)
KVSM_PARAMETER("network_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szNetwork)
KVSM_PARAMETERS_END(c)
if(szServer.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the server name as parameter","serverdb"));
return false;
}
if(!szNetwork.isEmpty())
{
// Check in the given network
KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szNetwork);
if(!pRecord)
{
debug("pRecord");
c->returnValue()->setBoolean(false);
return true;
}
KviServer * pServer = new KviServer();
pServer->setHostName(szServer);
debug("Server: %s",pServer->hostName().toUtf8().data());
KviServer * pCheckServer = pRecord->findServer(pServer,true);
if(!pCheckServer)
{
debug("pCheckServer");
c->returnValue()->setBoolean(false);
return true;
}
debug("Check server: %s",pCheckServer->hostName().toUtf8().data());
c->returnValue()->setBoolean(true);
} else {
// FIXME: Check through all networks
/*
KviPointerHashTableIterator<QString,KviServerDataBaseRecord> it(*(g_pServerDataBase->recordDict()));
while(KviServerDataBaseRecord * r = it.current())
{
net = new KviServerOptionsTreeWidgetItem(m_pTreeWidget,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_WORLD)),r->network());
KviPointerList<KviServer> * sl = r->serverList();
bool bCurrent = r->network()->name() == g_pServerDataBase->currentNetworkName().toUtf8().data();
net->setExpanded(bCurrent);
for(KviServer * s = sl->first();s;s = sl->next())
{
srv = new KviServerOptionsTreeWidgetItem(net,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_SERVER)),s);
if((s == r->currentServer()) && bCurrent)
{
srv->setSelected(true);
cur = srv;
}
}
++it;
}
*/
}
//c->returnValue()->setBoolean(true);
return true;
}
#if 0
#define SERVERDB_GET_PROPERTY(__functionName,__callName) \
static bool __functionName(KviKvsModuleFunctionCall * c) \
{ \
QString szName; \
bool bServer = false; \
\
KVSM_PARAMETERS_BEGIN(c) \
KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
KVSM_PARAMETERS_END(c) \
\
if(c->switches()->find('s',"server")) bServer = true; \
\
if(szName.isEmpty()) \
{ \
c->error(__tr2qs_ctx("You must provide the network/server name as parameter","serverdb")); \
return false; \
} \
\
if(!bServer) \
{ \
/* We want to get the property for the network*/ \
KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szName); \
if(!pNetwork) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \
return false; \
} \
\
c->returnValue()->setString(pNetwork->__callName()); \
} else { \
/* We want to get the property for the server*/ \
KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szName); \
if(!pRecord) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
return false; \
} \
\
/* Ensure we are manipulating a server*/ \
KviServer * pServer = pRecord->currentServer(); \
if(!pServer) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
return false; \
} \
\
c->returnValue()->setString(pServer->__callName()); \
} \
\
return true; \
}
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getNickName,nickName)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getUserName,userName)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getRealName,realName)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getEncoding,encoding)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getDescription,description)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getConnectCommand,onConnectCommand)
SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getLoginCommand,onLoginCommand)
#endif
/*
@doc: serverdb.addNetwork
@type:
command
@title:
serverdb.addNetwork
@short:
Adds a network
@syntax:
serverdb.addNetwork <string:network name>
@description:
Adds the specified network <network name> to the DB.[br]
If the network already exixts, an error is printed unless the -q switch is used.
@switches:
!sw: -a | --autoconnect
Autoconnect this network at KVIrc start.
@examples:
[example]
if(![fnc]$serverdb.networkExists[/fnc](Freenode)) serverdb.addNetwork -q Freenode
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c)
{
QString szNetName, szNetwork;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetName)
KVSM_PARAMETERS_END(c)
if(szNetName.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb"));
return false;
}
KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szNetName);
if(pNetwork)
{
if(c->switches()->find('q',"quiet")) return true;
c->error(__tr2qs_ctx("The network specified already exists","serverdb"));
return false;
}
pNetwork = new KviNetwork(szNetName);
if(c->switches()->find('a',"autoconnect")) pNetwork->setAutoConnect(true);
KviServerDataBaseRecord * pRecord = g_pServerDataBase->insertNetwork(pNetwork);
if(!pRecord)
{
c->error("Internal error: KVIrc author screwed up","serverdb");
return false;
}
return true;
}
/*
@doc: serverdb.addServer
@type:
command
@title:
serverdb.addServer
@short:
Adds a server
@syntax:
serverdb.addServer [switches] <string:network> <string:server>
@description:
Adds the server <server> to the network <network>.
@switches:
!sw: -a | --autoconnect
Autoconnect this server at KVIrc start.[br]
!sw: -c | --cache-ip
Caches the server IP at first connect to save bandwitch for future connects.[br]
!sw: -i | --ipv6
Use IPv6 socket to connect to the server.[br]
!sw: -p=<port> | --port=<port>
Use the port <port> to connect to the server.[br]
!sw: -q | --quiet
Do not print errors if the server already exist.[br]
!sw: -s | --ssl
Use SSL (Secure Socket Layer) socket to connect to the server.[br]
!sw: -w=<password> | --password=<password>
Use password <password> to connect to the server.
@examples:
[example]
[comment]Sets the nickname HelLViS69 for the server irc.freenode.net[/comment][br]
serverdb.setNickName -s irc.freenode.net HelLViS69
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c)
{
QString szNetwork, szServer;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetwork)
KVSM_PARAMETER("server_name",KVS_PT_STRING,0,szServer)
KVSM_PARAMETERS_END(c)
if(szNetwork.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb"));
return false;
}
if(szServer.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the server name as parameter","serverdb"));
return false;
}
KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szNetwork);
if(!pRecord)
{
// FIXME: default to orphan servers
c->error(__tr2qs_ctx("The specified network does not exist","serverdb"));
return false;
}
KviServer * pServer = new KviServer();
pServer->setHostName(szServer);
KviServer * pServerRecord = pRecord->findServer(pServer);
if(pServerRecord)
{
if(c->switches()->find('q',"quiet")) return true;
c->error(__tr2qs_ctx("The specified server already exists","serverdb"));
return false;
}
if(c->switches()->find('a',"autoconnect")) pServer->setAutoConnect(true);
if(c->switches()->find('c',"cache-ip")) pServer->setCacheIp(true);
if(c->switches()->find('i',"ipv6")) pServer->setIPv6(true);
if(c->switches()->find('s',"ssl")) pServer->setUseSSL(true);
QString tmp;
unsigned int uPort;
if(c->switches()->getAsStringIfExisting('p',"port",tmp))
{
bool bOk;
uPort = tmp.toInt(&bOk);
if(!bOk) uPort = 6667;
pServer->setPort(uPort);
}
if(c->switches()->getAsStringIfExisting('w',"password",tmp)) pServer->setPassword(tmp);
debug("Network: %s\nServer: %s\nPort: %d",szNetwork.toUtf8().data(),szServer.toUtf8().data(),uPort);
pRecord->insertServer(pServer);
return true;
}
#define SERVERDB_SET_NETWORK_PROPERTY(__functionName,__callName) \
static bool __functionName(KviKvsModuleCommandCall * c) \
{ \
QString szName, szPropertyName; \
\
KVSM_PARAMETERS_BEGIN(c) \
KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \
KVSM_PARAMETERS_END(c) \
\
if(szName.isEmpty()) \
{ \
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb")); \
return false; \
} \
\
if(szPropertyName.isEmpty()) \
{ \
c->error(__tr2qs_ctx("You must provide the value as parameter","serverdb")); \
return false; \
} \
\
KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szName); \
if(!pNetwork) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \
return false; \
} \
\
pNetwork->__callName(szPropertyName); \
\
return true; \
}
#define SERVERDB_SET_SERVER_PROPERTY(__functionName,__callName) \
static bool __functionName(KviKvsModuleCommandCall * c) \
{ \
QString szName, szPropertyName; \
\
KVSM_PARAMETERS_BEGIN(c) \
KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \
KVSM_PARAMETERS_END(c) \
\
if(szName.isEmpty()) \
{ \
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb")); \
return false; \
} \
\
if(szPropertyName.isEmpty()) \
{ \
c->error(__tr2qs_ctx("You must provide the value as parameter","serverdb")); \
return false; \
} \
\
KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szName); \
if(!pRecord) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
return false; \
} \
\
KviServer * pServer = pRecord->currentServer(); \
if(!pServer) \
{ \
if(c->switches()->find('q',"quiet")) return true; \
c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
return false; \
} \
\
pServer->__callName(szPropertyName); \
\
return true; \
}
/*
@doc: serverdb.setNetworkNickName
@type:
command
@title:
serverdb.setNetworkNickName
@short:
Sets the nickname
@syntax:
serverdb.setNetworkNickName [switches] <string:name> <string:nick>
@description:
Sets the nickname <nick> for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the nickname HelLViS69 for the Freenode network[/comment][br]
serverdb.setNetworkNickName -q Freenode HelLViS69
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkNickName,setNickName)
/*
@doc: serverdb.setNetworkUserName
@type:
command
@title:
serverdb.setNetworkUserName
@short:
Sets the username
@syntax:
serverdb.setNetworkUserName [switches] <string:name> <string:username>
@description:
Sets the username <username> for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the username kvirc for the Freenode network[/comment][br]
serverdb.setNetworkUserName -q Freenode kvirc
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkUserName,setUserName)
/*
@doc: serverdb.setNetworkRealName
@type:
command
@title:
serverdb.setNetworkRealName
@short:
Sets the realname
@syntax:
serverdb.setNetworkRealName [switches] <string:name> <string:realname>
@description:
Sets the realname <realname> for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the realname KVIrc 4.0 for the Freenode network[/comment][br]
serverdb.setNetworkRealName -q Freenode KVIrc 4.0
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkRealName,setRealName)
/*
@doc: serverdb.setNetworkEncoding
@type:
command
@title:
serverdb.setNetworkEncoding
@short:
Sets the encoding
@syntax:
serverdb.setNetworkEncoding [switches] <string:name> <string:encoding>
@description:
Sets the encoding <encoding> for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the encoding UTF-8 for the Freenode network[/comment][br]
serverdb.setNetworkEncoding -q Freenode UTF-8
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkEncoding,setEncoding)
/*
@doc: serverdb.setNetworkDescription
@type:
command
@title:
serverdb.setNetworkDescription
@short:
Sets the description
@syntax:
serverdb.setNetworkDescription [switches] <string:name> <string:description>
@description:
Sets the description <description> for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the description for the Freenode network[/comment][br]
serverdb.setNetworkDescription -q Freenode The FOSS Network
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkDescription,setDescription)
/*
@doc: serverdb.setNetworkConnectCommand
@type:
command
@title:
serverdb.setNetworkConnectCommand
@short:
Sets the connect command
@syntax:
serverdb.setNetworkConnectCommand [switches] <string:name> <string:command>
@description:
Sets the command <command> to run on connect for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the connect command for the Freenode network[/comment][br]
serverdb.setNetworkConnectCommand -q Freenode ns identify HelLViS69 foobar
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkConnectCommand,setOnConnectCommand)
/*
@doc: serverdb.setNetworkLoginCommand
@type:
command
@title:
serverdb.setNetworkLoginCommand
@short:
Sets the login command
@syntax:
serverdb.setNetworkLoginCommand [switches] <string:name> <string:command>
@description:
Sets the command <command> to run on login for the specified network <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the login command for the Freenode network[/comment][br]
serverdb.setNetworkLoginCommand -q Freenode join #KVIrc
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkLoginCommand,setOnLoginCommand)
/*
@doc: serverdb.setServerNickName
@type:
command
@title:
serverdb.setServerNickName
@short:
Sets the nickname
@syntax:
serverdb.setServerNickName [switches] <string:name> <string:nick>
@description:
Sets the nickname <nick> for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the nickname HelLViS69 for the Freenode network[/comment][br]
serverdb.setServerNickName -q irc.freenode.net HelLViS69
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerNickName,setNickName)
/*
@doc: serverdb.setServerUserName
@type:
command
@title:
serverdb.setServerUserName
@short:
Sets the username
@syntax:
serverdb.setServerUserName [switches] <string:name> <string:username>
@description:
Sets the username <username> for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the username kvirc for the Freenode server[/comment][br]
serverdb.setServerUserName -q irc.freenode.net kvirc
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerUserName,setUserName)
/*
@doc: serverdb.setServerRealName
@type:
command
@title:
serverdb.setServerRealName
@short:
Sets the realname
@syntax:
serverdb.setServerRealName [switches] <string:name> <string:realname>
@description:
Sets the realname <realname> for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the realname KVIrc 4.0 for the Freenode server[/comment][br]
serverdb.setServerRealName -q irc.freenode.net KVIrc 4.0
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerRealName,setRealName)
/*
@doc: serverdb.setServerEncoding
@type:
command
@title:
serverdb.setServerEncoding
@short:
Sets the encoding
@syntax:
serverdb.setServerEncoding [switches] <string:name> <string:encoding>
@description:
Sets the encoding <encoding> for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the encoding UTF-8 for the irc.freenode.net server[/comment][br]
serverdb.setServerEncoding -q Freenode UTF-8
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerEncoding,setEncoding)
/*
@doc: serverdb.setServerDescription
@type:
command
@title:
serverdb.setServerDescription
@short:
Sets the description
@syntax:
serverdb.setServerDescription [switches] <string:name> <string:description>
@description:
Sets the description <description> for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the description for the Freenode server[/comment][br]
serverdb.setServerDescription -q irc.freenode.net The FOSS Network
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerDescription,setDescription)
/*
@doc: serverdb.setServerConnectCommand
@type:
command
@title:
serverdb.setServerConnectCommand
@short:
Sets the connect command
@syntax:
serverdb.setServerConnectCommand [switches] <string:name> <string:command>
@description:
Sets the command <command> to run on connect for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the connect command for the Freenode server[/comment][br]
serverdb.setServerConnectCommand -q irc.freenode.net ns identify HelLViS69 foobar
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerConnectCommand,setOnConnectCommand)
/*
@doc: serverdb.setServerLoginCommand
@type:
command
@title:
serverdb.setServerLoginCommand
@short:
Sets the login command
@syntax:
serverdb.setServerLoginCommand [switches] <string:name> <string:command>
@description:
Sets the command <command> to run on login for the specified server <name>.
@switches:
!sw: -q | --quiet
Do not print errors if the server already exists.
@examples:
[example]
[comment]Quietly sets the login command for the Freenode server[/comment][br]
serverdb.setServerLoginCommand -q irc.freenode.net join #KVIrc
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerLoginCommand,setOnLoginCommand)
static bool serverdb_module_init(KviModule * m)
{
/*
KVSM_REGISTER_SIMPLE_COMMAND(m,"updateList",serverdb_kvs_cmd_updateList);
*/
#if 0
KVSM_REGISTER_FUNCTION(m,"getNickName",serverdb_kvs_fnc_getNickName);
KVSM_REGISTER_FUNCTION(m,"getRealName",serverdb_kvs_fnc_getRealName);
KVSM_REGISTER_FUNCTION(m,"getUserName",serverdb_kvs_fnc_getUserName);
KVSM_REGISTER_FUNCTION(m,"getConnectCommand",serverdb_kvs_fnc_getConnectCommand);
KVSM_REGISTER_FUNCTION(m,"getDescription",serverdb_kvs_fnc_getDescription);
KVSM_REGISTER_FUNCTION(m,"getEncoding",serverdb_kvs_fnc_getEncoding);
KVSM_REGISTER_FUNCTION(m,"getLoginCommand",serverdb_kvs_fnc_getLoginCommand);
#endif
KVSM_REGISTER_FUNCTION(m,"networkExists",serverdb_kvs_fnc_networkExists);
KVSM_REGISTER_FUNCTION(m,"serverExists",serverdb_kvs_fnc_serverExists);
KVSM_REGISTER_SIMPLE_COMMAND(m,"addNetwork",serverdb_kvs_cmd_addNetwork);
KVSM_REGISTER_SIMPLE_COMMAND(m,"addServer",serverdb_kvs_cmd_addServer);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkConnectCommand",serverdb_kvs_cmd_setNetworkConnectCommand);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkEncoding",serverdb_kvs_cmd_setNetworkEncoding);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkDescription",serverdb_kvs_cmd_setNetworkDescription);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkLoginCommand",serverdb_kvs_cmd_setNetworkLoginCommand);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkNickName",serverdb_kvs_cmd_setNetworkNickName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkRealName",serverdb_kvs_cmd_setNetworkRealName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkUserName",serverdb_kvs_cmd_setNetworkUserName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerConnectCommand",serverdb_kvs_cmd_setServerConnectCommand);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerEncoding",serverdb_kvs_cmd_setServerEncoding);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerDescription",serverdb_kvs_cmd_setServerDescription);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerLoginCommand",serverdb_kvs_cmd_setServerLoginCommand);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerNickName",serverdb_kvs_cmd_setServerNickName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerRealName",serverdb_kvs_cmd_setServerRealName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerUserName",serverdb_kvs_cmd_setServerUserName);
return true;
}
static bool serverdb_module_cleanup(KviModule *m)
{
return true;
}
static bool serverdb_module_can_unload(KviModule *)
{
return true;
}
KVIRC_MODULE(
"ServerDB", // module name
"4.0.0", // module version
"Copyright (C) 2008 Elvio Basello (hellvis69 at netsons dot org)", // author & (C)
"IRC server DB related functions",
serverdb_module_init,
serverdb_module_can_unload,
0,
serverdb_module_cleanup
)
|