refactor status message

This commit is contained in:
Green Sky 2024-04-22 21:45:34 +02:00
parent 7710da6c89
commit e8b069c803
No known key found for this signature in database
2 changed files with 20 additions and 5 deletions

View File

@ -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?)

View File

@ -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