Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 June, 2013, 22:43:47 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Random Java Libs -  (Read 644 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Online Online

Gender: Male
Last Login: Today at 22:30:08
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 616


Topic starter
Total Post Ratings: +53

View Profile WWW
« on: 23 July, 2011, 20:52:04 »
+1

I just finished converting the back end of my IRC bot into an IRC library, JIRC. It's a fairly easy way to add IRC stuff to anything. I only did the javadoc for the main class, so... =P The attached zip has the jar, javadoc, and source. Here's an example of how to use it (This is a simple command line IRC client, basically) Freel free to comment on things it needs or things you find odd =)
Spoiler for Example Below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//Sorry about the lack of comments, I'm a lazy documenter... =\
//Modified to add a few more comments =P
import java.io.*;
import java.util.*;
import java.util.regex.*;

public class Test {
   
    static PrintStream sout = System.out;
    static BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
   
    public static void main(String args[]) {
        JIRC jirc = new JIRC("withg.us.to", "JIRC_Test", "JIRC Test Bot") {
            //I just used a nameless class (whatever the correct term is, idk), you probably would want to create a seperate extending class for code neatness, but this is small, so...
            //All the methods that need to be implemented are the event handlers.  I tried to make the event names pretty obvious, but...
            protected void onConnect() { //When JIRC connects to IRC (Or reconnects, it auto reconnects on disconnect)
                sout.println("Connected!");
                joinChannel("test");
            }

            protected void onPingged(String server) { //When you are pinged
                sout.println("Ping? Pong!");
            }

            protected void onServerMessage(String message) { //When the server sends you a message
                Date now = new Date();
                sout.println("-[" + now.toGMTString() + "]- " + message);
            }

            protected void onChannelMessageReceive(String channel, String nick, String message) { //When you receive a message directed at a channel you are in
                sout.println("[" + now.toGMTString() + "] #" + channel + ": <" + nick + "> " + message);
            }

            protected void onPrivateMessageReceive(String nick, String message) { //When you receive a private message directed at you
                sout.println("[" + now.toGMTString() + "] <" + nick + "> " + message);
            }

            protected void onChannelMemberPart(String channel, String nick) { //When someone leaves a channel you are in
                sout.println(channel + ": " + nick + " has left");
            }

            protected void onChannelMemberJoin(String channel, String nick) { //When someone joins a channel you are in
                sout.println(channel + ": " + nick + " has joined");
            }

            protected void onChannelMemberQuit(String nick, String message) { //When someone who is in one or more channels with you quits
                sout.println(nick + " has quit (" + message + ")");
            }
        };
        jirc.start(); //Start JIRC
Pattern JoinCommand = Pattern.compile("/(?:join|j) (.+)", Pattern.CASE_INSENSITIVE);
Pattern PartCommand = Pattern.compile("/(?:part|p)", Pattern.CASE_INSENSITIVE);
Pattern CACCommand = Pattern.compile("/cac (.+)", Pattern.CASE_INSENSITIVE);
Pattern NickCommand = Pattern.compile("/(?:nick|n) (.+)", Pattern.CASE_INSENSITIVE);
Pattern OpCommand = Pattern.compile("/op (.+)", Pattern.CASE_INSENSITIVE);
Pattern DeOpCommand = Pattern.compile("/deop (.+)", Pattern.CASE_INSENSITIVE);
Pattern RawCommand = Pattern.compile("/raw (.+)", Pattern.CASE_INSENSITIVE);
Pattern ListCommand = Pattern.compile("/(?:list|l) #(.+)", Pattern.CASE_INSENSITIVE);
Pattern ExitCommand = Pattern.compile("/(?:exit|e)", Pattern.CASE_INSENSITIVE); //Because I'm lazy, so I used regex to detect commands etc
        String ActiveIRCChannel = ""; //To keep track of the channel you are currently talking in
        try {
            while (true) { //Loop for console input
                while (sin.ready()) {
                    String msg = sin.readLine();
                    if (msg != null) {
                        Matcher m;
                        if ((m = JoinCommand.matcher(msg)).find(0)) {
                            jirc.joinChannel(m.group(1).replace("#", ""));
                        } else if ((m = PartCommand.matcher(msg)).find(0)) {
                            jirc.partChannel(ActiveIRCChannel);
                        } else if ((m = NickCommand.matcher(msg)).find(0)) {
                            jirc.changeNick(m.group(1));
                        } else if ((m = OpCommand.matcher(msg)).find(0)) {
                            jirc.opChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = DeOpCommand.matcher(msg)).find(0)) {
                            jirc.deOpChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = CACCommand.matcher(msg)).find(0)) {
                            ActiveIRCChannel = m.group(1).replace("#", "");
                            sout.println("Changed the active channel to " + ActiveIRCChannel);
                        } else if ((m = ListCommand.matcher(msg)).find(0)) {
                            Channel curchan = jirc.getChannelList().get(JIRC.inChannelList(jirc.getChannelList(), m.group(1)));
                            Person[] People = curchan.getAllMembers();
                            for (int x = 0; x < People.length; x++) {
                                sout.println(People[x].getName() + " (" + People[x].getModes() + ") Active: " + People[x].isActive());
                            }
                        } else if ((m = RawCommand.matcher(msg)).find(0)) {
                            jirc.sendRawMessage(m.group(1));
                        } else if ((m = ExitCommand.matcher(msg)).find(0)) {
                            sout.close();
                            sin.close();
                            System.exit(0);
                        } else if (msg.startsWith("/")) {

                        } else {
                            jirc.sendMessage(ActiveIRCChannel, msg);
                            sout.println("#" + ActiveIRCChannel + ": <" + jirc.getNick() + "> " + msg);
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Additionally, notice the "s" in "Java Libs".  That's because I also plan on converting the backend of TFE into a general purpose TI File lib, and maybe some others if I feel like it.  This is it atm though =)

* JIRC.zip (68.7 KB - downloaded 23 times.)
« Last Edit: 24 July, 2011, 21:15:36 by cooliojazz » Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 13 June, 2013, 19:29:09
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #1 on: 24 July, 2011, 15:23:32 »
0

Great CoolioJazz, could you perhaps add a sample so we can know how to use it? Thanks Smiley
Logged
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Online Online

Gender: Male
Last Login: Today at 22:30:08
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 616


Topic starter
Total Post Ratings: +53

View Profile WWW
« Reply #2 on: 24 July, 2011, 21:06:37 »
0

The example is in the spoiler tags Wink If you need a better explanation of how it works, I can give that too though =P
Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 13 June, 2013, 19:29:09
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #3 on: 24 July, 2011, 22:57:35 »
0

The example is in the spoiler tags Wink If you need a better explanation of how it works, I can give that too though =P

I didn't notice it, perhaps because it is code inside spoiler.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//Sorry about the lack of comments, I'm a lazy documenter... =\
//Modified to add a few more comments =P
import java.io.*;
import java.util.*;
import java.util.regex.*;

public class Test {
   
    static PrintStream sout = System.out;
    static BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
   
    public static void main(String args[]) {
        JIRC jirc = new JIRC("withg.us.to", "JIRC_Test", "JIRC Test Bot") {
            //I just used a nameless class (whatever the correct term is, idk), you probably would want to create a seperate extending class for code neatness, but this is small, so...
            //All the methods that need to be implemented are the event handlers.  I tried to make the event names pretty obvious, but...
            protected void onConnect() { //When JIRC connects to IRC (Or reconnects, it auto reconnects on disconnect)
                sout.println("Connected!");
                joinChannel("test");
            }

            protected void onPingged(String server) { //When you are pinged
                sout.println("Ping? Pong!");
            }

            protected void onServerMessage(String message) { //When the server sends you a message
                Date now = new Date();
                sout.println("-[" + now.toGMTString() + "]- " + message);
            }

            protected void onChannelMessageReceive(String channel, String nick, String message) { //When you receive a message directed at a channel you are in
                sout.println("[" + now.toGMTString() + "] #" + channel + ": <" + nick + "> " + message);
            }

            protected void onPrivateMessageReceive(String nick, String message) { //When you receive a private message directed at you
                sout.println("[" + now.toGMTString() + "] <" + nick + "> " + message);
            }

            protected void onChannelMemberPart(String channel, String nick) { //When someone leaves a channel you are in
                sout.println(channel + ": " + nick + " has left");
            }

            protected void onChannelMemberJoin(String channel, String nick) { //When someone joins a channel you are in
                sout.println(channel + ": " + nick + " has joined");
            }

            protected void onChannelMemberQuit(String nick, String message) { //When someone who is in one or more channels with you quits
                sout.println(nick + " has quit (" + message + ")");
            }
        };
        jirc.start(); //Start JIRC
Pattern JoinCommand = Pattern.compile("/(?:join|j) (.+)", Pattern.CASE_INSENSITIVE);
Pattern PartCommand = Pattern.compile("/(?:part|p)", Pattern.CASE_INSENSITIVE);
Pattern CACCommand = Pattern.compile("/cac (.+)", Pattern.CASE_INSENSITIVE);
Pattern NickCommand = Pattern.compile("/(?:nick|n) (.+)", Pattern.CASE_INSENSITIVE);
Pattern OpCommand = Pattern.compile("/op (.+)", Pattern.CASE_INSENSITIVE);
Pattern DeOpCommand = Pattern.compile("/deop (.+)", Pattern.CASE_INSENSITIVE);
Pattern RawCommand = Pattern.compile("/raw (.+)", Pattern.CASE_INSENSITIVE);
Pattern ListCommand = Pattern.compile("/(?:list|l) #(.+)", Pattern.CASE_INSENSITIVE);
Pattern ExitCommand = Pattern.compile("/(?:exit|e)", Pattern.CASE_INSENSITIVE); //Because I'm lazy, so I used regex to detect commands etc
        String ActiveIRCChannel = ""; //To keep track of the channel you are currently talking in
        try {
            while (true) { //Loop for console input
                while (sin.ready()) {
                    String msg = sin.readLine();
                    if (msg != null) {
                        Matcher m;
                        if ((m = JoinCommand.matcher(msg)).find(0)) {
                            jirc.joinChannel(m.group(1).replace("#", ""));
                        } else if ((m = PartCommand.matcher(msg)).find(0)) {
                            jirc.partChannel(ActiveIRCChannel);
                        } else if ((m = NickCommand.matcher(msg)).find(0)) {
                            jirc.changeNick(m.group(1));
                        } else if ((m = OpCommand.matcher(msg)).find(0)) {
                            jirc.opChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = DeOpCommand.matcher(msg)).find(0)) {
                            jirc.deOpChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = CACCommand.matcher(msg)).find(0)) {
                            ActiveIRCChannel = m.group(1).replace("#", "");
                            sout.println("Changed the active channel to " + ActiveIRCChannel);
                        } else if ((m = ListCommand.matcher(msg)).find(0)) {
                            Channel curchan = jirc.getChannelList().get(JIRC.inChannelList(jirc.getChannelList(), m.group(1)));
                            Person[] People = curchan.getAllMembers();
                            for (int x = 0; x < People.length; x++) {
                                sout.println(People[x].getName() + " (" + People[x].getModes() + ") Active: " + People[x].isActive());
                            }
                        } else if ((m = RawCommand.matcher(msg)).find(0)) {
                            jirc.sendRawMessage(m.group(1));
                        } else if ((m = ExitCommand.matcher(msg)).find(0)) {
                            sout.close();
                            sin.close();
                            System.exit(0);
                        } else if (msg.startsWith("/")) {

                        } else {
                            jirc.sendMessage(ActiveIRCChannel, msg);
                            sout.println("#" + ActiveIRCChannel + ": <" + jirc.getNick() + "> " + msg);
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Just post it all like this, the code tags already shorten it, so it's not too big.

EDIT: And now that I read the code, it looks so easy to create a JIRC Object and connect to IRC! Awesome job! +1
« Last Edit: 24 July, 2011, 22:58:11 by ephan » Logged
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Online Online

Gender: Male
Last Login: Today at 22:30:08
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 616


Topic starter
Total Post Ratings: +53

View Profile WWW
« Reply #4 on: 25 July, 2011, 02:24:00 »
0

Yeah, but potentially, I was going to put quite a few libs in that one post, and with many examples, I just wanted to collapse them... Meh, w/e, it works =P Glad you like it though!  See anything you think it needs?
Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 13 June, 2013, 19:29:09
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #5 on: 27 July, 2011, 14:59:57 »
0

Yeah, but potentially, I was going to put quite a few libs in that one post, and with many examples, I just wanted to collapse them... Meh, w/e, it works =P Glad you like it though!  See anything you think it needs?

Is there an easy way to inherit JIRC and do thins from there?
Logged
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Online Online

Gender: Male
Last Login: Today at 22:30:08
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 616


Topic starter
Total Post Ratings: +53

View Profile WWW
« Reply #6 on: 29 July, 2011, 21:04:45 »
0

Well, I guess I'm not exactly sure what you're asking, but as far as I can tell, thats how you would do it without a "nameless" class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import jirc.*;

class myJIRC extends JIRC {

     myJIRC(String server, String nickname, String realname) {
          super(server, nickname, realname);
     }

     protected void onConnect() {
          //Event stuff!
          joinChannel("IRP"); //Join channel #IRP at startup!
     }
     //etc etc
}
So if that's not it, I'm not really sure what you're asking... =P
Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 13 June, 2013, 19:29:09
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #7 on: 29 July, 2011, 21:14:21 »
0

Oh sorry you're a Java programmer, you guys don't say "inherit", you say "extend", but yeah that's what I meant, cool!
Logged
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Online Online

Gender: Male
Last Login: Today at 22:30:08
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 616


Topic starter
Total Post Ratings: +53

View Profile WWW
« Reply #8 on: 06 August, 2012, 03:58:00 »
0

In light of the contest, I figured I might post all the amazing updates I've made to JIRC if anyone wants to use java and make their life easy Grin

Updated example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import com.up.jirc.*;
import java.io.*;
import java.text.DateFormat;
import java.util.*;
import java.util.regex.*;

public class Test {
   
    static PrintStream sout = System.out;
    static BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
    static String ActiveIRCChannel = "";
   
    public static void main(String args[]) {
        JIRC omni = new JIRC("withg.us.to", "JIRC_Test", "Test Implementation of JIRC", 6667) {
            protected void onConnect() {
                sout.println("Connected!");
            }

            protected void onPingged(String server) {
                sout.println("Ping? Pong!");
            }

            protected void onServerMessage(String message) {
                try {
                    ServerResponse sr = ServerResponse.parseString(message);
                    switch (sr.numeric) {
                        case MOTD:
                            sout.println("MOTD " + sr.response);
                            break;
                        case MOTDSTART:
                            sout.println("Message of the Day, " + sr.server);
                            break;
                        case ENDOFMOTD:
                            sout.println("End of MOTD");
                            break;
                        default:
                            sout.println(sr.numeric.toString() + ": " + sr.response);
                            break;
                    }
                } catch (Exception e) {
                    sout.println("[" + DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date()) + "] - " + message);
                }
            }

            protected void onChannelMessageReceive(String channel, String nick, String message) {
                sout.println("[" + DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date()) + "] #" + channel + ": <" + nick + "> " + message);
            }

            protected void onPrivateMessageReceive(String nick, String message) {
                sout.println("[" + DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date()) + "] <" + nick + "> " + message);
            }

            protected void onChannelMemberPart(String channel, String nick) {
                sout.println(channel + ": " + nick + " has left");
            }

            protected void onChannelMemberJoin(String channel, String nick) {
                sout.println(channel + ": " + nick + " has joined");
            }

            protected void onChannelMemberQuit(String nick, String message) {
                sout.println(nick + " has quit (" + message + ")");
            }
        };
        omni.setAddColors(true);
//        BLACKF "\033[30m"
//        GREYF "\033[1;30m"
//        REDF "\033[31m"
//        LIGHTREDF "\033[1;31m"
//        GREENF "\033[32m"
//        LIGHTGREENF "\033[1;32m"
//        YELLOWF "\033[33m"
//        LIGHTYELLOWF "\033[1;33m"
//        BLUEF "\033[34m"
//        LIGHTBLUEF "\033[1;34m"
//        MAGENTAF "\033[35m"
//        LIGHTMAGENTAF "\033[1;35m"
//        CYANF "\033[36m"
//        LIGHTCYANF "\033[1;36m"
//        WHITEF "\033[37m"
//        LIGHTWHITEF "\033[1;37m"
//        RESET "\033[0m"
        omni.setColors(new String[] {"\033[37m", "\033[30m", "\033[34m", "\033[32m", "\033[1;31m", "\033[31m", "\033[35m", "\033[1;31m", "\033[1;33m", "\033[1;32m", "\033[36m", "\033[1;36m", "\033[1;34m", "\033[1;35m", "\033[1;30m", "\033[1;30m", "\033[0m"});
        omni.start();
Pattern JoinCommand = Pattern.compile("/(?:join|j) (.+)", Pattern.CASE_INSENSITIVE);
Pattern PartCommand = Pattern.compile("/(?:part|p)", Pattern.CASE_INSENSITIVE);
Pattern CACCommand = Pattern.compile("/cac (.+)", Pattern.CASE_INSENSITIVE);
Pattern NickCommand = Pattern.compile("/(?:nick|n) (.+)", Pattern.CASE_INSENSITIVE);
Pattern OpCommand = Pattern.compile("/op (.+)", Pattern.CASE_INSENSITIVE);
Pattern DeOpCommand = Pattern.compile("/deop (.+)", Pattern.CASE_INSENSITIVE);
Pattern RawCommand = Pattern.compile("/raw (.+)", Pattern.CASE_INSENSITIVE);
Pattern ListCommand = Pattern.compile("/(?:list|l) #(.+)", Pattern.CASE_INSENSITIVE);
Pattern ExitCommand = Pattern.compile("/(?:exit|e)", Pattern.CASE_INSENSITIVE);
        try {
            while (true) {
                while (sin.ready()) {
                    String msg = sin.readLine();
                    if (msg != null) {
                        Matcher m;
                        if ((m = JoinCommand.matcher(msg)).find(0)) {
                            omni.joinChannel(m.group(1).replace("#", ""));
                        } else if ((m = PartCommand.matcher(msg)).find(0)) {
                            omni.partChannel(ActiveIRCChannel);
                        } else if ((m = NickCommand.matcher(msg)).find(0)) {
                            omni.changeNick(m.group(1));
                        } else if ((m = OpCommand.matcher(msg)).find(0)) {
                            omni.opChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = DeOpCommand.matcher(msg)).find(0)) {
                            omni.deOpChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = CACCommand.matcher(msg)).find(0)) {
                            ActiveIRCChannel = m.group(1).replace("#", "");
                            sout.println("Changed the active channel to " + ActiveIRCChannel);
                        } else if ((m = ListCommand.matcher(msg)).find(0)) {
                            Channel curchan = omni.getChannelList().get(JIRC.inChannelList(omni.getChannelList(), m.group(1)));
                            Person[] People = curchan.getAllMembers();
                            for (int x = 0; x < People.length; x++) {
                                sout.println(People[x].getName() + " (" + People[x].getModes() + ") Active: " + People[x].isActive());
                            }
                        } else if ((m = RawCommand.matcher(msg)).find(0)) {
                            omni.sendRawMessage(m.group(1));
                        } else if ((m = ExitCommand.matcher(msg)).find(0)) {
                            sout.close();
                            sin.close();
                            System.exit(0);
                        } else if (msg.startsWith("/")) {

                        } else {
                            omni.sendMessage(ActiveIRCChannel, msg);
                            sout.println("#" + ActiveIRCChannel + ": <" + omni.getNick() + "> " + msg);
                        }
                    }
                }
                Thread.sleep(10);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


Major things:
-Package change, now is com.up.jirc instead of just jirc
-Color support
-Server response parsing.  Does not include every single IRC response numeric, or even most of them, but it does have most of the more common ones, I probably will add the rest eventually =P
-And then just fixing a lot of stupid various connection things
-Also, the constructor now requires the port to connect to

I dislike how much time I spent javadoc-ing though...  And I still left a lot un-done! D= That's why I like personal projects, documentation is for losers ;P

* JIRC.jar (48.11 KB - downloaded 7 times.)
Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.715 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.