<commit_before>package main

import (
	"bytes"
	"net"
	"strings"
)

func strcat(s1 string, s2 string) string {
	var buffer bytes.Buffer
	buffer.WriteString(s1)
	buffer.WriteString(s2)
	return buffer.String()
}

func GetUserByNick(nick string) *User {
	nick = strings.ToLower(nick)
	for _, k := range userlist {
		if strings.ToLower(k.nick) == nick {
			return k
		}
	}
	return nil
}

func GetIpFromConn(conn net.Conn) string {
	ip := conn.RemoteAddr().String()
	if !strings.HasPrefix(ip, "[") {
		//IPV4
		return strings.Split(ip, ":")[0]
	} else {
		//IPV6
		ip = strings.Split(ip, "]")[0]
		ip = strings.TrimPrefix(ip, "[")
		return ip
	}
}

func GetChannelByName(name string) *Channel {
	return chanlist[strings.ToLower(name)]
}

func SendToMany(msg string, list []*User) {
	users := make(map[*User]int)
	for j, _ := range list {
		users[j] = 0
	}
	for j, _ := range users {
		j.SendLine(msg)
	}
}

/*
//SendToMany2f sends to all users in list ([]*User), does not check for dupes, accepts in printf format.
func SendToMany2f(list []*User, msg string, args ...interface{}) {
	for _, k := range list {
		k.SendLinef(msg, args...)
	}
}
*/

func ValidChanName(name string) bool {
	if ChanHasBadChars(name) {
		return false
	}
	for _, k := range valid_chan_prefix {
		if strings.HasPrefix(name, k) {
			return true
		}
	}
	return false
}<commit_msg>remove SendToMany2f, it has no reason to exist with channel.SendLinef()<commit_after>package main

import (
	"bytes"
	"net"
	"strings"
)

func strcat(s1 string, s2 string) string {
	var buffer bytes.Buffer
	buffer.WriteString(s1)
	buffer.WriteString(s2)
	return buffer.String()
}

func GetUserByNick(nick string) *User {
	nick = strings.ToLower(nick)
	for _, k := range userlist {
		if strings.ToLower(k.nick) == nick {
			return k
		}
	}
	return nil
}

func GetIpFromConn(conn net.Conn) string {
	ip := conn.RemoteAddr().String()
	if !strings.HasPrefix(ip, "[") {
		//IPV4
		return strings.Split(ip, ":")[0]
	} else {
		//IPV6
		ip = strings.Split(ip, "]")[0]
		ip = strings.TrimPrefix(ip, "[")
		return ip
	}
}

func GetChannelByName(name string) *Channel {
	return chanlist[strings.ToLower(name)]
}

func SendToMany(msg string, list []*User) {
	users := make(map[*User]int)
	for j, _ := range list {
		users[j] = 0
	}
	for j, _ := range users {
		j.SendLine(msg)
	}
}

func ValidChanName(name string) bool {
	if ChanHasBadChars(name) {
		return false
	}
	for _, k := range valid_chan_prefix {
		if strings.HasPrefix(name, k) {
			return true
		}
	}
	return false
}
{'fraction_non_alphanumeric': 0.14797136038186157, 'fraction_numerical': 0.008353221957040573, 'mean_word_length': 3.709737827715356, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3569741', 'n_tokens_mistral': 1015, 'n_tokens_neox': 959, 'n_words': 239}