Communi  3.4.0
A cross-platform IRC framework written with Qt
irc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008-2015 The Communi Project
3 
4  You may use this file under the terms of BSD license as follows:
5 
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are met:
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13  * Neither the name of the copyright holder nor the names of its
14  contributors may be used to endorse or promote products derived
15  from this software without specific prior written permission.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
21  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef IRC_H
30 #define IRC_H
31 
32 #include <IrcGlobal>
33 #include <QtCore/qobject.h>
34 #include <QtCore/qstring.h>
35 #include <QtCore/qmetatype.h>
36 
37 IRC_BEGIN_NAMESPACE
38 
39 #ifdef IRC_DOXYGEN
40 namespace Irc
41 {
42  Q_INVOKABLE QString version();
43  Q_INVOKABLE QString codeToString(int code);
44  Q_INVOKABLE QString nickFromPrefix(const QString& prefix);
45  Q_INVOKABLE QString identFromPrefix(const QString& prefix);
46  Q_INVOKABLE QString hostFromPrefix(const QString& prefix);
47  Q_INVOKABLE void registerMetaTypes();
48 #else
49 class IRC_CORE_EXPORT Irc : public QObject
50 {
51  Q_OBJECT
52  Q_ENUMS(Color DataRole SortMethod Code)
53 
54 public:
55  Q_INVOKABLE static QString version();
56  Q_INVOKABLE static QString codeToString(int code);
57  Q_INVOKABLE static QString nickFromPrefix(const QString& prefix);
58  Q_INVOKABLE static QString identFromPrefix(const QString& prefix);
59  Q_INVOKABLE static QString hostFromPrefix(const QString& prefix);
60  Q_INVOKABLE static void registerMetaTypes();
61 #endif
62 
63  enum Color {
64  White = 0,
65  Black = 1,
66  Blue = 2,
67  Green = 3,
68  Red = 4,
69  Brown = 5,
70  Purple = 6,
71  Orange = 7,
72  Yellow = 8,
74  Cyan = 10,
75  LightCyan = 11,
76  LightBlue = 12,
77  Pink = 13,
78  Gray = 14,
79  LightGray = 15
80  };
81 
82  enum DataRole {
90  };
91 
92  enum SortMethod {
97  };
98 
99  enum Code {
125  RPL_STATS = 210,
135  RPL_UMODEIS = 221,
136  RPL_MODLIST = 222,
142  RPL_SERVICE = 233,
161  RPL_LUSEROP = 252,
164  RPL_LUSERME = 255,
165  RPL_ADMINME = 256,
176  RPL_NETSTAT = 268,
178  RPL_PRIVS = 270,
181  RPL_NOTIFY = 273,
187  RPL_GLIST = 280,
193  RPL_FEATURE = 284,
198  RPL_CHKHEAD = 286,
206  RPL_HELPHDR = 290,
207  RPL_DATASTR = 290,
209  RPL_HELPOP = 291,
212  RPL_HELPTLR = 292,
214  RPL_HELPHLP = 293,
216  RPL_HELPFWD = 294,
218  RPL_HELPIGN = 295,
221  RPL_NONE = 300,
222  RPL_AWAY = 301,
224  RPL_ISON = 303,
225  RPL_TEXT = 304,
226  RPL_UNAWAY = 305,
227  RPL_NOWAWAY = 306,
251  RPL_LIST = 322,
252  RPL_LISTEND = 323,
262  RPL_NOTOPIC = 331,
263  RPL_TOPIC = 332,
273  RPL_INVITED = 345,
278  RPL_VERSION = 351,
284  RPL_CLOSING = 362,
286  RPL_LINKS = 364,
289  RPL_BANLIST = 367,
292  RPL_INFO = 371,
293  RPL_MOTD = 372,
299  RPL_SPAM = 377,
311  RPL_QLIST = 386,
312  RPL_IRCOPS = 386,
315  RPL_ALIST = 388,
317  RPL_TIME = 391,
319  RPL_USERS = 393,
321  RPL_NOUSERS = 395,
338  ERR_BADMASK = 415,
343  ERR_NOMOTD = 422,
353  ERR_NORULES = 434,
360  ERR_DEAD = 438,
366  ERR_NOLOGIN = 444,
386  ERR_KEYSET = 467,
389  ERR_LINKSET = 469,
403  ERR_NOULINE = 480,
410  ERR_DESYNC = 484,
440  ERR_BADPING = 513,
448  ERR_ADMONLY = 519,
464  RPL_LOGON = 600,
465  RPL_LOGOFF = 601,
468  RPL_NOWON = 604,
469  RPL_NOWOFF = 605,
473  RPL_ISOPER = 610,
474  RPL_ISLOCOP = 611,
478  RPL_DCCLIST = 618,
481  RPL_DCCINFO = 620,
482  RPL_ENDOFO = 626,
485  RPL_DUMPING = 640,
486  RPL_DUMPRPL = 641,
487  RPL_EODUMP = 642,
507  RPL_HELPTXT = 705,
510  RPL_ETRACE = 709,
511  RPL_KNOCK = 710,
521  ERR_NOPRIVS = 723,
527  RPL_MONLIST = 732,
529  ERR_MONLISTFULL = 734,
530  RPL_XINFO = 771,
545  };
546 };
547 
548 #ifndef QT_NO_DEBUG_STREAM
549 IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::Code code);
550 IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::DataRole role);
551 IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::Color color);
552 IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::SortMethod method);
553 #endif // QT_NO_DEBUG_STREAM
554 
555 IRC_END_NAMESPACE
556 
557 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::Code))
558 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::DataRole))
559 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::Color))
560 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::SortMethod))
561 
562 #endif // IRC_H
347
Definition: irc.h:275
DataRole
Definition: irc.h:82
262
Definition: irc.h:170
416
Definition: irc.h:339
483
Definition: irc.h:407
424
Definition: irc.h:345
338
Definition: irc.h:269
432
Definition: irc.h:350
405
Definition: irc.h:328
690
Definition: irc.h:505
550
Definition: irc.h:460
253
Definition: irc.h:162
672
Definition: irc.h:497
678
Definition: irc.h:499
259
Definition: irc.h:168
308
Definition: irc.h:230
504
Definition: irc.h:437
464
Definition: irc.h:383
268
Definition: irc.h:176
310
Definition: irc.h:236
485
Definition: irc.h:415
Miscellaneous identifiers used throughout the library.
Definition: irc.h:40
Channel/user prefix and name (QString)
Definition: irc.h:89
682
Definition: irc.h:501
210
Definition: irc.h:125
459
Definition: irc.h:378
381
Definition: irc.h:306
281
Definition: irc.h:189
480
Definition: irc.h:403
437
Definition: irc.h:358
348
Definition: irc.h:276
222
Definition: irc.h:137
485
Definition: irc.h:412
334
Definition: irc.h:267
309
Definition: irc.h:234
438
Definition: irc.h:360
291
Definition: irc.h:208
324
Definition: irc.h:253
723
Definition: irc.h:521
661
Definition: irc.h:489
982
Definition: irc.h:542
8
Definition: irc.h:105
516
Definition: irc.h:444
385
Definition: irc.h:310
240
Definition: irc.h:148
351
Definition: irc.h:278
The default value is "gray".
Definition: irc.h:78
485
Definition: irc.h:413
641
Definition: irc.h:486
611
Definition: irc.h:474
375
Definition: irc.h:296
243
Definition: irc.h:151
339
Definition: irc.h:270
208
Definition: irc.h:122
292
Definition: irc.h:211
300
Definition: irc.h:221
216
Definition: irc.h:131
311
Definition: irc.h:238
320
Definition: irc.h:248
419
Definition: irc.h:341
330
Definition: irc.h:260
296
Definition: irc.h:219
378
Definition: irc.h:300
320
Definition: irc.h:247
382
Definition: irc.h:307
10
Definition: irc.h:108
552
Definition: irc.h:462
50
Definition: irc.h:112
478
Definition: irc.h:400
416
Definition: irc.h:340
383
Definition: irc.h:308
608
Definition: irc.h:472
704
Definition: irc.h:506
327
Definition: irc.h:257
979
Definition: irc.h:539
472
Definition: irc.h:393
205
Definition: irc.h:119
715
Definition: irc.h:516
323
Definition: irc.h:252
670
Definition: irc.h:495
377
Definition: irc.h:298
278
Definition: irc.h:186
284
Definition: irc.h:193
437
Definition: irc.h:357
972
Definition: irc.h:533
249
Definition: irc.h:157
425
Definition: irc.h:346
613
Definition: irc.h:476
241
Definition: irc.h:149
Q_INVOKABLE QString nickFromPrefix(const QString &prefix)
Definition: irc.cpp:83
Sort by activity.
Definition: irc.h:96
333
Definition: irc.h:264
353
Definition: irc.h:280
442
Definition: irc.h:364
429
Definition: irc.h:347
200
Definition: irc.h:114
309
Definition: irc.h:233
660
Definition: irc.h:488
250
Definition: irc.h:158
Sort by hand by calling sort()
Definition: irc.h:93
256
Definition: irc.h:165
524
Definition: irc.h:457
445
Definition: irc.h:367
The default value is "blue".
Definition: irc.h:66
331
Definition: irc.h:262
Buffer object (IrcBuffer*)
Definition: irc.h:84
774
Definition: irc.h:532
354
Definition: irc.h:281
10
Definition: irc.h:107
408
Definition: irc.h:332
460
Definition: irc.h:379
The default value is "red".
Definition: irc.h:68
485
Definition: irc.h:414
Color
Definition: irc.h:63
293
Definition: irc.h:213
219
Definition: irc.h:134
977
Definition: irc.h:538
226
Definition: irc.h:139
689
Definition: irc.h:504
496
Definition: irc.h:429
503
Definition: irc.h:435
334
Definition: irc.h:265
352
Definition: irc.h:279
257
Definition: irc.h:166
468
Definition: irc.h:388
640
Definition: irc.h:485
520
Definition: irc.h:452
407
Definition: irc.h:330
519
Definition: irc.h:449
236
Definition: irc.h:145
349
Definition: irc.h:277
The default value is "black".
Definition: irc.h:65
392
Definition: irc.h:318
266
Definition: irc.h:174
421
Definition: irc.h:342
439
Definition: irc.h:361
254
Definition: irc.h:163
981
Definition: irc.h:541
317
Definition: irc.h:244
The default value is "green".
Definition: irc.h:67
282
Definition: irc.h:190
214
Definition: irc.h:129
289
Definition: irc.h:204
The default value is "pink".
Definition: irc.h:77
Sort by name (Irc::NameRole)
Definition: irc.h:94
519
Definition: irc.h:448
521
Definition: irc.h:453
394
Definition: irc.h:320
488
Definition: irc.h:421
666
Definition: irc.h:494
441
Definition: irc.h:363
520
Definition: irc.h:451
379
Definition: irc.h:302
315
Definition: irc.h:242
263
Definition: irc.h:172
664
Definition: irc.h:492
718
Definition: irc.h:519
730
Definition: irc.h:525
328
Definition: irc.h:258
626
Definition: irc.h:482
422
Definition: irc.h:343
489
Definition: irc.h:422
345
Definition: irc.h:273
313
Definition: irc.h:240
Sort by title (Irc::TitleRole)
Definition: irc.h:95
484
Definition: irc.h:411
285
Definition: irc.h:195
466
Definition: irc.h:385
974
Definition: irc.h:535
291
Definition: irc.h:210
497
Definition: irc.h:430
705
Definition: irc.h:507
665
Definition: irc.h:493
202
Definition: irc.h:116
Q_INVOKABLE QString version()
Definition: irc.cpp:56
526
Definition: irc.h:459
368
Definition: irc.h:290
402
Definition: irc.h:325
Channel object (IrcChannel*)
Definition: irc.h:85
607
Definition: irc.h:471
9
Definition: irc.h:106
290
Definition: irc.h:206
498
Definition: irc.h:431
325
Definition: irc.h:255
491
Definition: irc.h:424
710
Definition: irc.h:511
447
Definition: irc.h:369
462
Definition: irc.h:381
455
Definition: irc.h:374
4
Definition: irc.h:103
203
Definition: irc.h:117
290
Definition: irc.h:205
522
Definition: irc.h:454
The default value is "white".
Definition: irc.h:64
436
Definition: irc.h:356
330
Definition: irc.h:261
518
Definition: irc.h:446
679
Definition: irc.h:500
619
Definition: irc.h:479
242
Definition: irc.h:150
443
Definition: irc.h:365
237
Definition: irc.h:146
732
Definition: irc.h:527
514
Definition: irc.h:442
484
Definition: irc.h:410
286
Definition: irc.h:197
389
Definition: irc.h:316
724
Definition: irc.h:522
246
Definition: irc.h:154
388
Definition: irc.h:315
294
Definition: irc.h:216
631
Definition: irc.h:484
380
Definition: irc.h:305
493
Definition: irc.h:426
444
Definition: irc.h:366
600
Definition: irc.h:464
267
Definition: irc.h:175
406
Definition: irc.h:329
295
Definition: irc.h:217
341
Definition: irc.h:271
465
Definition: irc.h:384
218
Definition: irc.h:133
415
Definition: irc.h:338
294
Definition: irc.h:215
The default value is "lightgreen".
Definition: irc.h:73
365
Definition: irc.h:287
234
Definition: irc.h:143
642
Definition: irc.h:487
487
Definition: irc.h:419
305
Definition: irc.h:226
662
Definition: irc.h:490
457
Definition: irc.h:376
440
Definition: irc.h:362
5
Definition: irc.h:104
Q_INVOKABLE void registerMetaTypes()
Definition: irc.cpp:127
731
Definition: irc.h:526
387
Definition: irc.h:314
262
Definition: irc.h:171
446
Definition: irc.h:368
293
Definition: irc.h:214
303
Definition: irc.h:224
433
Definition: irc.h:351
299
Definition: irc.h:220
277
Definition: irc.h:185
288
Definition: irc.h:202
318
Definition: irc.h:245
281
Definition: irc.h:188
346
Definition: irc.h:274
Q_INVOKABLE QString identFromPrefix(const QString &prefix)
Definition: irc.cpp:100
283
Definition: irc.h:192
233
Definition: irc.h:142
213
Definition: irc.h:128
332
Definition: irc.h:263
618
Definition: irc.h:478
291
Definition: irc.h:209
285
Definition: irc.h:196
610
Definition: irc.h:473
479
Definition: irc.h:401
282
Definition: irc.h:191
387
Definition: irc.h:313
207
Definition: irc.h:121
481
Definition: irc.h:405
378
Definition: irc.h:301
244
Definition: irc.h:152
289
Definition: irc.h:203
307
Definition: irc.h:228
480
Definition: irc.h:404
362
Definition: irc.h:284
217
Definition: irc.h:132
413
Definition: irc.h:336
475
Definition: irc.h:396
458
Definition: irc.h:377
376
Definition: irc.h:297
215
Definition: irc.h:130
486
Definition: irc.h:417
630
Definition: irc.h:483
3
Definition: irc.h:102
274
Definition: irc.h:183
288
Definition: irc.h:201
The default value is "orange".
Definition: irc.h:71
771
Definition: irc.h:530
306
Definition: irc.h:227
Channel/user prefix (QString)
Definition: irc.h:87
514
Definition: irc.h:441
773
Definition: irc.h:531
393
Definition: irc.h:319
User object (IrcUser*)
Definition: irc.h:83
308
Definition: irc.h:231
453
Definition: irc.h:373
386
Definition: irc.h:311
461
Definition: irc.h:380
401
Definition: irc.h:324
287
Definition: irc.h:199
973
Definition: irc.h:534
617
Definition: irc.h:477
709
Definition: irc.h:510
452
Definition: irc.h:372
713
Definition: irc.h:514
329
Definition: irc.h:259
272
Definition: irc.h:180
524
Definition: irc.h:456
726
Definition: irc.h:524
380
Definition: irc.h:304
551
Definition: irc.h:461
1
Definition: irc.h:100
983
Definition: irc.h:543
502
Definition: irc.h:434
717
Definition: irc.h:518
290
Definition: irc.h:207
486
Definition: irc.h:418
476
Definition: irc.h:397
711
Definition: irc.h:512
403
Definition: irc.h:326
620
Definition: irc.h:481
449
Definition: irc.h:370
999
Definition: irc.h:544
51
Definition: irc.h:113
273
Definition: irc.h:181
265
Definition: irc.h:173
309
Definition: irc.h:232
255
Definition: irc.h:164
247
Definition: irc.h:155
518
Definition: irc.h:447
319
Definition: irc.h:246
602
Definition: irc.h:466
325
Definition: irc.h:254
270
Definition: irc.h:178
733
Definition: irc.h:528
473
Definition: irc.h:394
292
Definition: irc.h:212
209
Definition: irc.h:123
671
Definition: irc.h:496
The default value is "lightblue".
Definition: irc.h:76
232
Definition: irc.h:141
251
Definition: irc.h:160
212
Definition: irc.h:127
687
Definition: irc.h:502
474
Definition: irc.h:395
409
Definition: irc.h:333
312
Definition: irc.h:239
285
Definition: irc.h:194
310
Definition: irc.h:235
379
Definition: irc.h:303
316
Definition: irc.h:243
366
Definition: irc.h:288
14
Definition: irc.h:109
688
Definition: irc.h:503
503
Definition: irc.h:436
511
Definition: irc.h:438
469
Definition: irc.h:389
404
Definition: irc.h:327
363
Definition: irc.h:285
430
Definition: irc.h:348
222
Definition: irc.h:136
470
Definition: irc.h:391
408
Definition: irc.h:331
The default value is "lightgray".
Definition: irc.h:79
470
Definition: irc.h:390
The default value is "purple".
Definition: irc.h:70
Q_INVOKABLE QString codeToString(int code)
Definition: irc.cpp:66
451
Definition: irc.h:371
271
Definition: irc.h:179
434
Definition: irc.h:352
384
Definition: irc.h:309
612
Definition: irc.h:475
663
Definition: irc.h:491
605
Definition: irc.h:469
User mode (QString)
Definition: irc.h:88
517
Definition: irc.h:445
276
Definition: irc.h:184
374
Definition: irc.h:295
304
Definition: irc.h:225
248
Definition: irc.h:156
414
Definition: irc.h:337
386
Definition: irc.h:312
553
Definition: irc.h:463
321
Definition: irc.h:250
201
Definition: irc.h:115
463
Definition: irc.h:382
326
Definition: irc.h:256
431
Definition: irc.h:349
712
Definition: irc.h:513
42
Definition: irc.h:110
486
Definition: irc.h:416
468
Definition: irc.h:387
523
Definition: irc.h:455
280
Definition: irc.h:187
482
Definition: irc.h:406
396
Definition: irc.h:322
320
Definition: irc.h:249
372
Definition: irc.h:293
438
Definition: irc.h:359
231
Definition: irc.h:140
373
Definition: irc.h:294
976
Definition: irc.h:537
2
Definition: irc.h:101
361
Definition: irc.h:283
714
Definition: irc.h:515
269
Definition: irc.h:177
364
Definition: irc.h:286
206
Definition: irc.h:120
Code
Definition: irc.h:99
492
Definition: irc.h:425
603
Definition: irc.h:467
301
Definition: irc.h:222
274
Definition: irc.h:182
477
Definition: irc.h:399
43
Definition: irc.h:111
Buffer/user name (QString)
Definition: irc.h:86
342
Definition: irc.h:272
322
Definition: irc.h:251
391
Definition: irc.h:317
The default value is "brown".
Definition: irc.h:69
601
Definition: irc.h:465
314
Definition: irc.h:241
338
Definition: irc.h:268
494
Definition: irc.h:427
377
Definition: irc.h:299
287
Definition: irc.h:200
Q_INVOKABLE QString hostFromPrefix(const QString &prefix)
Definition: irc.cpp:117
225
Definition: irc.h:138
258
Definition: irc.h:167
725
Definition: irc.h:523
513
Definition: irc.h:440
487
Definition: irc.h:420
477
Definition: irc.h:398
261
Definition: irc.h:169
239
Definition: irc.h:147
708
Definition: irc.h:509
334
Definition: irc.h:266
501
Definition: irc.h:433
307
Definition: irc.h:229
467
Definition: irc.h:386
The default value is "lightcyan".
Definition: irc.h:75
604
Definition: irc.h:468
489
Definition: irc.h:423
310
Definition: irc.h:237
435
Definition: irc.h:354
367
Definition: irc.h:289
520
Definition: irc.h:450
355
Definition: irc.h:282
423
Definition: irc.h:344
211
Definition: irc.h:126
435
Definition: irc.h:355
412
Definition: irc.h:335
371
Definition: irc.h:292
411
Definition: irc.h:334
716
Definition: irc.h:517
The default value is "cyan".
Definition: irc.h:74
302
Definition: irc.h:223
250
Definition: irc.h:159
The default value is "yellow".
Definition: irc.h:72
221
Definition: irc.h:135
395
Definition: irc.h:321
456
Definition: irc.h:375
495
Definition: irc.h:428
295
Definition: irc.h:218
499
Definition: irc.h:432
512
Definition: irc.h:439
252
Definition: irc.h:161
479
Definition: irc.h:402
210
Definition: irc.h:124
484
Definition: irc.h:408
434
Definition: irc.h:353
484
Definition: irc.h:409
525
Definition: irc.h:458
SortMethod
Definition: irc.h:92
471
Definition: irc.h:392
400
Definition: irc.h:323
619
Definition: irc.h:480
722
Definition: irc.h:520
235
Definition: irc.h:144
245
Definition: irc.h:153
369
Definition: irc.h:291
706
Definition: irc.h:508
204
Definition: irc.h:118
286
Definition: irc.h:198
980
Definition: irc.h:540
515
Definition: irc.h:443
673
Definition: irc.h:498
606
Definition: irc.h:470
975
Definition: irc.h:536