Java IRC bot.

hi, recently I started making an irc bot in Java. I was testing it out on my friend's server and everything seemed to be working, it was reading from the server, and was responding to the one command. I wanted to show it to my other friend so I changed the variables to match his irc server, and the bot couldn't connect. I was wondering if the problem was in my friend's server or in my code. (I'll include what the server sends when I connect at the bottom)
package ircbot;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class bot {
    public static String message;
    /* variables */
    Socket sock;
    OutputStream out;
    BufferedWriter writer;
    InputStream in;
    BufferedReader reader;
    static doaction action = new doaction();
    String nick = "Gary";
    String user = "account 8 * :oHai";
    public static String channel = "#malvager";
    String ip = "127.0.0.1"; // <-- not the actual ip...
    int port = 11235;
    /* end variable and object declarations */
    public static void main(String[] args) {
        bot superbot = new bot();
        superbot.connect();
    public void connect() {
        try {
        sock = new Socket(ip, port);
        out = sock.getOutputStream();
        writer = new BufferedWriter(new OutputStreamWriter(out));
        in = sock.getInputStream();
        reader = new BufferedReader(new InputStreamReader(in));
        join(nick, channel, user, writer, reader);
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (IOException i) {
            i.printStackTrace();
        }// end try/catch
    public static void join(String nick, String channel, String user, BufferedWriter writer, BufferedReader reader) {
        try {
            writer.write("NICK " + nick);
            System.out.println("set nick");
            writer.newLine();
            writer.flush();
            System.out.println(reader.readLine());
            writer.write("USER " + user);
            System.out.println("set user");
            writer.newLine();
            writer.flush();
            System.out.println(reader.readLine());
            writer.write("JOIN " + channel);
            System.out.println("joined channel");
            writer.newLine();
            writer.flush();
            System.out.println(reader.readLine());
            read(reader, writer);
        } catch (IOException e) {
            e.printStackTrace();
    public static void read(BufferedReader reader, BufferedWriter writer) {
        String said;
        while(1 == 1) {
            try {
                said = reader.readLine();
                System.out.println(said);
                if (check(said) == true) {
                    print(writer);
            } catch (IOException f) {
                f.printStackTrace();
    public static boolean check(String input) {
        message = action.setinput(input);
        if (message.equals("I'm awesome")) {
            return(true);
        } else {
            return(false);
    public static void print(BufferedWriter writer) {
        Scanner input = new Scanner(System.in);
       try {
           writer.write("PRIVMSG " + channel + " " + message);
           writer.newLine();
           writer.flush();
       } catch(IOException r) {
           r.printStackTrace();
}// end class
package ircbot;
import java.lang.String;
public class doaction {
    public String setinput(String input) {
        int length = input.length();
        int control;
        String message = input;
        control = length - 5;
        message = message.substring(control, length);
        if (message.equals("!Gary")) {
            message = "I'm awesome";
            return(message);
        } else {
            message = input;
            return("bad");
}When I connect to my second friend's server (the one that doesn't work) I get:
set nick
:lolnepp.no-ip.biz NOTICE AUTH :*** Looking up your hostname...
set user
:lolnepp.no-ip.biz NOTICE AUTH :*** Found your hostname (cached)
joined channel
PING :51AA6A7F
:lolnepp.no-ip.biz 451 JOIN :You have not registered
When I connect to the friend's server that works I get:
set nick
:Malvager.hub NOTICE AUTH :*** Looking up your hostname...
set user
:Malvager.hub NOTICE AUTH :*** Found your hostname
joined channel
:Malvager.hub 001 Gary :Welcome to the Malvager-IRC-Network IRC Network [email protected]
:Malvager.hub 002 Gary :Your host is Malvager.hub, running version Unreal3.2.7
:Malvager.hub 003 Gary :This server was created Sun Oct 26 2008 at 00:01:26 PDT
:Malvager.hub 004 Gary Malvager.hub Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp
Okay yea, can anyoen tell me if the problem is in my code or the server? And if the problem is in the code could you please tell me what to change or point me in the right directin? thanks.

kajbj wrote:
youngdeveloper wrote:
What do you mean it doesn't look like a java program..? Sorry, I was watching tv while I was typing. It should say "Java problem" and not "Java program" :)
And yea, I realize it says that, but the steps to register are you enter the nick and the user which both come before that, so I was wondering if anyone with knowledge of how irc works could tell me if there's some other way of registering, or if the problem's in my code.Some IRC servers requires that an admin in the channel creates the user account.
KajOkay, glad to know it was supposed to say program :).
I'm pretty sure that it's not because the admin has to set up the acc. because this server was set up with the sole purpose of showing my friend my bot. However, it might be just that the server is retarded. I'm gonna try it on some other servers and see how it works there.

Similar Messages

  • Java irc bot problems

    Hello,
    Im trying to write a irc bot in java. So far it works well. I am trying to test
    for a quiet room. If room is quiet I want my bot to say something. Only problem
    is that my test for "quiet" are not working. Could someone take a look and
    tell me what Im doing wrong.
    Thanks,
    jd
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.InputStreamReader;
    import java.net.*;
    import java.io.*;
    import java.util.regex.*;
    import java.util.Vector;
    public class MySocket{
      Socket socket = null;
      BufferedReader in = null;
      PrintStream out = null;
      InetAddress inaddr = null;
      int mpt = 6667;   
    public MySocket(){
      String inet_string = new String("X.X.X.X"); //ip of irc server
      Vector myConnection = makeConnection(inet_string);
      BufferedReader psIn =  (BufferedReader) myConnection.elementAt(0);
      PrintStream psOut = (PrintStream) myConnection.elementAt(1);
      String command = new String("USER " + "mohadib67854" + " 0 0 :" + "mohadib");
      cmdSend(psOut , command);
      command = "NICK " + "javabot" + " 0";
      cmdSend(psOut , command);
      command = "JOIN #bot_test";
      cmdSend(psOut , command);
      String matchString = null;
      boolean end = false;
      while(!end){
       Pattern pattern = Pattern.compile(".{1,}:End of /NAMES list.{0,}");
       try{
        matchString = psIn.readLine();
       }catch(Exception e){
        System.out.println(e);
       Matcher matcher = pattern.matcher(matchString);
       System.out.println(matchString);
       end = matcher.matches();
      //say hello
      command = "PRIVMSG #bot_test :Hello";
      cmdSend( psOut , command);
      // now go to listen and process loop
      listen(psIn , psOut);
    } // close consructtor
    public void listen(BufferedReader psIn , PrintStream psOut){
      boolean end = false;
      String matchString = null;
      while(!end){
       try{
        matchString = psIn.readLine();
       }catch(Exception e){
        System.out.println(e);
       // print all buffer to console
       System.out.println(matchString);
       //ping
       Pattern pattern = Pattern.compile("^PING.{1,}");
       Matcher matcher = pattern.matcher(matchString);
       boolean ping = false;
       ping = matcher.matches();
       if(ping){
        String command = new String("PONG");
        cmdSend(psOut , command);
        continue;
       // room is quite
      /* pattern = Pattern.compile("");
       matcher = pattern.matcher(matchString);
       boolean quiet = false;
       quiet = matcher.matches(); */
       if(matchString == null){
        String command = new String("PRIVMSG #bot_test :zzz");
        cmdSend(psOut , command);
        continue;
       if(matchString.equals("")){
        String command = new String("PRIVMSG #bot_test :zzz");
        cmdSend(psOut , command);
        continue;
       if(matchString.equals("\n")){
        String command = new String("PRIVMSG #bot_test :zzz");
        cmdSend(psOut , command);
        continue;
       if(matchString.equals("\r")){
        String command = new String("PRIVMSG #bot_test :zzz");
        cmdSend(psOut , command);
        continue;
       // some one said hello to javabot
       boolean hello = false;
       boolean hello_backwards = false;
       pattern = Pattern.compile("^:(.{1,})!.{0,}javabot.{0,}hello.{0,}");
       matcher = pattern.matcher(matchString);
       hello = matcher.matches();
       pattern = Pattern.compile("^:(.{1,})!.{0,}hello.{0,}javabot.{0,}");
       Matcher matcher1 = pattern.matcher(matchString);
       hello_backwards = matcher1.matches();
       if(hello){
        String name = matcher.group(1);
        String command = new String("PRIVMSG #bot_test :Hello " + name);
        cmdSend(psOut , command);
        continue;
       else if(hello_backwards){
        String name = matcher1.group(1);
        String command = new String("PRIVMSG #bot_test :Hello " + name);
        cmdSend(psOut , command);
        continue;
      } //close while
    } // close listen
    public void cmdSend(PrintStream out , String command){
       try{
        out.println(command);
       }catch(Exception e){
        System.out.println(e);
    }// close cmdSend();
    public Vector makeConnection(String inet_string){
      try{
       inaddr = InetAddress.getByName(inet_string);
       socket = new Socket(inaddr,mpt);
       in = new BufferedReader (new InputStreamReader(socket.getInputStream()), 1024 );
       out = new PrintStream (socket.getOutputStream());
      }catch(Exception e){
        System.out.println(e);
      boolean end = false;
      String myIn = null;
      while(!end){
       try{
        myIn = new String(in.readLine());   
       }catch(Exception e){
        System.out.println(e);
       Pattern pattern = Pattern.compile(".{1,}Found your hostname"); // NOTICE AUTH :*** Found your hostname
               Matcher matcher = pattern.matcher(myIn);
       System.out.println(myIn);
       end = matcher.matches();
      // put in and out in a array to return
      Vector psReturn = new Vector();
      psReturn.add(in);
      psReturn.add(out);
      return psReturn;
    } // close makeConnection  
    public static void main(String[] args){
        MySocket ms = new MySocket();
    }

    I believe what you want is a thread that waits for x seconds before doing something (ie say something). If after x seconds the thread hasnt been killed/reset then do something and reset the thread.
    Your listen method should reset the thread everytime its called.
    when I say reset the thread I mean the thread will be doing a wait() and when it wakes up it should check a flag to see whether or not the room is still quiet. Your listen() method should set this flag.
    Thats a broad outline any hoo.
    Ted.
    'Standing in line to see the show tonight, theres a light on, heavy glow'

  • IRC Bot/Virus- is this possible on a mac?

    Hello all
    I'm hoping someone can help me with a little problem I am having. My service provider (Rogers cable) is claiming that one of my computers has contracted an "IRC Bot/Virus" (I have three imacs and 1 ibook on my network). I thought this was a windows virus. Is it even possible that one of my macs has this virus? If so, How do I get rid of it?
    Maybe they are just trying to get me to buy the anti virus software or something?
    Any help or insight would be welcome.

    Hello Mr.light,
    it is possible that a kind of unix program was installed on your mac, usually IRC-bots. My own experience is that my dutch ISP has shut me (partly) off because of abnormal outgoing IRC traffic. In my case 'they' cracked my password and installed psyBNC. on my Mac with OS X 10.3.9. With this program they can easy hide there activities on the net. psyBNC automagically connects to a certain IRC channel so the hackers can use your internetconnection to do their malicious work. The operators of the channels are most likey also the installers of this kind of software.
    U can monitor outgoing traffic with 'Little Snitch'. Most likely the IRC-bot runs as a process without a name or under a different name, use the Activity Monitor (in Utilities) to look for strange processes, google the names of the processes.
    also use Console (in Utilities) to read the 'Secure.log"
    Cracking of passwords is easy when you are running an ftp server, in combination with short or easy passwords and loginnames and with a bad configurated firewall or router

  • My iMac infected with "IRC Bot/Virus" So How can I Resolve this ?

    I Received Rogers EUA Team Notice say that one or more the computers in your home connected to Rogers Internet services appears to be infected with an " IRC BOT/Virus" So How can I Resolve this problem I just bought this I-mac over 1 yr Thanks
    iMac (27-inch Mid 2011)
    Also I have a PC but I already use Virus scanner (Rogers Online Protection) say no found.

    It seems this is just Rogers sending this to any client that as not installed the anti virus software they offer.
    That virus is Windows only, so it can't be running on your Mac.
    But could be on Windows if you are using boot camp.
    If this is not your case, just ignore the message from Rogers.
    See this thread about the same problem.
    https://discussions.apple.com/message/5882162?messageID=5882162#5882162?messageI D=5882162

  • Java IRC channels?

    I doubt this, as I've searched google many times looking for one with no luck. Are there any irc channels for java programmers where one can ask quick questions, or just talk about java in general? Something for quick answers to simple questions? Google searches only come up with millions of different java based irc clients, and how to create them.

    send a message to the nickserv for help on registering your IRC nick.
    /msg NickServ help register
    /msg NickServ help identify
    Once you've registered your nick, you'll be able to access the ##java chatroom

  • I know c,c++ and java language ! and i want to contribute for development of mozilla products ! any idea where i can find beginner level projects ?

    I know c,c++ and java language ! and i want to contribute for development of mozilla products ! any idea where i can find beginner level projects ! so that i can hone some real development skills too :)

    You could also try jumping in on some of the Mozilla IRC chat channels as was suggested to someone else in another thread.
    Also you could also try the [/forums/buddies new contributors forum], it does now have an Admin monitoring and replying. (At the time of the quoted post Admins were almost impossible to get hold of for forum matters )
    ''Noah_SUMO [/forums/buddies/710569#post-61671 said]''
    <blockquote>
    Sorry I didn't see this earlier. :)
    I know just the places where I think you'd fit in best. To make sure, just join us in #sumodev and #mozwebqa and #communityit at irc://irc.mozilla.org
    I think your skills in php, javascript, python and server admin-y stuff will come in real handy at these places. :D
    For example, some help is needed here to fix these tests after a new theme was added to wiki.mozilla.org and they are in python. https://github.com/mozilla/wiki-tests - more info in #mozwebqa
    And maybe some help with perl might be needed with firebot, a irc bot written in perl. Channel #firebot for that.
    And #communityit (for server admin stuff) and #sumodev could use some help as well, just pop in and ask. :)
    </blockquote>
    Also see
    * [[Contributor News & Resources#w_communication-channels]]_communication-channels
    ** Mibbit link (this one for #sumo channel ) https://www.mibbit.com/?server=irc.mozilla.org&channel=%23sumo
    P.S. and see
    * https://wiki.mozilla.org/Good_first_bug

  • So I want to create my own IRC client...

    I've wanted to make my own IRC client for a long time now. As soon as I switched from winfailure a few months ago (I think nearly a year now! ), actually.
    As time went by I've slowly, begrudgingly gotten used to irssi, but with gritted teeth all the same. On winfailure, I used HydraIRC, and while this application was quite good, its supposedly open source license wasn't free as in free speech, only as in free beer. So while the code was open, it was only opened such that the code couldn't be used in other projects. Stab.
    Anyway, I used this client for the better part of a year, and while it lacked quite a few things that would have probably turned others away like the complete lack of a scripting engine, it did what I wanted pretty well, and set an operational standard, if you will, that I got used to and have not found anywhere else. Yet.
    So I want to recreate the standard I picked up on but for POSIX platforms (except for cygwin), and introduce some features of my own too. I simply don't know where to start, however.
    Note that the subject says "create", not "write" - after asking around a bit in IRC ##linux recommended I try taking two IRC clients that have the features I want and merging their codebases. I've never done something like this before but I think it'd probably be fairly interesting, if not trying.
    So, I'll list the features I'm looking for, and perhaps you can give me some suggestions on 1) how I'd either implement this myself or 2) a client with X feature already coded in. Thanks.
    The features I'm looking for:
    - Code Simplicity: This is the most important, to me, in the case of using others' code. Complex code (just look at rxvt if you want complex code) will just confuse and down-hearten me and make me run away.
    - A network-oriented model: I want a client with a daemon, or server, that connects to my networks and performs most "heavyweight" takes, and a client, which just handles display. Quassel does this to an extent but is horribly underdeveloped and I don't have a system powerful enough to handle running Qt on a long-term basis (since I already tend to use GTK apps). I also don't know C++.
    - Multiple clients: This is the second most important. I really need this one. I want to be able to have a "main" client that can connect to the server and manage general tasks, and a "light" text-based, console-driven client that connects and can be run over ssh, for example. Quassel completely falls apart here because it uses KDE's network-IPC libraries to transfer data from the server to the client, which a quick check with Wireshark showed to be binary. And I wouldn't want my "lite" client to require KDE, or at least KDE's libraries - that'd just be majorly weird.
    - Speed: I want the client to be fast and responsive at all times, even on slower systems, and even when I'm connected to a lot of channels.
    - Scriptability: It doesn't need to be complex, like Perl's library that applications can bind in. That's overmuch IMHO and, most importantly, slow.
    I don't think one particular client meets those needs, but a few of you will probably shout "xchat!" Well, X-Chat is... not my thing. If irssi could be considered very far away from HydraIRC in terms of operation, X-Chat is the same distance away twice over. It doesn't operate the same way at all.
    So, now that I've loosely explained the features I want, let me now explain another thing I want to be able to do.
    Despite having hardware in dire need of upgrading right now (these systems aren't nearly that bad, but Firefox tends to eat my 512MB of RAM up pretty quickly, and I recently found all the PCs this house has in it 99% likely can't use DDR2 RAM, which isn't too good), I hope and believe that one day I'll upgrade to considerably better equipment with extensive graphics support. With this newer hardware I hope to create a new kind of UI model with animation integrated into the look-and-feel model of the UI the same way images are used for the same purpose today, GPLv3 license it so corporations can't steal it and use it in their products, and then bind it into my IRC client.
    However, I want to start now, before I upgrade. With this in mind, I don't know whether I should make my own GUI toolkit, or use an existing toolkit now and rewrite half the codebase later to support my own graphics and animations. I'm not very good at making things that are programmatically extensible and flexible, so I don't really know what to do here. Simple hand-rolled toolkits such as dialogs with some text and a button can be managed in under ~250 lines of code, but anything bigger, and, well... you get stuff like GTK and KDE, whose toolkit libraries in total are both on the order of over a couple of MBs each, and have been in development for years, and continue to evolve rapidly today. If you're careful, you end up with FLTK, which I don't like the look of at all.
    In addition to that, I want my client to be fast, even on slower computers. Right now, I have a 3-screen setup, with each screen being driven by a separate PC. The one on the right - the one I'd be putting my IRC client on - is a 450MHz P3 with 320MB of RAM. It runs X on a 4MB VGA card at 800x600. This is where I currently run an irssi session over ssh and screen. To give you an idea of the graphical power of this machine, antialiased Xft fonts with urxvt take 0.15 seconds to "scroll" when I say something in IRC. However, it's a capable PC if I harness its capability right, and is where I'd target my IRC client. And I dislike seeing my fonts redraw - I dislike seeing anything redraw, for that matter.
    You might think I'm crazy, writing an IRC client for one of the slowest PCs in the house that works, that I in future want to extend to use a graphics layer that I hope to develop on a server-class Nehalem workstation with an insane amount of RAM and a pair of SLI'd GTX 280s in it.
    I don't think I'm crazy. I'm using what I have to give back to the open source community, and using what I consider to be an cunning operational model to do it: back when the 450MHz P3 I spoke of was the only "main" working PC I had, I designed, in none other than Visual Basic 1.0, a media center UI. On Windows 98. In 2006. And, you know what, despite the fact that the animations it used were pretty basic, it actually looked really, really good. And why was this? Because I used software designed for 486DX2s running at 33MHz with 4 or 6MB of RAM, on a P3, with 128MB of RAM (yes, I've upgraded it since), clocked at 450MHz. The result? Blinding, optimized, speed. You really should try the older versions of VB sometime - I managed to score a copy of VB 2.0 which is legal to distribute because its "Make EXE" (ie compile) function is crippled. Email me and I'll mail you a copy - it's completely legal.
    In the same manner, if I design this IRC client and carefully construct it so its client/server model works capably on my two PCs, my server (a machine not unlike the P3 I've been discussing - my server just has more hard disks in it, a 50MHz faster processor, runs my left-hand display and my IRC network) and my old desktop (the 450MHz box I've mentioned so much), when I finally bring it over to my new computer it'll be so fast that it'll be as if the computer is registering keypresses before I even type them. And that's the kind of performance I want to couple with shinyyy graphics.
    Sorry this sounded halfway between a motivational speech, a request for help, and a coder's dilemma. lol
    -dav7

    Bit of an update: Varreon emailed me regarding VB 2.0 and we had a bit of a discussion regarding the language I planned to use.
    He said it would be fine to post our conversation, so here's how it panned out:
    Varreon wrote:...What language were you planning on writing your client in? I've written an irc bot in c++, and I'll upload my source code if you're interested in looking through it.
    dav7 wrote:
    Well, I'm not all that sure what language I want to use just yet.
    I know I want it to be extensible, so I could either use a high-level, extensible but slow scripting language to power the client as a whole, or I could go down a path already travelled, proved extremely successful and in my opinion cleaner, and embed a scripting language, which would negate the requirement for a high-level language but still facilitate customization.
    All the same, I'm not really all that sure what language to use.
    C++ isn't really my thing - on my current computers, g++ takes maybe 3 seconds to compile the smallest of source files, and while that isn't *really * all that long, I'm not all that patient. As it stands I consider /gcc/ too slow for my preferences and use tcc instead - you might like to try it if you're on a 32-bit system.
    I'll probably move to C++ when I get a new PC, but for now, all I really find fast enough for my liking is C, and I'm a little concerned that C might be a little too low-level for what I want to design here - beyond scriptability, I want the client itself to be easily extended in various directions. Of course the client will only appeal to a specific market (in an open source sense), but I do want it to feel organic and something that can be extended in as many directions as possible. So C probably won't be the language I use, and since C++ is slow to compile, it's probably going to be off the list as well.
    All the same, I'm not concerned about speed in the irrational way I have been in the past, but at the same time I do need to be careful in my thinking regardless of the language I use since don't want a client that lags to death. A good example of a slow program is SciTE - the text editor I'm typing this in, Geany, uses the same edit control it uses (Scintilla, which is written in C++, AFAIK), and while this component has a good degree of editorial control, scrolling with the scroll wheel can be slow. Also, when I recently tried to run SciTE on an old laptop I found on the side of the road (AMD K-6, 350MHz, 32MB RAM), I discovered that just *typing* would lag the system horribly - typing about 15 keystrokes quickly resulted in a lag of about 6 seconds after which what I typed would appear all at once. Typing single keys - slowly - resulted in a delay of around 0.20-0.39ms (guessed).
    Regarding scripting, I had my eyes on one embeddable language in particular but I forgot what it was called, so I headed to Wikipedia for a quick hunt-down session for it and managed to discover Falcon, which appears to use a VM but is at the same time the same insanely fast because it uses a C/C++-only policy for its modules. It also advertises itself as a scripting engine "ready to empower mission-critical multithreaded applications" so I'm considering Falcon to be a possible engine to integrate, and on a slightly long shot, even the language I might end up using. I also think hunting the first language I considered down and embedding that might be a nice idea, and I also might embed Perl. I'd love to be able to embed Ruby.
    Overall however, I do need to contain my enthusiasm - the desire to throw in multiple scripting engines, awe-inspiring compositing graphics layers, and support for multiple protocols isn't such a bad idea, but if not controlled will result in serious featuritis, which when combined with a verbose, low-level language will only result in me throwing myself at the project too hard "to get it done", with proven disastrous results.
    -dav7
    [ Note, there's an update in a follow-up post below this one that affects the information you see here - just so you know ]
    I've done some consideration since that email and it's possible that C++ might be able to be brought onto the table. This was mostly inspired by the good outcome I had with writing a couple of modules for InspIRCd, which uses C++, compared to my previous attempt when I knew no C.
    The main thing I'm a little indecisive about at the moment is the toolkit; I want something that's fast but doesn't look all that bad; FLTK is, as I've said previously, not something I like the look of - it does appear to be somewhat themable but it's impossible to escape the fact that it values speed over shininess, and while this is excellent for my current target, I don't want to develop something that relies on it so heavily that it's next to impossible to port to whatever I end up using when it's time to get the graphics in, such as a UI model on top of an OpenGL canvas.
    The second thing I'm unsure of is what scripting language I should use. I've done quite a bit of looking around - mostly to try and find that language I mentioned that I lost - and found quite a lot of possibilities, and even discovered that with some work (well, a lot of work, admittedly) it's even possible to embed Ruby into C++, and have Ruby call user-defined C++ functions and so on. It's not an official part of the project, but someone managed it nonetheless.
    It seems to be possible to embed popular languages such as Perl, Python, Tcl, Lua, etc, but then there are lesser-known languages designed for embedding, such as Nesla, AngelScript and the like (such as that language I can't find, heh). And of course I could also embed a JavaScript engine, which would probably be very odd but all the same quite an experience.
    Then there's Falcon, which appears to be a pretty good language in general but doesn't appear to have all that many modules available for it just yet, so doesn't seem to suit my purposes.
    So, summing up:
    - I don't know how I should develop this in terms of graphics - should I wait for a new PC and just use SDL or whatever I'm going to use, use a toolkit and either rewrite half of everything at some other point or juggle two display methods, or what?
    - The number of scripting languages out there is mind-boggling. To me, it's not what syntax the language uses, or whether it's statically or dynamically typed, or how readable it is, it's #1 how fast it is, and #2 how suitable it would be in the context of an IRC client - string manipulation (even on every incoming and/or outgoing message), user interface control, and so on.
    -dav7
    Last edited by dav7 (2009-02-16 09:25:49)

  • IWeb 09 java html snippet crash

    Hi.
    I'm trying to add a java irc (pjirc) applet as an HTML snippet, and everytime I do, iweb 09 freezes with a swirling beach ball, and makes me force quit it.
    Any idea how to fix this? Has anyone else had luck with a java irc client in iWeb?
    Thanks!

    Launch the Console (in the Applications/Utilities folder) and see what messages are recorded when it crashes. I could be that that particular applet is not compatible with iWeb. Cyclosaurus would know if it was or not.
    OT

  • Java Applet with Socket

    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.applet.*;
    public class Simple extends Applet {
         TextArea text;
         Socket _socket;
         public void init(){
              setLayout(null);
              text = new TextArea("", 10, 10, TextArea.SCROLLBARS_VERTICAL_ONLY);
              text.setBounds(10, 10, 350, 300);
              text.setEditable(false);
              add(text);
              try {
                   _socket =  new Socket("de.quakenet.org", 6667);
              }catch(Exception e) { output(e.getMessage()); };                              
         public void output(String s) {
              text.append(s);
         public void paint(Graphics g) {
    It throws following exception:
    access denied (java.net.SocketPermission de.quakenet.org resolve)
    I've read, that Applet can only connect localy. But for example jIRC works also http://www.jpilot.com/java/irc/demo.html ...
    How can I manage that?

    You get a java signing cert (like from Verysign) - when you sign the applet according to their instructions, it allows the end user to specify if your applet has rights or not, if they say yes, you would have the ability to connect to other servers.
    If you want to avoid this problem, make your program an application instead of an applet.

  • Executing a Java application from JAVA

    Hello all,
    I have a problem spawning a Java IRC client from another Java application. The client only manages to execute itself properly [join a specific channel] once the original parent application has been closed. Any ideas?
    The code is as follows:
    public void run(){
         String[] cmd = {"java", "IRC"};
         try {
               Process p = Runtime.getRuntime().exec(cmd);
              p.waitFor();
         } catch (Exception exc){
              print ("Could not run the IRC session file" + exc);
      }

    Well, if you ask me, it's not very good Java style to try to access the command line to run ANOTHER Java application.
    My suggestion is simply call the IRC program's methods to get it started. Don't bother with Runtime.exec.

  • Using reflection to load dynamic commands

    Hi,
    I am writing an irc bot and I want commands to be automatically updated even while the bot is running. Here's my current situation:
    Command interface:
    public interface Command {
        public int getLevel();
        public String manual();
        public void exec(String[] args);
    }Every command implements the Command interface and is named cmd.XXXCommand, for example: cmd.HelloCommand. The command is executed like this:
        // Get an instance of the command
        Class c = Class.forName("cmd." + command + "Command");
        Command cmd = (Command)c.newInstance();
        // Execute the command
        cmd.execute(args);Using the above approach new commands are automatically loaded and used by the running program. However an existing command is not updated while the program is running!
    I guess the reason is that the JVM has a copy of the loaded classes in memory to improve performance. Is there a way to get around this?
    Any help is appreciated. Thanks.

    Srini_Kandula,
    I used a modified version of the FileClassLoader I found from Google. There was no comment left with it so I can't remember where exactly. But here's the code:
    package quangntenemy.irc.bot;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    public class FileClassLoader extends ClassLoader {
         private String root;
         public FileClassLoader(String rootDir) {
              if (rootDir == null)
                   throw new IllegalArgumentException("Null root directory");
              root = rootDir;
         } // end constructor
         protected Class<?> loadClass(String name, boolean resolve)
                   throws ClassNotFoundException {
              Class c = findLoadedClass(name);
              if (c == null) {
                   try {
                        c = findSystemClass(name);
                   } catch (Exception e) {
              if (c == null) {
                   String filename = name.replace('.', File.separatorChar) + ".class";
                   try {
                        byte data[] = loadClassData(filename);
                        c = defineClass(name, data, 0, data.length);
                        if (c == null) throw new ClassNotFoundException(name);
                   } catch (IOException e) {
                        throw new ClassNotFoundException("Error reading file: "
                                  + filename);
              if (resolve) resolveClass(c);
              return c;
         } // end loadClass
         private byte[] loadClassData(String filename) throws IOException {
              File f = new File(root, filename);
              int size = (int) f.length();
              byte buff[] = new byte[size];
              FileInputStream fis = new FileInputStream(f);
              DataInputStream dis = new DataInputStream(fis);
              dis.readFully(buff);
              dis.close();
              return buff;
         } // end loadClassData
    } // end classAs ejp said, the key point is to "Use a new class loader for each load, and let the old one be GCd". Oh and the class should not be placed in the classpath, otherwise it has been loaded by the system ClassLoader.
    _dnoyeB (Beyond? :D), yes I am starting to use a Security Manager for it as the code is growing too big to control access to system resources manually :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Cross platform support

    Hi,
    I just finished a program i built on NetBeans (Windows XP). It's an IRC bot and i want to host it on my Linux server. It has the latest version of Java for Linux but i get a NoClassDefError when i try to run it. Is this a fault in the JRE or my program?
    Thanks in advance

    neither, it's a configuration issue, once you have the classpath set correctly, it will work fine

  • Primitive Strings?

    Hrmm..... About 2 weeks ago I was posting about maps, and my goal was to basically emulate an associative array.... Anyway, all works fine and well when it's a primitive string (errr..... I'm assuming that's the right term? Hrmmm might just be entirely wrong lol), but when it's a string object, the map maps the value with the object, not a plain string.... So, later when I try to access key X by string X, it's not the same thing since they're different objects.
    Anyway, my question is, how do I convert a string object to a primitive string? I'm getting the string from a BufferedReader.readLine() call, and then I'm manipulating it a little before processing the value....
    Anyway, thanks to anyone that can help!
    (P.S. To the guy who answered my last question on my other thread, if you read this thanks. I forgot about Java for 2 weeks and just not got back into working on something today. I would've said it on that thread, but didn't want to bump it x.x.)

    Errrr sorry...... Here's an example (not actual code):
    import java.io.*;
    import java.io.OutputStream;
    import java.net.*;
    import java.util.*;
    class Example {
         private Map<String,ActiveUser> Users = Collections.synchronizedMap(new HashMap<String,ActiveUser>());
         private PrintWriter out = null;
         private BufferedReader in = null;
         private Socket oSocket = null;
         private String LastMsg = null;
         public static void Example(String[] args) {
              Example ex = new Example();
         public Example() {
              //pretend in and out are set and bound to a socket.....
              while(true) {
                   if((this.LastMsg = this.in.readLine()) != null) { //I don't think the null is the best thing for here, but it seems to work x.x
                        int idx = LastMsg.indexOf(" ");
                        //pretend lines are in the format of "User OtherInfo"
                        if(idx >= 0) {
                             //In my actual script it checks more than if there's a space, since this could obviously cause problems......
                             String user = this.LastMsg.substring(0, idx);
                             String info = this.LastMsg.substring(idx+1);
                             this.Users.put(user, new ActiveUser(info));
                             So this is where things get interesting.....  Later on I get the user name from a different location too....
                             With this other location, the string is read from a file or a different source....
                             If at this point I were to put:
                             this.Users.put("snickers", new ActiveUser(info));
                             it would find the stuff later with .get(), but now it doesn't find it.
                             I can print out user and it will be "snickers" with no spaces or anything around it.
                             This lead me to believe that the problem was that the string as returned by readLine() was perhaps a string object,
                             like user = new String(), and then later, the 'primitive' as I called it string would be a different object, causing the Map to not ifnd it
                             since it compares objects, not string values.
                             The main reason I feel that's what it is is because if I put what I mentioned earlier with the literal "snickers" the code later on works fine.
                             Before you ask, yes, I'm positive user exactly equals "snickers"
    class ActiveUser {
         //pretend this does something
    }Sorry about the long bit of code x.x.
    If you need me to, I can elaborate more, or post my real code (which is quite long..... It's an IRC bot that monitors how long people are in a channel.)

  • Possible Virus On Bootcamp, how to remove?

    Hi, I think I may have gotten a virus on my windows partition of my macbook pro. I windows XP professional with service pack 3 installed. Last weekend I was booted into windows when it suffered a "fatal error." The computer restarted and windows XP was fine. I did, however, get this email from my university network manager concerning my computer:
    The computer in question appears to be infected with
    a Trojan or worm that reports home to an IRC server.
    Several examples include sdbot, spybot, gaobot, polybot,
    and some variants of OptixPro. We notice these because
    the computer is trying to connect to a known IRC bot
    controller.
    We often are unable to tell exactly which version of
    which IRC bot an infected computer has, but the
    detection method is rarely wrong. There are hundreds if
    not thousands of known variants of each of the above
    viruses, with new ones being released daily. Updated
    AntiVirus software may or may not detect this threat.
    Odds are good that the attacker obtained the
    password database for this computer, containing all
    of the passwords for all accounts on the computer.
    It is IMPERATIVE that all passwords for all accounts
    on this computer be changed before this computer
    is placed back onto the network.
    Computers infected with an IRC bot should have their
    hard disk formatted and have the Operating System
    reinstalled and patched before coming back onto the
    network. All passwords on the rebuild system should
    be different than they were on the infected system.
    IRC bots not only often come bundled with
    other malicious software, but once they connect to
    the IRC controller, they often download and install
    even more malicious software, without the knowledge
    and/or consent of the computer user. Therefore,
    even if AntiVirus software detects and removes the
    IRC bot, typically more malicious software is left
    behind, still running.
    IRC bots are updated frequently. Even up-to-date
    AntiVirus software often doesn't detect the latest
    IRC bots. Once the AntiVirus companies start
    detecting a particular IRC bot, the bot is typically
    instructed to update itself to a variant that is
    not detected by AntiVirus.
    Because of the above activities, scanning for viruses
    with an AntiVirus product is typically not an effective
    remedy for an IRC bot infection.
    I have symantec antivirus for mac, is there any way I can use it to scan the bootcamp partition? I think I know where the infected file is, but symantec says it's clean. I also have Symantec for Windows.
    It would be a HUGE inconvenience to reinstall windows XP because my disc is at home and I will not be home for another 2 and a half months. Can you give me any tips on how to remove this virus without reinstalling windows XP?
    Thanks,
    Sam

    If you delete it you are only getting rid of half the problem, and likely will be unable to do this.
    Start up in Safe mode.. (If you're having trouble doing this press start and search for MSCONFIG go to boot.ini and start in safe mode).
    This will only run basic stuff for windows and should potentially stop the Winlog running.
    However as I said winlog will probably re-appear because the trojan will likely just retrieve it back from the internet.
    I say the best solution is...
    Restart your mac into OS X, download Avast free edition and Spybot S&D or similar, and ZoneAlarm Firewall.
    Put them on your bootcamp drive. restart into windows in safe mode. Install those and restart back into safe mode if needed.
    Set avast to run a boot time scan (Scans before you load into Windows. Run SpyBot S&D. And set Zonealarm to have atleast some sort of protection running all the time.

  • Terms and Agreement Violation?

    Hey, thanks for taking to help me out. Anyways, I'm gonna be
    buying a web-hosting service pretty soon and I need to check
    something first. In the Terms and Agreement section of the site, I
    saw this paragraph.
    [CLIENT must not run any kind of 'server applications' for
    these are detrimental to the overall performance and security of
    the server. All programs/scripts that open a port on the shared
    hosting server are considered “server applications”.
    These include but are not limited to IRC servers, IRC proxies, IRC
    bots, Ikonboard (All versions), FormMail (Matt's Script Archive,
    Inc - all versions prior to v1.92), Greymatter, UltimateBBS (All
    versions), nph-proxy, including The Anonymizer.]
    Now, I will be using an open-source, free project I
    downloaded from a site. It'll be helping me out in organizing my
    articles while online. Is this considered to be a server
    application that the provider will disallow?
    Extra Info:
    Terms and Agreement Link -
    http://www.media4solutions.com/legal.php?doc=terms
    Open-Source Project -
    http://www.webwizguide.com/asp/sample_scripts/site_news_script.asp

    Da Ones wrote:
    > Now, I will be using an open-source, free project I
    downloaded from a site.
    > It'll be helping me out in organizing my articles while
    online. Is this
    > considered to be a server application that the provider
    will disallow?
    It's an agreement with the provider. It doesn't matter what
    "advice" you
    may receive in a public forum like this, only the provider
    can tell you
    whether it's happy with your proposal. Ask the provider.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for

  • Iphone 4s is not recognized by my powerbook

    I have updated all software, but iphone and powerbook will not sync as phone is not recognized by powerbook.  What do I do to correct situition?

  • Did you all know iOS 5 tips & tricks?

    How-To: Hiding Previous App Store Purchases by Matthew Sims on October 14, 2011 One of the many new features of iOS 5 and iCloud is that you can download previously purchased apps from the App Store without having to sync with your Mac or PC. While t

  • How do I get my contacts back on my phone from iCloud?

    I recently went on vacation and for some reason, my contacts got wiped out. No clue why, but I got on iCloud.com and found that all of my contacts are still there. I can't restore my phone because I've never synced it to a computer and I know that on

  • Active Directory authentication, OS X network homes on Xserve

    Hi I'm looking for a general guide/tips for our deployment of OS X in our Windows network. Everyone in our institution has an Active Directory account. We also have an Xserve 10.4.4 running as an OD Master with 400 accounts for people who use Macs. I

  • Preview won't start after upgrade to mavericks

    After Upgrading to Mavericks this afternoon (30th Oct 2013, 1420hrs) - i face the following problems. (there could be more problems that i may not have found out yet) 1. The Preview application cant start. when i double click the prview applicaiton i