comparison libpurple/protocols/myspace/myspace.c @ 18903:3159f259bbe4

Support all emoticons used in the official MySpaceIM client. Now the smile palette looks like this: http://msimprpl.darkthoughts.net/msimprpl-emoticons-palette-20070811.png
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 12 Aug 2007 02:41:54 +0000
parents 13abfc442ac6
children da2f37d232a9
comparison
equal deleted inserted replaced
18902:df1259c31bd1 18903:3159f259bbe4
48 * canonical form, as inserted by the "Smile!" dialog, first. For example, 48 * canonical form, as inserted by the "Smile!" dialog, first. For example,
49 * :) comes before :-), because although both are recognized as 'happy', 49 * :) comes before :-), because although both are recognized as 'happy',
50 * the first is inserted by the smiley button. 50 * the first is inserted by the smiley button.
51 * 51 *
52 * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */ 52 * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */
53
54 /* TODO: Use extra smileys not in default theme! Hylke is also working on
55 * some new smileys specific to MySpaceIM, use them too! */
56 static struct MSIM_EMOTICON 53 static struct MSIM_EMOTICON
57 { 54 {
58 gchar *name; 55 gchar *name;
59 gchar *symbol; 56 gchar *symbol;
60 } msim_emoticons[] = { 57 } msim_emoticons[] = {
61 { "bigsmile", ":D" }, 58 /* Unfortunately, this list duplicates much of the file
62 { "growl", ">:o" }, 59 * pidgin/pidgin/pixmaps/emotes/default/22/default.theme.in, because
63 { "growl", ">:O" }, 60 * that file is part of Pidgin, but we're part of libpurple.
64 { "mad", ":-[" }, 61 */
65 { "scared", "=-O" }, 62 { "bigsmile", ":D" },
66 { "scared", "=-o" }, 63 { "bigsmile", ":-D" },
67 { "tongue", ":P" }, 64 { "devil", "}:)" },
65 { "frazzled", ":Z" },
66 { "geek", "B)" },
67 { "googles", "%)" },
68 { "growl", ":E" },
69 { "laugh", ":))" }, /* Must be before ':)' */
70 { "happy", ":)" },
71 { "happy", ":-)" },
72 { "happi", ":)" },
73 { "heart", ":X" },
74 { "mohawk", "-:" },
75 { "mad", "X(" },
76 { "messed", "X)" },
77 { "nerd", "Q)" },
78 { "oops", ":G" },
79 { "pirate", "P)" },
80 { "scared", ":O" },
81 { "sidefrown", ":{" },
82 { "sinister", ":B" },
83 { "smirk", ":," },
84 { "straight", ":|" },
85 { "tongue", ":P" },
68 { "tongue", ":p" }, 86 { "tongue", ":p" },
69 { "devil", "O:-)" }, 87 { "tongy", ":P" },
70 { "devil", "o:-)" }, 88 { "upset", "B|" },
71 { "happy", ":)" },
72 { "happy", ":-)" },
73 { "happi", ":-)" },
74 { "messed", "8-)" },
75 { "sidefrown", ":-$" } ,
76 { "upset", ":-$" },
77 { "frazzled", ":-/" } ,
78 { "heart", ";-)" },
79 { "heart", ";)" },
80 { "nerd", "8-)"},
81 { "sinister", ":-,D" } ,
82 { "wink", ";-)" }, 89 { "wink", ";-)" },
83 { "winc", ";-)" }, 90 { "wink", ";)" },
84 { "geek", ":-X" }, 91 { "winc", ";)" },
85 { "laugh", ":-D" }, 92 { "worried", ":[" },
86 { "laugh", ":-d" }, 93 { "kiss", ":x" },
87 { "oops", ":'(" },
88 { "smirk", "8-)" },
89 { "worried", ":-(" } ,
90 { "worried", ":(" },
91 { "googles", "8-)" },
92 { "mohawk", ":-X" },
93 { "pirate", ":-)" },
94 { "straight", ":-!" },
95 { "kiss", ":-*" },
96 { NULL, NULL } 94 { NULL, NULL }
97 }; 95 };
98 96
99 /* Internal functions */ 97 /* Internal functions */
100 static void msim_send_zap(PurpleBlistNode *node, gpointer zap_num_ptr); 98 static void msim_send_zap(PurpleBlistNode *node, gpointer zap_num_ptr);
1079 msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) 1077 msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
1080 { 1078 {
1081 const gchar *name; 1079 const gchar *name;
1082 guint i; 1080 guint i;
1083 struct MSIM_EMOTICON *emote; 1081 struct MSIM_EMOTICON *emote;
1084 1082
1085 name = xmlnode_get_attrib(root, "n"); 1083 name = xmlnode_get_attrib(root, "n");
1086 if (!name) { 1084 if (!name) {
1087 purple_debug_info("msim", "msim_markup_i_to_html: <i> w/o n"); 1085 purple_debug_info("msim", "msim_markup_i_to_html: <i> w/o n");
1088 *begin = g_strdup(""); 1086 *begin = g_strdup("");
1089 *end = g_strdup(""); 1087 *end = g_strdup("");
1090 /* TODO: log as unrecognized */ 1088 /* TODO: log as unrecognized */
1091 return; 1089 return;
1092 } 1090 }
1093 1091
1092 /* Find and use canonical form of smiley symbol. */
1094 for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { 1093 for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) {
1095 gchar *name; 1094 if (!strcmp(name, emote->name)) {
1096 gchar *symbol; 1095 *begin = g_strdup(emote->symbol);
1097
1098 name = emote->name;
1099 symbol = emote->symbol;
1100
1101 if (!strcmp(name, name)) {
1102 *begin = g_strdup(symbol);
1103 *end = g_strdup(""); 1096 *end = g_strdup("");
1104 return; 1097 return;
1105 } 1098 }
1106 } 1099 }
1107 1100
1108 *begin = g_strdup(name); 1101 /* Couldn't find it, sorry. Try to degrade gracefully. */
1102 *begin = g_strdup_printf("**%s**", name);
1109 *end = g_strdup(""); 1103 *end = g_strdup("");
1110 } 1104 }
1111 1105
1112 /** Convert an individual msim markup tag to HTML. */ 1106 /** Convert an individual msim markup tag to HTML. */
1113 static void 1107 static void