refactor status message
This commit is contained in:
parent
7710da6c89
commit
e8b069c803
@ -14,7 +14,7 @@ namespace Contact::Components {
|
|||||||
struct TagSelfStrong {};
|
struct TagSelfStrong {};
|
||||||
|
|
||||||
// root node contact (like an account)
|
// root node contact (like an account)
|
||||||
struct TagRoot {};
|
struct TagRoot {};
|
||||||
// hint to display this contact in the contact list
|
// hint to display this contact in the contact list
|
||||||
struct TagBig {};
|
struct TagBig {};
|
||||||
|
|
||||||
@ -88,9 +88,24 @@ namespace Contact::Components {
|
|||||||
} state = disconnected;
|
} state = disconnected;
|
||||||
};
|
};
|
||||||
|
|
||||||
// status message
|
struct StatusText {
|
||||||
struct StatusMessage {
|
// aka status message
|
||||||
std::string msg;
|
std::string text;
|
||||||
|
|
||||||
|
// how much of the beginning of the text is the first line
|
||||||
|
size_t first_line_length {0u};
|
||||||
|
|
||||||
|
void fillFirstLineLength(void) {
|
||||||
|
first_line_length = 0u;
|
||||||
|
// find end of line
|
||||||
|
for (const auto c : text) {
|
||||||
|
if (c == '\n' || c == '\0') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
first_line_length++;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// last seen (not disconnected?)
|
// last seen (not disconnected?)
|
||||||
|
@ -36,7 +36,7 @@ DEFINE_COMP_ID(Contact::Components::TagAvatarInvalidate)
|
|||||||
DEFINE_COMP_ID(Contact::Components::AvatarMemory)
|
DEFINE_COMP_ID(Contact::Components::AvatarMemory)
|
||||||
DEFINE_COMP_ID(Contact::Components::AvatarFile)
|
DEFINE_COMP_ID(Contact::Components::AvatarFile)
|
||||||
DEFINE_COMP_ID(Contact::Components::ConnectionState)
|
DEFINE_COMP_ID(Contact::Components::ConnectionState)
|
||||||
DEFINE_COMP_ID(Contact::Components::StatusMessage)
|
DEFINE_COMP_ID(Contact::Components::StatusText)
|
||||||
|
|
||||||
#undef DEFINE_COMP_ID
|
#undef DEFINE_COMP_ID
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user