changeset 9935:bb0c04ebcdef

[gaim-migrate @ 10827] Someone should make this work so I don't have to #if 0 it out. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 02 Sep 2004 04:47:16 +0000
parents 31fddde685dd
children 3578cec797db
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 49 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Thu Sep 02 04:33:48 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Sep 02 04:47:16 2004 +0000
@@ -296,6 +296,8 @@
 static void oscar_set_info(GaimConnection *gc, const char *text);
 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message);
 
+static void recent_buddies_cb(const char *name, GaimPrefType type, gpointer value, gpointer data);
+
 static void oscar_free_name_data(struct name_data *data) {
 	g_free(data->name);
 	g_free(data->nick);
@@ -1717,6 +1719,9 @@
 	od->sess = sess;
 	sess->aux_data = gc;
 
+	/* Connect to core Gaim signals */
+	gaim_prefs_connect_callback("/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc);
+
 	conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
 	if (conn == NULL) {
 		gaim_debug_error("oscar",
@@ -7283,6 +7288,42 @@
 	oscar_direct_im_destroy(od, dim);
 }
 
+static void
+recent_buddies_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
+{
+	GaimConnection *gc = data;
+	OscarData *od = gc->proto_data;
+	aim_session_t *sess = od->sess;
+	fu32_t presence;
+
+	presence = aim_ssi_getpresence(sess->ssi.local);
+
+	if (value) {
+		presence |= 0x00400000;
+		aim_ssi_setpresence(sess, presence);
+	} else {
+		presence &= 0xFFBFFFFF;
+		aim_ssi_setpresence(sess, presence);
+	}
+}
+
+static GaimPluginPrefFrame *
+get_plugin_pref_frame(GaimPlugin *plugin) {
+	GaimPluginPrefFrame *frame;
+	GaimPluginPref *ppref;
+
+	frame = gaim_plugin_pref_frame_new();
+
+	ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/recent_buddies", _("Use recent buddies group"));
+	gaim_plugin_pref_frame_add(frame, ppref);
+
+	/* XXX - Why doesn't the following show up? */
+	ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/show_idle", _("Show how long you have been idle"));
+	gaim_plugin_pref_frame_add(frame, ppref);
+
+	return frame;
+}
+
 static GaimPluginProtocolInfo prpl_info =
 {
 	GAIM_PRPL_API_VERSION,
@@ -7352,6 +7393,10 @@
 	oscar_send_file			/* send_file */
 };
 
+static GaimPluginUiInfo prefs_info = {
+	get_plugin_pref_frame
+};
+
 static GaimPluginInfo info =
 {
 	GAIM_PLUGIN_API_VERSION,                          /**< api_version    */
@@ -7377,7 +7422,7 @@
 
 	NULL,                                             /**< ui_info        */
 	&prpl_info,                                       /**< extra_info     */
-	NULL,
+	&prefs_info,                                      /**< prefs_info     */
 	oscar_actions
 };
 
@@ -7396,6 +7441,9 @@
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 
 	my_protocol = plugin;
+
+	gaim_prefs_add_none("/plugins/prpl/oscar");
+	gaim_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE);
 }
 
 GAIM_INIT_PLUGIN(oscar, init_plugin, info);