Exemple #1
0
bool userOutput(std::string id)
{
    if (id.length() == 0)
        return false;
    
    std::string xml = getImageInfo(id);
    
	if (optDirect)
		printf("%s\n", getVal(xml, "link").c_str());
	if (optImagePage)
		printf("http://imgur.com/%s\n", id.c_str());
	if (optHtmlImage)
		printf("<img src=\"%s\" alt=\"Hosted by imgur.com\" />\n", getVal(xml, "link").c_str());
	if (optHtmlLink)
		printf("<a href=\"%s\" title=\"Hosted by imgur.com\">%s</a>\n", getVal(xml, "link").c_str(), getVal(xml, "link").c_str());
	if (optMessageBoard)
		printf("[IMG]%s[/IMG]\n", getVal(xml, "link").c_str());
	if (optMessageBoardLink)
		printf("[URL=%s][IMG]%s[/IMG][/URL]\n", getVal(xml, "link").c_str(), getVal(xml, "link").c_str());
	if (optOpenBrowser)
    {
        std::string url = "http://imgur.com/" + id;
		browseTo(url);
    }
	
	return true;
}
Exemple #2
0
bool userOutput(std::string id)
{
    if (id.length() == 0)
        return false;
    
    std::string xml = getImageInfo(id);
    std::string output;
    
	if (optDirect)
		spf(output, "%s\n", getVal(xml, "link").c_str());
	if (optImagePage)
		spf(output, "http://imgur.com/%s\n", id.c_str());
	if (optHtmlImage)
		spf(output, "<img src=\"%s\" alt=\"Hosted by imgur.com\" />\n", getVal(xml, "link").c_str());
	if (optHtmlLink)
		spf(output, "<a href=\"%s\" title=\"Hosted by imgur.com\">%s</a>\n", getVal(xml, "link").c_str(), getVal(xml, "link").c_str());
	if (optMessageBoard)
		spf(output, "[IMG]%s[/IMG]\n", getVal(xml, "link").c_str());
	if (optMessageBoardLink)
		spf(output, "[URL=%s][IMG]%s[/IMG][/URL]\n", getVal(xml, "link").c_str(), getVal(xml, "link").c_str());
	if (optOpenBrowser)
    {
        std::string url = "http://imgur.com/" + id;
		browseTo(url);
    }
    if (output.length() > 0)
        puts(output.c_str());
    if (optCopyClipboard && output.length() > 0)
        clipBuffer += output;
    
	return true;
}