@@ -238,6 +238,112 @@ def testListUsers(self):
238
238
self .sendLine (3 , "LIST <100" )
239
239
self .assertEqual (self ._parseChanList (3 ), {"#chan1" , "#chan2" })
240
240
241
+ @cases .mark_specifications ("Modern" )
242
+ def testListTwoChannels (self ):
243
+ """
244
+ "Parameters: [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]"
245
+ -- https://modern.ircdocs.horse/#list-message
246
+ """
247
+ self .connectClient ("foo" )
248
+
249
+ if "U" not in self .server_support .get ("ELIST" , "" ):
250
+ raise runner .OptionalExtensionNotSupported ("ELIST=U" )
251
+
252
+ if "TARGMAX" in self .server_support :
253
+ for item in (self .server_support ["TARGMAX" ]).split ("," ):
254
+ (command , max_ ) = item .split (":" , 1 )
255
+ if command == "LIST" and int (max_ or "1000" ) < 2 :
256
+ raise runner .OptionalExtensionNotSupported ("TARGMAX=LIST >= 2" )
257
+
258
+ self .sendLine (1 , "JOIN #chan1" )
259
+ self .getMessages (1 )
260
+ self .sendLine (1 , "JOIN #chan2" )
261
+ self .getMessages (1 )
262
+ self .sendLine (1 , "JOIN #chan3" )
263
+ self .getMessages (1 )
264
+
265
+ self .connectClient ("bar" )
266
+ self .sendLine (2 , "JOIN #chan2" )
267
+ self .getMessages (2 )
268
+
269
+ self .connectClient ("baz" )
270
+
271
+ self .sendLine (3 , "LIST" )
272
+ self .assertEqual (self ._parseChanList (3 ), {"#chan1" , "#chan2" , "#chan3" })
273
+
274
+ self .sendLine (3 , "LIST #chan1,#chan2" )
275
+ self .assertEqual (self ._parseChanList (3 ), {"#chan1" , "#chan2" })
276
+
277
+ @cases .mark_isupport ("ELIST" )
278
+ @cases .mark_specifications ("Modern" )
279
+ def testListTwoParams (self ):
280
+ """
281
+ "Parameters: [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]"
282
+ -- https://modern.ircdocs.horse/#list-message
283
+ """
284
+ self .connectClient ("foo" )
285
+
286
+ if "U" not in self .server_support .get ("ELIST" , "" ):
287
+ raise runner .OptionalExtensionNotSupported ("ELIST=U" )
288
+
289
+ self .sendLine (1 , "JOIN #chan1" )
290
+ self .getMessages (1 )
291
+ self .sendLine (1 , "JOIN #chan2" )
292
+ self .getMessages (1 )
293
+
294
+ self .connectClient ("bar" )
295
+ self .sendLine (2 , "JOIN #chan2" )
296
+ self .getMessages (2 )
297
+
298
+ self .connectClient ("baz" )
299
+
300
+ self .sendLine (3 , "LIST #chan1 >0" )
301
+ self .assertEqual (self ._parseChanList (3 ), {"#chan1" })
302
+
303
+ self .sendLine (3 , "LIST #chan1 <1" )
304
+ self .assertEqual (self ._parseChanList (3 ), set ())
305
+
306
+ self .sendLine (3 , "LIST #chan1,#chan2 >0" )
307
+ self .assertEqual (self ._parseChanList (3 ), {"#chan1" , "#chan2" })
308
+
309
+ self .sendLine (3 , "LIST #chan1,#chan2 <1" )
310
+ self .assertEqual (self ._parseChanList (3 ), set ())
311
+
312
+ @cases .mark_isupport ("ELIST" )
313
+ @cases .mark_specifications ("Modern" )
314
+ def testListTwoParamsTwoChannels (self ):
315
+ """
316
+ "Parameters: [<channel>{,<channel>}] [<elistcond>{,<elistcond>}]"
317
+ -- https://modern.ircdocs.horse/#list-message
318
+ """
319
+ self .connectClient ("foo" )
320
+
321
+ if "U" not in self .server_support .get ("ELIST" , "" ):
322
+ raise runner .OptionalExtensionNotSupported ("ELIST=U" )
323
+
324
+ if "TARGMAX" in self .server_support :
325
+ for item in (self .server_support ["TARGMAX" ]).split ("," ):
326
+ (command , max_ ) = item .split (":" , 1 )
327
+ if command == "LIST" and int (max_ or "1000" ) < 2 :
328
+ raise runner .OptionalExtensionNotSupported ("TARGMAX=LIST >= 2" )
329
+
330
+ self .sendLine (1 , "JOIN #chan1" )
331
+ self .getMessages (1 )
332
+ self .sendLine (1 , "JOIN #chan2" )
333
+ self .getMessages (1 )
334
+
335
+ self .connectClient ("bar" )
336
+ self .sendLine (2 , "JOIN #chan2" )
337
+ self .getMessages (2 )
338
+
339
+ self .connectClient ("baz" )
340
+
341
+ self .sendLine (3 , "LIST #chan1,#chan2 >0" )
342
+ self .assertEqual (self ._parseChanList (3 ), {"#chan1" , "#chan2" })
343
+
344
+ self .sendLine (3 , "LIST #chan1,#chan2 <1" )
345
+ self .assertEqual (self ._parseChanList (3 ), set ())
346
+
241
347
242
348
class FaketimeListTestCase (_BasedListTestCase ):
243
349
faketime = "+1y x30" # for every wall clock second, 1 minute passed for the server
0 commit comments