<commit_before>package plugins

import (
	"../ircclient"
	"bufio"
	"bytes"
	"crypto/rand"
	"encoding/binary"
	"fmt"
	"log"
	"net"
	"regexp"
	"time"
)

const (
	audiomett_topic_regexp      = `((?:^|\|)[^|]*)audiomett:[^|]*?(\s*(?:$|\|))`
	audiomett_topic_replacement = "${1}audiomett: %d %s$2"
	ping_intervall              = 30 * time.Second
)

type MumblePlugin struct {
	ic                   *ircclient.IRCClient
	quit                 chan bool
	audiomettTopicRegexp *regexp.Regexp
	topic                string
	lastUsers            int32
	running              bool
}

func (q *MumblePlugin) String() string {
	return "mumble"
}

func (q *MumblePlugin) Info() string {
	return "Displays the number of users connected to the mumble server in the channel topic"
}

func (q *MumblePlugin) Usage(cmd string) string {
	// just for interface saturation
	return ""
}

func (q *MumblePlugin) Register(cl *ircclient.IRCClient) {
	q.ic = cl
	q.quit = make(chan bool)
	q.audiomettTopicRegexp = regexp.MustCompile(audiomett_topic_regexp)
	q.topic = ""
	q.lastUsers = 0
	q.running = false

	// check for config
	if q.ic.GetStringOption("Mumble", "server") == "" || q.ic.GetStringOption("Mumble", "channel") == "" {
		log.Fatal("Need server and channel for Mumble ping")
	}

	q.Start()
}

func (q *MumblePlugin) Unregister() {
	return
}

func (q *MumblePlugin) ProcessLine(msg *ircclient.IRCMessage) {
	// log topic
	if msg.Command == "332" && msg.Args[0][1:] == q.ic.GetStringOption("Mumble", "channel") { // announce of topic during joining of channel
		q.topic = msg.Args[1]
	} else if msg.Command == "TOPIC" && msg.Target[1:] == q.ic.GetStringOption("Mumble", "channel") {
		q.topic = msg.Args[0]
	}
}

func (q *MumblePlugin) ProcessCommand(cmd *ircclient.IRCCommand) {
	return
}
<commit_msg>stop mumble ping during unregistering<commit_after>package plugins

import (
	"../ircclient"
	"bufio"
	"bytes"
	"crypto/rand"
	"encoding/binary"
	"fmt"
	"log"
	"net"
	"regexp"
	"time"
)

const (
	audiomett_topic_regexp      = `((?:^|\|)[^|]*)audiomett:[^|]*?(\s*(?:$|\|))`
	audiomett_topic_replacement = "${1}audiomett: %d %s$2"
	ping_intervall              = 30 * time.Second
)

type MumblePlugin struct {
	ic                   *ircclient.IRCClient
	quit                 chan bool
	audiomettTopicRegexp *regexp.Regexp
	topic                string
	lastUsers            int32
	running              bool
}

func (q *MumblePlugin) String() string {
	return "mumble"
}

func (q *MumblePlugin) Info() string {
	return "Displays the number of users connected to the mumble server in the channel topic"
}

func (q *MumblePlugin) Usage(cmd string) string {
	// just for interface saturation
	return ""
}

func (q *MumblePlugin) Register(cl *ircclient.IRCClient) {
	q.ic = cl
	q.quit = make(chan bool)
	q.audiomettTopicRegexp = regexp.MustCompile(audiomett_topic_regexp)
	q.topic = ""
	q.lastUsers = 0
	q.running = false

	// check for config
	if q.ic.GetStringOption("Mumble", "server") == "" || q.ic.GetStringOption("Mumble", "channel") == "" {
		log.Fatal("Need server and channel for Mumble ping")
	}

	q.Start()
}

func (q *MumblePlugin) Unregister() {
	q.Stop()
}

func (q *MumblePlugin) ProcessLine(msg *ircclient.IRCMessage) {
	// log topic
	if msg.Command == "332" && msg.Args[0][1:] == q.ic.GetStringOption("Mumble", "channel") { // announce of topic during joining of channel
		q.topic = msg.Args[1]
	} else if msg.Command == "TOPIC" && msg.Target[1:] == q.ic.GetStringOption("Mumble", "channel") {
		q.topic = msg.Args[0]
	}
}

func (q *MumblePlugin) ProcessCommand(cmd *ircclient.IRCCommand) {
	return
}

{'fraction_non_alphanumeric': 0.15339643652561247, 'fraction_numerical': 0.008351893095768375, 'mean_word_length': 3.4358024691358025, 'pattern_counts': {'":': 0, '<': 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': '5728371', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1304, 'n_words': 308}