If we can't determine rank for any reason just put a question mark

simenon [06-28-14 - 23:02]
If we can't determine rank for any reason just put a question mark
Only load once, unreg events else stuff messes up
Filename
GuildChat.lua
GuildChat.txt
Libs/libGuildInfo/LibGuildInfo.lua
diff --git a/GuildChat.lua b/GuildChat.lua
index 5cc01d6..10515ae 100644
--- a/GuildChat.lua
+++ b/GuildChat.lua
@@ -25,8 +25,8 @@ end


 function GuildChat:GetName(channelId, fromName, text)
-	local channelInfo = ChannelInfo[channelId]
-	if channelInfo.format ~= 1723 then return ZO_LinkHandler_CreatePlayerLink(fromName) end
+	local channelInfo = ChannelInfo[channelId]
+	if channelInfo.format ~= 1723 then return fromName end

 	--if GuildChat:GetLevel(fromName) == 0 then return ZO_LinkHandler_CreatePlayerLink(fromName) end

@@ -44,6 +44,7 @@ end

 function GuildChat:Register()
 	LC:registerName(function(...) return GuildChat:GetName(...) end)
+	EVENT_MANAGER:UnregisterForEvent( "GuildChatLoaded", EVENT_PLAYER_ACTIVATED )
 end

 function GuildChat:Loaded(...)
@@ -66,6 +67,8 @@ function GuildChat:Loaded(...)
 	LAM:AddCheckbox(panel, "showGuildRank", "Show Guild Rank", "Include a rank indicator",
 						function() return GuildChat.settings.guildRank end,
 						function(value) GuildChat.settings.guildRank = not GuildChat.settings.guildRank end)
+
+	EVENT_MANAGER:UnregisterForEvent( "GuildChatLoaded", EVENT_ADD_ON_LOADED )
 end

 EVENT_MANAGER:RegisterForEvent("GuildChatLoaded", EVENT_ADD_ON_LOADED, function(...) GuildChat:Loaded(...) end)
diff --git a/GuildChat.txt b/GuildChat.txt
index 4067cd0..3aa1eec 100644
--- a/GuildChat.txt
+++ b/GuildChat.txt
@@ -1,6 +1,6 @@
 ## Title: |cFFFFB0Guild Chat|r by |c00C000CrazyDutchGuy & Wobin|r
 ## Author: CrazyDutchGuy & Wobin
-## Version: v4.1
+## Version: v4.2
 ## APIVersion: 100007
 ## SavedVariables: GuildChat_Settings

diff --git a/Libs/libGuildInfo/LibGuildInfo.lua b/Libs/libGuildInfo/LibGuildInfo.lua
index 769bfd2..6192178 100644
--- a/Libs/libGuildInfo/LibGuildInfo.lua
+++ b/Libs/libGuildInfo/LibGuildInfo.lua
@@ -45,7 +45,9 @@ end

 function LibGuildInfo:GetGuildRankByMemberName(name)
 	local rankIndex = self:GetGuildRankIndexByMemberName(name)
-	if rankIndex == 1 then
+	if not rankIndex then
+		return "??"
+	elseif rankIndex == 1 then
 		return "GL"
 	else
 		return "R"..rankIndex