* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */
Info
Revision:3293
Author:victor
Date:2008-06-04 10:23:18 +0300 (Wed, 04 Jun 2008)
Comment:Scripts now can be used to form event's message (via %[..] macro)
Changes
U trunk/ChangeLog
U trunk/TODO
U trunk/include/unicode.h
U trunk/src/console/nxuilib/Makefile.am
A trunk/src/console/nxuilib/nxuilibw.def
U trunk/src/libnetxms/message.cpp
U trunk/src/server/core/dcithreshold.cpp
U trunk/src/server/core/events.cpp
U trunk/src/server/core/session.cpp
Diff
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/ChangeLog 2008-06-04 07:23:18 UTC (rev 3293)
@@ -2,6 +2,7 @@
* 0.2.22
*
+- Scripts now can be used to form event's message (via %[..] macro)
- Implemented XML encoding for NXCP messages
- Fixed issues: #201
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/TODO 2008-06-04 07:23:18 UTC (rev 3293)
@@ -5,7 +5,6 @@
GENERAL:
- Table DCI
-- Access to current node properties in NXSL scripts
- Finish Linux subagent
- Finish FreeBSD subagent
- Finish Solaris subagent
Modified: trunk/include/unicode.h
===================================================================
--- trunk/include/unicode.h 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/include/unicode.h 2008-06-04 07:23:18 UTC (rev 3293)
@@ -48,11 +48,11 @@
#include <tchar.h>
-#ifdef UNICODE
-
// Windows always use UCS-2
#define UNICODE_UCS2 1
+#ifdef UNICODE
+
#define _tcstoll wcstoll
#define _tcstoull wcstoull
@@ -264,11 +264,9 @@
// Check that either UNICODE_UCS2 or UNICODE_UCS4 are defined
-#ifdef UNICODE
#if !defined(UNICODE_UCS2) && !defined(UNICODE_UCS4)
#error Neither UNICODE_UCS2 nor UNICODE_UCS4 are defined
#endif
-#endif
#endif /* _unicode_h_ */
Modified: trunk/src/console/nxuilib/Makefile.am
===================================================================
--- trunk/src/console/nxuilib/Makefile.am 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/src/console/nxuilib/Makefile.am 2008-06-04 07:23:18 UTC (rev 3293)
@@ -20,7 +20,7 @@
MemDC.h \
nxuilib.clw \
nxuilib.cpp \
- nxuilib.def \
+ nxuilib.def nxuilibw.def \
nxuilib.dsp nxuilib.dsw \
nxuilib.h \
nxuilib.rc resource.h \
Added: trunk/src/console/nxuilib/nxuilibw.def
===================================================================
--- trunk/src/console/nxuilib/nxuilibw.def (rev 0)
+++ trunk/src/console/nxuilib/nxuilibw.def 2008-06-04 07:23:18 UTC (rev 3293)
@@ -0,0 +1,7 @@
+; nxuilibw.def : Declares the module parameters for the DLL.
+
+LIBRARY "nxuilibw"
+DESCRIPTION 'NetXMS Windows UI Dynamic Link Library (UNICODE)'
+
+EXPORTS
+ ; Explicit exports can go here
Modified: trunk/src/libnetxms/message.cpp
===================================================================
--- trunk/src/libnetxms/message.cpp 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/src/libnetxms/message.cpp 2008-06-04 07:23:18 UTC (rev 3293)
@@ -860,7 +860,9 @@
char *out, *bdata;
size_t blen;
TCHAR *tempStr;
+#if !defined(UNICODE) || defined(UNICODE_UCS4)
int bytes;
+#endif
static const TCHAR *dtString[] = { _T("int32"), _T("string"), _T("int64"), _T("int16"), _T("binary"), _T("float") };
xml.AddFormattedString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<nxcp version=\"%d\">\r\n <message code=\"%d\" id=\"%d\">\r\n"), m_nVersion, m_wCode, m_dwId);
Modified: trunk/src/server/core/dcithreshold.cpp
===================================================================
--- trunk/src/server/core/dcithreshold.cpp 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/src/server/core/dcithreshold.cpp 2008-06-04 07:23:18 UTC (rev 3293)
@@ -472,7 +472,7 @@
void Threshold::UpdateFromMessage(DCI_THRESHOLD *pData)
{
-#ifndef UNICODE_UCS2
+#if !defined(UNICODE) || defined(UNICODE_UCS4)
TCHAR szBuffer[MAX_DCI_STRING_VALUE];
#endif
@@ -509,7 +509,7 @@
#else
m_value = pData->value.szString;
#endif
-#else
+#else /* UNICODE */
ucs2_to_mb(pData->value.szString, -1, szBuffer, MAX_DCI_STRING_VALUE);
m_value = szBuffer;
#endif
Modified: trunk/src/server/core/events.cpp
===================================================================
--- trunk/src/server/core/events.cpp 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/src/server/core/events.cpp 2008-06-04 07:23:18 UTC (rev 3293)
@@ -181,7 +181,8 @@
DWORD dwPos, dwSize, dwParam;
NetObj *pObject;
struct tm *lt;
- char *pText, szBuffer[4];
+ char *pText, szBuffer[4], scriptName[256];
+ int i;
pObject = FindObjectById(m_dwSource);
if (pObject == NULL) // Normally shouldn't happen
@@ -328,6 +329,57 @@
dwPos += (DWORD)_tcslen(m_ppszParameters[dwParam]);
}
break;
+ case '[': // Script
+ for(i = 0, pCurr++; (*pCurr != ']') && (*pCurr != 0) && (i < 255); pCurr++)
+ {
+ scriptName[i++] = *pCurr;
+ }
+ if (*pCurr == 0) // no terminating ]
+ {
+ pCurr--;
+ }
+ else
+ {
+ NXSL_Program *script;
+ NXSL_Environment *pEnv;
+
+ scriptName[i] = 0;
+ StrStrip(scriptName);
+
+ g_pScriptLibrary->Lock();
+ script = g_pScriptLibrary->FindScript(scriptName);
+ if (script != NULL)
+ {
+ pEnv = new NXSL_Environment;
+ pEnv->SetLibrary(g_pScriptLibrary);
+// if (m_pNode != NULL)
+// script->SetGlobalVariable(_T("$node"), new NXSL_Value(new NXSL_Object(&m_nxslNodeClass, m_pNode)));
+
+ if (script->Run(pEnv) == 0)
+ {
+ TCHAR *temp = script->GetResult()->GetValueAsCString();
+ dwSize += (DWORD)_tcslen(temp);
+ pText = (char *)realloc(pText, dwSize);
+ _tcscpy(&pText[dwPos], temp);
+ dwPos += (DWORD)_tcslen(temp);
+ DbgPrintf(4, "Event::ExpandText(%d, \"%s\"): Script %s executed successfully",
+ m_dwCode, pszTemplate, scriptName);
+ }
+ else
+ {
+ DbgPrintf(4, "Event::ExpandText(%d, \"%s\"): Script %s execution error: %s",
+ m_dwCode, pszTemplate, scriptName, script->GetErrorText());
+ PostEvent(EVENT_SCRIPT_ERROR, g_dwMgmtNode, _T("ssd"), scriptName,
+ script->GetErrorText(), 0);
+ }
+ }
+ else
+ {
+ DbgPrintf(4, "Event::ExpandText(%d, \"%s\"): Cannot find script %s", m_dwCode, pszTemplate, scriptName);
+ }
+ g_pScriptLibrary->Unlock();
+ }
+ break;
default: // All other characters are invalid, ignore
break;
}
Modified: trunk/src/server/core/session.cpp
===================================================================
--- trunk/src/server/core/session.cpp 2008-06-02 13:09:03 UTC (rev 3292)
+++ trunk/src/server/core/session.cpp 2008-06-04 07:23:18 UTC (rev 3293)
@@ -2990,7 +2990,7 @@
NetObj *pObject;
BOOL bSuccess = FALSE;
static DWORD m_dwRowSize[] = { 8, 8, 12, 12, 260, 12 };
-#ifndef UNICODE_UCS2
+#if !defined(UNICODE) || defined(UNICODE_UCS4)
TCHAR szBuffer[MAX_DCI_STRING_VALUE];
#endif
Received on Wed Jun 04 2008 - 10:23:21 EEST
This archive was generated by hypermail 2.2.0 : Wed Jun 04 2008 - 10:20:57 EEST