@@ -2211,7 +2211,7 @@ static GSList *parse_eflp(const unsigned char *eflp, int length)
GSList *ret = NULL;
for (i = 0; i < length; i++) {
- if (iso639_2_from_language(eflp[i], code) == FALSE)
+ if (!iso639_2_from_language(eflp[i], code))
continue;
ret = g_slist_prepend(ret, g_strdup(code));
@@ -3937,117 +3937,6 @@ gboolean cbs_extract_app_port(const struct cbs *cbs, int *dst, int *src,
return extract_app_port_common(&iter, dst, src, is_8bit);
}
-gboolean iso639_2_from_language(enum cbs_language lang, char *iso639)
-{
- switch (lang) {
- case CBS_LANGUAGE_GERMAN:
- iso639[0] = 'd';
- iso639[1] = 'e';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_ENGLISH:
- iso639[0] = 'e';
- iso639[1] = 'n';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_ITALIAN:
- iso639[0] = 'i';
- iso639[1] = 't';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_FRENCH:
- iso639[0] = 'f';
- iso639[1] = 'r';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_SPANISH:
- iso639[0] = 'e';
- iso639[1] = 's';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_DUTCH:
- iso639[0] = 'n';
- iso639[1] = 'l';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_SWEDISH:
- iso639[0] = 's';
- iso639[1] = 'v';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_DANISH:
- iso639[0] = 'd';
- iso639[1] = 'a';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_PORTUGESE:
- iso639[0] = 'p';
- iso639[1] = 't';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_FINNISH:
- iso639[0] = 'f';
- iso639[1] = 'i';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_NORWEGIAN:
- iso639[0] = 'n';
- iso639[1] = 'o';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_GREEK:
- iso639[0] = 'e';
- iso639[1] = 'l';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_TURKISH:
- iso639[0] = 't';
- iso639[1] = 'r';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_HUNGARIAN:
- iso639[0] = 'h';
- iso639[1] = 'u';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_POLISH:
- iso639[0] = 'p';
- iso639[1] = 'l';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_CZECH:
- iso639[0] = 'c';
- iso639[1] = 's';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_HEBREW:
- iso639[0] = 'h';
- iso639[1] = 'e';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_ARABIC:
- iso639[0] = 'a';
- iso639[1] = 'r';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_RUSSIAN:
- iso639[0] = 'r';
- iso639[1] = 'u';
- iso639[2] = '\0';
- return TRUE;
- case CBS_LANGUAGE_ICELANDIC:
- iso639[0] = 'i';
- iso639[1] = 's';
- iso639[2] = '\0';
- return TRUE;
- default:
- iso639[0] = '\0';
- break;
- }
-
- return FALSE;
-}
-
char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
{
GSList *l;
@@ -19,6 +19,8 @@
*
*/
+enum cbs_language;
+
#define CBS_MAX_GSM_CHARS 93
#define SMS_MSGID_LEN 20
@@ -196,30 +198,6 @@ enum sms_pid_type {
SMS_PID_TYPE_USIM_DOWNLOAD = 0x7f,
};
-enum cbs_language {
- CBS_LANGUAGE_GERMAN = 0x0,
- CBS_LANGUAGE_ENGLISH = 0x1,
- CBS_LANGUAGE_ITALIAN = 0x2,
- CBS_LANGUAGE_FRENCH = 0x3,
- CBS_LANGUAGE_SPANISH = 0x4,
- CBS_LANGUAGE_DUTCH = 0x5,
- CBS_LANGUAGE_SWEDISH = 0x6,
- CBS_LANGUAGE_DANISH = 0x7,
- CBS_LANGUAGE_PORTUGESE = 0x8,
- CBS_LANGUAGE_FINNISH = 0x9,
- CBS_LANGUAGE_NORWEGIAN = 0xA,
- CBS_LANGUAGE_GREEK = 0xB,
- CBS_LANGUAGE_TURKISH = 0xC,
- CBS_LANGUAGE_HUNGARIAN = 0xD,
- CBS_LANGUAGE_POLISH = 0xE,
- CBS_LANGUAGE_UNSPECIFIED = 0xF,
- CBS_LANGUAGE_CZECH = 0x20,
- CBS_LANGUAGE_HEBREW = 0x21,
- CBS_LANGUAGE_ARABIC = 0x22,
- CBS_LANGUAGE_RUSSIAN = 0x23,
- CBS_LANGUAGE_ICELANDIC = 0x24
-};
-
enum cbs_geo_scope {
CBS_GEO_SCOPE_CELL_IMMEDIATE,
CBS_GEO_SCOPE_PLMN,
@@ -576,7 +554,6 @@ gboolean cbs_dcs_decode(guint8 dcs, gboolean *udhi, enum sms_class *cls,
enum sms_charset *charset, gboolean *compressed,
enum cbs_language *language, gboolean *iso639);
-gboolean iso639_2_from_language(enum cbs_language lang, char *iso639);
gboolean cbs_decode(const unsigned char *pdu, int len, struct cbs *out);
gboolean cbs_encode(const struct cbs *cbs, int *len, unsigned char *pdu);
gboolean cbs_extract_app_port(const struct cbs *cbs, int *dst, int *src,
@@ -3753,3 +3753,114 @@ unsigned char *convert_ucs2_to_gsm(const unsigned char *text, long len,
GSM_DIALECT_DEFAULT,
GSM_DIALECT_DEFAULT);
}
+
+bool iso639_2_from_language(enum cbs_language lang, char *iso639)
+{
+ switch (lang) {
+ case CBS_LANGUAGE_GERMAN:
+ iso639[0] = 'd';
+ iso639[1] = 'e';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_ENGLISH:
+ iso639[0] = 'e';
+ iso639[1] = 'n';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_ITALIAN:
+ iso639[0] = 'i';
+ iso639[1] = 't';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_FRENCH:
+ iso639[0] = 'f';
+ iso639[1] = 'r';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_SPANISH:
+ iso639[0] = 'e';
+ iso639[1] = 's';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_DUTCH:
+ iso639[0] = 'n';
+ iso639[1] = 'l';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_SWEDISH:
+ iso639[0] = 's';
+ iso639[1] = 'v';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_DANISH:
+ iso639[0] = 'd';
+ iso639[1] = 'a';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_PORTUGESE:
+ iso639[0] = 'p';
+ iso639[1] = 't';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_FINNISH:
+ iso639[0] = 'f';
+ iso639[1] = 'i';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_NORWEGIAN:
+ iso639[0] = 'n';
+ iso639[1] = 'o';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_GREEK:
+ iso639[0] = 'e';
+ iso639[1] = 'l';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_TURKISH:
+ iso639[0] = 't';
+ iso639[1] = 'r';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_HUNGARIAN:
+ iso639[0] = 'h';
+ iso639[1] = 'u';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_POLISH:
+ iso639[0] = 'p';
+ iso639[1] = 'l';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_CZECH:
+ iso639[0] = 'c';
+ iso639[1] = 's';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_HEBREW:
+ iso639[0] = 'h';
+ iso639[1] = 'e';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_ARABIC:
+ iso639[0] = 'a';
+ iso639[1] = 'r';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_RUSSIAN:
+ iso639[0] = 'r';
+ iso639[1] = 'u';
+ iso639[2] = '\0';
+ return true;
+ case CBS_LANGUAGE_ICELANDIC:
+ iso639[0] = 'i';
+ iso639[1] = 's';
+ iso639[2] = '\0';
+ return true;
+ default:
+ iso639[0] = '\0';
+ break;
+ }
+
+ return false;
+}
@@ -38,6 +38,30 @@ enum gsm_dialect {
GSM_DIALECT_URDU,
};
+enum cbs_language {
+ CBS_LANGUAGE_GERMAN = 0x0,
+ CBS_LANGUAGE_ENGLISH = 0x1,
+ CBS_LANGUAGE_ITALIAN = 0x2,
+ CBS_LANGUAGE_FRENCH = 0x3,
+ CBS_LANGUAGE_SPANISH = 0x4,
+ CBS_LANGUAGE_DUTCH = 0x5,
+ CBS_LANGUAGE_SWEDISH = 0x6,
+ CBS_LANGUAGE_DANISH = 0x7,
+ CBS_LANGUAGE_PORTUGESE = 0x8,
+ CBS_LANGUAGE_FINNISH = 0x9,
+ CBS_LANGUAGE_NORWEGIAN = 0xA,
+ CBS_LANGUAGE_GREEK = 0xB,
+ CBS_LANGUAGE_TURKISH = 0xC,
+ CBS_LANGUAGE_HUNGARIAN = 0xD,
+ CBS_LANGUAGE_POLISH = 0xE,
+ CBS_LANGUAGE_UNSPECIFIED = 0xF,
+ CBS_LANGUAGE_CZECH = 0x20,
+ CBS_LANGUAGE_HEBREW = 0x21,
+ CBS_LANGUAGE_ARABIC = 0x22,
+ CBS_LANGUAGE_RUSSIAN = 0x23,
+ CBS_LANGUAGE_ICELANDIC = 0x24
+};
+
char *convert_gsm_to_utf8(const unsigned char *text, long len, long *items_read,
long *items_written, unsigned char terminator);
@@ -105,3 +129,5 @@ unsigned char *convert_ucs2_to_gsm_with_lang(const unsigned char *text,
unsigned char *convert_ucs2_to_gsm(const unsigned char *text, long len,
long *items_read, long *items_written,
unsigned char terminator);
+
+bool iso639_2_from_language(enum cbs_language lang, char *iso639);