Commit 2b9c3c866e3b6d78facf6a0b88ef34493ad530c6
1 parent
5b539a52
Show error if Letter Sealing is enabled as it's not supported at the moment.
Showing
4 changed files
with
69 additions
and
1 deletions
libpurple/line.thrift
... | ... | @@ -86,6 +86,49 @@ enum ErrorCode { |
86 | 86 | NOT_SUPPORT_SEND_FILE = 49; |
87 | 87 | MUST_UPGRADE = 50; |
88 | 88 | NOT_AVAILABLE_PIN_CODE_SESSION = 51; |
89 | + EXPIRED_REVISION = 52; | |
90 | + NOT_YET_PHONE_NUMBER = 54; | |
91 | + BAD_CALL_NUMBER = 55; | |
92 | + UNAVAILABLE_CALL_NUMBER = 56; | |
93 | + NOT_SUPPORT_CALL_SERVICE = 57; | |
94 | + CONGESTION_CONTROL = 58; | |
95 | + NO_BALANCE = 59; | |
96 | + NOT_PERMITTED_CALLER_ID = 60; | |
97 | + NO_CALLER_ID_LIMIT_EXCEEDED = 61; | |
98 | + CALLER_ID_VERIFICATION_REQUIRED = 62; | |
99 | + NO_CALLER_ID_LIMIT_EXCEEDED_AND_VERIFICATION_REQUIRED = 63; | |
100 | + MESSAGE_NOT_FOUND = 64; | |
101 | + INVALID_ACCOUNT_MIGRATION_PINCODE_FORMAT = 65; | |
102 | + ACCOUNT_MIGRATION_PINCODE_NOT_MATCHED = 66; | |
103 | + ACCOUNT_MIGRATION_PINCODE_BLOCKED = 67; | |
104 | + INVALID_PASSWORD_FORMAT = 69; | |
105 | + FEATURE_RESTRICTED = 70; | |
106 | + MESSAGE_NOT_DESTRUCTIBLE = 71; | |
107 | + PAID_CALL_REDEEM_FAILED = 72; | |
108 | + PREVENTED_JOIN_BY_TICKET = 73; | |
109 | + SEND_MESSAGE_NOT_PERMITTED_FROM_LINE_AT = 75; | |
110 | + SEND_MESSAGE_NOT_PERMITTED_WHILE_AUTO_REPLY = 76; | |
111 | + SECURITY_CENTER_NOT_VERIFIED = 77; | |
112 | + SECURITY_CENTER_BLOCKED_BY_SETTING = 78; | |
113 | + SECURITY_CENTER_BLOCKED = 79; | |
114 | + TALK_PROXY_EXCEPTION = 80; | |
115 | + E2EE_INVALID_PROTOCOL = 81; | |
116 | + E2EE_RETRY_ENCRYPT = 82; | |
117 | + E2EE_UPDATE_SENDER_KEY = 83; | |
118 | + E2EE_UPDATE_RECEIVER_KEY = 84; | |
119 | + E2EE_INVALID_ARGUMENT = 85; | |
120 | + E2EE_INVALID_VERSION = 86; | |
121 | + E2EE_SENDER_DISABLED = 87; | |
122 | + E2EE_RECEIVER_DISABLED = 88; | |
123 | + E2EE_SENDER_NOT_ALLOWED = 89; | |
124 | + E2EE_RECEIVER_NOT_ALLOWED = 90; | |
125 | + E2EE_RESEND_FAIL = 91; | |
126 | + E2EE_RESEND_OK = 92; | |
127 | + HITOKOTO_BACKUP_NO_AVAILABLE_DATA = 93; | |
128 | + E2EE_UPDATE_PRIMARY_DEVICE = 94; | |
129 | + SUCCESS = 95; | |
130 | + CANCEL = 96; | |
131 | + E2EE_PRIMARY_NOT_SUPPORT = 97 | |
89 | 132 | } |
90 | 133 | |
91 | 134 | enum IdentityProvider { | ... | ... |
libpurple/purpleline.cpp
... | ... | @@ -350,6 +350,11 @@ void PurpleLine::send_message( |
350 | 350 | acct); |
351 | 351 | |
352 | 352 | if (conv) { |
353 | + if (err.code == line::ErrorCode::E2EE_RETRY_ENCRYPT) { | |
354 | + msg = "Failed to send message: Cannot send with Letter Sealing enabled."; | |
355 | + write_e2ee_error(conv); | |
356 | + } | |
357 | + | |
353 | 358 | purple_conversation_write( |
354 | 359 | conv, |
355 | 360 | "", | ... | ... |
libpurple/purpleline.hpp
... | ... | @@ -134,6 +134,7 @@ private: |
134 | 134 | void write_message(line::Message &msg, bool replay); |
135 | 135 | void write_message(PurpleConversation *conv, std::string &from, std::string &text, |
136 | 136 | time_t mtime, int flags); |
137 | + void write_e2ee_error(PurpleConversation *conv); | |
137 | 138 | |
138 | 139 | std::string get_room_display_name(line::Room &room); |
139 | 140 | void set_chat_participants(PurpleConvChat *chat, line::Room &room); | ... | ... |
libpurple/purpleline_write.cpp
... | ... | @@ -44,6 +44,22 @@ static std::string get_sticker_url(line::Message &msg, bool thumb = false) { |
44 | 44 | return url.str(); |
45 | 45 | } |
46 | 46 | |
47 | +void PurpleLine::write_e2ee_error(PurpleConversation *conv) { | |
48 | + if (purple_conversation_get_data(conv, "line-e2ee-error-shown")) | |
49 | + return; | |
50 | + | |
51 | + purple_conversation_write( | |
52 | + conv, | |
53 | + "", | |
54 | + "Letter Sealing encryption is not supported by purple-line. As a workaround, if you do not " | |
55 | + "need end-to-end encryption, Letter Sealing can be turned off from LINE settings on " | |
56 | + "your mobile device.", | |
57 | + (PurpleMessageFlags)PURPLE_MESSAGE_ERROR, | |
58 | + time(NULL)); | |
59 | + | |
60 | + purple_conversation_set_data(conv, "line-e2ee-error-shown", GINT_TO_POINTER(1)); | |
61 | +} | |
62 | + | |
47 | 63 | void PurpleLine::write_message(line::Message &msg, bool replay) { |
48 | 64 | std::string text; |
49 | 65 | int flags = 0; |
... | ... | @@ -92,7 +108,10 @@ void PurpleLine::write_message(line::Message &msg, bool replay) { |
92 | 108 | switch (msg.contentType) { |
93 | 109 | case line::ContentType::NONE: // actually text |
94 | 110 | case line::ContentType::LOCATION: |
95 | - if (msg.__isset.location) { | |
111 | + if (msg.contentMetadata.count("e2eeVersion")) { | |
112 | + text = "<em>[Letter Sealing encrypted message]</em>"; | |
113 | + write_e2ee_error(conv); | |
114 | + } else if (msg.__isset.location) { | |
96 | 115 | line::Location &loc = msg.location; |
97 | 116 | |
98 | 117 | text = markup_escape(loc.title) | ... | ... |