[calls/consistent_log_domain] notifier: Explicitly handle unknown callers



commit 4c0e8d6d5b971c0505b499321ccf7d4537e52f2e
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date:   Fri Jun 18 11:47:21 2021 +0200

    notifier: Explicitly handle unknown callers
    
    Closes #288

 src/calls-notifier.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/calls-notifier.c b/src/calls-notifier.c
index 7551f3f3..f2bedad6 100644
--- a/src/calls-notifier.c
+++ b/src/calls-notifier.c
@@ -49,24 +49,28 @@ notify (CallsNotifier *self, CallsCall *call)
   g_autofree gchar *ref = NULL;
   g_autofree gchar *label_callback = NULL;
   const char *name;
+  const char *number;
 
   contact = calls_call_get_contact (call);
   // TODO: We need to update the notification when the contact name changes
   name = calls_best_match_get_name (contact);
+  number = calls_call_get_number (call);
 
   if (calls_best_match_has_individual (contact))
     msg = g_strdup_printf (_("Missed call from <b>%s</b>"), name);
+  else if (number)
+    msg = g_strdup_printf (_("Missed call from %s"), number);
   else
-    msg = g_strdup_printf (_("Missed call from %s"), calls_call_get_number (call));
+    msg = g_strdup (_("Missed call from unknown caller"));
 
   g_notification_set_body (notification, msg);
 
-  if (calls_call_get_number (call)) {
-    label_callback = g_strdup_printf ("app.dial::%s", calls_call_get_number (call));
+  if (number) {
+    label_callback = g_strdup_printf ("app.dial::%s", number);
     g_notification_add_button (notification, _("Call back"), label_callback);
   }
 
-  ref = g_strdup_printf ("missed-call-%s", calls_call_get_number (call) ?: "unknown");
+  ref = g_strdup_printf ("missed-call-%s", number ?: "unknown");
   g_application_send_notification (app, ref, notification);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]