Skip to content
Snippets Groups Projects
Verified Commit cfe5a1d4 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Minor fixes

parent dd5d861e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -32,7 +32,7 @@ enum class ExtendedFeature {
/** IRC server custom message rate limits */
CustomRateLimits,
// Currently not supported
// DccFileTransfer,
DccFileTransfer,
/** Timestamp formatting in away (e.g. %%hh:mm%%) */
AwayFormatTimestamp,
/** Whether or not the core supports auth backends. */
......
......@@ -31,8 +31,7 @@ import de.kuschku.libquassel.util.flag.Flags
*
* This list should be cleaned up after every protocol break, as we can assume them to be present then.
*/
enum class LegacyFeature(override val bit: Int) :
Flag<LegacyFeature> {
enum class LegacyFeature(override val bit: Int) : Flag<LegacyFeature> {
SynchronizedMarkerLine(0x0001),
SaslAuthentication(0x0002),
SaslExternal(0x0004),
......@@ -62,7 +61,6 @@ enum class LegacyFeature(override val bit: Int) :
companion object : Flags.Factory<LegacyFeature> {
override val NONE: Flags<LegacyFeature> = LegacyFeature.of()
val validValues = values().filter { it.bit != 0 }.toTypedArray()
override fun of(bit: Int) = Flags.of<LegacyFeature>(bit)
override fun of(vararg flags: LegacyFeature) = Flags.of(*flags)
override fun of(flags: Iterable<LegacyFeature>) = Flags.of(flags)
......
......@@ -40,6 +40,10 @@ class QuasselFeatures(
companion object {
fun empty() = QuasselFeatures(emptySet(), emptySet())
fun all() = QuasselFeatures(ExtendedFeature.values().toSet(), emptySet())
fun all() = QuasselFeatures(
// Dcc is disabled
ExtendedFeature.values().toSet() - ExtendedFeature.DccFileTransfer,
emptySet()
)
}
}
......@@ -19,10 +19,7 @@
package de.kuschku.libquassel.protocol.primitive.serializer
import de.kuschku.libquassel.protocol.Buffer_Type
import de.kuschku.libquassel.protocol.Message
import de.kuschku.libquassel.protocol.Message_Flag
import de.kuschku.libquassel.protocol.Message_Type
import de.kuschku.libquassel.protocol.*
import de.kuschku.libquassel.quassel.BufferInfo
import de.kuschku.libquassel.quassel.QuasselFeatures
import de.kuschku.libquassel.util.roundTrip
......@@ -58,13 +55,13 @@ class MessageSerializerTest {
@Test
fun testNormalNoFeatures() {
val value = Message(
Int.MAX_VALUE,
Int.MAX_VALUE.toLong(),
Instant.ofEpochMilli(1524601750000),
Message_Type.of(*Message_Type.values()),
Message_Flag.of(*Message_Flag.values()),
BufferInfo(
Int.MAX_VALUE,
Int.MAX_VALUE,
BufferId.MAX_VALUE,
NetworkId.MAX_VALUE,
Buffer_Type.of(*Buffer_Type.validValues),
Int.MAX_VALUE,
"äẞ\u0000\uFFFF"
......@@ -106,13 +103,13 @@ class MessageSerializerTest {
@Test
fun testNormalAllFeatures() {
val value = Message(
Int.MAX_VALUE,
MsgId.MAX_VALUE,
Instant.ofEpochMilli(1524601750000),
Message_Type.of(*Message_Type.values()),
Message_Flag.of(*Message_Flag.values()),
BufferInfo(
Int.MAX_VALUE,
Int.MAX_VALUE,
BufferId.MAX_VALUE,
NetworkId.MAX_VALUE,
Buffer_Type.of(*Buffer_Type.validValues),
Int.MAX_VALUE,
"äẞ\u0000\uFFFF"
......@@ -130,13 +127,13 @@ class MessageSerializerTest {
@Test
fun testExtremeAllFeatures() {
val value = Message(
Int.MAX_VALUE,
MsgId.MAX_VALUE,
Instant.ofEpochMilli(Int.MAX_VALUE * 10000L),
Message_Type.of(*Message_Type.values()),
Message_Flag.of(*Message_Flag.values()),
BufferInfo(
Int.MAX_VALUE,
Int.MAX_VALUE,
BufferId.MAX_VALUE,
NetworkId.MAX_VALUE,
Buffer_Type.of(*Buffer_Type.validValues),
Int.MAX_VALUE,
"äẞ\u0000\uFFFF"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment