Add time_zone config option

This commit is contained in:
Joscha 2024-01-03 02:05:49 +01:00
parent 956d3013ea
commit c286e0244c
2 changed files with 31 additions and 4 deletions

View file

@ -17,6 +17,7 @@ Procedure when bumping the version number:
### Added ### Added
- Support for multiple euph server domains - Support for multiple euph server domains
- `time_zone` config option
- `--domain` option to `cove export` command - `--domain` option to `cove export` command
- `--domain` option to `cove clear-cookies` command - `--domain` option to `cove clear-cookies` command
- Domain field to "connect to new room" popup - Domain field to "connect to new room" popup

View file

@ -77,18 +77,40 @@ pub struct Config {
/// Initial sort order of rooms list. /// Initial sort order of rooms list.
/// ///
/// `alphabet` sorts rooms in alphabetic order. /// `"alphabet"` sorts rooms in alphabetic order.
/// ///
/// `importance` sorts rooms by the following criteria (in descending order /// `"importance"` sorts rooms by the following criteria (in descending
/// of priority): /// order of priority):
/// ///
/// 1. connected rooms before unconnected rooms /// 1. connected rooms before unconnected rooms
/// 2. rooms with unread messages before rooms without /// 2. rooms with unread messages before rooms without
/// 3. alphabetic order /// 3. alphabetic order
#[serde(default)] #[serde(default)]
#[document(default = "`alphabet`")] #[document(default = "`\"alphabet\"`")]
pub rooms_sort_order: RoomsSortOrder, pub rooms_sort_order: RoomsSortOrder,
/// Time zone that chat timestamps should be displayed in.
///
/// This option is interpreted as a POSIX TZ string. It is described here in
/// further detail:
/// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
///
/// On a normal system, the string `"localtime"` as well as any value from
/// the "TZ identifier" column of the following wikipedia article should be
/// valid TZ strings:
/// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
///
/// If the option is not specified, cove uses the contents of the `TZ`
/// environment variable instead. If the `TZ` environment variable does not
/// exist, cove uses the system's local time zone.
///
/// **Warning:** On Windows, cove can't get the local time zone and uses UTC
/// instead. However, you can still specify a path to a tz data file or a
/// custom time zone string.
#[serde(default)]
#[document(default = "$TZ or local time zone")]
pub time_zone: Option<String>,
#[serde(default)] #[serde(default)]
#[document(no_default)] #[document(no_default)]
pub euph: Euph, pub euph: Euph,
@ -115,4 +137,8 @@ impl Config {
} }
EuphRoom::default() EuphRoom::default()
} }
pub fn time_zone_ref(&self) -> Option<&str> {
self.time_zone.as_ref().map(|s| s as &str)
}
} }