summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp17
-rw-r--r--plugins/NotesAndReminders/src/miscutils.cpp36
-rw-r--r--plugins/NotesAndReminders/src/miscutils.h6
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp10
-rw-r--r--plugins/NotesAndReminders/src/options.cpp44
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp12
-rw-r--r--plugins/YARelay/src/main.cpp2
7 files changed, 40 insertions, 87 deletions
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 797a458851..b1d8f294ac 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -849,7 +849,7 @@ static unsigned __stdcall checkthread(void *dummy)
cur=conn;
while(cur!=NULL)
{
- if (searchConnection(first,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state)==NULL && settingStatusMask&1<<cur->state-1)
+ if (searchConnection(first,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state)==NULL && (settingStatusMask & (1 << (cur->state-1))))
{
@@ -1044,16 +1044,11 @@ extern "C" int __declspec(dllexport) Load(void)
pd.type=PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
//set all contacts to offline
- {
- HANDLE hContact;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hContact!=NULL) {
- if(!lstrcmpA(PLUGINNAME,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0))) {
- db_set_w(hContact,PLUGINNAME,"status",ID_STATUS_OFFLINE);
- }
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
- }
- }
+
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ if(!lstrcmpA(PLUGINNAME,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0)))
+ db_set_w(hContact,PLUGINNAME,"status",ID_STATUS_OFFLINE);
+
mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETCAPS);
CreateServiceFunction(service, (MIRANDASERVICE)GetCaps);
mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETNAME);
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp
index 1ea10305c9..8ce1ca8655 100644
--- a/plugins/NotesAndReminders/src/miscutils.cpp
+++ b/plugins/NotesAndReminders/src/miscutils.cpp
@@ -23,42 +23,6 @@ WORD ConvertControlToHotKey(WORD HK)
return R;
}
-void WriteSettingInt(HANDLE hContact,char *ModuleName,char *SettingName,int Value)
-{
- DBCONTACTWRITESETTING cws = {0};
- DBVARIANT dbv = {0};
- dbv.type = DBVT_DWORD;
- dbv.dVal = Value;
- cws.szModule = ModuleName;
- cws.szSetting = SettingName;
- cws.value = dbv;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (DWORD)&cws);
-}
-
-int ReadSettingInt(HANDLE hContact,char *ModuleName,char *SettingName,int Default)
-{
- DBCONTACTGETSETTING cws = {0};
- DBVARIANT dbv = {0};
- dbv.type = DBVT_DWORD;
- dbv.dVal = Default;
- cws.szModule = ModuleName;
- cws.szSetting = SettingName;
- cws.pValue = &dbv;
- if (CallService(MS_DB_CONTACT_GETSETTING,(DWORD)hContact,(DWORD)&cws))
- return Default;
- else
- return dbv.dVal;
-}
-
-void DeleteSetting(HANDLE hContact,char *ModuleName,char *SettingName)
-{
- DBCONTACTGETSETTING dbcgs = {0};
- dbcgs.szModule = ModuleName;
- dbcgs.szSetting = SettingName;
- dbcgs.pValue = NULL;
- CallService(MS_DB_CONTACT_DELETESETTING,(DWORD)hContact,(DWORD)&dbcgs);
-}
-
void FreeSettingBlob(WORD pSize,void *pbBlob)
{
DBVARIANT dbv = {0};
diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h
index 41f7f5cddc..52652891d5 100644
--- a/plugins/NotesAndReminders/src/miscutils.h
+++ b/plugins/NotesAndReminders/src/miscutils.h
@@ -1,7 +1,3 @@
-void WriteSettingInt(HANDLE hContact,char *ModuleName,
- char *SettingName,int Value);
-int ReadSettingInt(HANDLE hContact,char *ModuleName,
- char *SettingName,int Default);
void ReadSettingBlob(HANDLE hContact, char *ModuleName,
char *SettingName, WORD *pSize, void **pbBlob);
void WriteSettingBlob(HANDLE hContact,char *ModuleName,
@@ -11,8 +7,6 @@ BOOL ReadSettingBool(HANDLE hContact,char *ModuleName,
char *SettingName,BOOL Default);
void WriteSettingBool(HANDLE hContact,char *ModuleName,
char *SettingName,BOOL Value);
-void DeleteSetting(HANDLE hContact,char *ModuleName,
- char *SettingName);
void WriteSettingIntArray(HANDLE hContact,char *ModuleName,
char *SettingName,const int *Value, int Size);
bool ReadSettingIntArray(HANDLE hContact,char *ModuleName,
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index 58e809738e..d54b8ea03b 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -375,7 +375,7 @@ void LoadNotes(BOOL bIsStartup)
g_Stickies = NULL;
- NotesCount = ReadSettingInt(0,MODULENAME,"NotesData",0);
+ NotesCount = db_get_dw(0,MODULENAME,"NotesData",0);
for (I = 0; I < NotesCount; I++)
{
@@ -691,7 +691,7 @@ void PurgeNotes(void)
int NotesCount, I;
char ValueName[16];
- NotesCount = ReadSettingInt(0,MODULENAME,"NotesData",0);
+ NotesCount = db_get_dw(0,MODULENAME,"NotesData",0);
for(I = 0; I < NotesCount; I++)
{
sprintf(ValueName, "NotesData%d", I);
@@ -721,7 +721,7 @@ void OnDeleteNote(HWND hdlg, STICKYNOTE *SN)
void DeleteNotes(void)
{
PurgeNotes();
- WriteSettingInt(0, MODULENAME, "NotesData", 0);
+ db_set_dw(0, MODULENAME, "NotesData", 0);
PurgeNotesTree();
NOTIFY_LIST();
}
@@ -824,9 +824,9 @@ static void JustSaveNotesEx(STICKYNOTE *pModified)
int scrollV;
char *tData, *Value;
- const int OldNotesCount = ReadSettingInt(0, MODULENAME, "NotesData", 0);
+ const int OldNotesCount = db_get_dw(0, MODULENAME, "NotesData", 0);
- WriteSettingInt(0, MODULENAME, "NotesData", NotesCount);
+ db_set_dw(0, MODULENAME, "NotesData", NotesCount);
for (TTE = g_Stickies, I = 0; TTE; TTE = (TREEELEMENT*)TTE->next, I++)
{
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp
index b19e6b3b86..aaa257163c 100644
--- a/plugins/NotesAndReminders/src/options.cpp
+++ b/plugins/NotesAndReminders/src/options.cpp
@@ -444,17 +444,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar
else
db_unset(0,MODULENAME,"AltBrowser");
- WriteSettingInt(0,MODULENAME,"ShowNotesAtStart",g_ShowNotesAtStart);
- WriteSettingInt(0,MODULENAME,"ShowNoteButtons",g_ShowNoteButtons);
- WriteSettingInt(0,MODULENAME,"ShowScrollbar",g_ShowScrollbar);
- WriteSettingInt(0,MODULENAME,"AddContactMenuItems",g_AddContListMI);
- WriteSettingInt(0,MODULENAME,"NoteWidth",g_NoteWidth);
- WriteSettingInt(0,MODULENAME,"NoteHeight",g_NoteHeight);
- WriteSettingInt(0,MODULENAME,"Transparency",g_Transparency);
- WriteSettingInt(0,MODULENAME,"NoteTitleDate",g_NoteTitleDate);
- WriteSettingInt(0,MODULENAME,"NoteTitleTime",g_NoteTitleTime);
- WriteSettingInt(0,MODULENAME,"CloseAfterAddReminder",g_CloseAfterAddReminder);
- WriteSettingInt(0,MODULENAME,"UseMCI",!g_UseDefaultPlaySound);
+ db_set_dw(0,MODULENAME,"ShowNotesAtStart",g_ShowNotesAtStart);
+ db_set_dw(0,MODULENAME,"ShowNoteButtons",g_ShowNoteButtons);
+ db_set_dw(0,MODULENAME,"ShowScrollbar",g_ShowScrollbar);
+ db_set_dw(0,MODULENAME,"AddContactMenuItems",g_AddContListMI);
+ db_set_dw(0,MODULENAME,"NoteWidth",g_NoteWidth);
+ db_set_dw(0,MODULENAME,"NoteHeight",g_NoteHeight);
+ db_set_dw(0,MODULENAME,"Transparency",g_Transparency);
+ db_set_dw(0,MODULENAME,"NoteTitleDate",g_NoteTitleDate);
+ db_set_dw(0,MODULENAME,"NoteTitleTime",g_NoteTitleTime);
+ db_set_dw(0,MODULENAME,"CloseAfterAddReminder",g_CloseAfterAddReminder);
+ db_set_dw(0,MODULENAME,"UseMCI",!g_UseDefaultPlaySound);
SaveNotes();
LoadNotes(FALSE);
return TRUE;
@@ -576,17 +576,17 @@ void InitSettings(void)
g_lpszAltBrowser = db_get_sa(0,MODULENAME,"AltBrowser");
- g_ShowNotesAtStart = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNotesAtStart",1);
- g_ShowNoteButtons = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNoteButtons",1);
- g_ShowScrollbar = (BOOL)ReadSettingInt(0,MODULENAME,"ShowScrollbar",1);
- g_AddContListMI = (BOOL)ReadSettingInt(0,MODULENAME,"AddContactMenuItems",1);
- g_NoteWidth = ReadSettingInt(0,MODULENAME,"NoteWidth",179);
- g_NoteHeight = ReadSettingInt(0,MODULENAME,"NoteHeight",50);
- g_Transparency = ReadSettingInt(0,MODULENAME,"Transparency",255);
- g_NoteTitleDate = ReadSettingInt(0,MODULENAME,"NoteTitleDate",1);
- g_NoteTitleTime = ReadSettingInt(0,MODULENAME,"NoteTitleTime",1);
- g_CloseAfterAddReminder = (BOOL)ReadSettingInt(0,MODULENAME,"CloseAfterAddReminder",1);
- g_UseDefaultPlaySound = !(BOOL)ReadSettingInt(0,MODULENAME,"UseMCI",1);
+ g_ShowNotesAtStart = (BOOL)db_get_dw(0,MODULENAME,"ShowNotesAtStart",1);
+ g_ShowNoteButtons = (BOOL)db_get_dw(0,MODULENAME,"ShowNoteButtons",1);
+ g_ShowScrollbar = (BOOL)db_get_dw(0,MODULENAME,"ShowScrollbar",1);
+ g_AddContListMI = (BOOL)db_get_dw(0,MODULENAME,"AddContactMenuItems",1);
+ g_NoteWidth = db_get_dw(0,MODULENAME,"NoteWidth",179);
+ g_NoteHeight = db_get_dw(0,MODULENAME,"NoteHeight",50);
+ g_Transparency = db_get_dw(0,MODULENAME,"Transparency",255);
+ g_NoteTitleDate = db_get_dw(0,MODULENAME,"NoteTitleDate",1);
+ g_NoteTitleTime = db_get_dw(0,MODULENAME,"NoteTitleTime",1);
+ g_CloseAfterAddReminder = (BOOL)db_get_dw(0,MODULENAME,"CloseAfterAddReminder",1);
+ g_UseDefaultPlaySound = !(BOOL)db_get_dw(0,MODULENAME,"UseMCI",1);
ReadSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,SIZEOF(g_reminderListGeom));
ReadSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,SIZEOF(g_reminderListColGeom));
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 234aea3e6e..25c2772251 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -373,11 +373,11 @@ void PurgeReminders(void)
int ReminderCount,I;
char ValueName[32];
- ReminderCount = ReadSettingInt(0,MODULENAME,"RemindersData",0);
+ ReminderCount = db_get_dw(0,MODULENAME,"RemindersData",0);
for(I = 0;I < ReminderCount;I++)
{
sprintf(ValueName, "RemindersData%d", I);
- DeleteSetting(0,MODULENAME,ValueName);
+ db_unset(0, MODULENAME, ValueName);
}
}
@@ -390,11 +390,11 @@ void JustSaveReminders(void)
int ReminderCount;
REMINDERDATA *pReminder;
- const int OldReminderCount = ReadSettingInt(0, MODULENAME, "RemindersData", 0);
+ const int OldReminderCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
ReminderCount = TreeGetCount(RemindersList);
- WriteSettingInt(0,MODULENAME, "RemindersData", ReminderCount);
+ db_set_dw(0,MODULENAME, "RemindersData", ReminderCount);
for (TTE = RemindersList, I = 0; TTE; TTE = (TREEELEMENT*)TTE->next, I++)
{
@@ -472,7 +472,7 @@ void LoadReminders(void)
BOOL GenerateUids = FALSE;
RemindersList = NULL;
- RemindersCount = ReadSettingInt(0, MODULENAME, "RemindersData", 0);
+ RemindersCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
for (I = 0; I < RemindersCount; I++)
{
@@ -764,7 +764,7 @@ void SaveReminders(void)
void DeleteReminders(void)
{
PurgeReminders();
- WriteSettingInt(0,MODULENAME,"RemindersData",0);
+ db_set_dw(0,MODULENAME,"RemindersData",0);
PurgeReminderTree();
}
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp
index b6e479e9db..c4506df141 100644
--- a/plugins/YARelay/src/main.cpp
+++ b/plugins/YARelay/src/main.cpp
@@ -220,7 +220,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam)
// mark message as 'read'
if (iMarkRead > 0)
- CallService(MS_DB_EVENT_MARKREAD, wParam, lParam);
+ db_event_markRead(hContact, hDBEvent);
return 0;
}