thankyou
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: Contact Plugin  (Read 20728 times)

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Contact Plugin
« on: August 10, 2010, 06:02:57 PM »
hey

I present to you a little plugin

Plugin Contact for send an e_mail to the administration server

use : !contact <message to admin>

need smtp server

Installation:

1. Place the contact.py in your ../b3/extplugins and the
contact.xml in your ../b3/extplugins/conf folders.

2. Open contact.xml

modify e_mail adress for send message
modify e_mail adress for receive message
modify server name

3. Open your B3.xml file (default in b3/conf) and add the next line in the
<plugins> section of the file:

<plugin name="contact" priority="11" config="@b3/extplugins/conf/contact.xml"/>

Choose your next free number for the priority

download->contact v1.0
« Last Edit: August 11, 2010, 10:46:15 AM by PtitBigorneau »
PtitBigorneau

Offline xlr8or

  • [ www.xlrstats.com ]
  • Project Lead
  • Hero Member
  • *
  • Posts: 2057
    • The Art of Tactical Gaming
Re: Contact Plugin
« Reply #1 on: August 10, 2010, 09:23:59 PM »
Nice addition.

The priority parameter is however no longer used, so you don't need it anymore for plugins.

Offline grosbedo

  • Former Dev. (senate)
  • Sr. Member
  • *****
  • Posts: 258
Re: Contact Plugin
« Reply #2 on: August 11, 2010, 03:10:57 PM »
If you ever want to enhance this plugin, could you please add a better errors handling ?

Code: [Select]
100811 17:19:21 DEBUG   AdminPlugin: OnSay handle 5:"!contact hey mate ! someone
 is cheating currently, can you come in please ?"
100811 17:19:21 DEBUG   AdminPlugin: Handle command !contact hey mate ! someone
is cheating currently, can you come in please ?
100811 17:19:21 VERBOSE RCON sending (127.0.0.1:27963) say ^1supeR^5,^7Bot: ^3[p
m]^7 ^7There was an error processing your command
100811 17:19:21 ERROR   handler AdminPlugin could not handle event Say: error: [
Errno 111] Connection refused [('/home/openarena/b3/b3/parser.py', 765, 'handleE
vents', 'hfunc.parseEvent(event)'), ('/home/openarena/b3/b3/plugin.py', 157, 'pa
rseEvent', 'self.onEvent(event)'), ('/home/openarena/b3/b3/plugin.py', 175, 'onE
vent', 'self.handle(event)'), ('/home/openarena/b3/b3/plugins/admin.py', 172, 'h
andle', 'self.OnSay(event)'), ('/home/openarena/b3/b3/plugins/admin.py', 306, 'O
nSay', 'results = command.execute(data, event.client)'), ('/home/openarena/b3/b3
/plugins/admin.py', 1905, 'execute', 'self.func(data, client, copy.copy(self))')
, ('/home/openarena/b3/b3/extplugins/contact.py', 57, 'cmd_contact', "server = s
mtplib.SMTP('localhost')"), ('/usr/lib/python2.6/smtplib.py', 239, '__init__', '
(code, msg) = self.connect(host, port)'), ('/usr/lib/python2.6/smtplib.py', 295,
 'connect', 'self.sock = self._get_socket(host, port, self.timeout)'), ('/usr/li
b/python2.6/smtplib.py', 273, '_get_socket', 'return socket.create_connection((p
ort, host), timeout)'), ('/usr/lib/python2.6/socket.py', 514, 'create_connection
', 'raise error, msg')]

This is because I didn't configure SMTP yet (although it should work already, I will verify).

Other than that, good idea and good job ;)

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Re: Contact Plugin
« Reply #3 on: August 11, 2010, 04:35:28 PM »
thank you  :)
then plugin tested on urban terror,  on ubuntu server with sendmail

just add in php.ini (/etc/php5/apache2/php.ini) for sending mail via php

Code: [Select]
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.ptitbigorneau.fr #smtp adress
; http://php.net/smtp-port
smtp_port = 25

nothing to configure for sending mail via python

PtitBigorneau

Offline dakotaboul123

  • Sr. Member
  • ****
  • Posts: 182
Re: Contact Plugin
« Reply #4 on: August 16, 2010, 05:13:36 AM »
When i go to sue this plugin i get these  errors in my b3.log

100815 22:09:28   WARNING   WelcomePlugin: using default value 20 for command !greeting
100815 22:09:28   CRITICAL   Error loading plugin: No module named text
Traceback (most recent call last):
  File "b3\parser.pyo", line 473, in loadPlugins
  File "b3\parser.pyo", line 541, in pluginImport
  File "C:\UserFiles\dakotaboul123\GameServers\TC63810866725487762073825\b3\extplugins\contact.py", line 11, in <module>
  File "email\__init__.pyo", line 79, in __getattr__
ImportError: No module named text
100815 22:10:00   ERROR   Error executing crontab <bound method StatusPlugin.update of <b3.plugins.status.StatusPlugin instance at 0x01909F58>>: 'NoneType' object has no attribute 'gameName'
[('b3\\cron.pyo', 233, 'run', None), ('b3\\cron.pyo', 171, 'run', None), ('b3\\cron.pyo', 60, 'run', None), ('b3\\plugins\\status.pyo', 172, 'update', None)]
100815 22:11:00   ERROR   Error executing crontab <bound method StatusPlugin.update of <b3.plugins.status.StatusPlugin instance at 0x01909F58>>: 'NoneType' object has no attribute 'gameName'
[('b3\\cron.pyo', 233, 'run', None), ('b3\\cron.pyo', 171, 'run', None), ('b3\\cron.pyo', 60, 'run', None), ('b3\\plugins\\status.pyo', 172, 'update', None)]


But when i remove the plugin, they are gone

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Re: Contact Plugin
« Reply #5 on: August 16, 2010, 11:28:03 AM »
windows?  what version B3 , B3 Windows Installer?

you have an SMTP server?

the problem looks to be with "from email.MIMEText import MIMEText"

I am testing on windows 7 with the latest version B3 for windows
PtitBigorneau

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: Contact Plugin
« Reply #6 on: August 16, 2010, 11:54:40 AM »
@PtitBigorneau: It looks like dakotaboul123 is using the windows version of B3.
In the windows version of B3 the end user does not requires to have python installed on his computer. As a consequence if a 3rd party plugin tries to import a python module which is not already used by B3, the import will fail.

The smtplib module is not part of the B3 core. We will add this module to B3 1.3.4 when it goes public so this plugin can work fine with the windows release of B3.

@dakotaboul123: If you want to run this plugin right now, you have to install B3 from sources (and thus also install python on your computer, etc)
Or you can wait for the public release of B3 1.3.4
« Last Edit: August 16, 2010, 12:17:31 PM by Courgette »

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: Contact Plugin
« Reply #7 on: August 16, 2010, 12:28:38 PM »
@PtitBigorneau: i've been testing B3 1.3.4b on a windows machine and it appears that this plugin will only work on the windows version of B3 if you replace
Code: [Select]
from email.MIMEText import MIMEText
with
Code: [Select]
from email import *

also replace
Code: [Select]
email = MIMEText(message) 
with
Code: [Select]
email = MIMEText.MIMEText(message) 
« Last Edit: August 16, 2010, 12:44:33 PM by Courgette »

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Re: Contact Plugin
« Reply #8 on: August 16, 2010, 01:07:41 PM »
thank courgette

for the new version of the plugin, I've made the changes

new version 1.1

add command !acontact for sending messages between admins or moderators

adds 4 commands:

!addmail register or change your mail address

use : !addmail [adress mail]

!delmail for delete your mail address

use : !delmail

!listcontact for Admins list with an mail address registered

use : !listcontact

!acontact for message to admin or moderator server

use : !acontact [name or ID admin] [message]

Installation:

1. Place the contact.py in your ../b3/extplugins and the
contact.xml in your ../b3/extplugins/conf folders.

2. Open contact.xml

modify e_mail address for send message
modify e_mail address for receive message
modify server name
modify smtp server name (lacolhost or smtp.exemple.com)

3. Open your B3.xml file (default in b3/conf) and add the next line in the
<plugins> section of the file:

<plugin name="contact" config="@b3/extplugins/conf/contact.xml"/>

4. Run the contact SQL script (contact.sql) on your B3 database

download -> contact v1.1
« Last Edit: August 16, 2010, 04:32:45 PM by PtitBigorneau »
PtitBigorneau

Offline dakotaboul123

  • Sr. Member
  • ****
  • Posts: 182
Re: Contact Plugin
« Reply #9 on: August 17, 2010, 02:10:44 AM »
Im using the standalone version  :-\ So i assume it wont work with that?

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: Contact Plugin
« Reply #10 on: August 17, 2010, 08:10:13 AM »
wait for B3 v1.3.4

Offline grosbedo

  • Former Dev. (senate)
  • Sr. Member
  • *****
  • Posts: 258
Re: Contact Plugin
« Reply #11 on: August 17, 2010, 03:51:45 PM »
Nice additions PtitBigorneau ! Im going to install it _now_ !

/EDIT : Just, if I would see just one more feature, it would be a minimum time to wait between each mail, to avoid spamming.
« Last Edit: August 17, 2010, 04:36:52 PM by grosbedo »

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Re: Contact Plugin
« Reply #12 on: August 17, 2010, 04:55:52 PM »
Quote
Just, if I would see just one more feature, it would be a minimum time to wait between each mail, to avoid spamming.

I currently work on this problem.

pending the player's name, ip address, the guid and id of the player are shown in the mail

in cases of abuse the person is easily punishable
PtitBigorneau

Offline grosbedo

  • Former Dev. (senate)
  • Sr. Member
  • *****
  • Posts: 258
Re: Contact Plugin
« Reply #13 on: August 17, 2010, 05:52:54 PM »
I see :)

Offline PtitBigorneau

  • Moderator
  • Sr. Member
  • *
  • Posts: 194
    • www.ptitbigorneau.fr
Re: Contact Plugin
« Reply #14 on: August 19, 2010, 03:52:13 PM »
new version v1.2

add a system anti_spamming limiting the time between the sending of two messages and the number of messages sent in a given period

by default

limit for the players has a message every 5 minutes and 5 messages per hour

for admins just one message every 5 minutes

change command !listcontact -> !listmail

adds 4 commands

!bancontact for prohibit a player's message posting

use : !bancontact or!bcontact [name or id]

!unbancontact for lift the ban

use: !unbancontact or!ucontact [name or id]

!listcontact for shipments by mail the list of users who have sent a message and see the last 10 users

use: !listcontact or! ltcontact

!lookcontact for check if a player has sent a message and if it is allowed or not to send messages

use! lookcontact or lkcontact [name or id]

Installation:

1. Place the contact.py in your ../b3/extplugins and the
contact.xml in your ../b3/extplugins/conf folders.

2. Open contact.xml

modify e_mail address for send message
modify e_mail address for receive message
modify server name
modify smtp server name  (localhost or smtp.exemple.com)


3. Open your B3.xml file (default in b3/conf) and add the next line in the
<plugins> section of the file:

<plugin name="contact" config="@b3/extplugins/conf/contact.xml"/>

4. Run the contact SQL script (contact.sql or contact_update.sql if you have contact v1.1) on your B3 database

sorry for my english

Download ->contact v1.2
« Last Edit: August 20, 2010, 05:51:50 PM by PtitBigorneau »
PtitBigorneau

 


Rate this page +1 at Google Search