'MSG / Messaging'

def msg(self):

    ADMIN = current.session.s3.system_roles.ADMIN
    if (current.request.function in ('sms_outbound_gateway', 'email_channel', 'facebook_channel', 'sms_modem_channel', 'sms_smtp_channel', 'sms_webapi_channel', 'tropo_channel', 'twitter_channel')):
        return self.admin()
    settings_messaging = self.settings_messaging()
    return M(c='msg')(M('Compose', f='compose'), M('InBox', f='inbox')(M('Email', f='email_inbox'), M('RSS', f='rss'), M('SMS', f='sms_inbox'), M('Twitter', f='twitter_inbox')), M('Outbox', f='outbox')(M('Email', f='email_outbox'), M('Facebook', f='facebook_outbox'), M('SMS', f='sms_outbox'), M('Twitter', f='twitter_outbox')), M('Message    Log', f='message'), M('Distribution    groups', f='group')(M('Group    Memberships', f='group_membership')), M('Twitter    Search', f='twitter_result')(M('Search    Queries', f='twitter_search'), M('Results', f='twitter_result')), M('Administration', restrict=[ADMIN])(settings_messaging))
