LPMuds.net
September 03, 2010, 11:36:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: This is the forum page. For the main LPMuds page, visit http://lpmuds.net
 
   Home   SITE FAQ INTERMUD DOWNLOADS LINKS Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: LPUniLib R7 Intermud 3 implementation  (Read 768 times)
Tricky
BFF
***
Offline Offline

Posts: 170


I like what I code and I code what I like!


View Profile
« on: June 15, 2007, 08:59:54 PM »

LPUniLib R7 Intermud 3 implementation
(This is not very Windows friendly unless you have WinZip, 7-Zip or any archiving tool that understands tar and gzip files)

If you are feeling lucky and don't mind hosing your LPUniLib then just untar this file into the root /lib directory.

Code: (File list of additions and changes)
adm/daemons/ansi_parser.c
adm/daemons/chan_d.c
adm/daemons/socket_d.c
adm/daemons/chmodules/chdmod_i3.c
adm/daemons/chmodules/i3services/mod_auth.c
adm/daemons/chmodules/i3services/mod_beep.c
adm/daemons/chmodules/i3services/mod_channel.c
adm/daemons/chmodules/i3services/mod_emoteto.c
adm/daemons/chmodules/i3services/mod_error.c
adm/daemons/chmodules/i3services/mod_finger.c
adm/daemons/chmodules/i3services/mod_locate.c
adm/daemons/chmodules/i3services/mod_mudlist.c
adm/daemons/chmodules/i3services/mod_oob.c
adm/daemons/chmodules/i3services/mod_tell.c
adm/daemons/chmodules/i3services/mod_ucache.c
adm/daemons/chmodules/i3services/mod_version.c
adm/daemons/chmodules/i3services/mod_who.c
adm/daemons/chmodules/i3services/oob_mod_file.c
adm/include/global.h
adm/include/intermud3.h
adm/obj/simul_efun.c
adm/simul_efun/overrides.c
adm/simul_efun/strings.c
adm/simul_efun/system.c
cmds/adm/i3.c
cmds/std/finger.c
cmds/std/tell.c
cmds/wiz/i3seen.c
cmds/wiz/locate.c
cmds/wiz/mudinfo.c
cmds/wiz/mudlist.c
cmds/wiz/rwho.c
data/daemons/chmodules/i3_history/.empty
include/ansi.h
include/mudlib.h

Quick primer for socket_d...

Code: (Setup a client connection to a remote machine)
    object sock = load_object(SOCKET_D);
    int fd;

    sock->set_socketType(MUD);
    sock->set_socketReadCB("read_callback");
    sock->set_socketCloseCB("close_callback");
    sock->set_socketLogFile("i3.log");

    fd = sock->socketClientCreate("sock_id", REMOTE_IP, REMOTE_PORT);

This will connect a socket to the machine on REMOTE_IP listening on REMOTE_PORT.

You can now send data to that socket using either the returned 'fd' or the named id, in this case "sock_id", where data is any MudOS variable type (except object and function).

Code: (Write some data to the remote machine)
    sock->socketClientWrite("sock_id", data);

Any data that is sent to you from the remote machine is routed through the function 'read_callback'.

Check 'adm/daemons/chmodules/chdmod_i3.c' for a working example.

For server sockets then check 'adm/daemons/chmodules/i3services/mod_oob.c' for a working example. This file also uses client sockets.

Four mudlibs of note that inspired this mess of code are:
 * Dead Souls, Discworld, Lima and Tubmud

Also a big thanks to Tim Johnson (Tim@TimMUD) for posting his code on his website. Without it, I don't think I would have understood what was happening with sockets.

Tricky
Logged

Tricky
BFF
***
Offline Offline

Posts: 170


I like what I code and I code what I like!


View Profile
« Reply #1 on: June 18, 2007, 10:29:39 PM »

Somehow this was missed out of the archive...

Code: (/adm/simul_efun/messages.c)
/* messages.c

   Tricky
   14-MAY-2007
   simul_efun

*/

int is_smiley(string msg)
{
    string *smilies = ({
      /* Some smilies from MSN Messenger */
      ":-)", ":)",
      ":-D", ":D",
      ":-O", ":O", ":-o", ":o",
      ":-P", ":P", ":-p", ":p",
      ";-)", ";)",
      ":-(", ":(",
      ":-S", ":S", ":-s", ":s",
      ":-|", ":|",
      ":'(",
      ":-$", ":$",
      ":-@", ":@",
      ":-#", ":#",
      "8o|",
      "8-|", "8|",
      "^o)",
      ":-*", ":*",
      "+o(",
      ":^)",
      "*-)", "*)",
      "<:o)",
      "8-)", "8)",
      "|-)", "|)",
      ":-[", ":[",
      ":-b", ":b",
      "o:-)", "o:)",

      /* Some smilies from Yahoo! Messenger */
      "=;",
      ";;)",
      "i-)", "i)",
      ">:D<",
      "l-)", "l)",
      ":-/", ":/"
      "o/",
      ":-&", ":&",
      ":X", ":x",
      ":\">",
      "[-(", "[(",
      ":o)",
      "8-}", "8}",
      "=((",
      "<:-p", "<:p",
      "(:|",
      "X(", "x(",
      "=P~", "=p~",
      ":>",
      ":-?", ":?",
      "B-)", "B)", "b-)", "b)",
      "#-O", "#O", "#-o", "#o",
      "=D>",
      "#:-S", "#:S", "#:-s", "#:s",
      ":-SS", ":SS", ":-ss", ":ss",
      ">:)",
      "@-)", "@)",
      ":-((", ":((",
      ":^O", ":^o",
      ":-))", ":))",
      ":-W", ":W", ":-w", ":w",
      ":-<", ":<",
      "/:)",
      ">:-P", ">:P", ">:-p", ">:p",
      "=))",
      "<):-)", "<):)",

      /* Miscellaneous */
      "><>", "<><",
      ":*)",
      "8//=/\\=",
    });

    foreach(string emoteicon in smilies)
    {

        if(sizeof(msg) < sizeof(emoteicon)) continue;
        else
        if(sizeof(msg) > sizeof(emoteicon))
        {

            if(msg[0..sizeof(emoteicon)] == emoteicon + " ")
                return 1;

        }
        else
        if(msg == emoteicon)
            return 1;

    }

    return 0;
}

int is_emote(string msg)
{
    return (msg[0..0] == ":" || is_smiley(msg));
}
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!