Changeset 25:536c135ab269 in mailjam


Ignore:
Timestamp:
May 23, 2012, 10:19:54 AM (12 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Added support for adding members to a given mailing list, and to get a list
of members from a given mailing list, to the CLI client.

Location:
mailjam
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mailjam/cli.py

    r24 r25  
    146146        Alias: amlm
    147147        """
    148         pass
    149 
    150     def do_show_mailing_list_members(self, line):
    151         """
    152         show_mailing_list_members address
    153         """
    154         pass
    155    
     148        usage = 'usage: add_mailing_list_member member_address list_address'
     149        if not line:
     150            print usage
     151        else:
     152            params = line.split(' ')
     153            list_addr = params.pop()
     154            if params:
     155                member_addr = params.pop()
     156                result = self.rpc.members.add(member_addr, list_addr)
     157                print result
     158            else:
     159                # we need the member adddress too
     160                print usage
     161
     162    def do_amlm(self, line):
     163        """
     164        amlm member_address list_address
     165        Alias for the add_mailing_list_member command. To learn more type:
     166
     167        help add_mailing_list_member
     168        """
     169        self.do_add_mailing_list_member(line)
     170       
     171    def do_list_mailing_list_members(self, line):
     172        """
     173        list_mailing_list_members address
     174        List all the members from the given list.
     175
     176        Alias: lmlm       
     177        """
     178        if not line:
     179            print 'usage: list_mailing_list_members address'
     180        else:
     181            members = self.rpc.members.list(line)
     182            if not members:
     183                print 'No members found in list', line
     184            else:
     185                print len(members), 'member(s) found in list', line
     186                for m in members:
     187                    print m
     188
     189    def do_lmlm(self, line):
     190        """
     191        lmlm address
     192        Alias for the list_mailing_list_members command. To learn more type:
     193
     194        help list_mailing_lists
     195        """
     196        self.do_list_mailing_list_members(line)
     197       
    156198    def do_EOF(self, line):
    157199        return True
  • mailjam/daemon.py

    r24 r25  
    205205        if mailing in self.mailjam.mailings_addresses:
    206206            return self.mailjam.mailings[mailing].members_addresses()
     207        return []
    207208
    208209
Note: See TracChangeset for help on using the changeset viewer.