summaryrefslogtreecommitdiff
path: root/pcr/tootle/handle-unknown-message-types.patch
blob: 4653b267519998ff0ed4032c4580a27f3ff9f139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/src/API/NotificationType.vala b/src/API/NotificationType.vala
index 53598b5..25c2b2c 100644
--- a/src/API/NotificationType.vala
+++ b/src/API/NotificationType.vala
@@ -4,7 +4,8 @@ public enum Tootle.NotificationType {
     FAVORITE,
     FOLLOW,
     FOLLOW_REQUEST,  // Internal
-    WATCHLIST;       // Internal
+    WATCHLIST,       // Internal
+    UNKNOWN;         // Fallback
 
     public string to_string() {
         switch (this) {
@@ -20,8 +21,9 @@ public enum Tootle.NotificationType {
                 return "follow_request";
             case WATCHLIST:
                 return "watchlist";
+            case UNKNOWN:
             default:
-                assert_not_reached();
+                return "unknown";
         }
     }
     
@@ -39,8 +41,9 @@ public enum Tootle.NotificationType {
                 return FOLLOW_REQUEST;
             case "watchlist":
                 return WATCHLIST;
+            case "unknown":
             default:
-                assert_not_reached();
+                return UNKNOWN;
         }
     }
         
@@ -58,6 +61,8 @@ public enum Tootle.NotificationType {
                 return _("<a href=\"%s\"><b>%s</b></a> wants to follow you").printf (account.url, account.display_name);
             case WATCHLIST:
                 return _("<a href=\"%s\"><b>%s</b></a> posted a toot").printf (account.url, account.display_name);
+            case UNKNOWN:
+                return _("<a href=\"%s\"><b>%s</b></a> posted an unrecognized type of message").printf (account.url, account.display_name);
             default:
                 assert_not_reached();
         }
@@ -75,8 +80,9 @@ public enum Tootle.NotificationType {
             case FOLLOW:
             case FOLLOW_REQUEST:
                 return "contact-new-symbolic";
+            case UNKNOWN:
             default:
-                assert_not_reached();
+                return "dialog-warning";
         }
     }