<commit_before>package com.burghnerds.minexmpp;


import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

import java.io.IOException;

import org.jivesoftware.smack.*;
import org.jivesoftware.smack.tcp.*;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = MineXMPP.MODID, version = MineXMPP.VERSION)
public class MineXMPP
{
	public static final String MODID = "MineXMPP";
	public static final String VERSION = "0.01";

	private XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
	private AbstractXMPPConnection connection;

	private static String username, password, resource, service, host;

	@EventHandler
	public void preInit(FMLPreInitializationEvent event) {
		Configuration config = new Configuration(event.getSuggestedConfigurationFile());


		config.load();

		username = config.get(config.CATEGORY_GENERAL, "username", "username").getString();
		password = config.get(config.CATEGORY_GENERAL, "password", "password").getString();		
		resource = config.get(config.CATEGORY_GENERAL, "resource", "resource").getString();
		service = config.get(config.CATEGORY_GENERAL, "service", "service").getString();
		host = config.get(config.CATEGORY_GENERAL, "host", "host").getString();

		config.save();
	}

	@EventHandler
	public void init(FMLInitializationEvent event)
	{
		System.out.println("Test Upload");


		configBuilder = XMPPTCPConnectionConfiguration.builder();
		configBuilder.setUsernameAndPassword(username, password);
		configBuilder.setResource(resource);
		configBuilder.setServiceName(service);
		configBuilder.setHost("hephaestus");
		configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
		connection = new XMPPTCPConnection(configBuilder.build());

		//SASLAuthentication.unBlacklistSASLMechanism("PLAIN");
		//SASLAuthentication.unBlacklistSASLMechanism("DIGEST-MD5");

		try {
			System.out.println("Attempting to contact XMPP Server");
			connection.connect();
			System.out.println("Connection Successful. Attempting to log in");
			connection.login();
			System.out.println("Login successful");
		} catch (XMPPException e) {
			System.out.println("XMPP Exception Occurred");
			e.printStackTrace();
		} catch (SmackException e) {
			System.out.println("An error occurred");
			e.printStackTrace();
		} catch (IOException e) {
			System.out.println("IO Exception Occurred");
			e.printStackTrace();
		} finally {
			System.out.println("MineXMPP Finished Loading");
		}
	}
}<commit_msg>Added connection to chatroom on xmpp server<commit_after>package com.burghnerds.minexmpp;


import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.ServerChatEvent;

import java.io.IOException;

import org.jivesoftware.smack.*;
import org.jivesoftware.smack.tcp.*;
import org.jivesoftware.smackx.muc.MultiUserChat;
import org.jivesoftware.smackx.muc.MultiUserChatManager;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = MineXMPP.MODID, version = MineXMPP.VERSION)
public class MineXMPP
{
	public static final String MODID = "MineXMPP";
	public static final String VERSION = "0.01";

	private XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
	private AbstractXMPPConnection connection;
	private MultiUserChatManager manager;
	private MultiUserChat chatroom;

	private static String username, password, resource, service, host, chatRoomName, chatRoomPrefix;
	
	private boolean isConnected = false;

	@EventHandler
	public void preInit(FMLPreInitializationEvent event) 
	{
		Configuration config = new Configuration(event.getSuggestedConfigurationFile());


		config.load();

		username = config.get(config.CATEGORY_GENERAL, "username", "username").getString();
		password = config.get(config.CATEGORY_GENERAL, "password", "").getString();		
		resource = config.get(config.CATEGORY_GENERAL, "resource", "resource").getString();
		service = config.get(config.CATEGORY_GENERAL, "service", "service").getString();
		host = config.get(config.CATEGORY_GENERAL, "host", "host").getString();
		chatRoomName = config.get(config.CATEGORY_GENERAL, "room-name", "chat").getString();
		chatRoomPrefix = config.get(config.CATEGORY_GENERAL, "service-chatroom-prefix", "conference").getString();

		config.save();
	}

	@EventHandler
	public void init(FMLInitializationEvent event)	
	{
		System.out.println("Test Upload");
		
		//Initialize configurations
		configBuilder = XMPPTCPConnectionConfiguration.builder();
		configBuilder.setUsernameAndPassword(username, password);
		configBuilder.setResource(resource);
		configBuilder.setServiceName(service);
		configBuilder.setHost(host);
		configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
		connection = new XMPPTCPConnection(configBuilder.build());


		try {
			System.out.println("Attempting to contact XMPP Server");
			connection.connect();
			
			System.out.println("Connection Successful. Attempting to log in");
			connection.login();
			
			String fullChatName = chatRoomName+"@"+chatRoomPrefix +"."+service;
			System.out.println("Login successful. Attemtping to join public chatroom " + fullChatName);
			manager = MultiUserChatManager.getInstanceFor(connection);
			chatroom = manager.getMultiUserChat(fullChatName);
			chatroom.join(username);
			
			isConnected = true;
		} catch (XMPPException e) {
			System.out.println("XMPP Exception Occurred");
			e.printStackTrace();
		} catch (SmackException e) {
			System.out.println("An error occurred");
			e.printStackTrace();
		} catch (IOException e) {
			System.out.println("IO Exception Occurred");
			e.printStackTrace();
		} finally {
			System.out.println("MineXMPP Finished Loading");
		}
	}
	

}
{'fraction_non_alphanumeric': 0.11926605504587157, 'fraction_numerical': 0.0010358094110683633, 'mean_word_length': 5.813508064516129, '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': '6641588', 'n_tokens_mistral': 2229, 'n_tokens_neox': 2082, 'n_words': 373}