Skip to content

Commit

Permalink
ref: Remove the "robot" flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Dec 10, 2024
1 parent 707414f commit 9eb6c5e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ interface ChatRoomMember {
/** The last [Presence] packet received for this member (or null it if no presence has been received yet) */
val presence: Presence?

val isRobot: Boolean
val isJigasi: Boolean
val isTranscriber: Boolean
val isJibri: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ class ChatRoomMemberImpl(
}
private set

private var robot = false
override val isRobot: Boolean
get() {
// Jigasi and Jibri do not use the "robot" signaling, but semantically they should be considered "robots".
return robot || isJigasi || isJibri
}

private fun updateSourceInfo(presence: Presence) {
val sourceInfo = presence.getExtension<StandardExtensionElement>("SourceInfo", "jabber:client")
if (sourceInfo == null) {
Expand Down Expand Up @@ -156,13 +149,6 @@ class ChatRoomMemberImpl(

val firstPresence = (this.presence == null)
this.presence = presence
presence.getExtension(UserInfoPacketExt::class.java)?.let {
val newStatus = it.isRobot
if (newStatus != null && robot != newStatus) {
logger.debug { "robot: $robot" }
robot = newStatus
}
}

presence.getExtension(CapsExtension::class.java)?.let {
capsNodeVer = "${it.node}#${it.ver}"
Expand Down Expand Up @@ -273,9 +259,9 @@ class ChatRoomMemberImpl(
this["region"] = region.toString()
this["occupant_jid"] = occupantJid.toString()
this["jid"] = jid.toString()
this["robot"] = robot
this["is_jibri"] = isJibri
this["is_jigasi"] = isJigasi
this["is_transcriber"] = isTranscriber
this["role"] = role.toString()
this["video_codecs"] = JSONArray().apply { videoCodecs?.let { addAll(it) } }
this["stats_id"] = statsId.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ class AutoOwnerRoleManager(chatRoom: ChatRoom) : ChatRoomRoleManager(chatRoom) {
return@add
}

owner = chatRoom.members.find { !it.isRobot && it.role.hasOwnerRights() }
owner = chatRoom.members.find { !(it.isJibri || it.isJigasi) && it.role.hasOwnerRights() }
if (owner != null) {
return@add
}

val newOwner = chatRoom.members.find { !it.isRobot && it.role != MemberRole.VISITOR }
val newOwner = chatRoom.members.find { !(it.isJibri || it.isJigasi) && it.role != MemberRole.VISITOR }
if (newOwner != null) {
logger.info("Electing new owner: $newOwner")
chatRoom.grantOwnership(newOwner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class JibriChatRoomMember(
override val name: String get() = TODO("Not yet implemented")
override val jid: Jid? get() = TODO("Not yet implemented")
override val sourceInfos: Set<SourceInfo> get() = TODO("Not yet implemented")
override val isRobot: Boolean get() = TODO("Not yet implemented")
override val isJigasi: Boolean get() = TODO("Not yet implemented")
override val isTranscriber: Boolean get() = TODO("Not yet implemented")
override val isJibri: Boolean get() = TODO("Not yet implemented")
Expand Down

0 comments on commit 9eb6c5e

Please sign in to comment.