Ejemplo n.º 1
0
void MainWindow::on_actionAbout_libircclient_triggered()
{
    QString content = tr("libircclient is a small but powerful library, which implements client-server IRC protocol. <br/>");
    QString address = "http://libircclient.sourceforge.net";
    content.append(tr("Official site: <a href='%1'>%1</a> <br/>").arg(address));

    char version[255];
    unsigned int high, low;
    irc_get_version(&high, &low);
    sprintf(version, "%d.%02d", high, low);
    content.append(tr("Current version %1 <br/>").arg(version));

    QMessageBox::about(this, tr("About libircclient"), content);
}
Ejemplo n.º 2
0
static void libirc_event_ctcp_internal (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
{
	if ( origin )
	{
		char nickbuf[128], textbuf[256];
		irc_target_get_nick (origin, nickbuf, sizeof(nickbuf));

		if(is_lua_active(session))
			if(lua_process_event(session,event,origin,params,count))
				return;

		if ( strstr (params[0], "PING") == params[0] ){
			_snprintf(textbuf,sizeof(textbuf),"PONG%s",params[0]+4);
			irc_cmd_ctcp_reply (session, nickbuf, textbuf);
			printf("--->pong reply %s\n",textbuf);
		}
		else if ( !strcmp (params[0], "VERSION") )
		{
			unsigned int high, low;
			irc_get_version (&high, &low);

			sprintf (textbuf, "VERSION slimIRC client - using libirc by Georgy Yunaev ver.%d.%d", high, low);
			irc_cmd_ctcp_reply (session, nickbuf, textbuf);
		}
		else if ( !strcmp (params[0], "FINGER") )
		{
			sprintf (textbuf, "FINGER %s (%s) Idle 0 seconds", 
				session->username ? session->username : "******",
				session->realname ? session->realname : "noname");

			irc_cmd_ctcp_reply (session, nickbuf, textbuf);
		}
		else if ( !strcmp (params[0], "TIME") )
		{
			time_t now = time(0);

#if defined (ENABLE_THREADS) && defined (HAVE_LOCALTIME_R)
			struct tm tmtmp, *ltime = localtime_r (&now, &tmtmp);
#else
			struct tm * ltime = localtime (&now);
#endif
			strftime (textbuf, sizeof(textbuf), "%a %b %d %H:%M:%S %Z %Y", ltime);
			irc_cmd_ctcp_reply (session, nickbuf, textbuf);
		}
	}
}