fix phonebook duplicates

This commit is contained in:
yuni 2024-10-26 22:44:39 +02:00
parent c787e7caf4
commit 52d962a6bb

View file

@ -1025,8 +1025,11 @@ pub fn handle_chat_scripts(
} }
"registercontact" => { "registercontact" => {
if CONTACTS.contains(&param1) { if CONTACTS.contains(&param1) {
prefs.contacts.push(param1.to_string()); let param1_string = param1.to_string();
if !prefs.contacts.contains(&param1_string) {
prefs.contacts.push(param1_string);
prefs.save(); prefs.save();
}
} else { } else {
error!("Can't register contact `{param1}', it doesn't exist in the chat::CONTACTS constant."); error!("Can't register contact `{param1}', it doesn't exist in the chat::CONTACTS constant.");
} }