File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
src/main/java/org/kitteh/irc/client/library Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 3636
3737import java .util .ArrayList ;
3838import java .util .Collections ;
39+ import java .util .LinkedHashMap ;
3940import java .util .List ;
4041import java .util .Map ;
4142import java .util .Optional ;
@@ -104,11 +105,11 @@ public DefaultMessageTagManager(Client.WithManagement client) {
104105
105106 @ Override
106107 public @ NonNull List <MessageTag > getCapabilityTags (@ NonNull String tagList ) {
107- String [] tags = tagList .split (";" ); // Split up by semicolon
108- List < MessageTag > list = new ArrayList <>();
108+ String [] tagSplit = tagList .split (";" ); // Split up by semicolon
109+ Map < String , MessageTag > tags = new LinkedHashMap <>();
109110 int index ;
110111 TagCreator tagCreator ;
111- for (String tag : tags ) {
112+ for (String tag : tagSplit ) {
112113 String tagName ;
113114 @ Nullable String value ;
114115 // Split out value if present
@@ -131,9 +132,10 @@ public DefaultMessageTagManager(Client.WithManagement client) {
131132 if (messageTag == null ) {
132133 messageTag = new DefaultMessageTag (tagName , value );
133134 }
134- list .add (messageTag );
135+ // "Clients receiving messages with more than one occurrence of a tag key SHOULD discard all but the final occurrence."
136+ tags .put (tagName .toLowerCase (), messageTag );
135137 }
136- return Collections .unmodifiableList (list );
138+ return Collections .unmodifiableList (new ArrayList <>( tags . values ()) );
137139 }
138140
139141 private @ NonNull String getTagValue (@ NonNull String tag ) {
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ interface NumericCommandServerMessage extends ServerMessage {
7373 @ NonNull List <MessageTag > getTags ();
7474
7575 /**
76- * Gets the named tag if present
76+ * Gets the named tag if present.
7777 *
7878 * @param name tag name
7979 * @return tag if present
You can’t perform that action at this time.
0 commit comments