当前位置: 首页>>代码示例>>C++>>正文


C++ purple_prefs_get_string函数代码示例

本文整理汇总了C++中purple_prefs_get_string函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_prefs_get_string函数的具体用法?C++ purple_prefs_get_string怎么用?C++ purple_prefs_get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了purple_prefs_get_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_screenshot_insert_menuitem_activate_cb

/**
   The user wants to insert a sreenshot.
 */
static void
on_screenshot_insert_menuitem_activate_cb (GtkWidget * screenshot_insert_menuitem,
					   PidginConversation *gtkconv) {
    PurplePlugin *plugin = purple_plugins_find_with_id (PLUGIN_ID);
   
  
    if (!strcmp (purple_prefs_get_string (PREF_SEND_TYPE), "img-ftp-http")) {
      PurpleConversation *conv = gtkconv->active_conv;
      
      /* Direct IM of image is allowed by current protocol */
      if (!(purple_conversation_get_features (conv) & PURPLE_CONNECTION_NO_IMAGES)) {
	    send_as_image (NULL, gtkconv);
      } else if (strcmp(purple_prefs_get_string (PREF_FTP_REMOTE_URL), "") && 
		 strcmp(purple_prefs_get_string (PREF_FTP_USERNAME), "") && 
		 strcmp(purple_prefs_get_string (PREF_FTP_PASSWORD), "")) {
	    send_as_ftp_link (NULL, gtkconv);
      } else if (strcmp (purple_prefs_get_string (PREF_UPLOAD_TO), HOST_DISABLED)) {
	    send_as_link (NULL, gtkconv);
      } else {
	    purple_notify_error (plugin, PLUGIN_NAME, PLUGIN_ERROR,
                                 PLUGIN_CONFIGURE_ERROR);
            plugin_stop (plugin);
      }
    }
}
开发者ID:EionRobb,项目名称:pidgin-sendscreenshot,代码行数:28,代码来源:menus.c

示例2: g_list_concat

GList *get_pending_list(guint max) {
	const char *im=purple_prefs_get_string("/plugins/gtk/gtk-sarah-barnot/im");
	const char *chat=purple_prefs_get_string(
	                                     "/plugins/gtk/gtk-sarah-barnot/chat");
	GList *l_im = NULL;
	GList *l_chat = NULL;

	
	if (im != NULL && strcmp(im, "always") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             FALSE, max);
	} else if (im != NULL && strcmp(im, "hidden") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             TRUE, max);
	}

	if (chat != NULL && strcmp(chat, "always") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_TEXT,
		                                               FALSE, max);
	} else if (chat != NULL && strcmp(chat, "nick") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_NICK,
		                                               FALSE, max);
	}

	if (l_im != NULL && l_chat != NULL)
		return g_list_concat(l_im, l_chat);
	else if (l_im != NULL)
		return l_im;
	else
		return l_chat;
}
开发者ID:moutons,项目名称:pidgin-xmonad,代码行数:35,代码来源:xmobar-notification.c

示例3: translate_receiving_chat_msg

gboolean
translate_receiving_chat_msg(PurpleAccount *account, char **sender,
                             char **message, PurpleConversation *conv,
                             PurpleMessageFlags *flags)
{
	struct TranslateConvMessage *convmsg;
	const gchar *stored_lang = "auto";
	gchar *stripped;
	const gchar *to_lang;
	PurpleChat *chat;
	const gchar *service_to_use = "";
	
	chat = purple_blist_find_chat(account, conv->name);
	service_to_use = purple_prefs_get_string(SERVICE_PREF);
	to_lang = purple_prefs_get_string(LOCALE_PREF);
	if (chat)
		stored_lang = purple_blist_node_get_string((PurpleBlistNode *)chat, DEST_LANG_SETTING);
	if (!stored_lang)
		stored_lang = "auto";
	if (!chat || !service_to_use || g_str_equal(stored_lang, "none") || g_str_equal(stored_lang, to_lang))
	{
		//Allow the message to go through as per normal
		return FALSE;
	}
	
	stripped = purple_markup_strip_html(*message);
	
	convmsg = g_new0(struct TranslateConvMessage, 1);
	convmsg->account = account;
	convmsg->sender = *sender;
	convmsg->conv = conv;
	convmsg->flags = *flags;
	
	if (g_str_equal(service_to_use, "google"))
	{
		google_translate(stripped, stored_lang, to_lang, translate_receiving_chat_msg_cb, convmsg);
	} else if (g_str_equal(service_to_use, "bing"))
	{
		bing_translate(stripped, stored_lang, to_lang, translate_receiving_chat_msg_cb, convmsg);
	}
	
	g_free(stripped);
	
	g_free(*message);
	*message = NULL;
	*sender = NULL;
	
	if (conv == NULL)
	{
		// Fake receiving a message to open the conversation window
		*message = g_strdup(" ");
		*flags |= PURPLE_MESSAGE_INVISIBLE | PURPLE_MESSAGE_NO_LOG;
		return FALSE;
	}
	
	//Cancel the message
	return TRUE;
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:58,代码来源:translate.c

示例4: get_pending_events

void get_pending_events(gboolean* unread, gboolean* important) {
	const char *im=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/im");
	const char *chat=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/chat");
	GList *l_im = NULL;
	GList *l_chat = NULL;

        *unread = FALSE;
        *important = FALSE;
	
	if (im != NULL && strcmp(im, "always") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             FALSE, 1);
	} else if (im != NULL && strcmp(im, "hidden") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             TRUE, 1);
	}

        // check for chat
	if (chat != NULL && strcmp(chat, "always") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_TEXT,
		                                               FALSE, 1);
	} else if (chat != NULL && strcmp(chat, "nick") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_NICK,
		                                               FALSE, 1);
	}

        gboolean unimportant = FALSE;

        // check for important contacts
        if (l_im != NULL && color_important != LED_NONE) {
            GList* p = l_im;

            while (p != NULL) {
                PurpleConversation* conv = (PurpleConversation*)p->data;
                if (is_important (conv->account->username))
                    *important = TRUE;
                else
                    unimportant = TRUE;
                p = p->next;
            }
        }

        if (!*important)
            unimportant = TRUE;

        if (l_im != NULL || l_chat != NULL)
            *unread = unimportant;

        if (l_im != NULL)
            g_list_free (l_im);

        if (l_chat != NULL)
            g_list_free (l_chat);
}
开发者ID:Shmuma,项目名称:HW-notifier,代码行数:58,代码来源:hwnotify.c

示例5: ggzpurple_preferences_get_frame

GtkWidget *
ggzpurple_preferences_get_frame(PurplePlugin *plugin) {

	pTable = gtk_table_new(5,5,TRUE);

	pLogin = gtk_entry_new();
	pPassword = gtk_entry_new();
	pCheckBox = gtk_check_button_new();
	pServer = gtk_entry_new();

	gtk_entry_set_visibility(GTK_ENTRY(pPassword), FALSE);


	gtk_entry_set_text(GTK_ENTRY(pLogin),purple_prefs_get_string("/plugins/gtk/ggzpurple/login"));
	gtk_entry_set_text(GTK_ENTRY(pPassword),purple_prefs_get_string("/plugins/gtk/ggzpurple/password"));
	gtk_entry_set_text(GTK_ENTRY(pServer),purple_prefs_get_string("/plugins/gtk/ggzpurple/server"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pCheckBox), purple_prefs_get_bool("/plugins/gtk/ggzpurple/guest"));


	gtk_table_attach_defaults(GTK_TABLE(pTable),gtk_label_new("Identification en 'guest' :"),0,2,1,2);
	gtk_table_attach_defaults(GTK_TABLE(pTable),gtk_label_new("Pseudo :"),0,2,2,3);
	gtk_table_attach_defaults(GTK_TABLE(pTable),gtk_label_new("Pass :"),0,2,3,4);
	gtk_table_attach_defaults(GTK_TABLE(pTable),gtk_label_new("Serveur :"),0,2,4,5);

	gtk_table_attach_defaults(GTK_TABLE(pTable),pCheckBox,3,4,1,2);
	gtk_table_attach_defaults(GTK_TABLE(pTable),pLogin,3,5,2,3);
	gtk_table_attach_defaults(GTK_TABLE(pTable),pPassword,3,5,3,4);
	gtk_table_attach_defaults(GTK_TABLE(pTable),pServer,3,5,4,5);

	//purple_prefs_set_int(pref_url, int);

	//purple_prefs_add_string(const char *name, const char *value);
	//purple_prefs_add_bool(const char *name, gboolean value);
	//purple_prefs_add_int(const char *name, int value);


	//gboolean purple_prefs_get_bool(const char *name);
	//int purple_prefs_get_int(const char *name);

	//const char *purple_prefs_get_string(const char *name);


	g_signal_connect(GTK_OBJECT(pLogin), "changed", G_CALLBACK(ggzpurple_entry_change_cb), "/plugins/gtk/ggzpurple/login");

	g_signal_connect(GTK_OBJECT(pPassword), "changed", G_CALLBACK(ggzpurple_entry_change_cb), "/plugins/gtk/ggzpurple/password");

	g_signal_connect(GTK_OBJECT(pServer), "changed", G_CALLBACK(ggzpurple_entry_change_cb), "/plugins/gtk/ggzpurple/server");

	g_signal_connect(GTK_OBJECT(pCheckBox), "clicked", G_CALLBACK(ggzpurple_checkbox_change_cb), "/plugins/gtk/ggzpurple/guest");

	gtk_widget_show_all(pTable);
	return pTable;
}
开发者ID:ralight,项目名称:ggz,代码行数:53,代码来源:simple.c

示例6: translate_receiving_im_msg

gboolean
translate_receiving_im_msg(PurpleAccount *account, char **sender,
                             char **message, PurpleConversation *conv,
                             PurpleMessageFlags *flags)
{
	struct TranslateConvMessage *convmsg;
	const gchar *stored_lang = "auto";
	gchar *stripped;
	const gchar *to_lang;
	PurpleBuddy *buddy;
	const gchar *service_to_use = "";
	
	buddy = purple_find_buddy(account, *sender);
	service_to_use = purple_prefs_get_string(SERVICE_PREF);
	to_lang = purple_prefs_get_string(LOCALE_PREF);
	if (buddy)
		stored_lang = purple_blist_node_get_string((PurpleBlistNode *)buddy, DEST_LANG_SETTING);
	if (!stored_lang)
		stored_lang = "auto";
	if (!buddy || !service_to_use || g_str_equal(stored_lang, "none") || g_str_equal(stored_lang, to_lang))
	{
		//Allow the message to go through as per normal
		return FALSE;
	}
	
	if (conv == NULL)
		conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, *sender);
	
	stripped = purple_markup_strip_html(*message);
	
	convmsg = g_new0(struct TranslateConvMessage, 1);
	convmsg->account = account;
	convmsg->sender = *sender;
	convmsg->conv = conv;
	convmsg->flags = *flags;
	
	if (g_str_equal(service_to_use, "google"))
	{
		google_translate(stripped, stored_lang, to_lang, translate_receiving_message_cb, convmsg);
	} else if (g_str_equal(service_to_use, "bing"))
	{
		bing_translate(stripped, stored_lang, to_lang, translate_receiving_message_cb, convmsg);
	}
	
	g_free(stripped);
	
	g_free(*message);
	*message = NULL;
	*sender = NULL;
	
	//Cancel the message
	return TRUE;
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:53,代码来源:translate.c

示例7: init_plugin

static void
init_plugin(PurplePlugin *plugin)
{
	gboolean dates = FALSE, ims = FALSE, chats = FALSE;

	purple_prefs_add_none(PREF_ROOT_GPPATH);
	purple_prefs_add_none(PREF_ROOT_PPATH);
	purple_prefs_add_none(PREF_ROOT_PATH);

	if(purple_prefs_exists("/plugins/core/enhanced_history/int")) {
		if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_date"), "no"))
			dates = TRUE;
		if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_im"), "no"))
			ims = TRUE;
		if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_chat"), "no"))
			chats = TRUE;

		purple_prefs_add_int(PREF_NUMBER_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/int"));
		purple_prefs_add_int(PREF_BYTES_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/bytes"));
		purple_prefs_add_int(PREF_MINS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/mins"));
		purple_prefs_add_int(PREF_HOURS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/hours"));
		purple_prefs_add_int(PREF_DAYS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/days"));
		purple_prefs_add_bool(PREF_DATES_PATH, dates);
		purple_prefs_add_bool(PREF_IM_PATH, ims);
		purple_prefs_add_bool(PREF_CHAT_PATH, chats);

		purple_prefs_remove("/plugins/core/enhanced_history/int");
		purple_prefs_remove("/plugins/core/enhanced_history/bytes");
		purple_prefs_remove("/plugins/core/enhanced_history/mins");
		purple_prefs_remove("/plugins/core/enhanced_history/hours");
		purple_prefs_remove("/plugins/core/enhanced_history/days");
		purple_prefs_remove("/plugins/core/enhanced_history/string_date");
		purple_prefs_remove("/plugins/core/enhanced_history/string_im");
		purple_prefs_remove("/plugins/core/enhanced_history/string_chat");
		purple_prefs_remove("/plugins/core/enhanced_history");
	} else {
		/* Create these prefs with sensible defaults */
		purple_prefs_add_int(PREF_NUMBER_PATH, 10);
		purple_prefs_add_int(PREF_BYTES_PATH, 4096);
		purple_prefs_add_int(PREF_MINS_PATH, 0);
		purple_prefs_add_int(PREF_HOURS_PATH, 0);
		purple_prefs_add_int(PREF_DAYS_PATH, 0);
		purple_prefs_add_bool(PREF_DATES_PATH, TRUE);
		purple_prefs_add_bool(PREF_IM_PATH, TRUE);
		purple_prefs_add_bool(PREF_CHAT_PATH, FALSE);
	}

	info.name = _("Enhanced History");
	info.summary = _("An enhanced version of the history plugin.");
	info.description = _("An enhanced versoin of the history plugin. Grants ability to "
			"select the number of previous conversations to show instead of just one.");
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:52,代码来源:enhancedhist.c

示例8: process_urls

/* Frees 'urls' */
static void
process_urls(PurpleConversation *conv, GList *urls)
{
	GList *iter;
	int c;
	FinchConv *fconv = FINCH_CONV(conv);
	GntTextView *tv = GNT_TEXT_VIEW(fconv->tv);

	for (iter = urls, c = 1; iter; iter = iter->next, c++) {
		int i;
		CbInfo *cbdata;
		gchar *url, *str;
		gchar *original_url;
		const gchar *tiny_url;

		i = gnt_text_view_get_lines_below(tv);

		original_url = purple_unescape_html((char *)iter->data);
		tiny_url = g_hash_table_lookup(tinyurl_cache, original_url);
		if (tiny_url) {
			gchar *str = g_strdup_printf("\n[%d] %s", c, tiny_url);

			g_free(original_url);
			gnt_text_view_append_text_with_flags(tv, str, GNT_TEXT_FLAG_DIM);
			if (i == 0)
				gnt_text_view_scroll(tv, 0);
			g_free(str);
			continue;
		}
		cbdata = g_new(CbInfo, 1);
		cbdata->num = c;
		cbdata->original_url = original_url;
		cbdata->tag = g_strdup_printf("%s%d", "tiny_", tag_num++);
		cbdata->conv = conv;
		if (g_ascii_strncasecmp(original_url, "http://", 7) && g_ascii_strncasecmp(original_url, "https://", 8)) {
			url = g_strdup_printf("%shttp%%3A%%2F%%2F%s", purple_prefs_get_string(PREF_URL), purple_url_encode(original_url));
		} else {
			url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(original_url));
		}
		purple_http_get(NULL, url_fetched, cbdata, url);
		str = g_strdup_printf(_("\nFetching TinyURL..."));
		gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag);
		g_free(str);
		if (i == 0)
			gnt_text_view_scroll(tv, 0);
		g_free(iter->data);
		g_free(url);
	}
	g_list_free(urls);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:51,代码来源:gnttinyurl.c

示例9: commande

PurpleCmdRet commande(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) {
	int argc,pid;
	char *joueur;
	char *jeu;
	joueur=g_strdup_printf("host%d", (int) (999.0*rand()/(RAND_MAX+1.0)));
	for(argc=0;args[argc];argc++);
	if(argc==0) {
		if(error)
			*error=g_strdup("Il faut spécifier un jeu, les jeux possibles sont(respectez la casse):\n-TicTacToe\n-Reversi\n-Chess");
		return PURPLE_CMD_RET_FAILED;
	}
	jeu=args[0];
	pid=fork();
	if(pid==0) {
		char **parms=malloc(4*sizeof(char *));
		char *sys_parm;
		if(purple_prefs_get_bool("/plugins/gtk/ggzpurple/guest"))
		 {
			parms[0]=joueur;
			parms[1]=jeu;
			sys_parm=g_strdup_printf("%s -u %s -g %s -s %s", GGZWRAPPER, parms[0], parms[1], purple_prefs_get_string("/plugins/gtk/ggzpurple/server"));
		 }
		else
		 {
			parms[0]=(char*)purple_prefs_get_string("/plugins/gtk/ggzpurple/login");
			parms[1]=jeu;
			sys_parm=g_strdup_printf("%s -u %s -g %s -p %s -s %s", GGZWRAPPER, parms[0], parms[1], purple_prefs_get_string("/plugins/gtk/ggzpurple/password"), purple_prefs_get_string("/plugins/gtk/ggzpurple/server"));
		 }
		parms[0]="sh";
		parms[1]="-c";
		parms[2]=sys_parm;
		parms[3]=NULL;
		printf("LAUNCH: %s,%s %s %s\n", "/bin/sh", parms[0], parms[1], parms[2]);
		execv("/bin/sh", parms);
		exit(0);
	} else if(pid>0) {
		if(purple_prefs_get_bool("/plugins/gtk/ggzpurple/guest")) purple_conv_im_send(PURPLE_CONV_IM(conv), g_strdup_printf("%s%s %s %s", HEADER, jeu,joueur, FOOTER));
		else purple_conv_im_send(PURPLE_CONV_IM(conv), g_strdup_printf("%s%s %s %s", HEADER, jeu,purple_prefs_get_string("/plugins/gtk/ggzpurple/login"), FOOTER));

		LastGamePID = pid;

		return PURPLE_CMD_RET_OK;
	} else {
		if(error)
		*error=strdup("Probleme de fork()");
		return PURPLE_CMD_RET_FAILED;
	}
}
开发者ID:ralight,项目名称:ggz,代码行数:48,代码来源:simple.c

示例10: buzz_cb

//Callback function to send autoreply when buzz is received
static void buzz_cb(PurpleAccount *account, char *who, PurpleConversation *conv, guint type) {

    PurpleConvIm *im = purple_conversation_get_im_data(conv);
    const char *msg = purple_prefs_get_string(REPLY_MSG);

    purple_conv_im_send(im, msg);
}
开发者ID:RebornSoldier,项目名称:Pidgin-Buzz-Autoreply,代码行数:8,代码来源:buzz_resp.c

示例11: purplerc_set_font

static void
purplerc_set_font(GtkWidget *widget, gpointer data)
{
	gchar title[128];
	GtkWidget *font_dialog = NULL;
	gint subscript = GPOINTER_TO_INT(data);
	const gchar *pref = NULL, *prefpath = NULL;

	if (subscript == -1) {
		g_snprintf(title, sizeof(title), _("Select Interface Font"));
		prefpath = "/plugins/gtk/purplerc/gtk-font-name";
	} else {
		g_snprintf(title, sizeof(title), _("Select Font for %s"),
		           _(font_names[subscript]));
		prefpath = font_prefs[subscript];
	}

	font_dialog = gtk_font_selection_dialog_new(title);
	g_signal_connect(G_OBJECT(font_dialog), "response",
	                 G_CALLBACK(purplerc_font_response), data);

	pref = purple_prefs_get_string(prefpath);

	if (pref != NULL && strcmp(pref, "")) {
		gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog), pref);
	}

	gtk_window_present(GTK_WINDOW(font_dialog));
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:29,代码来源:pidginrc.c

示例12: purplerc_set_color

static void
purplerc_set_color(GtkWidget *widget, gpointer data)
{
	GdkColor color;
	gchar title[128];
	const gchar *pref = NULL;
	GtkWidget *color_dialog = NULL;
	gint subscript = GPOINTER_TO_INT(data);

	g_snprintf(title, sizeof(title), _("Select Color for %s"),
	           _(color_names[GPOINTER_TO_INT(data)]));
	color_dialog = gtk_color_selection_dialog_new(_("Select Color"));
	g_signal_connect(G_OBJECT(color_dialog), "response",
	                 G_CALLBACK(purplerc_color_response), data);

	pref = purple_prefs_get_string(color_prefs[subscript]);

	if (pref != NULL && strcmp(pref, "")) {
		if (gdk_color_parse(pref, &color)) {
#if GTK_CHECK_VERSION(2,14,0)
			gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(
				gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))),
				&color);
#else
			gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color);
#endif
		}
	}

	gtk_window_present(GTK_WINDOW(color_dialog));
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:31,代码来源:pidginrc.c

示例13: plugin_load

static gboolean 
plugin_load(PurplePlugin *plugin) {

  FILE *which_pf;
  char line[1024];
  which_pf= popen("which festival 2>/dev/null","r");
  fscanf(which_pf,"%1023s",line);
  pclose(which_pf);

  if( *line != '/')
    return FALSE;

  char proc[1024];
  sprintf(proc, "%s %s", snd((char *)purple_prefs_get_string("/pidgin/sound/method")), line);
  purple_debug(PURPLE_DEBUG_INFO, "pidgin festival", proc);

  int errno=0;
  festival_pf= popen(proc,"w");

  if(errno) {
    pclose(festival_pf);
    return FALSE;
  }

  load_conf();

  void *conv_handle = purple_conversations_get_handle();
  void *blist_handle = purple_blist_get_handle();
  void *accounts_handle = purple_accounts_get_handle();

  purple_signal_connect(conv_handle, "received-im-msg",
		      plugin, PURPLE_CALLBACK(im_recv_im), NULL);
  purple_signal_connect(conv_handle, "received-chat-msg",
  		      plugin, PURPLE_CALLBACK(im_recv_im), NULL);
  purple_signal_connect(conv_handle, "conversation-created",
  		      plugin, PURPLE_CALLBACK(chat_created), NULL);
  purple_signal_connect(blist_handle, "buddy-signed-on",
  		      plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL);
  purple_signal_connect(blist_handle, "buddy-signed-off",
  		      plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL);
  purple_signal_connect(conv_handle, "chat-buddy-joined",
  		      plugin, PURPLE_CALLBACK(chat_buddy_joined_cb), NULL);
  purple_signal_connect(conv_handle, "chat-buddy-left",
		      plugin, PURPLE_CALLBACK(chat_buddy_left_cb), NULL);

  /* Buddy List subsystem signals */
  purple_signal_connect(blist_handle, "buddy-away",
		      plugin, PURPLE_CALLBACK(buddy_away_cb), NULL);
  purple_signal_connect(blist_handle, "buddy-back",
		      plugin, PURPLE_CALLBACK(buddy_back_cb), NULL);
  purple_signal_connect(blist_handle, "buddy-idle",
		      plugin, PURPLE_CALLBACK(buddy_idle_cb), NULL);
  purple_signal_connect(blist_handle, "buddy-unidle",
		      plugin, PURPLE_CALLBACK(buddy_unidle_cb), NULL);

  purple_signal_connect(accounts_handle, "account-connecting",
		      plugin, PURPLE_CALLBACK(account_connecting_cb), NULL);

  return TRUE;
}
开发者ID:gerrywastaken,项目名称:pidgin-festival,代码行数:60,代码来源:festival.c

示例14: get_lastfm_ws_pref

void get_lastfm_ws_pref(GtkBox *box)
{
  GtkWidget *widget, *vbox, *hbox, *label;
  GtkAdjustment *interval_spinner_adj = (GtkAdjustment *) gtk_adjustment_new(purple_prefs_get_int(PREF_LASTFM_INTERVAL),
                                                                             INTERVAL_SECONDS, 600.0, INTERVAL_SECONDS, INTERVAL_SECONDS*5.0, INTERVAL_SECONDS*5.0);

  vbox = gtk_vbox_new(FALSE, 5);
  gtk_box_pack_start(GTK_BOX(box), vbox, FALSE, FALSE, 0);

  hbox = gtk_hbox_new(FALSE, 5);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Username:")), FALSE, FALSE, 0);
  widget = gtk_entry_new();
  gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
  gtk_entry_set_text(GTK_ENTRY(widget), purple_prefs_get_string(PREF_LASTFM));
  g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(cb_lastfm_ws_username_changed), (gpointer) PREF_LASTFM);

  hbox = gtk_hbox_new(FALSE, 5);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("poll interval:")), FALSE, FALSE, 0);
  widget = gtk_spin_button_new(interval_spinner_adj, INTERVAL_SECONDS, 0);
  gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
  g_signal_connect(G_OBJECT(widget), "value-changed", G_CALLBACK(cb_lastfm_ws_interval_changed), (gpointer) PREF_LASTFM_INTERVAL);

  label = gtk_label_new(_("This is the interval (in seconds) at which we check Last.fm for changes"));
  gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
  gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
}
开发者ID:jon-turney,项目名称:pidgin-musictracker,代码行数:30,代码来源:lastfm_ws.c

示例15: get_lastfm_ws_info

void
get_lastfm_ws_info(struct TrackInfo* ti)
{
  const char *user = purple_prefs_get_string(PREF_LASTFM);
  if (!strcmp(user,""))
    {
      trace("No last.fm user name");
      return;
    }
  trace("Got user name: %s",user);

  // Check if it's time to check again
  static int count = 0;
  if (count < 0)
    {
      trace("last.fm ratelimit %d",count);
    }
  else
    {
      count = count - purple_prefs_get_int(PREF_LASTFM_INTERVAL);

      char *url = g_strdup_printf(LASTFM_WS_URL, user, LASTFM_WS_API_KEY);
      trace("URL is %s", url);

      purple_util_fetch_url_request(url, TRUE, USER_AGENT, FALSE, NULL, FALSE, lastfm_ws_fetch, NULL);

      g_free(url);
    }
  count = count + INTERVAL_SECONDS;

  *ti = lastfm_ws_ti;
}
开发者ID:jon-turney,项目名称:pidgin-musictracker,代码行数:32,代码来源:lastfm_ws.c


注:本文中的purple_prefs_get_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。