{"id":19,"date":"2010-04-19T19:56:13","date_gmt":"2010-04-19T18:56:13","guid":{"rendered":"http:\/\/nanaki.apm.etc.tu-bs.de\/wordpress\/?p=19"},"modified":"2021-08-24T16:46:55","modified_gmt":"2021-08-24T14:46:55","slug":"mumble-murmur-setting-a-default-channel-for-authenticated-users","status":"publish","type":"post","link":"https:\/\/www.cosmocanyon.de\/wordpress\/2010\/04\/mumble-murmur-setting-a-default-channel-for-authenticated-users\/","title":{"rendered":"Mumble\/Murmur: Setting a default channel for authenticated users (hardcoded solution)"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\"><strong><span style=\"color: #ff0000;\">Update (05\/02\/2011):<\/span><\/strong><\/span> With the release of Mumble v.1.2.3-rc2, the below mentioned method isn&#8217;t necessary anymore. Please have <a href=\"\/wordpress\/2011\/02\/05\/mumblemurmur-prevent-authenticated-users-from-rejoining-their-last-used-channel-in-1-2-3-rc2\/\">a look at this post for updated information<\/a>.<\/p>\n<hr \/>\n<p>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 <a href=\"http:\/\/mumble.sourceforge.net\/\">Mumble 1.2.2<\/a> 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 &#8220;two area&#8221; channelsetup &#8211; 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.<\/p>\n<p>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 &#8220;nice-to-have&#8221; 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.<\/p>\n<p><!--more-->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 &#8220;change lobby&#8221;-function. If you want to change the default channel for unregistered users, just insert a new entry to the table &#8216;config&#8217; in the database. It has three fields:<\/p>\n<ul>\n<li>&#8216;server_id&#8217; = your server id (probably 1, if you just have one server running)<\/li>\n<li>&#8216;key&#8217; = &#8216;defaultchannel&#8217;<\/li>\n<li>&#8216;value&#8217; = the channel id of the channel you want to use as a default channel (see table &#8216;channels&#8217; for the corresponding channel id for a given channelname<\/li>\n<\/ul>\n<p>But this still doesn&#8217;t solve the &#8216;return-to-last-channel&#8217;-issue of authenticated users. Unfortunately, the binary doesn&#8217;t provide an option for changing this. The good news is: Mumble is open source, so you (and I \ud83d\ude09 ) can change the code to let it work as you like!<\/p>\n<p>For information about obtaining the mumble sourcecode, see <a href=\"http:\/\/mumble.sourceforge.net\/Development\">http:\/\/mumble.sourceforge.net\/Development<\/a>. I used the &#8216;1.2.2&#8217; tagged branch. The server saves the information about the last channel in the table &#8216;users&#8217;, field &#8216;lastchannel&#8217;. The corresponding src-file is &#8216;\/src\/murmur\/ServerDB.cpp&#8217;. The function is in line 1333:<\/p>\n<p><code>void Server::setLastChannel(const User *p) {<br \/>\nif (p-&gt;iId &lt; 0)<br \/>\nreturn;<br \/>\nif (p-&gt;cChannel-&gt;bTemporary)<br \/>\nreturn;<br \/>\nTransactionHolder th;<br \/>\nQSqlQuery &amp;query = *th.qsqQuery;<br \/>\nSQLPREP(\"UPDATE `%1users` SET `lastchannel`=? WHERE `server_id` = ? AND `user_id` = ?\");<br \/>\nquery.addBindValue(p-&gt;cChannel-&gt;iId);<br \/>\nquery.addBindValue(iServerNum);<br \/>\nquery.addBindValue(p-&gt;iId);<br \/>\nSQLEXEC();<br \/>\n}<\/code><\/p>\n<p>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&#8217;t forget to comment the next line out. The result should look something like this:<\/p>\n<p><code>void Server::setLastChannel(const User *p) {<br \/>\nif (p-&gt;iId &lt; 0)<br \/>\nreturn;<br \/>\nif (p-&gt;cChannel-&gt;bTemporary)<br \/>\nreturn;<br \/>\nTransactionHolder th;<br \/>\nQSqlQuery &amp;query = *th.qsqQuery;<br \/>\nSQLPREP(\"UPDATE `%1users` SET `lastchannel` = 0 WHERE `server_id` = ? AND `user_id` = ?\");<br \/>\n\/\/ query.addBindValue(p-&gt;cChannel-&gt;iId);<br \/>\nquery.addBindValue(iServerNum);<br \/>\nquery.addBindValue(p-&gt;iId);<br \/>\nSQLEXEC();<br \/>\n}<\/code><\/p>\n<p>For compiling instructions, see <a href=\"http:\/\/mumble.sourceforge.net\/Development\">http:\/\/mumble.sourceforge.net\/Development<\/a>.<\/p>\n<p><strong>Links:<\/strong><\/p>\n<ul>\n<li><a href=\"\/shadnix\/mumble\/ServerDB.cpp.diff\">Diff<\/a> (will set the root-channel as default channel after connect)<\/li>\n<li><a href=\"\/shadnix\/mumble\/murmur-static_x86-1.2.2-with_defaultchannel_root.tar.gz\">Murmur Linux Server (root-channel as default)<\/a> &#8211; based on Murmur v. 1.2.2<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Update (05\/02\/2011): With the release of Mumble v.1.2.3-rc2, the below mentioned method isn&#8217;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 &hellip; <a href=\"https:\/\/www.cosmocanyon.de\/wordpress\/2010\/04\/mumble-murmur-setting-a-default-channel-for-authenticated-users\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Mumble\/Murmur: Setting a default channel for authenticated users (hardcoded solution)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":12,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":907,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/posts\/19\/revisions\/907"}],"wp:attachment":[{"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cosmocanyon.de\/wordpress\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}