Jump to content
Mumble forums

Eggdrop script to list mumble users


Recommended Posts

A little eggdrop script to list mumble users to an irc channel. You may modify and use these scripts in any way you like.

Please post or PM me of possible modifications to the scripts.

Special thanks to Svedrin (Author of Mumble-django) for python/ice help.

irc channel output (only server:channel combinations with users on separate rows ):

<@purch> !m
<@botti> nahka.CoD MW2: purch, jukkis, seppo
<@botti> nolla.Strikeforce: aman


Requirements are eggdrop, python, murmur with ICE.

TCL script just splits and putchan the return of the python script:


#mumble.tcl version 0.3 by Arto Puranen

# Reply to triggers on these channels
set mumble(channellist) {#channel1 #channel2}

# Binds
bind pub - !m mumble

# python executable
set mumble(cmdpython) "/usr/bin/python"

# python script
set mumble(info) "/home/puke/eggdrop/scripts/python/mumble.py"

# If mumble(channellist) is empty, all channels apply
if {$mumble(channellist) == ""} {
set mumble(channellist) [channels]

## The Stuff ##

proc mumble {nick uhost hand chan arg} {
   global mumble

   if {[lsearch [string toupper $mumble(channellist)] [string toupper $chan]] == -1} {
       return 0
   set html [exec $mumble(cmdpython) $mumble(info) 2> /dev/null]
   #putchan $chan "$html"
   set y [llength $html]
   #putchan $chan "$y"
   for {set x 0} {$x<$y} {incr x} {
       set line [lindex $html $x]
       putchan $chan "$line"

set mumble(versio) "0.3"
putlog "mumble.tcl v$mumble(versio) by Arto Puranen"


Python script finds users from servers and creates proper output for tcl script. This script works from shell too (~ $ python mumble.py)

- Added mumble 1.2.3 support


# Author Arto Puranen
# Thanks to svedrin (author of mumble-django)

__version__ = 'Mumble.py ver 1.2'

### configs

# The first is Ice connection string to a server.
# The second is server name to be printed to the irc channel.
servConn = [['Meta:tcp -h -p 6502', 'nahka'],
           ['Meta:tcp -h xx.yy.zzz.yx -p 6502', 'nolla']]

# No users on the mumble servers then print this
emptyOutput = 'None'

# Exclude servers by server registername
exServ = ['kalju']

# Exclude channels by channel name
exChan = ['']

# No response from a server message
noRespMess = 'ei vastaa'

# Murmur.ice from mumble ver >= 1.2.3 (1 = true; 0 = false)
iceVer = 0

# Murmur.ice path
icePath = '/usr/share/slice'

### config end

import sys
import traceback
import Ice
import os

class ice():

   def __init__(self, iceconn, iceVer, icePath):
       self.output = {}
           slicefile = 'Murmur.ice'
           slicepath = icePath
           # load murmur module
           """ Load the slice file with the correct include dir set, if possible. """
           if hasattr(Ice, "getSliceDir"):
               icepath = Ice.getSliceDir()
               icepath = None

           if iceVer == 0:
               # use this if mumble ver (Murmur.ice) < 1.2.3
               # use this if mumble ver (Murmur.ice) >= 1.2.3
               Ice.loadSlice(os.path.join(slicepath,slicefile), ['-I' + icepath, slicefile])

           import Murmur
           self.idd = Ice.InitializationData()
           self.ice = Ice.initialize(self.idd)
           self.prx = self.ice.stringToProxy(iceconn)
           except Ice.Exception:
               raise EnvironmentError( "Murmur does not appear to be listening on this address (Ice ping failed)." )
           self.meta = Murmur.MetaPrx.checkedCast(self.prx)
           self.servers = self.meta.getBootedServers()
           self.default = self.meta.getDefaultConf()
           status = 1

   def getPlayers(self):
       for sid in self.servers:
           if sid.getAllConf()['registername'] in self.exServ:
           channels = sid.getChannels()
           userList = sid.getUsers()
           for uid in userList:
               uidChannelId = sid.getState(uid).channel
               uidChannelName = sid.getChannelState(uidChannelId).name
               if uidChannelName in self.exChan:
               uidUserName = sid.getState(uid).name
               if not self.output[self.serverName].has_key(uidChannelName):
                   self.output[self.serverName][uidChannelName] = []
   def returnOutput(self):
       fulllist = ''
       start = r'{'
       end = r'}'
       bold = '\002'
       for s in self.output:
           if self.output[s].keys():
               channelList = self.output[s].keys()
               for c in channelList:
                   list = '%s%s%s.%s:%s ' % (start, bold, s, c, bold)
                   userList = self.output[s][c]
                   for u in userList:
                       list += '%s, ' % (u)
                   list = list[:-2] + '%s ' % (end)
                   fulllist += list
       return fulllist

   def close(self):
           status = 0
           status = 1

def main(servconn, emptyOutput, exServ, exChan, noRespMess):
   outputlist = ''
   start = r'{'
   end = r'}'
   bold = '\002'
   for s in servconn:
           serv = ice(s[0])
           serv.exServ = exServ
           serv.exChan = exChan
           serv.serverName = s[1]
           serv.output = {serv.serverName : {}}
           outputlist += serv.returnOutput()
           outputlist += '%s%s %s%s' % (start, s[1], noRespMess, end)

   if outputlist:
       print outputlist
       outputlist = '%s%s%s%s%s' % (start, bold, emptyOutput, bold, end)
       print outputlist

main(servConn, emptyOutput, exServ, exChan, noRespMess)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...