Joined: 22 Feb 2004 Posts: 121 Location: Richmond, VA
Posted: Tue Nov 30, 2004 12:34 am Post subject:
Basically this module wraps up stuff needed to simulate chats with msn.
Keep in mind this is a beta (v0.3). If you find any bugs or have any suggestions for method additions or changes please post them here.
Methods:
Quote:
new( msn => $msn, notify => $bool, autoCreate => $bool2 ) Creates a new SimChat object. $msn is a MSN object. notify is a boolean that turns on notifications when users join and leave chats, set name flags or room topics are set. autoCreate is a boolean which controls if a new chat room is created when you try to put users into a room that does not exist.
createChat( $chatname ) Creates a chat room. $chatname is the name of the room.
destroyChat( $chatname ) Destroys a chat room. $chatname is the name of the room.
joinChat( $chatname, @users ) Puts @users in $chatname. If autoCreate is true, then it will also create $chatname if it does not exist.
leaveChat( $chatname, @users ) Takes @users out of $chatname. If $chatname is undef, then @users are taken out of all chats.
sendChat( $chatname, $from, $message, %style ) Sends message with %style to $chatname. If $from is sent then it does not send to that user. (So you don't send the message to the sender of the message.)
getChats( $user ) Returns an arrayref of chats $user is in.
getAllChats( ) Returns an arrayref of all chats.
getUsers( $chatname ) Returns an arrayref of all users in $chatname.
setNameFlag( $user, $bool ) Sets a flag for $user that controls if the name of the message's sender is put on the front of messages he receives from a chat. (Support for clients that don't support P4 naming, like Trillian.)
setTopic( $chatname, $topic ) Sets the topic of $chatname to $topic. To unset a topic, just set it to undef.
getTopic( $chatname ) Gets the topic for $chatname.
All methods return true for success and false otherwise.
Included is MSN::SimChat and a little test script called simchat.pl
Joined: 22 Feb 2004 Posts: 121 Location: Richmond, VA
Posted: Tue Nov 30, 2004 7:04 pm Post subject:
Not that I don't love the praise, but give me some constructive criticism people! What do you like about it, what would you like to see, what would you like changed, what would you do differently?
Joined: 22 Feb 2004 Posts: 121 Location: Richmond, VA
Posted: Tue Nov 30, 2004 7:12 pm Post subject:
QUOTE(Mojave @ Nov 29 2004, 04:56 PM)
Why does addChat take a list of users? It seems to me when you first create a chat, there would be nobody to put in it yet.
Well say you have a bot that doesn't have any specified chat rooms, it just lets users create them when they want. Ths si when you need it. If a room does not exist, you would create it and put the user(s) who want to chat in that room in it. The possibilities are endless. A secret to my code at the moment is you can just call joinChat and ti will create a room if there is not one (although it does give a warning). Should these 2 methods just be combined? should addChat only make a chat and joinChat only add to the chat? What do you guys think?
I think you definitely need an addChat method, so that you can setup cahts that people can join and leave. joinChat could have an optional parameter to add the chat if it doesn't exist yet, as you said. If no chat exists and someone tries to join a chat (and you aren't auto-creating chats), then it should fail with an error. You could also have leaveChat automatically delete the chat when the last person leaves, and that would also be an option. So you need a remChat too. And what about broadcastToChat (or some better name)?
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Tue Nov 30, 2004 7:28 pm Post subject:
I think it needs support for trillian,i.e. not useing p-4 chat for users who can't see it.
Most chat functionality I would see being added threw commands though. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com
Joined: 22 Feb 2004 Posts: 121 Location: Richmond, VA
Posted: Wed Dec 01, 2004 1:07 am Post subject:
I think the only support I would give for trillian users is flag you can set for a user if you want that user to have the name of that user displayed in front of the message.
Maybe something like setNameFlag( $user, $boolean );
If true everytime I send a message to that user I would send the name in from of the message.
Joined: 22 Feb 2004 Posts: 121 Location: Richmond, VA
Posted: Wed Dec 01, 2004 4:07 am Post subject:
I just posted up a new version: 0.3.
Look at the first post in this topic for methods and the download.
Changes: -renamed addChat to createChat -createChat only creates chats, does not add any users -added destoyChat method -added setTopic, getTopic and notifications of these actions -added a contructor flag autoCreate that lets you choose if joinChat will create chats or not -added a getUsers method (how'd I forget that?) -renamed getChat to getChats and getChats to getAllChats -added a setNameFlag method and edited sendChat to work with it -more error handling