Skip to content

Commit

Permalink
Merge pull request #178 from AIE-Guild/bugfix/172_system_message
Browse files Browse the repository at this point in the history
Bugfix/172 system message
  • Loading branch information
mrogaski committed Mar 28, 2020
2 parents 2bc1340 + 652f51c commit b3e7bfc
Show file tree
Hide file tree
Showing 28 changed files with 619 additions and 116 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ install:
script:
- lua -lluacov tests/TestUtility.lua -v
- lua -lluacov tests/TestSettings.lua -v
- lua -lluacov tests/TestSystemEventHandler.lua -v

after_success:
- luacov-coveralls
Expand Down
2 changes: 1 addition & 1 deletion API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

This project uses [Semantic Versioning](http://semver.org/).

## [1.11.0] -- Unreleased
### Fixed
- Updated debug message call stack parsing for 8.3.

### Changed
- Updated the TOC for WoW 8.3.0.
- Refactored CHAT_MSG_SYSTEM handling to use an abstract factory and added
full unit testing for the polymorphic classes.

## [1.10.1] -- 2019-09-24
### Updated
- Updated the TOC for WoW 8.2.5.
Expand Down Expand Up @@ -623,6 +632,7 @@ flapping roster announcements for characters in peer co-guilds.
## 0.9.00 -- 2010-11-01
Initial commit.

[1.11.0]: https://github.com/AIE-Guild/GreenWall/compare/v1.10.1...v1.11.0
[1.10.1]: https://github.com/AIE-Guild/GreenWall/compare/v1.10.0...v1.10.1
[1.10.0]: https://github.com/AIE-Guild/GreenWall/compare/v1.9.15...v1.10.0
[1.9.15]: https://github.com/AIE-Guild/GreenWall/compare/v1.9.14...v1.9.15
Expand Down
2 changes: 1 addition & 1 deletion Channel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
93 changes: 3 additions & 90 deletions GreenWall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -407,96 +407,9 @@ function GreenWall_OnEvent(self, event, ...)
elseif event == 'CHAT_MSG_SYSTEM' then

local message = select(1, ...)

gw.Debug(GW_LOG_DEBUG, 'event=%s, message=%q', event, message)

local pat_online = ERR_FRIEND_ONLINE_SS:format('(.+)', '(.+)'):gsub('([%[%]])', '%%%1')
local pat_offline = ERR_FRIEND_OFFLINE_S:format('(.+)')
local pat_join = ERR_GUILD_JOIN_S:format('(.+)')
local pat_leave = ERR_GUILD_LEAVE_S:format('(.+)')
local pat_quit = ERR_GUILD_QUIT_S:format(gw.player)
local pat_removed = ERR_GUILD_REMOVE_SS:format('(.+)', '(.+)')
local pat_kick = ERR_GUILD_REMOVE_SS:format('(.+)', '(.+)')
local pat_promote = ERR_GUILD_PROMOTE_SSS:format('(.+)', '(.+)', '(.+)')
local pat_demote = ERR_GUILD_DEMOTE_SSS:format('(.+)', '(.+)', '(.+)')

if message:match(pat_online) then

local _, player = message:match(pat_online)
player = gw.GlobalName(player)
gw.config.comember_cache:hold(player)
gw.Debug(GW_LOG_DEBUG, 'comember_cache: updated %s', player)

elseif message:match(pat_offline) then

local player = message:match(pat_offline)
player = gw.GlobalName(player)
gw.config.comember_cache:hold(player)
gw.Debug(GW_LOG_DEBUG, 'comember_cache: updated %s', player)

elseif message:match(pat_join) then

local player = message:match(pat_join)
if gw.GlobalName(player) == gw.player then
-- We have joined the guild.
gw.Debug(GW_LOG_NOTICE, 'guild join detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'join')
end

elseif message:match(pat_leave) then

local player = message:match(pat_leave)
if gw.GlobalName(player) == gw.player then
-- We have left the guild.
gw.Debug(GW_LOG_NOTICE, 'guild quit detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_quit) then

local player = message:match(pat_quit)
if gw.GlobalName(player) == gw.player then
-- We have left the guild.
gw.Debug(GW_LOG_NOTICE, 'guild quit detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_removed) then

local player = message:match(pat_removed)
if gw.GlobalName(player) == gw.player then
-- We have been kicked from the guild.
gw.Debug(GW_LOG_NOTICE, 'guild kick detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_kick) then

local target, player = message:match(pat_kick)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you kicked %s', target)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'remove', target)
end

elseif message:match(pat_promote) then

local player, target, rank = message:match(pat_promote)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you promoted %s to %s', target, rank)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'promote', target, rank)
end

elseif message:match(pat_demote) then

local player, target, rank = message:match(pat_demote)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you demoted %s to %s', target, rank)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'demote', target, rank)
end
end
handler = GwSystemEventHandler:factory(gw.config, message)
handler:run()

elseif event == 'GUILD_ROSTER_UPDATE' then

Expand Down
1 change: 1 addition & 0 deletions GreenWall.toc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Config.lua
Compat.lua
Chat.lua
Channel.lua
SystemEventHandler.lua
API.lua
Interface.lua
GreenWall.lua
Expand Down
2 changes: 1 addition & 1 deletion GreenWall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion HoldDown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Interface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License (MIT)

Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Lib/Base64BCA.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Lib/CRC16-CCITT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Lib/SemanticVersion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ issue tracker, please e-mail the details and I will add an issue record.
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit b3e7bfc

Please sign in to comment.