Quantcast

Improved event handling: Guild addon comm will only refresh if number of online guild members have changed.

F16Gaming (Laptop) [05-10-12 - 10:57]
Improved event handling: Guild addon comm will only refresh if number of online guild members have changed.
Filename
Events.lua
diff --git a/Events.lua b/Events.lua
index 51e2ac0..000ea51 100644
--- a/Events.lua
+++ b/Events.lua
@@ -1,18 +1,18 @@
 --[[
 	* Copyright (c) 2011-2012 by Adam Hellberg.
-	*
+	*
 	* This file is part of Command.
-	*
+	*
 	* Command is free software: you can redistribute it and/or modify
 	* it under the terms of the GNU General Public License as published by
 	* the Free Software Foundation, either version 3 of the License, or
 	* (at your option) any later version.
-	*
+	*
 	* Command is distributed in the hope that it will be useful,
 	* but WITHOUT ANY WARRANTY; without even the implied warranty of
 	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 	* GNU General Public License for more details.
-	*
+	*
 	* You should have received a copy of the GNU General Public License
 	* along with Command. If not, see <http://www.gnu.org/licenses/>.
 --]]
@@ -113,7 +113,12 @@ function C.Events.PARTY_LEADER_CHANGED(self, ...)
 	AC:UpdateGroup()
 end

+local numGuildMembers = 0
 function C.Events.GUILD_ROSTER_UPDATE(self, ...)
 	if AC.GuildRunning then return end
-	AC:UpdateGuild()
+	local _, tmpGuildMembers = GetNumGuildMembers()
+	if numGuildMembers ~= tmpGuildMembers then
+		numGuildMembers = tmpGuildMembers
+		AC:UpdateGuild()
+	end
 end