Skip to content

Commit 1fbf757

Browse files
committed
Added OnPluginPacketDebug callback for processing packet debugging
1 parent acbaceb commit 1fbf757

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

doc.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5691,17 +5691,21 @@ COleDateTime tNow = COleDateTime::GetCurrentTime();
56915691
CString strTitle = "Packet debug - ";
56925692
strTitle += m_mush_name;
56935693

5694-
AppendToTheNotepad (strTitle,
5695-
TFormat ("%s%s packet: %I64d (%i bytes) at %s%s%s",
5696-
ENDLINE,
5697-
sCaption,
5698-
iNumber,
5699-
size,
5700-
(LPCTSTR) strTime,
5701-
ENDLINE,
5702-
ENDLINE),
5703-
false, // append
5704-
eNotepadPacketDebug);
5694+
5695+
CString strMsg = TFormat ("%s%s packet: %I64d (%i bytes) at %s%s%s",
5696+
ENDLINE,
5697+
sCaption,
5698+
iNumber,
5699+
size,
5700+
(LPCTSTR) strTime,
5701+
ENDLINE,
5702+
ENDLINE);
5703+
5704+
if (!SendToFirstPluginCallbacks (ON_PLUGIN_PACKET_DEBUG, strMsg))
5705+
AppendToTheNotepad (strTitle,
5706+
strMsg,
5707+
false, // append
5708+
eNotepadPacketDebug);
57055709

57065710
// keep going until we have displayed it all
57075711
while (size > 0)
@@ -5725,14 +5729,17 @@ COleDateTime tNow = COleDateTime::GetCurrentTime();
57255729
*pa = 0;
57265730
*ph = 0;
57275731

5728-
AppendToTheNotepad (strTitle,
5729-
CFormat ("%-*s %s%s",
5732+
strMsg = CFormat ("%-*s %s%s",
57305733
MAX_DEBUG_CHARS,
57315734
asciibuf,
57325735
hexbuf,
5733-
ENDLINE),
5734-
false, // append
5735-
eNotepadPacketDebug);
5736+
ENDLINE);
5737+
5738+
if (!SendToFirstPluginCallbacks (ON_PLUGIN_PACKET_DEBUG, strMsg))
5739+
AppendToTheNotepad (strTitle,
5740+
strMsg,
5741+
false, // append
5742+
eNotepadPacketDebug);
57365743
}
57375744

57385745
} // end of CMUSHclientDoc::Debug_Packets

plugins.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const string ON_PLUGIN_LOSEFOCUS ("OnPluginLoseFocus");
4040

4141
// capture stuff
4242
const string ON_PLUGIN_TRACE ("OnPluginTrace");
43+
const string ON_PLUGIN_PACKET_DEBUG ("OnPluginPacketDebug");
4344
const string ON_PLUGIN_BROADCAST ("OnPluginBroadcast");
4445
const string ON_PLUGIN_SCREENDRAW ("OnPluginScreendraw");
4546
const string ON_PLUGIN_SELECTION_CHANGED ("OnPluginSelectionChanged");
@@ -143,7 +144,8 @@ string PluginCallbacksNames [] = {
143144
ON_PLUGIN_TELNET_SUBNEGOTIATION,
144145

145146
ON_PLUGIN_TICK,
146-
ON_PLUGIN_TRACE,
147+
ON_PLUGIN_TRACE,
148+
ON_PLUGIN_PACKET_DEBUG,
147149
ON_PLUGIN_WORLD_OUTPUT_RESIZED,
148150
ON_PLUGIN_WORLD_SAVE,
149151

plugins.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ extern const string ON_PLUGIN_LOSEFOCUS; // "OnPluginLoseFocus"
188188

189189
// capture stuff
190190
extern const string ON_PLUGIN_TRACE; // "OnPluginTrace"
191+
extern const string ON_PLUGIN_PACKET_DEBUG; // "OnPluginPacketDebug"
191192
extern const string ON_PLUGIN_BROADCAST; // "OnPluginBroadcast"
192193
extern const string ON_PLUGIN_SCREENDRAW; // "OnPluginScreendraw"
193194
extern const string ON_PLUGIN_SELECTION_CHANGED; // "OnPluginSelectionChanged"

0 commit comments

Comments
 (0)