New message processing

This commit is contained in:
nemunaire 2014-10-05 18:19:20 +02:00
parent 981025610e
commit dfde4c5f49
20 changed files with 520 additions and 326 deletions

View file

@ -16,6 +16,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from message import TextMessage, DirectAsk
class IRCException(Exception):
def __init__(self, message, personnal=True):
@ -24,6 +26,7 @@ class IRCException(Exception):
self.personnal = personnal
def fill_response(self, msg):
# TODO: no more Response usable here
from more import Response
return Response(self.message, channel=msg.receivers, nick=(msg.nick if self.personnal else None))
if self.personnal:
return DirectAsk(msg.frm, self.message, server=msg.server, to=msg.to_response)
else:
return TextMessage(self.message, server=msg.server, to=msg.to_response)