core: commands to set chat notification settings (#946)

* core: commands to set chat notification settings

* add API
This commit is contained in:
Evgeny Poberezkin
2022-08-19 15:17:05 +01:00
committed by GitHub
parent 3221c0abb5
commit 70168967a3
13 changed files with 146 additions and 56 deletions
@@ -460,6 +460,7 @@ class Contact(
val profile: Profile,
val activeConn: Connection,
val viaGroup: Long? = null,
// val chatSettings: ChatSettings,
override val createdAt: Instant,
override val updatedAt: Instant
): SomeChat, NamedChat {
@@ -540,6 +541,7 @@ class GroupInfo (
override val localDisplayName: String,
val groupProfile: GroupProfile,
val membership: GroupMember,
// val chatSettings: ChatSettings,
override val createdAt: Instant,
override val updatedAt: Instant
): SomeChat, NamedChat {
@@ -1136,6 +1136,7 @@ sealed class CC {
class SetUserSMPServers(val smpServers: List<String>): CC()
class APISetNetworkConfig(val networkConfig: NetCfg): CC()
class APIGetNetworkConfig: CC()
class APISetChatSettings(val type: ChatType, val id: Long, val chatSettings: ChatSettings): CC()
class APIContactInfo(val contactId: Long): CC()
class APIGroupMemberInfo(val groupId: Long, val groupMemberId: Long): CC()
class AddContact: CC()
@@ -1186,6 +1187,7 @@ sealed class CC {
is SetUserSMPServers -> "/smp_servers ${smpServersStr(smpServers)}"
is APISetNetworkConfig -> "/_network ${json.encodeToString(networkConfig)}"
is APIGetNetworkConfig -> "/network"
is APISetChatSettings -> "/_settings ${chatRef(type, id)} ${json.encodeToString(chatSettings)}"
is APIContactInfo -> "/_info @$contactId"
is APIGroupMemberInfo -> "/_info #$groupId $groupMemberId"
is AddContact -> "/connect"
@@ -1237,6 +1239,7 @@ sealed class CC {
is SetUserSMPServers -> "setUserSMPServers"
is APISetNetworkConfig -> "/apiSetNetworkConfig"
is APIGetNetworkConfig -> "/apiGetNetworkConfig"
is APISetChatSettings -> "/apiSetChatSettings"
is APIContactInfo -> "apiContactInfo"
is APIGroupMemberInfo -> "apiGroupMemberInfo"
is AddContact -> "addContact"
@@ -1348,6 +1351,11 @@ data class KeepAliveOpts(
}
}
@Serializable
data class ChatSettings(
val enableNtfs: Boolean
)
val json = Json {
prettyPrint = true
ignoreUnknownKeys = true