Permalink
Browse files

ignore multiple spaces in admin commands, close #10

  • Loading branch information...
1 parent 621da54 commit e751c5b143f09cd68fd68bf4f858f7322c49ccfc oau committed Oct 17, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 core.py
View
20 core.py
@@ -409,15 +409,17 @@ def _parse_action(self, src, phone, orig_msg):
number = None
action = None
- if admin_cmd.startswith('add sender '):
- action = 'add_sender'
- number = normalize_number(admin_cmd[len('add sender '):])
- elif admin_cmd.startswith('add admin '):
- action = 'add_admin'
- number = normalize_number(admin_cmd[len('add admin '):])
- elif admin_cmd.startswith('add '):
- action = 'add'
- number = normalize_number(admin_cmd[len('add '):])
+ if admin_cmd.startswith('add '):
+ rest = admin_cmd[len('add '):].strip()
+ if rest.startswith('sender '):
+ action = 'add_sender'
+ number = normalize_number(rest[len('sender '):].strip())
+ elif rest.startswith('admin '):
+ action = 'add_admin'
+ number = normalize_number(rest[len('admin '):].strip())
+ else:
+ action = 'add'
+ number = normalize_number(rest)
if action and number:
return {'action':action, 'number':number, 'group':group}
else:

0 comments on commit e751c5b

Please sign in to comment.