Viewing Issue Advanced Details

ID 0002721 Category [DMDirc] IRC Parser Severity minor
Reproducibility always Date Submitted 2009-07-04 17:17 Last Update 2009-11-21 22:56
Reporter Dataforce Assigned To Dataforce View Status public
Priority normal Status closed Resolution fixed
Platform Fixed in Version Target Version 0.6.3m2
Product Version Product Build
Summary 0002721: 005 Support for parameter negation
Description
005 Support for parameter negation
Needs unit test no
Upstream Bug URL

Relationships

Notes

authorShane Mc Cormack <shane@dmdirc.com>2009-07-04 16:48:15 (GMT)
commit8c64dd0d457b4434da10cb5d0e56c25e66ab9b65 (patch) (side-by-side diff)
Add support for paramter negation in parser. Fixes issue 2721
-rw-r--r--src/com/dmdirc/parser/irc/Process004005.java33
1 files changed, 18 insertions, 15 deletions
Click to Expand/Collapse
diff src/com/dmdirc/parser/irc/Process004005.java
@@ -51,18 +51,21 @@ public class Process004005 extends IRCProcessor {
myParser.parseUserModes();
} else if (sParam.equals("005")) {
// 005
- String[] Bits = null;
- String sKey = null, sValue = null;
for (int i = 3; i < token.length ; i++) {
- Bits = token[i].split("=",2);
- sKey = Bits[0].toUpperCase();
- if (Bits.length == 2) { sValue = Bits[1]; } else { sValue = ""; }
+ String[] Bits = token[i].split("=",2);
+ final boolean isNegation = (Bits[0].charAt(0) == '-');
+ final String sKey = (isNegation) ? Bits[0].toUpperCase() : Bits[0].substring(1).toUpperCase();
+ final String sValue = (Bits.length == 2) ? Bits[1] : "";
callDebugInfo(IRCParser.DEBUG_INFO, "%s => %s",sKey,sValue);
- myParser.h005Info.put(sKey,sValue);
- if (sKey.equals("NETWORK")) {
+ if (isNegation) {
+ myParser.h005Info.remove(sKey);
+ } else {
+ myParser.h005Info.put(sKey,sValue);
+ }
+ if (sKey.equals("NETWORK") && !isNegation) {
myParser.sNetworkName = sValue;
callGotNetwork();
- } else if (sKey.equals("CASEMAPPING")) {
+ } else if (sKey.equals("CASEMAPPING") && !isNegation) {
byte limit = (byte)4;
if (sValue.equalsIgnoreCase("strict-rfc1459")) {
limit = (byte)3;
@@ -74,9 +77,9 @@ public class Process004005 extends IRCProcessor {
final boolean limitChanged = (myParser.getIRCStringConverter().getLimit() != limit);
myParser.updateCharArrays(limit);
if (limitChanged && myParser.knownClients() == 1) {
- // This means that the casemapping is not rfc1459
- // We have only added ourselves so far (from 001)
- // We can fix the hashtable easily.
+ // This means that the casemapping is not rfc1459
+ // We have only added ourselves so far (from 001)
+ // We can fix the hashtable easily.
myParser.removeClient(myParser.getMyself());
myParser.addClient(myParser.getMyself());
}
@@ -89,13 +92,13 @@ public class Process004005 extends IRCProcessor {
} else if (sKey.equals("LISTMODE")) {
// Support for potential future decent mode listing in the protocol
//
- // See my proposal: http://shane.dmdirc.com/listmodes.php
+ // See my proposal: http://shanemcc.co.uk/irc/#listmode
// Add listmode handler
String[] handles = new String[2];
handles[0] = sValue; // List mode item
- sValue = ""+(Integer.parseInt(sValue) + 1);
- myParser.h005Info.put("LISTMODEEND", sValue);
- handles[1] = sValue; // List mode end
+ final String endValue = ""+(Integer.parseInt(sValue) + 1);
+ myParser.h005Info.put("LISTMODEEND", endValue);
+ handles[1] = endValue; // List mode end
// Add listmode handlers
try {
myParser.getProcessingManager().addProcessor(handles, myParser.getProcessingManager().getProcessor("__LISTMODE__"));

Issue History

Date Modified Username Field Change
2009-07-04 17:17 Dataforce New Issue
2009-07-04 17:17 Dataforce Status new => assigned
2009-07-04 17:17 Dataforce Assigned To => Dataforce
2009-07-04 17:57 Dataforce Checkin
2009-07-04 17:57 Dataforce Note Added: 0007096
2009-07-04 17:57 Dataforce Status assigned => resolved
2009-07-04 17:57 Dataforce Resolution open => fixed
2009-11-08 12:52 Greboid Status resolved => closed
2009-11-21 22:56 MD87 Category *Unsorted => IRC Parser