Beispiel #1
0
Datei: irc.c Projekt: VoxOx/VoxOx
static void irc_view_motd(GaimPluginAction *action)
{
	GaimConnection *gc = (GaimConnection *) action->context;
	struct irc_conn *irc;
	char *title;

	if (gc == NULL || gc->proto_data == NULL) {
		gaim_debug(GAIM_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n");
		return;
	}
	irc = gc->proto_data;
	if (irc->motd == NULL) {
		gaim_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);
	gaim_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL);
	g_free(title);
}
static void
version_fetch_cb(void *ud, const char *data, size_t len)
{
	const char *changelog = data;
	char *cur_ver, *formatted;
	GString *message;
	int i=0;

	if(!changelog || !len)
		return;

	while(changelog[i] && changelog[i] != '\n') i++;

	cur_ver = g_strndup(changelog, i);
	changelog += i;

	while(*changelog == '\n') changelog++;

	message = g_string_new("");
	g_string_append_printf(message, _("You are using Gaim version %s.  The "
			"current version is %s.<hr>"),
			gaim_core_get_version(), cur_ver);

	if(*changelog) {
		formatted = gaim_strdup_withhtml(changelog);
		g_string_append_printf(message, _("<b>ChangeLog:</b>\n%s<br><br>"),
				formatted);
		g_free(formatted);
	}

	g_string_append_printf(message, _("You can get version %s from:<br>"
			"<a href=\"http://gaim.sourceforge.net/\">"
			"http://gaim.sourceforge.net</a>."), cur_ver);

	gaim_notify_formatted(NULL, _("New Version Available"),
			_("New Version Available"), NULL, message->str,
			NULL, NULL);

	g_string_free(message, TRUE);
	g_free(cur_ver);
}