From 816679396527097c034c7b292c616c6fe10c63a2 Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 01:57:37 -0500 Subject: [PATCH 1/6] Create CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e865e37 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Change Log + +This project uses [Semantic Versioning](http://semver.org/). + +## 0.1.0-dev -- 2015-12-17 +Initial commit. From 1471a19099d4634c49bb556dd6cc5d1e67d3f843 Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 01:57:46 -0500 Subject: [PATCH 2/6] Updated the TOC. --- GWSonar.toc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GWSonar.toc b/GWSonar.toc index 9ff4420..d7186f3 100644 --- a/GWSonar.toc +++ b/GWSonar.toc @@ -1,8 +1,8 @@ ## Interface: 60200 ## Title: GWSonar -## Notes: A demonstration of the WoW GreenWallAPI. +## Notes: A demonstration of the GreenWall add-on communication API. ## Author: Mark Rogaski -## Version: 0.1.0-dev +## Version: 0.1.0-alpha ## URL: https://github.com/AIE-Guild/GWSonar ## DefaultState: enabled ## X-Category: Guild From 9715dbbfa5dbcc1b1389cf4d1e1c9f46be2b0f18 Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 02:04:32 -0500 Subject: [PATCH 3/6] Cleaned up source formatting. --- GWSonar.lua | 14 ++++++++++++++ GWSonar.toc | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/GWSonar.lua b/GWSonar.lua index d8f974c..8151778 100644 --- a/GWSonar.lua +++ b/GWSonar.lua @@ -109,18 +109,26 @@ end -- @param echo True is the plater receiving the message is the sender -- @param message The message data local function PingHandler(addon, sender, echo, message) + if addon == 'GWSonar' then + local op, guid, serial = strsplit('/', message) if op == 'REQUEST' then + -- Send the response local token = string.format('RESPONSE/%s/%s', guid, serial) GreenWallAPI.SendMessage('GWSonar', token) + elseif op == 'RESPONSE' then + local delta = GetTime() - GWSonar.timestamp table.insert(GWSonar.sample, delta) Write('ping response received from %s, %.3f second(s).', sender, delta) + end + end + end @@ -135,15 +143,21 @@ function GWSonar_OnLoad(self) -- Register slash command handler SLASH_GWSONAR1 = '/gwsonar' function SlashCmdList.GWSONAR(msg, editbox) + if msg == 'ping' then + local token = Ping() Write('ping request sent.') + elseif msg == 'stats' then + local n = #GWSonar.sample local min, max = MinMax(GWSonar.sample) local avg = Mean(GWSonar.sample) Write('%d response(s); min/avg/max = %.3f/%.3f/%.3f', n, min, avg, max) + end + end -- Register for events diff --git a/GWSonar.toc b/GWSonar.toc index d7186f3..4eb27bc 100644 --- a/GWSonar.toc +++ b/GWSonar.toc @@ -6,7 +6,7 @@ ## URL: https://github.com/AIE-Guild/GWSonar ## DefaultState: enabled ## X-Category: Guild -## X-Date: 2015-12-17 +## X-Date: 2015-12-18 GWSonar.lua GWSonar.xml From 0856bcb963ef7626f53375b4c5156b08e404ea4a Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 02:06:00 -0500 Subject: [PATCH 4/6] Added luadoc. --- doc/files/GWSonar.html | 257 ++++++++++++++++++++++++++++++++++++ doc/index.html | 84 ++++++++++++ doc/luadoc.css | 286 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 627 insertions(+) create mode 100644 doc/files/GWSonar.html create mode 100644 doc/index.html create mode 100644 doc/luadoc.css diff --git a/doc/files/GWSonar.html b/doc/files/GWSonar.html new file mode 100644 index 0000000..4150922 --- /dev/null +++ b/doc/files/GWSonar.html @@ -0,0 +1,257 @@ + + + + Reference + + + + + +
+ +
+ +
+
+
+ +
+ + + +
+ +

File GWSonar.lua

+ + + + + + + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Mean (t)Mean value from a table.
MinMax (t)Minimum/maximum values from a table.
Ping ()Send a ping request.
PingHandler (addon, sender, echo, message)Generate and process ping responses.
Write (...)Write a message to the default chat frame.
+ + + + + + +
+
+ + + + +

Functions

+
+ + + +
Mean (t)
+
+Mean value from a table. + + +

Parameters:

+
    + +
  • + t: A table of numeric values. Taken from http://lua-users.org/wiki/SimpleStats . +
  • + +
+ + + + + + + + +
+ + + + +
MinMax (t)
+
+Minimum/maximum values from a table. + + +

Parameters:

+
    + +
  • + t: A table of numeric values. Taken from http://lua-users.org/wiki/SimpleStats . +
  • + +
+ + + + + + + + +
+ + + + +
Ping ()
+
+Send a ping request. + + + + + + + + + +
+ + + + +
PingHandler (addon, sender, echo, message)
+
+Generate and process ping responses. + + +

Parameters:

+
    + +
  • + addon: The sending addon +
  • + +
  • + sender: The sending player +
  • + +
  • + echo: True is the plater receiving the message is the sender +
  • + +
  • + message: The message data +
  • + +
+ + + + + + + + +
+ + + + +
Write (...)
+
+Write a message to the default chat frame. + + +

Parameters:

+
    + +
  • + ...: A list of the string and arguments for substitution using the syntax of string.format. +
  • + +
+ + + + + + + + +
+ + +
+ + + + + + + +
+ +
+ +
+

Valid XHTML 1.0!

+
+ +
+ + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..f413db0 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,84 @@ + + + + Reference + + + + + +
+ +
+ +
+
+
+ +
+ + + +
+ + + + + + + +

Files

+ + + + + + + + +
GWSonar.lua
+ + +
+ +
+ +
+

Valid XHTML 1.0!

+
+ +
+ + diff --git a/doc/luadoc.css b/doc/luadoc.css new file mode 100644 index 0000000..b82606f --- /dev/null +++ b/doc/luadoc.css @@ -0,0 +1,286 @@ +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color:#ffffff; margin:0px; +} + +code { + font-family: "Andale Mono", monospace; +} + +tt { + font-family: "Andale Mono", monospace; +} + +body, td, th { font-size: 11pt; } + +h1, h2, h3, h4 { margin-left: 0em; } + +textarea, pre, tt { font-size:10pt; } +body, td, th { color:#000000; } +small { font-size:0.85em; } +h1 { font-size:1.5em; } +h2 { font-size:1.25em; } +h3 { font-size:1.15em; } +h4 { font-size:1.06em; } + +a:link { font-weight:bold; color: #004080; text-decoration: none; } +a:visited { font-weight:bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration:underline; } +hr { color:#cccccc } +img { border-width: 0px; } + + +h3 { padding-top: 1em; } + +p { margin-left: 1em; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; + margin-left: 0em; +} + +blockquote { margin-left: 3em; } + +pre.example { + background-color: rgb(245, 245, 245); + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: silver; + border-right-color: silver; + border-bottom-color: silver; + border-left-color: silver; + padding: 1em; + margin-left: 1em; + margin-right: 1em; + font-family: "Andale Mono", monospace; + font-size: smaller; +} + + +hr { + margin-left: 0em; + background: #00007f; + border: 0px; + height: 1px; +} + +ul { list-style-type: disc; } + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } +table.index ul { padding-top: 0em; margin-top: 0em; } + +table { + border: 1px solid black; + border-collapse: collapse; + margin-left: auto; + margin-right: auto; +} +th { + border: 1px solid black; + padding: 0.5em; +} +td { + border: 1px solid black; + padding: 0.5em; +} +div.header, div.footer { margin-left: 0em; } + +#container +{ + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product +{ + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#product_logo +{ +} + +#product_name +{ +} + +#product_description +{ +} + +#main +{ + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation +{ + float: left; + width: 18em; + margin: 0; + vertical-align: top; + background-color: #f0f0f0; + overflow:visible; +} + +#navigation h1 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align:left; + margin:0px; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + padding: 0; + margin: 1px; +} + +#navigation li +{ + text-indent: -1em; + margin: 0em 0em 0em 0.5em; + display: block; + padding: 3px 0px 0px 12px; +} + +#navigation li li a +{ + padding: 0px 3px 0px -1em; +} + +#content +{ + margin-left: 18em; + padding: 1em; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about +{ + clear: both; + margin: 0; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight:bold; color: #004080; text-decoration: underline; } + + #main { background-color: #ffffff; border-left: 0px; } + #container { margin-left: 2%; margin-right: 2%; background-color: #ffffff; } + + #content { margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff; } + + #navigation { display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list td +{ + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; } +table.module_list td.summary { width: 100%; } + +table.file_list +{ + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.file_list td +{ + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.file_list td.name { background-color: #f0f0f0; } +table.file_list td.summary { width: 100%; } + + +table.function_list +{ + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td +{ + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; } +table.function_list td.summary { width: 100%; } + + +table.table_list +{ + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.table_list td +{ + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.table_list td.name { background-color: #f0f0f0; } +table.table_list td.summary { width: 100%; } + +dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.function dd {padding-bottom: 1em;} +dl.function h3 {padding-top: 1em; margin: 0; font-size: medium;} + +dl.table dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd {padding-bottom: 1em;} +dl.table h3 {padding: 0; margin: 0; font-size: medium;} + +#TODO: make module_list, file_list, function_list, table_list inherit from a list + From 9656cfcf1bfe16957946f1074b3c3dcf7d7d871a Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 02:07:54 -0500 Subject: [PATCH 5/6] Create .gitattributes --- .gitattributes | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..35b04d5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# Source files +# ============ +*.lua text + +# Luadoc output +# ============= +*.html text +*.css text From 17e0110c19961c4646f05a7cf79aae1eb1fa67b1 Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Fri, 18 Dec 2015 02:19:32 -0500 Subject: [PATCH 6/6] Now blocking our own requests and responses. --- CHANGELOG.md | 6 ++++++ GWSonar.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e865e37..1b068ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,5 +2,11 @@ This project uses [Semantic Versioning](http://semver.org/). +## Unreleased +### Fixed +- Now blocking our own requests and responses. + ## 0.1.0-dev -- 2015-12-17 Initial commit. + +[0.1.0]: https://github.com/AIE-Guild/GWSonar/compare/v0.1.0-dev...v0.1.0 diff --git a/GWSonar.lua b/GWSonar.lua index 8151778..28d4e81 100644 --- a/GWSonar.lua +++ b/GWSonar.lua @@ -110,7 +110,7 @@ end -- @param message The message data local function PingHandler(addon, sender, echo, message) - if addon == 'GWSonar' then + if addon == 'GWSonar' and not echo then local op, guid, serial = strsplit('/', message) if op == 'REQUEST' then