summaryrefslogtreecommitdiff
authorwimpie <wimpie>2005-01-08 15:16:37 (UTC)
committer wimpie <wimpie>2005-01-08 15:16:37 (UTC)
commit955213d274c2f0c11d0f153e2fed5df5170e50f6 (patch) (unidiff)
tree5bf19444380a734ae5c184ba83aeb093e6ae4113
parent9acc68823f95f62367813dbb42387ad5ee094aae (diff)
downloadopie-955213d274c2f0c11d0f153e2fed5df5170e50f6.zip
opie-955213d274c2f0c11d0f153e2fed5df5170e50f6.tar.gz
opie-955213d274c2f0c11d0f153e2fed5df5170e50f6.tar.bz2
Changes in this patch:
*Added some irc numerical codes (253, 422) *Reordered codes *Unified some functions which did exactly the same in two functions *Changed nick ordering in channel list, now nicks get ordered first by flags and then by name.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannellist.cpp26
-rw-r--r--noncore/net/opieirc/ircchannellist.h1
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp61
-rw-r--r--noncore/net/opieirc/ircmessageparser.h8
4 files changed, 50 insertions, 46 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp
index 4e13dee..6bef318 100644
--- a/noncore/net/opieirc/ircchannellist.cpp
+++ b/noncore/net/opieirc/ircchannellist.cpp
@@ -16,9 +16,9 @@ void IRCChannelList::update() {
16 if (person->flags & PERSON_FLAG_OP) { 16 if (person->flags & PERSON_FLAG_OP) {
17 insertItem(op, person->person->nick()); 17 insertItem(op, "1" + person->person->nick());
18 } else if (person->flags & PERSON_FLAG_HALFOP) { 18 } else if (person->flags & PERSON_FLAG_HALFOP) {
19 insertItem(op, person->person->nick()); 19 insertItem(op, "2" + person->person->nick());
20 } else if (person->flags & PERSON_FLAG_VOICE) { 20 } else if (person->flags & PERSON_FLAG_VOICE) {
21 insertItem(voice, person->person->nick()); 21 insertItem(voice, "3" + person->person->nick());
22 } else { 22 } else {
23 insertItem(person->person->nick()); 23 insertItem("4" + person->person->nick());
24 } 24 }
@@ -26,2 +26,3 @@ void IRCChannelList::update() {
26 sort(); 26 sort();
27 adjustNicks();
27} 28}
@@ -47 +48,18 @@ bool IRCChannelList::removePerson(QString nick) {
47 48
49void IRCChannelList::adjustNicks() {
50 QString txt;
51 QPixmap pm;
52
53 for(unsigned int i=0; i<count(); i++) {
54 txt = text(i).remove(0,1);
55 if(pixmap(i)) {
56 pm = *pixmap(i);
57 removeItem(i);
58 insertItem(pm, txt, i);
59 }
60 else {
61 removeItem(i);
62 insertItem(txt,i);
63 }
64 }
65}
diff --git a/noncore/net/opieirc/ircchannellist.h b/noncore/net/opieirc/ircchannellist.h
index deab649..b4e46eb 100644
--- a/noncore/net/opieirc/ircchannellist.h
+++ b/noncore/net/opieirc/ircchannellist.h
@@ -30,2 +30,3 @@ public:
30 void update(); 30 void update();
31 void adjustNicks();
31 bool hasPerson(QString nick); 32 bool hasPerson(QString nick);
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index ecc7e9a..f8ccbb6 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -31,14 +31,15 @@ IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = {
31IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { 31IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
32 { 1, FUNC(parseNumerical001) }, // RPL_WELCOME 32 { 1, FUNC(parseNumericalSecondParam) }, // RPL_WELCOME
33 { 2, FUNC(parseNumerical002) }, // RPL_YOURHOST 33 { 2, FUNC(parseNumericalSecondParam) }, // RPL_YOURHOST
34 { 3, FUNC(parseNumerical003) }, // RPL_CREATED 34 { 3, FUNC(parseNumericalSecondParam) }, // RPL_CREATED
35 { 4, FUNC(parseNumerical004) }, // RPL_MYINFO 35 { 4, FUNC(parseNumericalAllParams) }, // RPL_MYINFO
36 { 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL 36 { 5, FUNC(parseNumericalSecondParam) }, // RPL_BOUNCE, RPL_PROTOCTL
37 { 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT 37 { 250, FUNC(parseNumericalAllParams) }, // RPL_STATSCONN
38 { 252, FUNC(parseNumericalStats) }, // RPL_LUSEROP 38 { 251, FUNC(parseNumericalSecondParam) }, // RPL_LUSERCLIENT
39 { 265, FUNC(parseNumericalStats) }, // RPL_LOCALUSERS 39 { 252, FUNC(parseNumericalAllParams) }, // RPL_LUSEROP
40 { 266, FUNC(parseNumericalStats) }, // RPL_GLOBALUSERS 40 { 253, FUNC(parseNumericalAllParams) }, // RPL_LUSERUNKNOWN
41 { 250, FUNC(parseNumericalStats) }, // RPL_STATSCONN 41 { 254, FUNC(parseNumericalAllParams) }, // RPL_LUSERCHANNELS
42 { 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS 42 { 255, FUNC(parseNumericalSecondParam) }, // RPL_LUSERME
43 { 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME 43 { 265, FUNC(parseNumericalAllParams) }, // RPL_LOCALUSERS
44 { 266, FUNC(parseNumericalAllParams) }, // RPL_GLOBALUSERS
44 { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC 45 { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC
@@ -47,10 +48,11 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
47 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES 48 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
48 { 375, FUNC(parseNumericalStats) }, // RPL_MOTDSTART 49 { 372, FUNC(parseNumericalSecondParam) }, // RPL_MOTD
49 { 372, FUNC(parseNumericalStats) }, // RPL_MOTD 50 { 375, FUNC(parseNumericalSecondParam) }, // RPL_MOTDSTART
50 { 376, FUNC(parseNumericalStats) }, // RPL_ENDOFMOTD 51 { 376, FUNC(parseNumericalSecondParam) }, // RPL_ENDOFMOTD
51 { 377, FUNC(parseNumericalStats) }, // RPL_MOTD2 52 { 377, FUNC(parseNumericalSecondParam) }, // RPL_MOTD2
52 { 378, FUNC(parseNumericalStats) }, // RPL_MOTD3 53 { 378, FUNC(parseNumericalSecondParam) }, // RPL_MOTD3
53 { 401, FUNC(parseNumericalNoSuchNick) }, // ERR_NOSUCHNICK 54 { 401, FUNC(parseNumericalNoSuchNick) }, // ERR_NOSUCHNICK
54 { 406, FUNC(parseNumericalNoSuchNick) }, // ERR_WASNOSUCHNICK 55 { 406, FUNC(parseNumericalNoSuchNick) }, // ERR_WASNOSUCHNICK
55 { 412, FUNC(parseNumericalStats) }, // ERR_NOTEXTTOSEND 56 { 412, FUNC(parseNumericalSecondParam) }, // ERR_NOTEXTTOSEND
57 { 422, FUNC(parseNumericalSecondParam) }, // ERR_NOMOTD
56 { 433, FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE 58 { 433, FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE
@@ -59,2 +61,3 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
59 61
62
60IRCMessageParser::IRCMessageParser(IRCSession *session) { 63IRCMessageParser::IRCMessageParser(IRCSession *session) {
@@ -462,8 +465,4 @@ void IRCMessageParser::parseLiteralKick(IRCMessage *message) {
462 465
463void IRCMessageParser::parseNumerical001(IRCMessage *message) {
464 /* Welcome to IRC message, display */
465 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->param(1)));
466}
467 466
468void IRCMessageParser::parseNumerical002(IRCMessage *message) { 467void IRCMessageParser::parseNumericalSecondParam(IRCMessage *message) {
469 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->param(1))); 468 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->param(1)));
@@ -471,7 +470,3 @@ void IRCMessageParser::parseNumerical002(IRCMessage *message) {
471 470
472void IRCMessageParser::parseNumerical003(IRCMessage *message) { 471void IRCMessageParser::parseNumericalAllParams(IRCMessage *message) {
473 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->param(1)));
474}
475
476void IRCMessageParser::parseNumerical004(IRCMessage *message) {
477 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters())); 472 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters()));
@@ -479,10 +474,2 @@ void IRCMessageParser::parseNumerical004(IRCMessage *message) {
479 474
480void IRCMessageParser::parseNumerical005(IRCMessage *message) {
481 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters()));
482}
483
484void IRCMessageParser::parseNumericalStats(IRCMessage *message) {
485 emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->param(1)));
486}
487
488void IRCMessageParser::parseNumericalNames(IRCMessage *message) { 475void IRCMessageParser::parseNumericalNames(IRCMessage *message) {
@@ -570 +557,3 @@ void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *) {
570} 557}
558
559
diff --git a/noncore/net/opieirc/ircmessageparser.h b/noncore/net/opieirc/ircmessageparser.h
index c4dd96c..5412f5f 100644
--- a/noncore/net/opieirc/ircmessageparser.h
+++ b/noncore/net/opieirc/ircmessageparser.h
@@ -75,8 +75,4 @@ private:
75 void parseLiteralTopic(IRCMessage *message); 75 void parseLiteralTopic(IRCMessage *message);
76 void parseNumerical001(IRCMessage *message); 76 void parseNumericalSecondParam(IRCMessage *message);
77 void parseNumerical002(IRCMessage *message); 77 void parseNumericalAllParams(IRCMessage *message);
78 void parseNumerical003(IRCMessage *message);
79 void parseNumerical004(IRCMessage *message);
80 void parseNumerical005(IRCMessage *message);
81 void parseNumericalStats(IRCMessage *message);
82 void parseNumericalNames(IRCMessage *message); 78 void parseNumericalNames(IRCMessage *message);