Beispiel #1
0
void delete_http_request(http_request* request)
{
	int valid = 1;

	if (!request) {
		err_log("delete_http_request: got null pointer in request");
		return;
	}

	if ((!request->path) || (!request->version)) {
		valid = 0;
		info_log("request->path or request->version is null");
	}

	if (request->variables != NULL) {
		if (!delete_http_request_vars(request->variables)) {
			valid = 0;
			info_log("request->variables were screwed up");
		}
	}

	if (request->headers != NULL) {
		if (!delete_http_request_header(request->headers)) {
			valid = 0;
		}
	}

	if (!valid) {
		err_log("delete_http_request: request structure was malformed. got illegal null pointer");
	}
}
Beispiel #2
0
//mela actions :)
static int
msg_peluche(const char *replyto, struct userlist *user, char *data)
{
	char *message, *msg;
	int i;

	if (data != NULL) {
		message = strtok(data, "");

		if (*(message + strlen(message) - 1) == ' ')
			*(message + strlen(message) - 1) = '\0';
	
		msg = malloc(sizeof(char) * strlen(data) + 1);
		for (i = 0; i < strlen(data); i++)
			*(msg + i) = '=';
		*(msg + strlen(data)) = '\0';
	
		info_log("Peluche %s on %s by %s\n", message, replyto, unick(user));
		
		privmsg(usinfo(user), replyto, "%s: 8%sD", message, msg);

		free(msg);
	} else {
		info_log("Peluche on %s by %s\n", replyto, unick(user));

		privmsg(usinfo(user), replyto, "8=============D");
	}

	return (0);
}
Beispiel #3
0
static void user_join(int UNUSED(event), struct socket_info *sinfo, char *nick, char *dest, char *UNUSED(info))
{
	int uaccess;
	struct server_list *server ;
	struct userlist *user ;
	char *channel = dest ;
	
	if (botinfo->autoop != 1) {
		return;
	}

	server = GetServerBySocket(sinfo) ;

	user = GetFromChannel(nick, channel, server);
	uaccess = GetChannelAccess(user, channel);

	if (uaccess <= botinfo->oplevel) {
		info_log("Auto op %s\n", nick);
		irc_sprintf(sinfo, "MODE %s +o %s\n", channel, nick);
		return;
	}

	if (uaccess <= botinfo->hoplevel) {
		info_log("Auto hop %s\n", nick);
		irc_sprintf(sinfo, "MODE %s +h %s\n", channel, nick);
		return;
	}

	if (uaccess <= botinfo->voicelevel) {
		info_log("Auto voice %s\n", nick);
		irc_sprintf(sinfo, "MODE %s +v %s\n", channel, nick);
		return;
	}
}
Beispiel #4
0
static int 
msg_porn(const char *replyto, struct userlist *user, char *data)
{
	char *message;
	char *begin_yp = "http://www.youporn.com/search?query=";
	char *end_yp = "&type=straight";
	char *begin_rt = "http://www.redtube.com/?search=";
	char *begin_pt = "http://www.porntube.com/search?q=";
	char *end_pt = "&Submit=Go";
	int i;
	
	if (data == NULL) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Syntax error: P**n <text>");
		return(0);
	}
	
	message = strtok(data, "");
	
	info_log("YouPorn \"%s\" on %s by %s\n", message, replyto, unick(user));
	info_log("PornTube \"%s\" on %s by %s\n", message, replyto, unick(user));
	info_log("RedTube \"%s\" on %s by %s\n", message, replyto, unick(user));

	
	for (i = 0; i < strlen(message); i++) {
		if (*(message + i) == ' ') {
			*(message + i) = '+';
		}
	}
	
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "YouPorn: %s%s%s", begin_yp, message, end_yp);
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "RedTube: %s%s", begin_rt, message);
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "PornTube: %s%s%s", begin_pt, message, end_pt);

	return(0);
}
Beispiel #5
0
static void print_md5(const char *path)
{
  FILE *file = fopen(path, "r");

  if (file == NULL)
  {
    error_log("Couldn't open %s. Error was %s", path, strerror(errno));
    return;
  }
  // Get the size and other information
  struct stat info;

  if (stat(path, &info) != 0)
  {
    error_log("Couldn't open file %s; %s", path, strerror(errno));
    return;
  }

  size_t size = info.st_size;

  if (size == 0)
  {
    unsigned char empty[512];

    if (fread(empty, 512, 1, file) != 0 || feof(file) == 0)
    {
      error_log("ERROR reading %s! (It was reported as a zero size file but it didn't appear to be empty!", path);
      return;
    }

    info_log("Empty file OK.");

  } else
  {
    char *data = (char *) g_malloc(size);

    if (fread(data, size, 1, file) != 1)
    {
      error_log("ERROR reading %s (%s)!", path, strerror(errno));
      g_free(data);
      fclose(file);
      return;
    }

    gchar *checksum = g_compute_checksum_for_data(G_CHECKSUM_MD5, (guchar *) data, size);

    info_log("md5: %s %s", path, checksum);
    g_free(checksum);
    g_free(data);
  }

  fclose(file);
  return;
}
Beispiel #6
0
static int msg_kick(const char *replyto, struct userlist *user, char *data)
{

	char *channel, *nick, *message ;
	struct userlist *target;
	int user_access;

	/* syntax: kick <channel> <nick> */
	channel = strtok(data, " ");
	nick = strtok(NULL, " ");
	message = strtok(NULL, "");

	if (channel == NULL || nick == NULL) {
		msgreply(user, replyto, "Syntax error: kick <channel> <nickname>");
		return (0);
	}

	if (strcaseeq(nick, user->userinfo->server->nick)) {
		info_log("%s tried to make me kick myself\n", unick(user));
		irc_sprintf(usinfo(user), "KICK %s %s :Try to make me kick myself eh?\n", channel, unick(user));
		return (0);
	}

	user_access = GetChannelAccess(user, channel);

	if (user_access < 0)
		return (access_too_low(user, replyto));

	target = GetFromChannel(nick, channel, user->userinfo->server);

	if (target == NULL)
		msgreply(user, replyto, "I don't see that user in the channel");

	if ((target->access >= 0) && (user_access > target->access)) {
		privmsg(usinfo(user), unick(target), "%s tried to kick you!", unick(user) );
		privmsg(usinfo(user), replyto, "attempt to kick user with higher access denied");
		return (0);
	}

	info_log("KICK %s %s\n", channel, unick(target));

	msgreply(user, replyto, "Kicking %s on %s", nick, channel);

	if (message == NULL) {
		irc_sprintf(usinfo(user), "KICK %s %s\n", channel, nick);
		return (0);
	} else {
		irc_sprintf(usinfo(user), "KICK %s %s :%s\n", channel, nick, message);
		return (0);
	}
}
Beispiel #7
0
	ProgramObjectPtr StandardPrograms::compile(const GraphicContextPtr &gc, const void *vertex_code, int vertex_code_size, const void *fragment_code, int fragment_code_size)
	{
		auto vertex_shader = ShaderObject::create(gc, ShaderType::vertex, vertex_code, vertex_code_size);
		if (!vertex_shader->try_compile())
			throw Exception(string_format("Unable to compile standard vertex shader: %1", vertex_shader->info_log()));

		auto fragment_shader = ShaderObject::create(gc, ShaderType::fragment, fragment_code, fragment_code_size);
		if (!fragment_shader->try_compile())
			throw Exception(string_format("Unable to compile standard fragment shader: %1", fragment_shader->info_log()));

		auto program = ProgramObject::create(gc);
		program->attach(vertex_shader);
		program->attach(fragment_shader);
		return program;
	}
Beispiel #8
0
void DetectNetworkSetupThread::on(Complete, HttpConnection*, const string&) throw() {
	debug_log(AUTODETECT, "parsing response {%s}", m_buffer.c_str());
	try {
		SimpleXML xml;
		xml.fromXML(m_buffer);
		if (xml.findChild("response")) {
			debug_log(AUTODETECT, "found <response>");
			xml.stepIn();
			if (xml.findChild("mode")) {
				string mode = xml.getChildData();
				info_log(AUTODETECT, "mode={%s}", mode.c_str());
				xml.resetCurrentChild();
				string address;
				if (xml.findChild("address")) {
					string address = xml.getChildData();
					info_log(AUTODETECT, "address={%s}", address.c_str());
					if (!address.empty()) {
						SettingsManager::getInstance()->set(SettingsManager::EXTERNAL_IP, address);
					}
				}
				else {
					warn_log(AUTODETECT, "<address> not found");
				}
				debug_log(AUTODETECT, "local address={%s}", connection.m_localIp.c_str());
				if (Util::stricmp(mode, "active") == 0) {
					SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_NAT);
					debug_log(AUTODETECT, "setting ACTIVE mode");
				}
				else if (Util::stricmp(mode, "passive") == 0) {
					SettingsManager::getInstance()->set(SettingsManager::INCOMING_CONNECTIONS, SettingsManager::INCOMING_FIREWALL_PASSIVE);
				}
				else {
					throw Exception("Wrong mode '" + mode + "'");
				}
			}
			else {
				warn_log(AUTODETECT, "<mode> not found");
			}
		}
		else {
			warn_log(AUTODETECT, "<response> not found");
		}
	} 
	catch (const Exception &e) {
		error_log(AUTODETECT, "Error parsing response: %s", e.getError().c_str());
	}
	finalize();
}
Beispiel #9
0
static int oneToOneResponseReceivedCallback(OneToOneResult* result)
{
    sg_sprintf(LOG_GLOBAL_BUFFER, "Received [%s] from peer [%s]", result->peerMsg, result->peerClientId);
    info_log(LOG_GLOBAL_BUFFER);

    return SUCCESS;
}
extern "C" bool malloc_debug_initialize(HashTable* hash_table, const MallocDebug* malloc_dispatch) {
  g_hash_table = hash_table;
  g_malloc_dispatch = malloc_dispatch;

  pthread_key_create(&g_debug_calls_disabled, NULL);

  char debug_backlog[PROP_VALUE_MAX];
  if (__system_property_get("libc.debug.malloc.backlog", debug_backlog)) {
    g_malloc_debug_backlog = atoi(debug_backlog);
    info_log("%s: setting backlog length to %d\n", getprogname(), g_malloc_debug_backlog);
  }

  // Check if backtracing should be disabled.
  char env[PROP_VALUE_MAX];
  if (__system_property_get("libc.debug.malloc.nobacktrace", env) && atoi(env) != 0) {
    g_backtrace_enabled = false;
    __libc_format_log(ANDROID_LOG_INFO, "libc", "not gathering backtrace information\n");
  }

  if (g_backtrace_enabled) {
    backtrace_startup();
  }

  return true;
}
Beispiel #11
0
static int msg_join(const char *replyto, struct userlist *user, char *data)
{
	char *channel, *key ;

	if (data == NULL) {
		msgreply(user, replyto, "Syntax error: join <channel> <key>");
		return (0);
	}

	channel = strtok(data, " ");
	key = strtok(NULL, "");

	if (channel == NULL) {
		msgreply(user, replyto, "Syntax error: join <channel> <key>");
		return (0);
	}

	if (EnterChannel(data, key, user->userinfo->server) == -1) {
		msgreply(user, replyto, "I'm in that channel already");
	} else {
		msgreply(user, replyto, "Joining %s", channel);
		info_log("Join to %s requested by %s\n", channel, unick(user)) ;
	}

	return (0);
}
Beispiel #12
0
GLuint TheMaze2::shaderFromFile(std::string filename, GLenum type) {
    std::ifstream in_stream(filename.c_str());
    std::string source_str((std::istreambuf_iterator<char>(in_stream)),
                           std::istreambuf_iterator<char>());
    const char *source_ca = source_str.c_str();
    
    GLuint shader = glCreateShader(type);
    glShaderSource(shader, 1, &source_ca, NULL);
    glCompileShader(shader);
    
    GLint isCompiled = 0;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled);
    if (isCompiled == GL_FALSE) {
        GLint max_len = 0;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &max_len);
        std::vector<GLchar> info_log(max_len);
        glGetShaderInfoLog(shader, max_len, &max_len, &info_log[0]);
        
        std::cout << "Error compiling shader " << filename << std::endl;
        for (GLchar c : info_log) {
            std::cout << c;
        }
        std::cout << std::endl;
        return 0;
    }
    
    return shader;
}
Beispiel #13
0
static int msg_topic(const char *replyto, struct userlist *user, char *data)
{
	char *channel, *topic ;

	if (data == NULL) {
		msgreply(user, replyto, "Syntax error: topic <channel> <text>");
		return (0);
	}

	channel = strtok(data, " ");
	topic = strtok(NULL, "");

	if (channel == NULL || topic == NULL) {
		msgreply(user, replyto, "Syntax error: topic <channel> <text>");
		return (0);
	}

	if (GetChannelAccess(user, channel) < 0) {
		return (access_too_low(user, replyto));
	}
	info_log("Topic on %s set to %s by %s\n", channel, topic, unick(user));

	msgreply(user, replyto, "Changing topic on %s", channel);

	irc_sprintf(usinfo(user), "TOPIC %s :%s\n", channel, topic);

	return (0);

}
Beispiel #14
0
static int msg_mode(const char *replyto, struct userlist *user, char *data)
{
	char *channel, *modes ;

	if (data == NULL) {
		msgreply(user, replyto, "Syntax error: mode <channel> <flags>");
		return (0);
	}

	channel = strtok(data, " ");
	modes = strtok(NULL, "");

	if (channel == NULL || modes == NULL) {
		msgreply(user, replyto, "Syntax error: mode <channel> <flags>");
		return (0);
	}

	if (GetChannelAccess(user, channel) < 0) {
		return (access_too_low(user, replyto));
	}
	info_log("Mode change %s on %s by %s\n", modes, channel, unick(user));
	msgreply(user, replyto, "Changing mode on %s to %s", channel, modes);
	irc_sprintf(usinfo(user), "MODE %s %s\n", channel, modes);

	return (0);
}
Beispiel #15
0
/*
static int msg_part(const char *replyto, struct userlist *user, const char *data)
{

	if (data == NULL) {
		msgreply(user, replyto, "Syntax error: part <channel>");
		return(0);
	}

	if(ExitChannel(data, user->userinfo->server)==-1) {
		msgreply(user, replyto, "I can't part a channel that I'm not in");
	} else {
		msgreply(user, replyto, "Parting %s", data);
		info_log("Parted %s by %s\n", data, user->userinfo->nick);
	}

	return (0);

}

static int msg_ctcp(const char *replyto, struct userlist *user, const char *data)
{

	if (data == NULL) {
		if (botinfo->ctcp == 1) {
			msgreply(user, replyto, "CTCP ON");
		} else {
			msgreply(user, replyto, "CTCP OFF");
		}
		
		return(0);
	}
	
	if (strcaseeq("off", data)) {
		botinfo->ctcp = 0;
		msgreply(user, replyto, "CTCP OFF");
		return(0);
	}
	if (strcaseeq("on", data)) {
		botinfo->ctcp = 1;
		msgreply(user, replyto, "CTCP ON");
		return(0);
	}
	msgreply(user, replyto, "Syntax error: ctcp <on/off>");
	return(0);
}
*/
static int 
msg_part(const char *replyto, struct userlist *user, char *data)
{
	char *channel, *message;
	
	if (data == NULL) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Syntax error: part <channel> [text]");
		return(0);
	}
	
	channel = strtok(data, " ");
	message = strtok(NULL, "");
	
	if (message == NULL) {
		privmsg(usinfo(user), channel, "Bye!");
	} else {
		privmsg(usinfo(user), channel, "%s", message);
	}

	if (ExitChannel(data, user->userinfo->server) == -1) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "I can't part a channel that I'm not in");
	} else {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Parting %s", data);
		info_log("Parted %s by %s\n", data, user->userinfo->nick);
	}
	
	return(0);
}
Beispiel #16
0
	/* needed to shut the compilor up */
	return(0);
}

//admin only command: lists registered bot users
static int msg_listusers(const char *replyto, struct userlist *user, const char * UNUSED(data))
{
	info_log("Requested listusers by %s\n", user->userinfo->nick);
	int i=0;
	struct userdata *userdata_curr;
	userdata_curr=conf_userdata;
	while(userdata_curr != NULL){
		msgreply(user, replyto, "      %s",userdata_curr->usernick);
		userdata_curr=userdata_curr->next;
		i++;
	}
	msgreply(user, replyto, "--- %i users total ---",i);
	return(0);
}


static int msg_version(const char *replyto, struct userlist *user, const char * UNUSED(data))
{
	msgreply(user, replyto, "Version: %s", botinfo->ver);
	return(0);
}

static int msg_time(const char *replyto, struct userlist *user, const char * UNUSED(data))
{
	char timestr[50];

	time(&currtime);

	strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%Y",
		 localtime(&currtime));

	msgreply(user, replyto, "The current time is: %s", timestr);
	return(0);
}

static int msg_reload(const char *replyto, struct userlist *user, const char * UNUSED(data))
{
	info_log("Reload by %s\n", user->userinfo->nick);
	acid_reload("reloading\n");
	//msgreply(user, replyto, "Reload complete.");
	msgreply(user, replyto, "Professore ho ricaricato Utenti e Log sulla navetta siamo pronti a consegnarli.");

	return(0);
}

#if 0 /* too ugly to live */
static int msg_help(const char *replyto, struct userlist *user, const char *data)
{
	char *line;
	FILE *fp_help;

	/* This is not ideal.. spending this much time inside a routine will
	   make it hard for the bot to handle outside events in a timely manor */

	if ((line = malloc(100)) == NULL) {
		display_error("execute: Malloc error!\n");
		return (-1);
	}
	if ((fp_help = fopen("../docs/help", "r")) == NULL) {
		info_log("Cant open help file! \n");
		free(line);
		msgreply(user, replyto, "Cant open help file! ");
		return(0);
	}
	while (fgets(line, 100, fp_help) != NULL) {
		if (msgreply(user, replyto, "%s", line) == -1) {
			free(line);
			return (-1);
		}
		/* give the server time to accept the input */
		sleep(1);
	}
	free(line);
	return (0);
}
Beispiel #17
0
	void Shader::Build() {
		this->program = glCreateProgram();

		for (auto shader : this->shaders) {
			glAttachShader(this->program, shader);
		}

		glLinkProgram(this->program);

		GLint is_linked = 0;
		glGetProgramiv(this->program, GL_LINK_STATUS, (int *)&is_linked);
		if (is_linked == GL_FALSE) {
			GLint max_length = 0;
			glGetProgramiv(this->program, GL_INFO_LOG_LENGTH, &max_length);

			std::vector<GLchar> info_log(max_length);
			glGetProgramInfoLog(this->program, max_length, &max_length, &info_log[0]);
			std::copy(info_log.begin(), info_log.end(), std::ostream_iterator<GLchar>(std::cout, ""));

			DeleteProgram();

			return;
		}

		for (auto shader : this->shaders) {
			glDetachShader(this->program, shader);
		}
	}
Beispiel #18
0
static void CheckMissing(struct servercstruct *server) {
	int delay;
	
	if(!IsConnecting(server->sinfo)&&(server->nexttry<=currtime) ) {
		if(server->server!=NULL) {
			DelServer(server->server);
			server->server=NULL;
		}
		if(botinfo->maxtries != 0 && server->conatt >= botinfo->maxtries) {
			NotConnectable(server->sinfo);
			return;
		}
			
		server->conatt++;
		delay=CalcConDelay(server->conatt);
		server->nexttry=currtime+delay;
		info_log("Connecting to %s attempt %i next attempt in %i seconds\n",server->address, server->conatt, delay); 
		AddServer(server->sinfo, server->address, botinfo->nick);

		/* convert botinfo->timout (minutes) to sinfo->timeout (seconds) */
		server->sinfo->timeout=botinfo->timeout * 60;
		//disconnectonidle(server->sinfo); 
		
		connect_to_host(server->sinfo,server->address,server->port);
	}
	
}
Beispiel #19
0
/* ================ handle_pullin_on_client_pipe() ================ */
int handle_pullin_on_client_pipe(zloop_t *loop, zsock_t *pipe, void *user_data)
{
    client_t *client = (client_t*)user_data;

    if ( over_actors >= total_actors ){
        zloop_reader_end(loop, pipe);
        return -1;
    }

    zmsg_t *msg = zmsg_recv(pipe);
    if ( msg == NULL ){
        zloop_reader_end(loop, pipe);
        return -1;
    }

    /*zmsg_print(msg);*/

    if ( message_check_status(msg, MSG_STATUS_ACTOR_OVER) == 0 ){
        over_actors++;
        info_log("Actor %d over! (%d/%d)", client->id, over_actors, total_actors);
    }

    zmsg_destroy(&msg);

    return 0;
}
Beispiel #20
0
/* ==================== on_connection() ==================== */ 
static void on_connection(uv_stream_t *stream, int status)
{
    server_t *server= (server_t*)stream->data;

    /* -------- create_session -------- */
    session_callbacks_t callbacks = {
        session_idle_cb,
        session_timer_cb,
        session_async_cb,
        session_is_idle,
        session_handle_message,
        session_init,
        session_destroy
    };
    session_t *session = session_new((void*)server, callbacks);
    if ( session == NULL ){
        error_log("session_new() failed. session == NULL.");
        return;
    }
    int ret = session_accept(session, &server->connection.handle.tcp);
    if ( ret != 0 ) {
        error_log("session_accept() failed. ret=%d", ret);
        return;
    }

    info_log("Connected. (server_fd = %d, session_fd = %d)", server_fd(server), session_fd(session));

}
Beispiel #21
0
static int 
msg_google(const char *replyto, struct userlist *user, char *data)
{
	char *message;
	char *begin_web = "http://www.google.it/search?hl=it&q=";
	char *end_web = "&btnG=Cerca&meta=";
	char *begin_img = "http://images.google.it/images?q=";
	char *end_img = "&um=1&ie=UTF-8&sa=N&tab=wi";
	char *begin_news = "http://news.google.it/news?hl=it&q=";
	char *end_news = "&um=1&ie=UTF-8&sa=N&tab=in";
	int i;
	
	if (data == NULL) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Syntax error: google <text>");
		return(0);
	}
	
	message = strtok(data, "");
	
	info_log("Google \"%s\" on %s by %s\n", message, replyto, unick(user));
	
	for (i = 0; i < strlen(message); i++) {
		if (*(message + i) == ' ') {
			*(message + i) = '+';
		}
	}
	
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Google Web: %s%s%s", begin_web, message, end_web);
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Google Immagini: %s%s%s", begin_img, message, end_img);
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Google News: %s%s%s", begin_news, message, end_news);

	return(0);
}
Beispiel #22
0
static int 
msg_youtube(const char *replyto, struct userlist *user, char *data)
{
	char *message;
	char *begin = "http://www.youtube.com/results?search_query=";
	char *end = "&search_type=&aq=-1&oq=";
	int i;
	
	if (data == NULL) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Syntax error: YouTube <text>");
		return(0);
	}
	
	message = strtok(data, "");
	
	info_log("YouTube \"%s\" on %s by %s\n", message, replyto, unick(user));
	
	for (i = 0; i < strlen(message); i++) {
		if (*(message + i) == ' ') {
			*(message + i) = '+';
		}
	}
	
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "%s%s%s", begin, message, end);
	return(0);
}
Beispiel #23
0
static int 
msg_meteo(const char *replyto, struct userlist *user, char *data)
{
	char *message;
	char *begin_meteo = "http://www.google.it/search?hl=it&q=meteo+";
	char *end_meteo = "&btnG=Cerca+con+Google&meta=";
	int i;
	
	if (data == NULL) {
		send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Syntax error: meteo <city>");
		return(0);
	}
	
	message = strtok(data, "");
	
	info_log("Meteo \"%s\" on %s by %s\n", message, replyto, unick(user));
	
	for (i = 0; i < strlen(message); i++) {
		if (*(message + i) == ' ') {
			*(message + i) = '+';
		}
	}
	
	send_notice(user->userinfo->server->sinfo, user->userinfo->nick, "Meteo Web: %s%s%s", begin_meteo, message, end_meteo);

	return(0);
}
Beispiel #24
0
void acid_reload(const char *reason)
{
	close_log();
	init_log() ;
	info_log("Reload: %s\n",reason) ;
	read_user_data();
}
Beispiel #25
0
static int msg_opuser(const char *replyto, struct userlist *user, char *data)
{
	char *channel, *usertoop ;

	if (data == NULL) {
		msgreply(user, replyto, "Syntax error: opuser <channel> <user>");
		return (0);
	}

	channel = strtok(data, " ");
	usertoop = strtok(NULL, "");

	if (user == NULL) {
		msgreply(user, replyto, "Syntax error: opuser <channel> <user>");
		return (0);
	}

	if (GetChannelAccess(user, channel) >= 0) {
		info_log("Opuser %s on %s\n", usertoop, channel);
		msgreply(user, replyto, "Opping %s on %s", usertoop, channel);
		irc_sprintf(usinfo(user), "MODE %s +o %s\n", channel, usertoop);
	} else {
		msgreply(user, replyto, "Authorization failed!");
	}

	return (0);
}
Beispiel #26
0
GLuint loadProgram(std::vector<GLuint> shaders)
{
    GLuint program = glCreateProgram();;
    for (GLuint shader : shaders)
    {
        glAttachShader(program, shader); 
    }
    glLinkProgram(program);

    int success = 0;
    glGetProgramiv(program, GL_LINK_STATUS, &success);
    if (!success)
    {
        int log_length;
        glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
        std::vector<GLchar> buffer (log_length);
        glGetProgramInfoLog(program, log_length, nullptr, buffer.data());
        std::string info_log (buffer.data(), log_length);

        fatalError("Failed to link program.");
    }

    for (GLuint shader : shaders)
    {
        glDetachShader(program, shader); 
    }
    return program;
}
Beispiel #27
0
void remove_old_executable_binary()
{
    instaMsg.singletonUtilityFs.deleteFile(&(instaMsg.singletonUtilityFs), BINARY_NAME);

    sg_sprintf(LOG_GLOBAL_BUFFER, PROSTR("%sOld Binary [%s] successfully deleted."), FILE_UPGRADE, BINARY_NAME);
    info_log(LOG_GLOBAL_BUFFER);
}
Beispiel #28
0
void copy_new_executable_binary_from_temp_location()
{
    instaMsg.singletonUtilityFs.copyFile(&(instaMsg.singletonUtilityFs), TEMP_FILE_NAME, BINARY_NAME);

    sg_sprintf(LOG_GLOBAL_BUFFER, PROSTR("%sFile [%s] successfully copied to [%s]"), FILE_UPGRADE, TEMP_FILE_NAME, BINARY_NAME);
    info_log(LOG_GLOBAL_BUFFER);
}
Beispiel #29
0
int parse_http_request_uri(char** recvbuf, http_request* request)
{
	if (!parse_http_request_method(recvbuf, request)) {
		info_log("parse_http_request_method failed");
		return 0;
	}

	if (!parse_http_request_path(recvbuf, request)) {
		info_log("parse_http_request_path failed");
		return 0;
	}

	if (!parse_http_request_variables(recvbuf, request))
		return 0;

	return 1;
}
 void ShaderManager::logShaderInfoLog(const unsigned int& shader_object) {
   int max_length = 0;
   glGetShaderiv(shader_object, GL_INFO_LOG_LENGTH, &max_length);
   std::vector<char> info_log(max_length);
   glGetShaderInfoLog(shader_object, max_length, &max_length, &info_log[0]);
   std::string output(info_log.begin(), info_log.end());
   LOG(INFO)<<output;
 }