BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.3.x Custom/Unofficial Modules => Topic started by: Blueeagle on March 04, 2007, 03:39:39 pm

Title: modules/Mail.php
Post by: Blueeagle on March 04, 2007, 03:39:39 pm
I've been working on a bot mail system that allows members and guests to send offline messages to eachother. This is a huge improvement over offline tells.

Features:
 - All registered alts of a player has got access to the same mailbox.
 - Configurable with the new settings module to allow different levels of access to send and read mail. (IE it can be restricted so only leaders/admins may send mail and everyone may read mail sendt or only leaders can read mail but everyone can send mail to them or all but guests can send/recieve and so on)
- Configurable expiration time of read and unread mail
- Conigurable (global) notificaton of unread mail when a player logs on any of his alts

To do: (ignore the to-do list in the Mail.php file.
 - Cron jobs got lost in a brainfart. Needs to be re-implemented.
 - Colors of message windows needs to be ported to the new Colors module
 - Implement a mass messaging feature so that leaders (configurable ofcourse) can send messages to everyone of a certain access level. (Not sure how this should be done. Ideas are welcome)
 - For those running a webserver on the same machine as the bot it would be possible to implement a web-based send mail interface that iterfaces directly with the database. Not sure how to best make such an interface to be implementable by various boards used by guilds tho.
 - Testing, testing and more testing

Please give feedback.

Attatchment: modules/Mail.php

Edit: Added more stuff to the TO-DO list
Title: Re: modules/Mail.php
Post by: Alreadythere on March 04, 2007, 04:11:51 pm
Nice idea!

For more info on colors check the wiki (http://bebot.link/wiki/doku.php?id=colors)
Title: Re: modules/Mail.php
Post by: Blueeagle on March 04, 2007, 05:01:30 pm
Nice idea!

For more info on colors check the wiki (http://bebot.link/wiki/doku.php?id=colors)

Yeah, I saw that. I had it all set up but I lost it when I was updating the svn tree. :p
Title: Re: modules/Mail.php
Post by: Malosar on March 04, 2007, 06:22:50 pm
Thats a really good idea, mind if I help out?
Title: Re: modules/Mail.php
Post by: Wolfbiter on March 04, 2007, 06:28:48 pm
Always thought about doing this, but never got off my fat ass.
Good job.
Title: Re: modules/Mail.php
Post by: Wolfbiter on March 04, 2007, 06:41:45 pm
Well.. here goes my check of the script...

Code: [Select]
Line 186: $mailbox=$this->bot->alts->main($user);
Line 187: $no_of_messages=$this->new_mail_count($name);
I assume it's supposed to use main for mail, but it still checks mail for $name instead of $mailbox.

Maybe make the logon notify a user setting instead of a script setting? Since some people might want to be notified and others doesn't.
For when you add cron, maybe go over buddylist and see if anyone has any unread mail still?
You should remove all commented things that isn't yours (like all the stuff from the template you don't use).
Title: Re: modules/Mail.php
Post by: Blueeagle on March 04, 2007, 07:47:38 pm
Thats a really good idea, mind if I help out?

Thank you and no, go right a head. :)

Edit: Khalem talked something about setting up a dev branch. Now I don't know how to do that but it might be a good idea if several people are to be working on this.
Title: Re: modules/Mail.php
Post by: Blueeagle on March 04, 2007, 07:48:34 pm
Well.. here goes my check of the script...

Code: [Select]
Line 186: $mailbox=$this->bot->alts->main($user);
Line 187: $no_of_messages=$this->new_mail_count($name);
I assume it's supposed to use main for mail, but it still checks mail for $name instead of $mailbox.

Maybe make the logon notify a user setting instead of a script setting? Since some people might want to be notified and others doesn't.
For when you add cron, maybe go over buddylist and see if anyone has any unread mail still?
You should remove all commented things that isn't yours (like all the stuff from the template you don't use).

Yeah I think I missed some notifies. This probably explains it. Thank you.
Title: Re: modules/Mail.php
Post by: Alreadythere on March 29, 2007, 12:29:56 pm
Some errors I caught:

As I don't like spam right on logon I've added a slight delay to the notifies. And I've added default access levels for the commands.

Here (http://www.m8y.de/ao/bebot/Mail.phps) is my modified version with the fixes/adds.

PS: forgot to add: if you aren't allowed to send mail it just returns an empty tell. Missing some return value there.
Title: Re: modules/Mail.php
Post by: Blueeagle on March 29, 2007, 10:02:51 pm
Good job mate!

Just to find something to pick on:
  • if(msg===1) in buddy() got one = too many

= assings
== checks for equality
=== checks for identicality

if (1 ==  "1") is true while
if (1 === "1") is false because 1 is an integer while "1" is a string

A moot point since the variable type is irellevant in this case. :)
Title: Re: modules/Mail.php
Post by: Malosar on March 29, 2007, 10:51:41 pm
hehe, you said assings  ;D

(sorry, had to do it)
Title: Re: modules/Mail.php
Post by: Alreadythere on March 29, 2007, 11:20:40 pm
= assings
== checks for equality
=== checks for identicality

if (1 ==  "1") is true while
if (1 === "1") is false because 1 is an integer while "1" is a string

A moot point since the variable type is irellevant in this case. :)
Didn't know that yet, nice to learn that.
Title: Re: modules/Mail.php
Post by: Blueeagle on March 29, 2007, 11:51:36 pm
hehe, you said assings  ;D

(sorry, had to do it)

Aw poo! ;)
Title: Re: modules/Mail.php
Post by: Alreadythere on March 30, 2007, 12:41:33 pm
Why did you add the make_item_blob() function btw? Not sure what's it supposed to archieve, and it's crashing my AORC :P
Title: Re: modules/Mail.php
Post by: Blueeagle on March 30, 2007, 03:19:14 pm
Because itemrefs sendt trough make_blob were rendered useless.
Title: Re: modules/Mail.php
Post by: Alreadythere on March 30, 2007, 04:14:45 pm
Replace " with ' in the itemref before posting it in the blob, works for me all the time with the standard make_blob() function.
Title: Re: modules/Mail.php
Post by: lazarus on June 13, 2007, 03:25:11 pm
For some reason I cant send mails... it give me the empty tell. and I understand that is because of missing permissions? well I have tryed all the access lvls, but it's the same.

Title: Re: modules/Mail.php
Post by: Temar on July 19, 2007, 04:36:48 am
1 thing im after not sure if u got
is mailbot for ALL admin or leader etc
was thinking maybe were owner can see all msg for leader/admin/superamin/owner
but like admin only see leader/admin

these msgs being sent are not specifit for any 1 just AN admin

i was thinking of making somit along the line but look like it would be better as part of ur module
Title: Re: modules/Mail.php
Post by: Temar on July 19, 2007, 04:43:30 am
oh and also i run SVN
Quote
Fatal error: Call to a member function on a non-object in /home/Bots/Testbot/modules/Mail.php on line 109
Title: Re: modules/Mail.php
Post by: Alreadythere on July 19, 2007, 10:13:09 am
It doesn't do what you want, it's just a kind of offline message system between users.

Though I don't see any possible error in line 109 - did you download the file version in my post here (http://bebot.link/index.php/topic,697.msg5467.html#msg5467)?
Title: Re: modules/Mail.php
Post by: Temar on July 19, 2007, 12:17:53 pm
yes i downloaded it from this topic on 1st post
Title: Re: modules/Mail.php
Post by: Alreadythere on July 19, 2007, 03:49:26 pm
how can you not see this Problem?
Because I'm talking about the version I posted, which is this one here (http://www.m8y.de/ao/bebot/Mail.phps).

It is already up-to-date for 0.3.5 or current SVN.

Basically it's a slightly modified version of the one Blueeagle posted first.
Title: Re: modules/Mail.php
Post by: Temar on July 19, 2007, 11:20:24 pm
Oh yer sorry
Title: Re: modules/Mail.php
Post by: Nytridr on November 24, 2007, 01:59:26 am
I am having a proble with the following line

Code: [Select]
$query="INSERT INTO #___mail_message (mailbox, recipient, sender, message, expires) VALUES('$mailbox', '$recipient', '$sender', '$message', 'FROM_UNIXTIME($expires)')";

Line 264

it will not accept
FROM_UNIXTIME($expires)'
for somereason it keeps with the whole thing.. and the time is in the ()'s

Code: [Select]
rsbot [2007-11-24 00:57:44]     [TELL]  [INC]   Nytridra: !mail send nytridr tes
ties
MySQL error (# 0) on query: INSERT INTO rsbot_mail_message (mailbox, re
cipient, sender, message, expires) VALUES('Metanyt', 'Nytrid
r', 'Nytridra', 'testies', 'FROM_UNIXTIME(1211587064)')
Incorrect datetime value: 'FROM_UNIXTIME(1211587064)' for column 'expires' at ro
w 1
rsbot [2007-11-24 00:57:44]     [TELL]  [OUT]   -> Nytridra: Message sent to Nyt
ridr (Metanyt).

this use to work.. so IDK what changed..
SimplePortal 2.3.7 © 2008-2024, SimplePortal