-- Class definition file for message objects
-- Written by Moritz Hoffmann 2006, part of the orx-irc project
-- Released under the BSD license

-- base message class for all messages floating around
-- only offers the TimeStamp method that returns the time the message was
-- created. As messages (normally) get dreated as a result of incoming data
-- the timestamp shuold quite adequat

-- This is the parent class to all other message classes
::CLASS ircmessage PUBLIC
::METHOD init
  expose TimeStamp id
  TimeStamp = NowToTS()
::METHOD TimeStamp
  expose TimeStamp
  return TimeStamp
-- There are a lot of different messages, for thier hirarchy have a look at messages.txt in
-- the doc directory 

-- user messages superclass, includes a sender
::CLASS umsg SUBCLASS ircmessage PUBLIC
::METHOD init
  expose sender
  use arg sender
  self~init:super
::METHOD sender
  expose sender
  return sender

-- nick change message, method nick to find out the new nick, string
::CLASS msgnick SUBCLASS umsg PUBLIC
::METHOD init
  expose newnick
  use arg sender,newnick
  self~init:super(sender)
::METHOD nick
  expose newnick
  return newnick

-- quit message, includes a string
::CLASS msgquit SUBCLASS umsg PUBLIC
::METHOD init
  expose string
  use arg sender,string
  self~init:super(sender)
::METHOD string
  expose string
  return string

-- superclass for all messages that have a special receiver other than self and a string
::CLASS umsgr SUBCLASS umsg PUBLIC
::METHOD init
  expose receiver string
  use arg sender,receiver,string
  self~init:super(sender)
::METHOD receiver
  expose receiver
  return receiver
::METHOD string
  expose string; return string

-- normal text message to either channel or self
::CLASS privmsg SUBCLASS umsgr PUBLIC

-- same like privmsg only that notice's are less common
::CLASS unotice SUBCLASS umsgr PUBLIC

-- invite message, always directed at self, string is the list of channels
::CLASS invite SUBCLASS umsgr PUBLIC

-- kill message, includes a sender, a receiver and a string (the reason)
::CLASS msgkill SUBCLASS umsgr PUBLIC

-- kick message, sender, receiver, channel, string
::CLASS msgkick SUBCLASS umsgr PUBLIC
::METHOD init
  expose channel
  use arg sender, receiver, channel, string
  self~init:super(sender,receiver,string)
::METHOD channel
  expose channel
  return channel

-- part message, sender, receiver, string
::CLASS msgpart SUBCLASS umsgr PUBLIC

-- topic message, server, receiver, string
::CLASS msgtopic SUBCLASS umsgr PUBLIC

-- mode message, sender, receiver, string
::CLASS msgmode SUBCLASS umsgr PUBLIC

-- join message, sender, receiver, no string
::CLASS msgjoin SUBCLASS umsgr PUBLIC
::METHOD init
  use arg sender, receiver
  self~init:super(sender,receiver)

-- Server messages

-- I'm not sure how the server messages will be handled in future. maybe they are just internal
-- objects that are not passed on to the script object. That would result in a more limited
-- functionality of the program.
-- the other way would be to generate the necessary replies (like ping) in the client calss
-- but still forward the massage to the sripting object. the server messages are normally
-- very important to the client's stability thus it's needed to work on them in the core
-- client. I don't think it would be needed for a user to replace the ping functionality
-- of the client when the message itself gets forwarded.

::CLASS smsg SUBCLASS ircmessage PUBLIC
::METHOD init
  expose string
        use arg string
        self~init:super
::METHOD String
  expose string
        return string
-- ping class (missing: string that needs to be replied!)
-- the reply in generated by the client due to performance and securety reasons
::CLASS msgping SUBCLASS smsg PUBLIC

-- error message, leads to a disconnect.
::CLASS msgerror SUBCLASS smsg PUBLIC
::METHOD init
  self~init:super('') --error messages don't necessarily have a string connected with them

-- server notice
::CLASS snotice SUBCLASS smsg PUBLIC

-- wallops message, need to test this as it's only copied from the manual...
::CLASS msgwallops SUBCLASS smsg PUBLIC

-- a numeric message, the script object will work on it.
::CLASS nummsg SUBCLASS smsg PUBLIC
::METHOD init
  expose number
  use arg number, string
  self~init:super(string)
::METHOD number
  expose number
  return number

-- a mode message originating from the server
::CLASS smode SUBCLASS smsg PUBLIC
::METHOD init
  expose server target
  use arg server, target, string
  self~init:super(string)
  return self

::METHOD server
  expose server
  return server
::METHOD target
  expose target
  return target


