summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat/clist.cpp12
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp13
-rw-r--r--plugins/Scriver/src/msglog.cpp2
-rw-r--r--plugins/Scriver/src/msgs.cpp32
-rw-r--r--plugins/Scriver/src/msgwindow.cpp2
-rw-r--r--plugins/Scriver/src/sendqueue.cpp2
7 files changed, 29 insertions, 36 deletions
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp
index 34205bfb4a..836277f933 100644
--- a/plugins/Scriver/src/chat/clist.cpp
+++ b/plugins/Scriver/src/chat/clist.cpp
@@ -91,7 +91,7 @@ END_GROUPLOOP:
BOOL CList_SetOffline(HANDLE hContact, BOOL bHide)
{
if ( hContact ) {
- char * szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char * szProto = GetContactProto(hContact);
DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
@@ -104,7 +104,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule)
{
HANDLE hContact = db_find_first();
while ( hContact ) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if ( MM_FindModule( szProto )) {
if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) {
int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0);
@@ -128,7 +128,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam)
if (!hContact)
return 0;
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ szProto = GetContactProto(hContact);
if ( MM_FindModule(szProto)) {
if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
@@ -170,7 +170,7 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
if ( hContact ) {
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
if ( szProto ) {
if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE )
CallProtoService( szProto, PS_JOINCHAT, wParam, lParam );
@@ -185,7 +185,7 @@ INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
if ( hContact ) {
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
if ( szProto )
CallProtoService( szProto, PS_LEAVECHAT, wParam, lParam );
}
@@ -196,7 +196,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
if ( hContact ) {
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
CLISTMENUITEM clmi = {0};
clmi.cbSize = sizeof(CLISTMENUITEM);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 113cf79437..1c71dbb959 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -475,7 +475,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam) {
dbei.flags = DBEF_SENT | (( item->flags & PREF_RTL) ? DBEF_RTL : 0 );
if ( item->flags & PREF_UTF )
dbei.flags |= DBEF_UTF;
- dbei.szModule = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) item->hContact, 0);
+ dbei.szModule = GetContactProto(item->hContact);
dbei.timestamp = time(NULL);
dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
if ( !( item->flags & PREF_UTF ))
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index b4a27aa27d..757f74aaa5 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -164,7 +164,7 @@ void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) {
static BOOL IsUtfSendAvailable(HANDLE hContact)
{
- char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
if ( szProto == NULL )
return FALSE;
@@ -264,11 +264,10 @@ void SetStatusIcon(struct SrmmWindowData *dat) {
if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 &&
DBGetContactSettingByte(NULL,"CLC","Meta",0) == 0) {
hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0);
- if (hContact != NULL) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- } else {
+ if (hContact != NULL)
+ szProto = GetContactProto(hContact);
+ else
hContact = dat->windowData.hContact;
- }
}
Skin_ReleaseIcon(dat->statusIcon);
@@ -767,7 +766,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->hwndParent = GetParent(hwndDlg);
dat->parent = (ParentWindowData *) GetWindowLongPtr(dat->hwndParent, GWLP_USERDATA);
dat->windowData.hwndLog = NULL;
- dat->szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) dat->windowData.hContact, 0);
+ dat->szProto = GetContactProto(dat->windowData.hContact);
dat->avatarPic = 0;
if (dat->windowData.hContact && dat->szProto != NULL)
dat->wStatus = DBGetContactSettingWord(dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
@@ -1889,7 +1888,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts")==0) {
HANDLE hContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0);
if (hContact!=NULL) {
- smaddInfo.Protocolname = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ smaddInfo.Protocolname = GetContactProto(hContact);
}
}
GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYS), &rc);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index bb768cbb95..6c610bd0cd 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -1087,7 +1087,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts")==0) {
HANDLE hContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0);
if (hContact!=NULL) {
- smre.Protocolname = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ smre.Protocolname = GetContactProto(hContact);
}
}
if (fi.chrg.cpMin > 0) {
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 7708b6c1c0..1a9450776e 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -63,12 +63,11 @@ static int SRMMStatusToPf2(int status)
int IsAutoPopup(HANDLE hContact) {
if (g_dat->flags & SMF_AUTOPOPUP) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if (strcmp(szProto, "MetaContacts") == 0 ) {
hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact, 0);
- if (hContact != NULL) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- }
+ if (hContact != NULL)
+ szProto = GetContactProto(hContact);
}
if (szProto && (g_dat->openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) {
return 1;
@@ -150,18 +149,13 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam)
HWND hwnd;
NewMessageWindowLParam newData = { 0 };
- {
- /* does the HCONTACT's protocol support IM messages? */
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (szProto) {
- if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
- return 1;
- }
- else {
- /* unknown contact */
- return 1;
- } //if
- }
+ /* does the HCONTACT's protocol support IM messages? */
+ char *szProto = GetContactProto((HANDLE)wParam);
+ if (szProto == NULL)
+ return 1; /* unknown contact */
+
+ if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
+ return 1;
if ((hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam))) {
if (lParam) {
@@ -194,7 +188,7 @@ static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam)
NewMessageWindowLParam newData = { 0 };
{
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
//logInfo("Show message window for: %s (%s)", CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, 0), szProto);
if (szProto) {
/* does the HCONTACT's protocol support IM messages? */
@@ -284,7 +278,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam)
static int MessageSettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto)))
return 0;
WindowList_Broadcast(g_dat->hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam);
@@ -385,7 +379,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
if ( hContact ) {
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
CLISTMENUITEM clmi = {0};
clmi.cbSize = sizeof(CLISTMENUITEM);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp
index 6e306db168..4003851adf 100644
--- a/plugins/Scriver/src/msgwindow.cpp
+++ b/plugins/Scriver/src/msgwindow.cpp
@@ -353,7 +353,7 @@ static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact)
MessageWindowTabData *mwtd = (MessageWindowTabData *) mir_alloc(sizeof(MessageWindowTabData));
mwtd->hwnd = hwnd;
mwtd->hContact = hContact;
- mwtd->szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ mwtd->szProto = GetContactProto(hContact);
mwtd->parent = dat;
dat->childrenCount++;
tci.mask = TCIF_PARAM | TCIF_IMAGE | TCIF_TEXT;
diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp
index 1a85d67d4f..fe02397c6e 100644
--- a/plugins/Scriver/src/sendqueue.cpp
+++ b/plugins/Scriver/src/sendqueue.cpp
@@ -28,7 +28,7 @@ static char *MsgServiceName(HANDLE hContact)
{
char szServiceName[100];
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return PSS_MESSAGE;