summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMataes <mataes2007@gmail.com>2020-04-04 15:30:13 +0300
committerMataes <mataes2007@gmail.com>2020-04-04 15:30:38 +0300
commit5fc4e483a326e60c4410049c3e667edaa5650757 (patch)
tree4aa93a06999cf47fdd498c09c1af1adf2454931d
parent35f3a41206cc576853943620d7d9a7efe593fed5 (diff)
newstory: added support of jabber subscription
-rw-r--r--plugins/NewStory/src/history.h1
-rw-r--r--plugins/NewStory/src/history_array.cpp4
-rw-r--r--plugins/NewStory/src/history_control.cpp17
-rw-r--r--plugins/NewStory/src/templates.cpp12
-rw-r--r--plugins/NewStory/src/templates.h2
5 files changed, 36 insertions, 0 deletions
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h
index c6f018c476..8ad124c46d 100644
--- a/plugins/NewStory/src/history.h
+++ b/plugins/NewStory/src/history.h
@@ -2,6 +2,7 @@
#define __history_h__
#define EVENTTYPE_STATUSCHANGE 25368
+#define EVENTTYPE_JABBER_PRESENCE 2001
enum
{
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index f4138a68a7..e7f6e9bddd 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -36,6 +36,10 @@ bool HistoryArray::ItemData::load(EventLoadMode mode)
}
break;
+ case EVENTTYPE_JABBER_PRESENCE:
+ wtext = DbEvent_GetTextW(&dbe, CP_ACP);
+ break;
+
case EVENTTYPE_AUTHREQUEST:
atext = new char[512];
atext_del = true;
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 3e67d98fd9..d7fb75cc37 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -704,6 +704,12 @@ static void BeginEditItem(HWND hwnd, NewstoryListData *data, int index)
colorid = COLOR_INOTHER;
break;
+ case EVENTTYPE_JABBER_PRESENCE:
+ tpl = TPL_COPY_PRESENCE;
+ fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
+ colorid = !(item->dbe.flags & DBEF_SENT) ? COLOR_INOTHER : COLOR_OUTOTHER;
+ break;
+
default:
tpl = TPL_COPY_OTHER;
fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
@@ -770,6 +776,11 @@ static int LayoutItem(HWND hwnd, HistoryArray *items, int index)
fontid = FONT_INOTHER;
break;
+ case EVENTTYPE_JABBER_PRESENCE:
+ tpl = TPL_PRESENCE;
+ fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
+ break;
+
default:
tpl = TPL_OTHER;
fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
@@ -831,6 +842,12 @@ static int PaintItem(HDC hdc, HistoryArray *items, int index, int top, int width
colorid = COLOR_INOTHER;
break;
+ case EVENTTYPE_JABBER_PRESENCE:
+ tpl = TPL_PRESENCE;
+ fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
+ colorid = !(item->dbe.flags & DBEF_SENT) ? COLOR_INOTHER : COLOR_OUTOTHER;
+ break;
+
default:
tpl = TPL_OTHER;
fontid = !(item->dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER;
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp
index 414d5e487d..e76d679fea 100644
--- a/plugins/NewStory/src/templates.cpp
+++ b/plugins/NewStory/src/templates.cpp
@@ -269,6 +269,12 @@ void vfAdded(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
vars->SetVar('M', item->getTBuf(), false);
}
+void vfPresence(int, TemplateVars* vars, MCONTACT, HistoryArray::ItemData* item)
+{
+ // %M: the message string itself
+ TplSetVar(vars, 'M', item->getTBuf(), false);
+}
+
void vfDeleted(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
{
// %M: the message string itself
@@ -298,6 +304,9 @@ TemplateInfo templates[TPL_COUNT] =
{ "tpl/msglog/status", L"Message Log", ICO_SIGNIN, L"Status Changes",
L"%I%i[b]%N, %t:[/b]%n%M", 0, 0,
{ vfGlobal, vfContact, vfEvent, vfSign, 0 } },
+ { "tpl/msglog/presense", L"Message Log", ICO_UNKNOWN, L"'Presence Requests",
+ L"%I%i[b]%N, %t:[/b]%n%M", 0, 0,
+ { vfGlobal, vfContact, vfEvent, vfPresence, 0 } },
{ "tpl/msglog/other", L"Message Log", ICO_UNKNOWN, L"Other Events",
L"%I%i[b]%N, %t:[/b]%n%M", 0, 0,
{ vfGlobal, vfContact, vfEvent, vfOther, 0 } },
@@ -324,6 +333,9 @@ TemplateInfo templates[TPL_COUNT] =
{ "tpl/copy/status", L"Clipboard", ICO_SIGNIN, L"Status Changes",
L"%N, %t:\x0d\x0a%M%n", 0, 0,
{ vfGlobal, vfContact, vfEvent, vfSign, 0 } },
+ { "tpl/copy/presence", L"Clipboard", ICO_UNKNOWN, L"Presence Requests",
+ L"%N, %t:\x0d\x0a%M%n", 0, 0,
+ { vfGlobal, vfContact, vfEvent, vfPresence, 0 } },
{ "tpl/copy/other", L"Clipboard", ICO_UNKNOWN, L"Other Events",
L"%N, %t:\x0d\x0a%M%n", 0, 0,
{ vfGlobal, vfContact, vfEvent, vfOther, 0 } },
diff --git a/plugins/NewStory/src/templates.h b/plugins/NewStory/src/templates.h
index 89b5d2a431..c8e23f2225 100644
--- a/plugins/NewStory/src/templates.h
+++ b/plugins/NewStory/src/templates.h
@@ -52,6 +52,7 @@ enum
TPL_AUTH,
TPL_ADDED,
TPL_DELETED,
+ TPL_PRESENCE,
TPL_COPY_MESSAGE,
TPL_COPY_FILE,
@@ -62,6 +63,7 @@ enum
TPL_COPY_AUTH,
TPL_COPY_ADDED,
TPL_COPY_DELETED,
+ TPL_COPY_PRESENCE,
TPL_COUNT
};