comparison libpurple/protocols/null/nullprpl.c @ 25365:367b3ddcf5c3

propagate from branch 'im.pidgin.pidgin' (head 81aa401ac9855c99eb55a7cf91fa221860dee220) to branch 'im.pidgin.pidgin.next.minor' (head cf7b71a77c33c3e1d2f392c46d090fb936eb47b7)
author Richard Laager <rlaager@wiktel.com>
date Mon, 08 Dec 2008 17:57:09 +0000
parents 0edd1e140b6e c687fd9c379e
children 2d4f0dd04334
comparison
equal deleted inserted replaced
24656:6f41450584a7 25365:367b3ddcf5c3
218 /* 218 /*
219 * prpl functions 219 * prpl functions
220 */ 220 */
221 static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) 221 static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy)
222 { 222 {
223 /* shamelessly steal (er, borrow) the meanwhile protocol icon. it's cute! */ 223 return "null";
224 return "meanwhile";
225 }
226
227 static const char *nullprpl_list_emblem(PurpleBuddy *buddy)
228 {
229 const char* emblem;
230
231 if (get_nullprpl_gc(buddy->name)) {
232 PurplePresence *presence = purple_buddy_get_presence(buddy);
233 PurpleStatus *status = purple_presence_get_active_status(presence);
234 emblem = purple_status_get_name(status);
235 } else {
236 emblem = "offline";
237 }
238
239 purple_debug_info("nullprpl", "using emblem %s for %s's buddy %s\n",
240 emblem, buddy->account->username, buddy->name);
241 return emblem;
242 } 224 }
243 225
244 static char *nullprpl_status_text(PurpleBuddy *buddy) { 226 static char *nullprpl_status_text(PurpleBuddy *buddy) {
245 purple_debug_info("nullprpl", "getting %s's status text for %s\n", 227 purple_debug_info("nullprpl", "getting %s's status text for %s\n",
246 buddy->name, buddy->account->username); 228 buddy->name, buddy->account->username);
303 purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", 285 purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n",
304 acct->username, 286 acct->username,
305 NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); 287 NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE);
306 288
307 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL_STATUS_ONLINE, 289 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL_STATUS_ONLINE,
308 NULL_STATUS_ONLINE, TRUE); 290 NULL, TRUE);
309 purple_status_type_add_attr(type, "message", _("Online"), 291 purple_status_type_add_attr(type, "message", _("Message"),
310 purple_value_new(PURPLE_TYPE_STRING)); 292 purple_value_new(PURPLE_TYPE_STRING));
311 types = g_list_prepend(types, type); 293 types = g_list_prepend(types, type);
312 294
313 type = purple_status_type_new(PURPLE_STATUS_AWAY, NULL_STATUS_AWAY, 295 type = purple_status_type_new(PURPLE_STATUS_AWAY, NULL_STATUS_AWAY,
314 NULL_STATUS_AWAY, TRUE); 296 NULL, TRUE);
315 purple_status_type_add_attr(type, "message", _("Away"), 297 purple_status_type_add_attr(type, "message", _("Message"),
316 purple_value_new(PURPLE_TYPE_STRING)); 298 purple_value_new(PURPLE_TYPE_STRING));
317 types = g_list_prepend(types, type); 299 types = g_list_prepend(types, type);
318 300
319 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL_STATUS_OFFLINE, 301 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL_STATUS_OFFLINE,
320 NULL_STATUS_OFFLINE, TRUE); 302 NULL, TRUE);
321 purple_status_type_add_attr(type, "message", _("Offline"), 303 purple_status_type_add_attr(type, "message", _("Message"),
322 purple_value_new(PURPLE_TYPE_STRING)); 304 purple_value_new(PURPLE_TYPE_STRING));
323 types = g_list_prepend(types, type); 305 types = g_list_prepend(types, type);
324 306
325 return g_list_reverse(types); 307 return g_list_reverse(types);
326 } 308 }
1071 128, /* max_height */ 1053 128, /* max_height */
1072 10000, /* max_filesize */ 1054 10000, /* max_filesize */
1073 PURPLE_ICON_SCALE_DISPLAY, /* scale_rules */ 1055 PURPLE_ICON_SCALE_DISPLAY, /* scale_rules */
1074 }, 1056 },
1075 nullprpl_list_icon, /* list_icon */ 1057 nullprpl_list_icon, /* list_icon */
1076 nullprpl_list_emblem, /* list_emblem */ 1058 NULL, /* list_emblem */
1077 nullprpl_status_text, /* status_text */ 1059 nullprpl_status_text, /* status_text */
1078 nullprpl_tooltip_text, /* tooltip_text */ 1060 nullprpl_tooltip_text, /* tooltip_text */
1079 nullprpl_status_types, /* status_types */ 1061 nullprpl_status_types, /* status_types */
1080 nullprpl_blist_node_menu, /* blist_node_menu */ 1062 nullprpl_blist_node_menu, /* blist_node_menu */
1081 nullprpl_chat_info, /* chat_info */ 1063 nullprpl_chat_info, /* chat_info */
1128 NULL, /* new_xfer */ 1110 NULL, /* new_xfer */
1129 nullprpl_offline_message, /* offline_message */ 1111 nullprpl_offline_message, /* offline_message */
1130 NULL, /* whiteboard_prpl_ops */ 1112 NULL, /* whiteboard_prpl_ops */
1131 NULL, /* send_raw */ 1113 NULL, /* send_raw */
1132 NULL, /* roomlist_room_serialize */ 1114 NULL, /* roomlist_room_serialize */
1133 NULL, /* padding... */ 1115 NULL, /* unregister_user */
1134 NULL, 1116 NULL, /* send_attention */
1135 NULL, 1117 NULL, /* attention_types */
1136 sizeof(PurplePluginProtocolInfo), /* struct_size */ 1118 sizeof(PurplePluginProtocolInfo), /* struct_size */
1137 NULL 1119 NULL, /* get_account_text_table */
1138 }; 1120 };
1139 1121
1140 static void nullprpl_init(PurplePlugin *plugin) 1122 static void nullprpl_init(PurplePlugin *plugin)
1141 { 1123 {
1142 /* see accountopt.h for information about user splits and protocol options */ 1124 /* see accountopt.h for information about user splits and protocol options */
1143 PurpleAccountUserSplit *split = purple_account_user_split_new( 1125 PurpleAccountUserSplit *split = purple_account_user_split_new(
1144 _("Example user split (unused)"), /* text shown to user */ 1126 _("Example user split"), /* text shown to user */
1145 "default", /* default value */ 1127 "default", /* default value */
1146 '@'); /* field separator */ 1128 '@'); /* field separator */
1147 PurpleAccountOption *option = purple_account_option_string_new( 1129 PurpleAccountOption *option = purple_account_option_string_new(
1148 _("Example option (unused)"), /* text shown to user */ 1130 _("Example option"), /* text shown to user */
1149 "example", /* pref name */ 1131 "example", /* pref name */
1150 "default"); /* default value */ 1132 "default"); /* default value */
1151 1133
1152 purple_debug_info("nullprpl", "starting up\n"); 1134 purple_debug_info("nullprpl", "starting up\n");
1153 1135
1154 prpl_info.user_splits = g_list_append(NULL, split); 1136 prpl_info.user_splits = g_list_append(NULL, split);
1155 prpl_info.protocol_options = g_list_append(NULL, option); 1137 prpl_info.protocol_options = g_list_append(NULL, option);
1156 1138
1157 /* register whisper chat command, /msg */ 1139 /* register whisper chat command, /msg */
1158 purple_cmd_register("msg", 1140 purple_cmd_register("msg",
1159 "ws", /* args: recipient and message */ 1141 "ws", /* args: recipient and message */
1160 PURPLE_CMD_P_DEFAULT, /* priority */ 1142 PURPLE_CMD_P_DEFAULT, /* priority */
1161 PURPLE_CMD_FLAG_CHAT, 1143 PURPLE_CMD_FLAG_CHAT,
1162 "prpl-null", 1144 "prpl-null",
1163 send_whisper, 1145 send_whisper,
1164 "msg &lt;username&gt; &lt;message&gt;: send a private message, aka a whisper", 1146 "msg &lt;username&gt; &lt;message&gt;: send a private message, aka a whisper",
1165 NULL); /* userdata */ 1147 NULL); /* userdata */
1166 1148
1167 /* get ready to store offline messages */ 1149 /* get ready to store offline messages */
1168 goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */ 1150 goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */
1169 g_str_equal, /* key comparison fn */ 1151 g_str_equal, /* key comparison fn */
1170 g_free, /* key free fn */ 1152 g_free, /* key free fn */
1187 NULL, /* ui_requirement */ 1169 NULL, /* ui_requirement */
1188 0, /* flags */ 1170 0, /* flags */
1189 NULL, /* dependencies */ 1171 NULL, /* dependencies */
1190 PURPLE_PRIORITY_DEFAULT, /* priority */ 1172 PURPLE_PRIORITY_DEFAULT, /* priority */
1191 NULLPRPL_ID, /* id */ 1173 NULLPRPL_ID, /* id */
1192 "Nullprpl", /* name */ 1174 "Null - Testing Plugin", /* name */
1193 "0.3", /* version */ 1175 DISPLAY_VERSION, /* version */
1194 "Null Protocol Plugin", /* summary */ 1176 N_("Null Protocol Plugin"), /* summary */
1195 "Null Protocol Plugin", /* description */ 1177 N_("Null Protocol Plugin"), /* description */
1196 "Ryan Barrett <nullprpl@ryanb.org>", /* author */ 1178 NULL, /* author */
1197 "http://snarfed.org/space/pidgin+null+protocol+plugin", /* homepage */ 1179 PURPLE_WEBSITE, /* homepage */
1198 NULL, /* load */ 1180 NULL, /* load */
1199 NULL, /* unload */ 1181 NULL, /* unload */
1200 nullprpl_destroy, /* destroy */ 1182 nullprpl_destroy, /* destroy */
1201 NULL, /* ui_info */ 1183 NULL, /* ui_info */
1202 &prpl_info, /* extra_info */ 1184 &prpl_info, /* extra_info */