Skip to content

Commit

Permalink
Expose stable line ID when provided by the relay
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoran committed Dec 7, 2024
1 parent 83c5039 commit 3bdc6c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.ubergeek42.weechat.ColorScheme


open class Line(
@JvmField val id: Int?,
@JvmField val pointer: Long,
@JvmField val type: LineSpec.Type,
@JvmField val timestamp: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private val TITLE_LINE_POINTER = ++fakePointerCounter


open class FakeLine(pointer: Long) : Line(
pointer, LineSpec.Type.Other,
null, pointer, LineSpec.Type.Other,
timestamp = 0, rawPrefix = "", rawMessage = "",
nick = null, isVisible = false, isHighlighted = false,
LineSpec.DisplayAs.Unspecified, LineSpec.NotifyLevel.Low)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/ubergeek42/WeechatAndroid/relay/Spec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class HotlistSpec(entry: HdataEntry) {
@JvmInline value class LineSpec(val entry: HdataEntry) {
inline val bufferPointer: Long get() = entry.getPointerLong("buffer")

inline val id: Int? get() = entry.getIntOrNull("id")
inline val pointer: Long get() = entry.pointerLong
inline val timestamp: Long get() = entry.getItem("date").asTime().time
inline val prefix: String? get() = entry.getStringOrNull("prefix")
Expand All @@ -170,7 +171,7 @@ class HotlistSpec(entry: HdataEntry) {
companion object {
fun makeLastLinesRequest(id: String, pointer: Long, numberOfLines: Int) =
"($id) hdata buffer:${pointer.as0x}/own_lines/last_line(-$numberOfLines)/data " +
"date,displayed,prefix,message,highlight,notify,tags_array"
"id,date,displayed,prefix,message,highlight,notify,tags_array"
}

fun toLine(): Line {
Expand Down Expand Up @@ -249,7 +250,7 @@ class HotlistSpec(entry: HdataEntry) {
}
}

return Line(pointer, type,
return Line(id, pointer, type,
timestamp, prefix ?: "", message ?: "",
nick,
visible, highlight,
Expand Down

0 comments on commit 3bdc6c5

Please sign in to comment.