• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ purple_prefs_get_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: load_config

/* On-disk configuration file format:
 * ip(xxx.xxx.xxx.xxx)/netmask
 * status
 * ip(xxx.xxx.xxx.xxx)/netmask
 * status
 */
gboolean
load_config()
{
   /* load configuration file */
   gchar *file = purple_prefs_get_string(PREF_CONFIG);
   gchar *buf;
   gsize len;
   if (!g_file_get_contents(file, &buf, &len, NULL)) {
      trace ("Load config file failed");
      return FALSE;
   }

   /* count rule number */
   gsize i;
   for (i=0; i<len; i++) {
      if (buf[i] == '\n') rule_cnt++;
   }
   /* count here is not exactly the true, because it may happen that 
    * \n\n\n, this would be fixed later */
   rule_cnt = (rule_cnt +1)/2;   

   rules = (Rule *)malloc(rule_cnt * sizeof(Rule));

   /* parse rules */
   char *ch = buf;
   rule_cnt = 0;
   while (load_one_rule(&ch, rules+rule_cnt)) {
      rule_cnt++;
   }

   trace("get number of rules: %d", rule_cnt);

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


示例17: set_sensitive_if_input_and_noexist

/* part stolen from gtkutils.c */
static void
set_sensitive_if_input_and_noexist (GtkWidget * entry,
                                    GtkWidget * dlgbox_rename) {
    GtkWidget *warn_label;
    gchar *capture_path_filename = NULL;
    const gchar *text;

    warn_label = g_object_get_data (G_OBJECT (dlgbox_rename), "warn-label");

    text = purple_escape_filename (gtk_entry_get_text (GTK_ENTRY (entry)));

    capture_path_filename =
        g_build_filename (purple_prefs_get_string (PREF_STORE_FOLDER),
                          text, NULL);

    gtk_dialog_set_response_sensitive (GTK_DIALOG (dlgbox_rename),
                                       GTK_RESPONSE_OK, (*text != '\0'));
    /* warn user if file already exists */
    if (g_file_test (capture_path_filename, G_FILE_TEST_EXISTS)
        && (*text != '\0'))
        gtk_widget_show (warn_label);
    else
        gtk_widget_hide (warn_label);

    if (capture_path_filename != NULL)
        g_free (capture_path_filename);
}
开发者ID:EionRobb,项目名称:pidgin-sendscreenshot,代码行数:28,代码来源:dialogs.c


示例18: _pidgin_smiley_theme_init

void
_pidgin_smiley_theme_init(void)
{
	GList *it;
	const gchar *user_smileys_dir;
	const gchar *theme_name;

	probe_dirs = g_new0(gchar*, 3);
	probe_dirs[0] = g_build_filename(
		PURPLE_DATADIR, "pixmaps", "pidgin", "emotes", NULL);
	user_smileys_dir = probe_dirs[1] = g_build_filename(
		purple_user_dir(), "smileys", NULL);

	if (!g_file_test(user_smileys_dir, G_FILE_TEST_IS_DIR)) {
		if (g_mkdir(user_smileys_dir, S_IRUSR | S_IWUSR | S_IXUSR) == 0) {
			purple_debug_error("gtksmiley-theme",
				"Failed to create user smileys dir");
		}
	}

	/* setting theme by name (copy-paste from gtkprefs) */
	pidgin_smiley_theme_probe();
	theme_name = purple_prefs_get_string(
		PIDGIN_PREFS_ROOT "/smileys/theme");
	for (it = smiley_themes; it; it = g_list_next(it)) {
		PidginSmileyTheme *theme = it->data;

		if (g_strcmp0(pidgin_smiley_theme_get_name(theme), theme_name))
			continue;

		purple_smiley_theme_set_current(PURPLE_SMILEY_THEME(theme));
	}
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:33,代码来源:gtksmiley-theme.c


示例19: menu_action_sendkey_cb

/* ------------------
 * send public key to other person in conversation
 * ------------------ */
static void
menu_action_sendkey_cb(PurpleConversation *conv, void* data)
{
	// check if user selected a main key
	const char* fpr = purple_prefs_get_string(PREF_MY_KEY);
	if (fpr == NULL)
		fpr = "";
	if (strcmp(fpr,"") != 0)
	{
		char* key = NULL;
		// get key
		key = get_key_armored(fpr);

		if (key != NULL)
		{
			// send key
			PurpleConvIm* im_data = purple_conversation_get_im_data(conv);
			if (im_data != NULL)
			{
				purple_conv_im_send_with_flags(im_data,key,PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_INVISIBLE | PURPLE_MESSAGE_RAW );
				purple_conversation_write(conv,"","Public key sent!",PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG,time(NULL));
			}
		}
	}else
	{
		purple_conversation_write(conv,"","You haven't selected a personal key yet.",PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG,time(NULL));
	}
}
开发者ID:bitboulder,项目名称:Pidgin-GPG,代码行数:31,代码来源:pidgin-gpg.c


示例20: start_direct_connection

/* start the connection when all the details are available */
void 
start_direct_connection()
{
	int server_pid=fork();
	if (server_pid==0)
	{
		/* child process: run the server */
		purple_debug_misc(PLUGIN_ID,"server_ip=\"%s\"\n",purple_value_get_string(server_ip));

		const char* cmd=purple_prefs_get_string(PREF_SERVER_COMMAND_LINE);

		/* replace the port in the command string */
		GRegex *port_regex=g_regex_new("[$]PORT",0,0,NULL);
		char* command=g_regex_replace(port_regex,cmd,-1,0,purple_value_get_string(port),0,NULL);

		purple_debug_misc(PLUGIN_ID,"server command=\"%s\"\n",command);
		gchar **splitted_command=g_strsplit(command," ",0);

		execvp(splitted_command[0],splitted_command);

		g_free(command);
		g_free(splitted_command);
		g_free(port_regex);
	}
	else 
	{
		/* original process: sent the connection request*/
		send_connect_request_message();

	}
}
开发者ID:hariseldon78,项目名称:pidgin-share-desktop,代码行数:32,代码来源:server.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ purple_signal_connect函数代码示例发布时间:2022-05-30
下一篇:
C++ purple_prefs_get_int函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap