Mumble/Murmur: Setting a default channel for authenticated users (hardcoded solution)

Update (05/02/2011): With the release of Mumble v.1.2.3-rc2, the below mentioned method isn’t necessary anymore. Please have a look at this post for updated information.


My World of WarCraft guild changed the voice software this weekend. We used Ventrilo up until now, but our server will shut down today, so we had to change and gave Mumble 1.2.2 a try. The server setup was quick, the voice quality is good and the channel based ACLs provides a huge flexibility for user group based access rights. We are using a basic “two area” channelsetup – a closed area for guild members only (for raids, pvp, chating, etc.) and a public area (for random groups, friends, etc.). So, every guild member is registered to the server and was given access rights to the internal area by the admin.

After using mumble for the first two days, we noticed a little flaw: When a authenticated user disconnect from Murmur, the server saves the last channel the user was in. If the user connects to the server again, the server moves the user back to the last channel automatically. I understand, that this feature is probably widly seen as a “nice-to-have” and not as a drawback, but our voice server is used quite heavy and already a few people bumped in conversations accidentally. So, I started to search for a solution to set a default channel to get everyone in the lobby after a connect.

Murmur provides an option to set a default channel via a database entry, but this option only affects non-registered user. It seems more like a “change lobby”-function. If you want to change the default channel for unregistered users, just insert a new entry to the table ‘config’ in the database. It has three fields:

  • ‘server_id’ = your server id (probably 1, if you just have one server running)
  • ‘key’ = ‘defaultchannel’
  • ‘value’ = the channel id of the channel you want to use as a default channel (see table ‘channels’ for the corresponding channel id for a given channelname

But this still doesn’t solve the ‘return-to-last-channel’-issue of authenticated users. Unfortunately, the binary doesn’t provide an option for changing this. The good news is: Mumble is open source, so you (and I 😉 ) can change the code to let it work as you like!

For information about obtaining the mumble sourcecode, see http://mumble.sourceforge.net/Development. I used the ‘1.2.2’ tagged branch. The server saves the information about the last channel in the table ‘users’, field ‘lastchannel’. The corresponding src-file is ‘/src/murmur/ServerDB.cpp’. The function is in line 1333:

void Server::setLastChannel(const User *p) {
if (p->iId < 0)
return;
if (p->cChannel->bTemporary)
return;
TransactionHolder th;
QSqlQuery &query = *th.qsqQuery;
SQLPREP("UPDATE `%1users` SET `lastchannel`=? WHERE `server_id` = ? AND `user_id` = ?");
query.addBindValue(p->cChannel->iId);
query.addBindValue(iServerNum);
query.addBindValue(p->iId);
SQLEXEC();
}

Basically, if you want the server to use a default channel on connect, you can hardcode it here. Just set a valid channel_id for lastchannel. Preferably 0, which should be the root channel, but any valid channel_id should do. Don’t forget to comment the next line out. The result should look something like this:

void Server::setLastChannel(const User *p) {
if (p->iId < 0)
return;
if (p->cChannel->bTemporary)
return;
TransactionHolder th;
QSqlQuery &query = *th.qsqQuery;
SQLPREP("UPDATE `%1users` SET `lastchannel` = 0 WHERE `server_id` = ? AND `user_id` = ?");
// query.addBindValue(p->cChannel->iId);
query.addBindValue(iServerNum);
query.addBindValue(p->iId);
SQLEXEC();
}

For compiling instructions, see http://mumble.sourceforge.net/Development.

Links:

2 thoughts on “Mumble/Murmur: Setting a default channel for authenticated users (hardcoded solution)”

  1. FYI, I saw this post and thought it’d make a nice little challenge for myself hacking on Murmur – I submitted a patch (#3039789) that makes the “remember last channel for registered users” toggle-able. I did it in Messages.cpp instead – preventing the server from sending the channel back to the user after they’re logged in… the “last channel” setting is still saved, it’s just never used. That way if someone turns the setting back on (which is the default), users will return to their current channel.

    Hopefully I didn’t screw anything up when I did the patch, it gets accepted, and then you won’t have to hack your server and recompile after 1.2.3. 🙂

  2. Nice work! I already thought about such a solution myself, but i’m currently too busy with exams. I know that a hardcoded solution isn’t very nice, but it was good enough for me in that moment 😉

    I already talked about that matter in the mumble IRC-channel. The developers had no reason against a toggle-able solution, so if they like your implementation, then it will probably get accepted.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.