Exemple #1
0
static void
show_private_list(PurplePluginAction *action, guint16 list_type, const gchar *title, const gchar *list_description, const gchar *menu_action_name)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	OscarData *od = purple_connection_get_protocol_data(gc);
	PurpleAccount *account = purple_connection_get_account(gc);
	GSList *buddies, *filtered_buddies, *cur;
	gchar *text, *secondary;

	buddies = purple_find_buddies(account, NULL);
	filtered_buddies = NULL;
	for (cur = buddies; cur != NULL; cur = cur->next) {
		PurpleBuddy *buddy;
		const gchar *bname;

		buddy = cur->data;
		bname = purple_buddy_get_name(buddy);
		if (aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, list_type)) {
			filtered_buddies = g_slist_prepend(filtered_buddies, buddy);
		}
	}

	g_slist_free(buddies);

	filtered_buddies = g_slist_reverse(filtered_buddies);
	text = oscar_format_buddies(filtered_buddies, _("you have no buddies on this list"));
	g_slist_free(filtered_buddies);

	secondary = g_strdup_printf(_("You can add a buddy to this list "
					"by right-clicking on them and "
					"selecting \"%s\""), menu_action_name);
	purple_notify_formatted(gc, title, list_description, secondary, text, NULL, NULL);
	g_free(secondary);
	g_free(text);
}
Exemple #2
0
static void action_about_openfetion(PurplePluginAction *action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	GString *info;
	gchar *title;

	g_return_if_fail(NULL != gc);

	info = g_string_new("<html><body>");
	g_string_append(info, _("<p><b>Author</b>:<br>\n"));
	g_string_append(info, "levin(<a href='http://twitter.com/levin108'>@levin108</a>)<br>\n");
	g_string_append(info, "<br/>\n");

	g_string_append(info, _("pidgin-openfetion is a Fetion protocol plugin for libpurple, <br/>"
				"implemented by the openfetion team.<br/>"
				"It supports most features of China Mobile's Fetion V4 protocol. <br/>"
				"It's lightweight and efficient.<br/><br/>"
				"Project homepage: http://code.google.com/p/ofetion/"));
	g_string_append(info, "<br/><br/>");
	g_string_append(info, _("<p><b>Translators</b></p>:<br/>\n"));
	/* Translators: HTML format, So do add a <br /> to every translator,
	 * such as Zhang <br/> \nWang <br/>
	 */
	g_string_append(info, _("translator-credits"));
	g_string_append(info, "\n</body></html>");

	title = g_strdup_printf(_("About OpenFetion %s"), DISPLAY_VERSION);
	purple_notify_formatted(gc, title, title, NULL, info->str, NULL, NULL);

	g_free(title);
	g_string_free(info, TRUE);
}
static void
notify_format_cb(PurplePluginAction *action)
{
    purple_notify_formatted(question_and_answer_plugin, "Test Notification", "Test Notification",
        "Test Notification",
        "<I>This is a test notification with formatted text.</I>", NULL, NULL);
}
Exemple #4
0
/* show a brief summary of what we get from login packet */
static void action_show_account_info(PurplePluginAction *action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	qq_data *qd;
	GString *info;
	struct tm *tm_local;
	int index;

	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
	qd = (qq_data *) gc->proto_data;
	info = g_string_new("<html><body>");

	tm_local = localtime(&qd->login_time);
	g_string_append_printf(info, _("<b>Login time</b>: %d-%d-%d, %d:%d:%d<br>\n"),
			(1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
			tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
	g_string_append_printf(info, _("<b>Total Online Buddies</b>: %d<br>\n"), qd->online_total);
	tm_local = localtime(&qd->online_last_update);
	g_string_append_printf(info, _("<b>Last Refresh</b>: %d-%d-%d, %d:%d:%d<br>\n"),
			(1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
			tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);

	g_string_append(info, "<hr>");

	g_string_append_printf(info, _("<b>Server</b>: %s<br>\n"), qd->curr_server);
	g_string_append_printf(info, _("<b>Client Tag</b>: %s<br>\n"), qq_get_ver_desc(qd->client_tag));
	g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP");
	g_string_append_printf(info, _("<b>My Internet IP</b>: %s:%d<br>\n"), inet_ntoa(qd->my_ip), qd->my_port);

	g_string_append(info, "<hr>");
	g_string_append(info, "<i>Network Status</i><br>\n");
	g_string_append_printf(info, _("<b>Sent</b>: %lu<br>\n"), qd->net_stat.sent);
	g_string_append_printf(info, _("<b>Resend</b>: %lu<br>\n"), qd->net_stat.resend);
	g_string_append_printf(info, _("<b>Lost</b>: %lu<br>\n"), qd->net_stat.lost);
	g_string_append_printf(info, _("<b>Received</b>: %lu<br>\n"), qd->net_stat.rcved);
	g_string_append_printf(info, _("<b>Received Duplicate</b>: %lu<br>\n"), qd->net_stat.rcved_dup);

	g_string_append(info, "<hr>");
	g_string_append(info, "<i>Last Login Information</i><br>\n");

	for (index = 0; index < sizeof(qd->last_login_time) / sizeof(time_t); index++) {
		tm_local = localtime(&qd->last_login_time[index]);
		g_string_append_printf(info, _("<b>Time</b>: %d-%d-%d, %d:%d:%d<br>\n"),
				(1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
				tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
	}
	if (qd->last_login_ip.s_addr != 0) {
		g_string_append_printf(info, _("<b>IP</b>: %s<br>\n"), inet_ntoa(qd->last_login_ip));
	}

	g_string_append(info, "</body></html>");

	purple_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL);

	g_string_free(info, TRUE);
}
static void alias_what (GtkButton *button, gpointer data)
{
  purple_notify_formatted (NULL, _("Aliases"), _("What this list is for"), NULL,
    _("Logs in Purple are stored verbatim with what you see on the screen.  "
      "The names of the people in the conversation (both yourself and your "
      "buddy) are shown with their given aliases as opposed to actual screen "
      "names.  If you have given yourself an alias in a conversation, list "
      "it using this dialog.  If you do not, messages written by you will "
      "be incorrectly identified as received instead of sent.<br><br>Correct "
      "capitalization and whitespace are not required for detection to "
      "work.<br><br>You must disable/re-enable log stats to refresh the "
      "database after an alias change."), 
      NULL, NULL);
}
// Show the account information received at the login
// such as expiration, creation, etc.
static void waprpl_show_accountinfo(PurplePluginAction *action) {
  PurpleConnection * gc = (PurpleConnection *) action->context;
  whatsapp_connection * wconn = purple_connection_get_protocol_data(gc);
  
  unsigned long long creation, freeexpires;
  char * status;
  waAPI_accountinfo(wconn->waAPI,&creation, &freeexpires,&status);
  
  time_t creationtime = creation;
  time_t freeexpirestime = freeexpires;
  char * cr = g_strdup(asctime(localtime(&creationtime)));
  char * ex = g_strdup(asctime(localtime(&freeexpirestime)));

  char * text = g_strdup_printf("Account status: %s<br />Created on: %s<br />Free expires on: %s\n",status,cr,ex);

  purple_notify_formatted(gc, "Account information", "Account information", "", text, NULL, NULL);
}
Exemple #7
0
static void irc_view_motd(PurplePluginAction *action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	struct irc_conn *irc;
	char *title;

	if (gc == NULL || gc->proto_data == NULL) {
		purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n");
		return;
	}
	irc = gc->proto_data;
	if (irc->motd == NULL) {
		purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"),
				  _("There is no MOTD associated with this connection."));
		return;
	}
	title = g_strdup_printf(_("MOTD for %s"), irc->server);
	purple_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL);
	g_free(title);
}
Exemple #8
0
static void action_show_account_info(PurplePluginAction *action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	GString *info;
	gchar *province, *city;

	fetion_account *ac = purple_connection_get_protocol_data(gc);
	User *user = ac->user;

	info = g_string_new("<html><body>");

	province = get_province_name(user->province);
	city     = get_city_name(user->province, user->city);
	g_string_append_printf(info, _("<b>Last Login Time</b>: %s<br>\n"), user->lastLoginTime);
	g_string_append_printf(info, _("<b>Last Login IP</b>: %s<br>\n"), user->lastLoginIp);
	g_string_append_printf(info, _("<b>Public IP</b>: %s<br>\n"), user->publicIp);
	g_string_append(info, "<hr>");
	g_string_append_printf(info, _("<b>Fetion Number</b>: %s<br>\n"), user->sId);
	g_string_append_printf(info, _("<b>Mobile Number</b>: %s<br>\n"), user->mobileno);
	g_string_append_printf(info, _("<b>Login Time</b>: %s<br>\n"), user->lastLoginTime);
	g_string_append_printf(info, _("<b>NickName</b>: %s<br>\n"), user->nickname);
	g_string_append_printf(info, _("<b>Signature</b>: %s<br>\n"), user->impression);
	g_string_append_printf(info, _("<b>Province</b>: %s<br>\n"), province);
	g_string_append_printf(info, _("<b>City</b>: %s<br>\n"), city);
	g_string_append(info, "<hr>");
	g_string_append_printf(info, _("<b>SMS Sent Today</b>: %d<br>\n"), user->smsDayCount);
	g_string_append_printf(info, _("<b>SMS Sent This Month</b>: %d<br>\n"), user->smsMonthCount);
	g_string_append_printf(info, _("<b>SMS Limit Today</b>: %d<br>\n"), user->smsDayLimit);
	g_string_append_printf(info, _("<b>SMS Limit This Month</b>: %d<br>\n"), user->smsMonthLimit);


	g_string_append(info, "</body></html>");

	purple_notify_formatted(gc, NULL, _("Account Information"), NULL, info->str, NULL, NULL);

	g_string_free(info, TRUE);
	g_free(province); g_free(city);
}
Exemple #9
0
static void
silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components)
{
	SilcPurple sg = gc->proto_data;
	const char *chname;
	char tmp[256], *tmp2;
	GString *s;
	SilcChannelEntry channel;
	SilcHashTableList htl;
	SilcChannelUser chu;

	if (!components)
		return;

	chname = g_hash_table_lookup(components, "channel");
	if (!chname)
		return;
	channel = silc_client_get_channel(sg->client, sg->conn,
					  (char *)chname);
	if (!channel) {
		silc_client_get_channel_resolve(sg->client, sg->conn,
						(char *)chname,
						silcpurple_chat_getinfo_res,
						components);
		return;
	}

	s = g_string_new("");
	tmp2 = g_markup_escape_text(channel->channel_name, -1);
	g_string_append_printf(s, _("<b>Channel Name:</b> %s"), tmp2);
	g_free(tmp2);
	if (channel->user_list && silc_hash_table_count(channel->user_list))
		g_string_append_printf(s, _("<br><b>User Count:</b> %d"),
				       (int)silc_hash_table_count(channel->user_list));

	silc_hash_table_list(channel->user_list, &htl);
	while (silc_hash_table_get(&htl, NULL, (void *)&chu)) {
		if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) {
			tmp2 = g_markup_escape_text(chu->client->nickname, -1);
			g_string_append_printf(s, _("<br><b>Channel Founder:</b> %s"),
					       tmp2);
			g_free(tmp2);
			break;
		}
	}
	silc_hash_table_list_reset(&htl);

	if (channel->cipher)
		g_string_append_printf(s, _("<br><b>Channel Cipher:</b> %s"),
				       channel->cipher);

	if (channel->hmac)
		/* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */
		g_string_append_printf(s, _("<br><b>Channel HMAC:</b> %s"),
				       channel->hmac);

	if (channel->topic) {
		tmp2 = g_markup_escape_text(channel->topic, -1);
		g_string_append_printf(s, _("<br><b>Channel Topic:</b><br>%s"), tmp2);
		g_free(tmp2);
	}

	if (channel->mode) {
		g_string_append_printf(s, _("<br><b>Channel Modes:</b> "));
		silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp));
		g_string_append(s, tmp);
	}

	if (channel->founder_key) {
		char *fingerprint, *babbleprint;
		unsigned char *pk;
		SilcUInt32 pk_len;
		pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len);
		if (pk) {
			fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
			babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);

			g_string_append_printf(s, _("<br><b>Founder Key Fingerprint:</b><br>%s"), fingerprint);
			g_string_append_printf(s, _("<br><b>Founder Key Babbleprint:</b><br>%s"), babbleprint);

			silc_free(fingerprint);
			silc_free(babbleprint);
			silc_free(pk);
		}
	}

	purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL);
	g_string_free(s, TRUE);
}
Exemple #10
0
static void action_about_libqq(PurplePluginAction *action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	GString *info;
	gchar *title;

	g_return_if_fail(NULL != gc);

	info = g_string_new("<html><body>");
	g_string_append(info, _("<p><b>Original Author</b>:<br>\n"));
	g_string_append(info, "puzzlebird<br>\n");
	g_string_append(info, "<br>\n");

	g_string_append(info, _("<p><b>Code Contributors</b>:<br>\n"));
	g_string_append(info, "gfhuang(poppyer) : patches for libpurple 2.0.0beta2, maintainer<br>\n");
	g_string_append(info, "Yuan Qingyun : patches for libpurple 1.5.0, maintainer<br>\n");
	g_string_append(info, "henryouly : file transfer, udp sock5 proxy and qq_show, maintainer<br>\n");
	g_string_append(info, "hzhr : maintainer<br>\n");
	g_string_append(info, "joymarquis : maintainer<br>\n");
	g_string_append(info, "arfankai : fixed bugs in char_conv.c<br>\n");
	g_string_append(info, "rakescar : provided filter for HTML tag<br>\n");
	g_string_append(info, "yyw : improved performance on PPC linux<br>\n");
	g_string_append(info, "lvxiang : provided ip to location original code<br>\n");
	g_string_append(info, "markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007<br>\n");
	g_string_append(info, "ccpaging : maintainer since 2007<br>\n");
	g_string_append(info, "icesky : maintainer since 2007<br>\n");
	g_string_append(info, "csyfek : faces, maintainer since 2007<br>\n");
	g_string_append(info, "V.E.O : maintainer since 2011, OpenQ rename to LibQQ<br>\n");
	g_string_append(info, "cnangel : maintainer since 2012<br>\n");
	g_string_append(info, "worr : maintainer / AdiumQQ developer<br>\n");
	g_string_append(info, "<br>\n");

	g_string_append(info, _("<p><b>Lovely Patch Writers</b>:<br>\n"));
	g_string_append(info, "gnap : message displaying, documentation<br>\n");
	g_string_append(info, "manphiz : room processing<br>\n");
	g_string_append(info, "moo : room processing<br>\n");
	g_string_append(info, "Coly Li : room processing<br>\n");
	g_string_append(info, "Emil Alexiev : captcha verification on login based on LumaQQ for MAC (2007), login, add buddy, remove buddy, message exchange and logout<br>\n");
	g_string_append(info, "Chengming Wang : buddy memo<br>\n");
	g_string_append(info, "lonicerae : chat room window bugfix, server list bugfix, buddy memo<br>\n");
	g_string_append(info, "<br>\n");

	g_string_append(info, _("<p><b>Acknowledgement</b>:<br>\n"));
	g_string_append(info, "Shufeng Tan : http://sf.net/projects/perl-oicq<br>\n");
	g_string_append(info, "Jeff Ye : http://www.sinomac.com<br>\n");
	g_string_append(info, "Hu Zheng : http://forlinux.yeah.net<br>\n");
	g_string_append(info, "yunfan : http://www.myswear.net<br>\n");
	g_string_append(info, "OpenQ Team : http://openq.linuxsir.org<br>\n");
	g_string_append(info, "LumaQQ Team : http://lumaqq.linuxsir.org<br>\n");
	g_string_append(info, "Pidgin Team : http://www.pidgin.im<br>\n");
	g_string_append(info, "Huang Guan : http://home.xxsyzx.com<br>\n");
	g_string_append(info, "OpenQ Google Group : http://groups.google.com/group/openq<br>\n");
	g_string_append(info, "LibQQ Google Code : http://libqq-pidgin.googlecode.com<br>\n");
	g_string_append(info, "LibQQ Github Code : https://github.com/cnangel/pidgin-libqq<br>\n");
	g_string_append(info, "<br>\n");

	g_string_append(info, _("<p><b>Scrupulous Testers</b>:<br>\n"));
	g_string_append(info, "yegle<br>\n");
	g_string_append(info, "cnzhangbx<br>\n");
	g_string_append(info, "casparant<br>\n");
	g_string_append(info, "wd<br>\n");
	g_string_append(info, "x6719620<br>\n");
	g_string_append(info, "netelk<br>\n");
	g_string_append(info, _("and more, please let me know... thank you!))"));
	g_string_append(info, "<br>\n<br>\n");
	g_string_append(info, _("<p><i>And, all the boys in the backroom...</i><br>\n"));
	g_string_append(info, _("<i>Feel free to join us!</i> :)"));
	g_string_append(info, "</body></html>");

	title = g_strdup_printf(_("About LibQQ %s"), LIBQQ_VERSION);
	purple_notify_formatted(gc, title, title, NULL, info->str, NULL, NULL);

	g_free(title);
	g_string_free(info, TRUE);
}