diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-02 15:39:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-02 15:39:37 +0000 |
commit | bba1ccccb6072b6e12ede32d4e8e6a28ede32c5c (patch) | |
tree | 5e35e904856f67a54762ff16a0e3d0a8f7928d57 /plugins | |
parent | 6270be1be1979c0ad41ea506200431bcfc79360c (diff) |
first version of Non-IM Contact that could be compiled
git-svn-id: http://svn.miranda-ng.org/main/trunk@4287 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
31 files changed, 2613 insertions, 2493 deletions
diff --git a/plugins/!NotAdopted/Non-IM Contact/commonheaders.h b/plugins/!NotAdopted/Non-IM Contact/commonheaders.h deleted file mode 100644 index 596c0b4403..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/commonheaders.h +++ /dev/null @@ -1,142 +0,0 @@ -//=====================================================
-// Includes (yea why not include lots of stuff :p )
-//=====================================================
-#ifndef COMMONHEADERS
-#define COMMONHEADERS
-
-
-#include <windows.h>
-#include <commctrl.h>
-#include <stdio.h>
-#include <time.h>
-#include <stddef.h>
-#include <process.h>
-#include <string.h>
-#include <winsock.h>
-#include <shlobj.h>
-#include <prsht.h>
-#include <pshpack1.h>
-#ifndef NDEBUG
-#define _CRTDBG_MAP_ALLOC
-#include <crtdbg.h>
-#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-typedef struct DLGTEMPLATEEX
-{
- WORD dlgVer;
- WORD signature;
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- WORD cDlgItems;
- short x;
- short y;
- short cx;
- short cy;
-} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
-
-#include <poppack.h>
-
-
-#include "resource.h"
-#include "../miranda_src/SDK/Headers_c/newpluginapi.h"
-#include "../miranda_src/SDK/Headers_c/m_clist.h"
-#include "../miranda_src/SDK/Headers_c/m_clui.h"
-#include "../miranda_src/SDK/Headers_c/m_skin.h"
-#include "../miranda_src/SDK/Headers_c/m_langpack.h"
-#include "../miranda_src/SDK/Headers_c/m_protomod.h"
-#include "../miranda_src/SDK/Headers_c/m_database.h"
-#include "../miranda_src/SDK/Headers_c/m_system.h"
-#include "../miranda_src/SDK/Headers_c/m_protocols.h"
-#include "../miranda_src/SDK/Headers_c/m_userinfo.h"
-#include "../miranda_src/SDK/Headers_c/m_options.h"
-#include "../miranda_src/SDK/Headers_c/m_protosvc.h"
-#include "../miranda_src/SDK/Headers_c/m_utils.h"
-#include "../miranda_src/SDK/Headers_c/m_ignore.h"
-#include "../miranda_src/SDK/Headers_c/m_clc.h"
-#include "../miranda_src/SDK/headers_c/m_netlib.h"
-//#include "../miranda_src/SDK/Headers_c/m_uninstaller.h"
-#include <winbase.h>
-
-
-//=======================================================
-// Definitions
-//=======================================================
-#define modname "NIM_Contact"
-#define modFullname "Non-IM Contact"
-#define MAXLINES 10000
-#define MAX_STRING_LENGTH 10000
-#define LINE_LENGTH 10000
-#define msg(a,b) MessageBox(0,a,b,MB_OK);
-#define TIMER (DBGetContactSettingWord(NULL, modname, "Timer", 1) * 1000)
-/* ERROR VALUES */
-#define ERROR_NO_LINE_AFTER_VAR_F -1
-#define ERROR_LINE_NOT_READ -2
-#define ERROR_NO_FILE -3
-
-//=======================================================
-// Defines
-//=======================================================
-//General
-HINSTANCE hInst;
-extern int LCStatus;
-static HANDLE hWindowList=NULL;
-
-//Services.c
-int GetLCCaps(WPARAM wParam,LPARAM lParam);
-int GetLCName(WPARAM wParam,LPARAM lParam);
-int LoadLCIcon(WPARAM wParam,LPARAM lParam);
-int SetLCStatus(WPARAM wParam,LPARAM lParam);
-int GetLCStatus(WPARAM wParam,LPARAM lParam);
-int DBGetContactSettingString(HANDLE hContact, char* szModule, char* szSetting, char* value);
-
-// dialog.c
-int addContact(WPARAM wParam,LPARAM lParam) ;
-int editContact(WPARAM wParam,LPARAM lParam);
-BOOL CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-int testStringReplacer(WPARAM wParam, LPARAM lParam);
-int LoadFilesDlg(WPARAM wParam, LPARAM lParam);
-
-
-// files.c
-int Openfile(char * outputFile, int saveOpen);
-BOOL CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-int savehtml(char* outFile);
-char* getMimDir(char* file);
-int exportContacts(WPARAM wParam,LPARAM lParam) ;
-
-// contactinfo.c
-BOOL CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-void ExportContact(HANDLE hContact);
-int ImportContacts(WPARAM wParam, LPARAM lParam);
-
-// stringreplacer.c
-int stringReplacer(const char* oldString, char* newString, HANDLE hContact);
-void replaceAllStrings(HANDLE hContact);
-void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module12, char* setting2);
-
-//timer.c
-UINT_PTR timerId;
-void CALLBACK timerProc();
-int startTimer(int interval);
-int killTimer();
-
-// http.c
-void NetlibInit();
-int InternetDownloadFile (CHAR *szUrl);
-char *szInfo;
-char *szData;
-HANDLE hNetlibUser;
-// threads.c
-unsigned long forkthread ( void (__cdecl *threadcode)(void*),unsigned long stacksize,void *arg) ;
-
-
-#endif
-
-#ifndef NDEBUG
-#include <crtdbg.h>
-#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-#pragma comment(lib,"comctl32.lib")
diff --git a/plugins/!NotAdopted/Non-IM Contact/contactinfo.c b/plugins/!NotAdopted/Non-IM Contact/contactinfo.c deleted file mode 100644 index 2a6fb5cea7..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/contactinfo.c +++ /dev/null @@ -1,785 +0,0 @@ -#include "commonheaders.h"
-BOOL CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- {
- HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
- char name[2048];
- TranslateDialogDefault(hwnd);
- SetWindowLong(hwnd, GWL_USERDATA, (LPARAM)(HANDLE)hContact);
-
- if (!DBGetContactSettingString(hContact, modname, "Name", name)) break;
- SetDlgItemText(hwnd, IDC_DISPLAY_NAME, name);
- if (!DBGetContactSettingString(hContact, modname, "ToolTip", name)) break;
- SetDlgItemText(hwnd, IDC_TOOLTIP, name);
- }
- return TRUE;
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- return TRUE;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_DISPLAY_NAME)))
- {
- char text[512];
- GetDlgItemText(hwnd,IDC_DISPLAY_NAME,text,sizeof(text));
- DBWriteContactSettingString(hContact, modname, "Name", text);
- WriteSetting(hContact, modname, "Name", modname, "Nick");
- }
- else
- {
- DBDeleteContactSetting(hContact, modname, "Name");
- DBDeleteContactSetting(hContact, modname, "Nick");
- }
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_TOOLTIP)))
- {
- char text[2048];
- GetDlgItemText(hwnd,IDC_TOOLTIP,text,sizeof(text));
- DBWriteContactSettingString(hContact, modname, "ToolTip", text);
- WriteSetting(hContact, modname, "ToolTip", "UserInfo", "MyNotes");
- }
- else
- {
- DBDeleteContactSetting(hContact, modname, "ToolTip");
- DBDeleteContactSetting(hContact, "UserInfo", "MyNotes");
- }
- }
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
-
-static WNDPROC g_PrevBtnWndProc = 0;
-
-LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- LRESULT res = CallWindowProc(g_PrevBtnWndProc, hWnd, message, wParam, lParam);
- if(WM_PAINT == message)
- {
- RECT rc;
- HDC dc = GetDC(hWnd);
- BOOL isPressed = BST_CHECKED == SendMessage(hWnd, BM_GETCHECK, 0, 0);
-
- GetClientRect(hWnd, &rc);
- rc.left += (rc.right - rc.left - 16) / 2;
- rc.top += (rc.bottom - rc.top - 16) / 2;
- if(isPressed)
- OffsetRect(&rc, 1, 1);
- DrawIconEx(dc, rc.left, rc.top, (HICON)GetWindowLong(hWnd, GWL_USERDATA),
- 16, 16, 0, 0, DI_NORMAL);
- ReleaseDC(hWnd, dc);
- }
-
- return res;
-}
-
-void checkGroups(char* group)
-{
- int i;
- char str[50], name[256];
- DBVARIANT dbv;
-
- if (lstrlen(group) < 1)
- return;
-
- for (i = 0;; i++)
- {
- itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
- break;
- if (dbv.type == DBVT_ASCIIZ)
- {
- if (dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.pszVal + 1, group))
- {
- DBFreeVariant(&dbv);
- return;
- }
-
- DBFreeVariant(&dbv);
- }
- }
- name[0] = 1 | GROUPF_EXPANDED;
- strncpy(name + 1, group, sizeof(name) - 1);
- name[strlen(group) + 1] = '\0';
- DBWriteContactSettingString(NULL, "CListGroups", str, name);
- CallService(MS_CLUI_GROUPADDED, i + 1, 0);
-}
-
-int BrowseForFolder(HWND hwnd,char *szPath)
-{
- BROWSEINFO bi={0};
- LPMALLOC pMalloc;
- ITEMIDLIST *pidlResult;
- int result=0;
-
- if(SUCCEEDED(OleInitialize(NULL))) {
- if(SUCCEEDED(CoGetMalloc(1,&pMalloc))) {
- bi.hwndOwner=hwnd;
- bi.pszDisplayName=szPath;
- bi.lpszTitle=Translate("Select Folder");
- bi.ulFlags=BIF_EDITBOX|BIF_RETURNONLYFSDIRS; // Use this combo instead of BIF_USENEWUI
- // bi.lpfn=BrowseCallbackProc;
- bi.lParam=(LPARAM)szPath;
-
- pidlResult=SHBrowseForFolder(&bi);
- if(pidlResult) {
- SHGetPathFromIDList(pidlResult,szPath);
- lstrcat(szPath,"\\");
- result=1;
- }
- pMalloc->lpVtbl->Free(pMalloc,pidlResult);
- pMalloc->lpVtbl->Release(pMalloc);
- }
- OleUninitialize();
- }
- return result;
-}
-
-BOOL CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- {
- int i = 0;
- DBVARIANT dbv;
- char string[512];
- HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
- TranslateDialogDefault(hwnd);
- SetWindowLong(hwnd, GWL_USERDATA, (LPARAM)(HANDLE)hContact);
- if (!hContact) break;
- else
- {
- /* link*/
- if (DBGetContactSettingString(hContact, modname, "ProgramString", string))
- SetDlgItemText(hwnd, IDC_LINK, string);
- if (DBGetContactSettingString(hContact, modname, "ProgramParamsString", string))
- SetDlgItemText(hwnd, IDC_PARAMS, string);
- /* group*/
- while (i != -1)
- {
- char str[3], name[256];
- wsprintf(str, "%d", i);
- if (!DBGetContactSetting(NULL, "CListGroups", str, &dbv))
- {
- lstrcpyn(name,dbv.pszVal+1,sizeof(name));
- SendMessage(GetDlgItem(hwnd, IDC_GROUP), CB_INSERTSTRING,0, (LPARAM)name);
- i++;
- }
- else i = -1;
- }
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv))
- SetDlgItemText(hwnd, IDC_GROUP, dbv.pszVal);
-
- }
- /* icons */
- CheckRadioButton(hwnd, 40072, 40080, DBGetContactSettingWord(hContact, modname, "Icon", ID_STATUS_ONLINE));
- SetWindowLong(GetDlgItem(hwnd, CHK_ONLINE), GWL_USERDATA, (LONG)LoadSkinnedProtoIcon(modname, ID_STATUS_ONLINE));
- g_PrevBtnWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwnd, CHK_ONLINE), GWL_WNDPROC, (LONG)ButtWndProc);
- for (i = ID_STATUS_ONLINE; i<=ID_STATUS_OUTTOLUNCH; i++)
- {
- SetWindowLong(GetDlgItem(hwnd, i), GWL_USERDATA, (LONG)LoadSkinnedProtoIcon(modname, i));
- SetWindowLong(GetDlgItem(hwnd, i), GWL_WNDPROC, (LONG)ButtWndProc);
- }
- DBFreeVariant(&dbv);
- /* timer */
- CheckDlgButton(hwnd, CHK_USE_TIMER, DBGetContactSettingByte(hContact, modname ,"UseTimer", 0));
- if (DBGetContactSettingWord(hContact, modname ,"Timer", 15))
- {
- CheckDlgButton(hwnd, CHK_USE_TIMER,1);
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
- SetDlgItemText(hwnd, IDC_TIMER, itoa(DBGetContactSettingWord(hContact, modname ,"Timer", 15), string, 10));
- if (!DBGetContactSettingWord(NULL, modname ,"Timer", 1))
- SetDlgItemText(hwnd,IDC_TIMER_INTERVAL_MSG, "Non-IM Contact protocol timer is Disabled");
- else
- {
- _snprintf(string, sizeof(string), "Timer intervals... Non-IM Contact Protocol timer is %d seconds",DBGetContactSettingWord(NULL, modname ,"Timer", 1));
- SetDlgItemText(hwnd,IDC_TIMER_INTERVAL_MSG, string);
- }
- }
- /* always visible */
- if (DBGetContactSettingByte(hContact, modname ,"AlwaysVisible", 0))
- {
- CheckDlgButton(hwnd, IDC_ALWAYS_VISIBLE, 1);
- EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),1);
- CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, DBGetContactSettingByte(hContact, modname ,"VisibleUnlessOffline", 1));
- }
-
- }
- return TRUE;
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch(LOWORD(wParam)) {
- case IDC_ALWAYS_VISIBLE:
- if (IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE))
- {
- HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
- EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),1);
- CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, DBGetContactSettingByte(hContact, modname ,"VisibleUnlessOffline", 1));
- }
- else EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),0);
- break;
- case CHK_USE_TIMER:
- if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER))
- {
- HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
- char string[4];
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
- SetDlgItemText(hwnd, IDC_TIMER, itoa(DBGetContactSettingWord(hContact, modname ,"Timer", 15), string, 10));
- }
- else
- {
- EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 0);
- }
- break;
- case IDC_OPEN_FILE:
- {
- char szFileName[512];
- if (Openfile(szFileName,1))
- SetDlgItemText(hwnd, IDC_LINK, szFileName);
- }
- break;
- case IDC_OPEN_FOLDER:
- {
- char szFileName[512];
- if (BrowseForFolder(hwnd, szFileName))
- {
- wsprintf(szFileName, "%s ,/e", szFileName);
- SetDlgItemText(hwnd, IDC_LINK, "explorer.exe");
- SetDlgItemText(hwnd, IDC_PARAMS, szFileName);
- }
- }
- break;
-
- return TRUE;
- }
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- int status = GetLCStatus(0,0);
- HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
- int i;
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_LINK)))
- {
- char text[512];
- GetDlgItemText(hwnd,IDC_LINK,text,sizeof(text));
- DBWriteContactSettingString(hContact, modname, "ProgramString", text);
- WriteSetting(hContact, modname, "ProgramString", modname, "Program");
- }
- else DBDeleteContactSetting(hContact, modname, "ProgramString");
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_PARAMS)))
- {
- char text[512];
- GetDlgItemText(hwnd,IDC_PARAMS,text,sizeof(text));
- DBWriteContactSettingString(hContact, modname, "ProgramParamsString", text);
- WriteSetting(hContact, modname, "ProgramParamsString", modname, "ProgramParams");
- }
- else DBDeleteContactSetting(hContact, modname, "ProgramParamsString");
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_GROUP)))
- {
- char text[512];
- GetDlgItemText(hwnd,IDC_GROUP,text,sizeof(text));
- checkGroups(text);
- DBWriteContactSettingString(hContact, "CList", "Group", text);
- }
- else DBDeleteContactSetting(hContact, "CList", "Group");
- for (i = ID_STATUS_ONLINE; i<=ID_STATUS_OUTTOLUNCH; i++)
- {
- if (IsDlgButtonChecked(hwnd, i))
- DBWriteContactSettingWord(hContact, modname, "Icon", (WORD)i);
- }
- /* set correct status */
- if ( (status == ID_STATUS_ONLINE) || (status == ID_STATUS_AWAY) ||
- (status == DBGetContactSettingWord(hContact, modname, "Icon", ID_STATUS_ONLINE) )
- )
- DBWriteContactSettingWord(hContact, modname, "Status", (WORD)DBGetContactSettingWord(hContact, modname, "Icon", ID_STATUS_ONLINE));
- else
- DBWriteContactSettingWord(hContact, modname, "Status", ID_STATUS_OFFLINE);
-
- if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER))
- {
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_TIMER)))
- {
- char text[512];
- GetDlgItemText(hwnd,IDC_TIMER,text,sizeof(text));
- DBWriteContactSettingWord(hContact, modname, "Timer", (WORD)atoi(text));
- }
- else DBWriteContactSettingWord(hContact, modname, "Timer", 15);
- }
- else DBWriteContactSettingWord(hContact, modname, "Timer", 0);
- // always visible
- DBWriteContactSettingByte(hContact, modname, "AlwaysVisible", (BYTE)IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE));
- DBWriteContactSettingByte(hContact, modname, "VisibleUnlessOffline", (BYTE)IsDlgButtonChecked(hwnd, IDC_VISIBLE_UNLESS_OFFLINE));
- }
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
-
-
-char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replaceWithStr)
-{
- int i=0;
- while (oldStr[i] != '\0')
- {
- // msg(&oldStr[i],"");
- if (!strncmp(&oldStr[i],findStr, strlen(findStr)))
- {
- strcat(newStr,replaceWithStr);
- i += strlen(findStr);
- }
- else
- {
- strncat(newStr,&oldStr[i],1);
- i++;
- }
- }
- return newStr;
-}
-#define MAX_REPLACES 15
-BOOL CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- {
- HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
- TranslateDialogDefault(hwnd);
- SetWindowLong(hwnd, GWL_USERDATA, (LPARAM)(HANDLE)hContact);
- }
- return TRUE;
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch(LOWORD(wParam)) {
- case IDC_EXPORT:
- ExportContact((HANDLE)GetWindowLong(hwnd, GWL_USERDATA));
- break;
- case IDC_DOIT:
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)))
- {
- char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
- char newString[MAX_REPLACES][512], oldString[MAX_REPLACES][512];
- char dbVar1[2000], dbVar2[2000];
- int i=0,j=0, k=0;
- char *string = oldString[k];
- HANDLE hContact1 = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA), hContact2;
- GetDlgItemText(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
- if (DBGetContactSettingString(hContact1, modname, "Name", dbVar1))
- {
- // get the list of replace strings
- while (replace[i] != '\0')
- {
- if (replace[i] == ',')
- {
- string = newString[k];
- j=0;
- }
- else if (!strncmp(&replace[i], "\r\n",2))
- {
- if (string == newString[k])
- k--;
- if (k = MAX_REPLACES) break;
- string = oldString[++k];
- i+=2;
- continue;
- }
- else
- {
- string[j] = replace[i];
- string[++j] = '\0';
- }
- i++;
- }
- hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)modname);
- CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
- DBWriteContactSettingString(hContact2, modname, "Nick", Translate("New Non-IM Contact"));
- // blank dbVar2 so the replaceing doesnt crash..
- strcpy(dbVar2, "");
- // copy the name (dbVar1 is the name)
- for (i=0;i<=k;i++)
- {
- copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
- }
- DBWriteContactSettingString(hContact2, modname, "Name", dbVar2);
- // copy the ProgramString
- if (DBGetContactSettingString(hContact1, modname, "ProgramString",dbVar1))
- {
- strcpy(dbVar2, "");
- for (i=0;i<=k;i++)
- {
- copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
- }
- DBWriteContactSettingString(hContact2, modname, "ProgramString", dbVar2);
- }
- // copy the ProgramParamString
- if (DBGetContactSettingString(hContact1, modname, "ProgramParamString",dbVar1))
- {
- strcpy(dbVar2, "");
- for (i=0;i<=k;i++)
- {
- copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
- }
- DBWriteContactSettingString(hContact2, modname, "ProgramParamString", dbVar2);
- }
- // copy the group
- if (DBGetContactSettingString(hContact1, "CList", "Group",dbVar1))
- {
- strcpy(dbVar2, "");
- for (i=0;i<=k;i++)
- {
- copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
- }
- DBWriteContactSettingString(hContact2, "CList", "Group", dbVar2);
- }
- // copy the ToolTip
- if (DBGetContactSettingString(hContact1, modname, "ToolTip",dbVar1))
- {
- strcpy(dbVar2, "");
- for (i=0;i<=k;i++)
- {
- copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
- }
- DBWriteContactSettingString(hContact2, modname, "ToolTip", dbVar2);
- }
- // timer
- DBWriteContactSettingByte(hContact2, modname, "UseTimer", (BYTE)DBGetContactSettingByte(hContact1, modname, "UseTimer", 0));
- DBWriteContactSettingByte(hContact2, modname, "Minutes", (BYTE)DBGetContactSettingByte(hContact1, modname, "Minutes", 0));
- DBWriteContactSettingWord(hContact2, modname, "Timer", (WORD)DBGetContactSettingWord(hContact1, modname, "Timer", 0));
- //icon
- DBWriteContactSettingWord(hContact2, modname, "Icon", (WORD)DBGetContactSettingWord(hContact1, modname, "Icon", 40072));
- replaceAllStrings(hContact2);
- }
- }
- else
- {
- char dbVar1[2000];
- HANDLE hContact1 = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA), hContact2;
- if (DBGetContactSettingString(hContact1, modname, "Name", dbVar1))
- {
- if (!(hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)))
- {
- msg("contact did not get created","");
- return 0;
- }
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)modname);
- CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
- DBWriteContactSettingString(hContact2, modname, "Nick", Translate("New Non-IM Contact"));
- DBWriteContactSettingString(hContact2, modname, "Name", dbVar1);
- if (DBGetContactSettingString(hContact1, modname, "ProgramString",dbVar1))
- {
- DBWriteContactSettingString(hContact2, modname, "ProgramString", dbVar1);
- }
- // copy the ProgramParamString
- if (DBGetContactSettingString(hContact1, modname, "ProgramParamString",dbVar1))
- {
- DBWriteContactSettingString(hContact2, modname, "ProgramParamString", dbVar1);
- }
- // copy the group
- if (DBGetContactSettingString(hContact1, "CList", "Group",dbVar1))
- {
- DBWriteContactSettingString(hContact2, "CList", "Group", dbVar1);
- }
- // copy the ToolTip
- if (DBGetContactSettingString(hContact1, modname, "ToolTip",dbVar1))
- {
- DBWriteContactSettingString(hContact2, modname, "ToolTip", dbVar1);
- }
- // timer
- DBWriteContactSettingByte(hContact2, modname, "UseTimer", (BYTE)DBGetContactSettingByte(hContact1, modname, "UseTimer", 0));
- DBWriteContactSettingByte(hContact2, modname, "Minutes", (BYTE)DBGetContactSettingByte(hContact1, modname, "Minutes", 0));
- DBWriteContactSettingWord(hContact2, modname, "Timer", (WORD)DBGetContactSettingWord(hContact1, modname, "Timer", 0));
- //icon
- DBWriteContactSettingWord(hContact2, modname, "Icon", (WORD)DBGetContactSettingWord(hContact1, modname, "Icon", 40072));
- replaceAllStrings(hContact2);
- }
- }
-
-
- break;
-
- return TRUE;
- }
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- }
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
-
-void ExportContact(HANDLE hContact)
-{
- FILE* file;
- char szFileName[MAX_PATH];
- char DBVar[1024];
- int tmp;
-
- if (Openfile(szFileName, 0))
- {
- // if (tmp = MessageBox(0, "Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append this contact to the end of the file.",modFullname, MB_YESNO) == IDYES)
- // file = fopen(szFileName, "w");
- // else
- file = fopen(szFileName, "a");
- if (file)
- {
- if (DBGetContactSettingString(hContact, modname, "Name", DBVar))
- {
- fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ProgramString", DBVar))
- fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ProgramParamString", DBVar))
- fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ToolTip", DBVar))
- fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (DBGetContactSettingString(hContact, "CList", "Group", DBVar))
- fprintf(file, "Group=%s\r\n", DBVar);
- if (tmp = DBGetContactSettingWord(hContact, modname, "Icon", 40072))
- fprintf(file, "Icon=%d\r\n", tmp);
- if (tmp = DBGetContactSettingByte(hContact, modname, "UseTimer", 0))
- fprintf(file, "UseTimer=%d\r\n", tmp);
- if (tmp = DBGetContactSettingByte(hContact, modname, "Minutes", 1))
- fprintf(file, "Minutes=%d\r\n", tmp);
- if (tmp = DBGetContactSettingWord(hContact, modname, "Timer", 0))
- fprintf(file, "Timer=%d\r\n", tmp);
- fprintf(file, "[/Non-IM Contact]\r\n");
- }
- else ("Contact is invalid",modFullname);
- fclose(file);
- }
- }
-}
-
-int ImportContacts(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", tooltip[3000] = "", line[2001] = "";
- int icon = 40072, usetimer = 0, minutes = 1, timer = 0;
- FILE* file;
- char fn[MAX_PATH];
- int i,j, contactDone = 0;
- if (Openfile(fn, 1))
- {
- file = fopen(fn, "r");
- if (file)
- {
- while (fgets(line,2000,file) )
- {
- if (!strcmp(line, "\r\n\0")) continue;
- else if (!strcmp(line,"[Non-IM Contact]\r\n"))
- {
- contactDone = 0;
- }
- else if (!strncmp(line, "Name=" ,strlen("Name=")))
- {
- i=strlen("Name=");j=0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0')
- {
- name[j] = line[i++];
- name[++j] = '\0';
- }
- contactDone =1;
- }
- else if (!strncmp(line, "ProgramString=" ,strlen("ProgramString=")))
- {
- i=strlen("ProgramString=");j=0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0')
- {
- program[j] = line[i++];
- program[++j] = '\0';
- }
- }
- else if (!strncmp(line, "ProgramParamString=" ,strlen("ProgramParamString=")))
- {
- i=strlen("ProgramParamString=");j=0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0')
- {
- programparam[j] = line[i++];
- programparam[++j] = '\0';
- }
- }
- else if (!strncmp(line, "Group=" ,strlen("Group=")))
- {
- i=strlen("Group=");j=0;
- while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0')
- {
- group[j] = line[i++];
- group[++j] = '\0';
- }
- }
- else if (!strncmp(line, "ToolTip=" ,strlen("ToolTip=")))
- {
- i=strlen("ToolTip=");
- strcpy(tooltip, &line[i]);
- fgets(line,2000,file);
- while (!strstr(line,"</tooltip>\r\n"))
- {
- strcat(tooltip,line);
- fgets(line,2000,file);
- }
- // the line that has the </tooltip>
- strncat(tooltip,line, strlen(line) - strlen("</tooltip>\r\n"));
- }
- else if (!strncmp(line, "Icon=", strlen("Icon=")))
- {
- i=strlen("Icon=");
- sscanf(&line[i], "%d", &icon);
- }
- else if (!strncmp(line, "UseTimer=", strlen("UseTimer=")))
- {
- i=strlen("UseTimer=");
- sscanf(&line[i], "%d", &usetimer);
- }
- else if (!strncmp(line, "Timer=" ,strlen("Timer=")))
- {
- i=strlen("Timer=");
- sscanf(&line[i], "%d", &timer);
- }
- else if (!strncmp(line, "Minutes=", strlen("Minutes=")))
- {
- i=strlen("Minutes=");
- sscanf(&line[i], "%d", &minutes);
- }
- else if (contactDone && !strcmp(line,"[/Non-IM Contact]\r\n"))
- {
- char *msg;
- if (!name) continue;
- msg = (char*)malloc(strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1);
- wsprintf(msg, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
- if (program)
- {
- msg = (char*)realloc(msg, strlen(msg) + strlen(program) +strlen("Program: \r\n") +1);
- strcat(msg, "Program: ");
- strcat(msg,program);
- strcat(msg,"\r\n");
- }
- if (programparam)
- {
- msg = (char*)realloc(msg, strlen(msg) + strlen(programparam) +strlen("Program Parameters: \r\n") +1);
- strcat(msg, "Program Parameters: ");
- strcat(msg,programparam);
- strcat(msg,"\r\n");
- }
- if (tooltip)
- {
- msg = (char*)realloc(msg, strlen(msg) + strlen(tooltip) +strlen("ToolTip: \r\n") +1);
- strcat(msg, "ToolTip: ");
- strcat(msg,tooltip);
- strcat(msg,"\r\n");
- }
- if (group)
- {
- msg = (char*)realloc(msg, strlen(msg) + strlen(group) +strlen("Group: \r\n") +1);
- strcat(msg, "Group: ");
- strcat(msg,group);
- strcat(msg,"\r\n");
- }
- if (icon)
- {
- char tmp[64];
- if (icon == ID_STATUS_ONLINE)
- wsprintf(tmp, "Icon: Online\r\n");
- else if (icon == ID_STATUS_AWAY)
- wsprintf(tmp, "Icon: Away\r\n");
- else if (icon == ID_STATUS_NA)
- wsprintf(tmp, "Icon: NA\r\n");
- else if (icon == ID_STATUS_DND)
- wsprintf(tmp, "Icon: DND\r\n");
- else if (icon == ID_STATUS_OCCUPIED)
- wsprintf(tmp, "Icon: Occupied\r\n");
- else if (icon == ID_STATUS_FREECHAT)
- wsprintf(tmp, "Icon: Free For Chat\r\n");
- else if (icon == ID_STATUS_INVISIBLE)
- wsprintf(tmp, "Icon: Invisible\r\n");
- else if (icon == ID_STATUS_ONTHEPHONE)
- wsprintf(tmp, "Icon: On The Phone\r\n");
- else if (icon == ID_STATUS_OUTTOLUNCH)
- wsprintf(tmp, "Icon: Out To Lunch\r\n");
- msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
- strcat(msg,tmp);
- }
- if (usetimer && timer)
- {
- char tmp[64],tmp2[8];
- if (minutes)
- strcpy(tmp2,"Minutes");
- else strcpy(tmp2,"Seconds");
- wsprintf(tmp, "UseTimer: Yes\r\nTimer: %d %s",timer, tmp2);
- msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
- strcat(msg,tmp);
- }
-
- if (MessageBox(0,msg,modFullname,MB_YESNO) == IDYES)
- {
- if (!(hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)))
- {
- msg("contact did get created","");
- continue;
- }
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)modname);
- CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
- DBWriteContactSettingString(hContact, modname, "Nick", Translate("New Non-IM Contact"));
- DBWriteContactSettingString(hContact, modname, "Name", name);
- DBWriteContactSettingString(hContact, modname, "ProgramString", program);
- // copy the ProgramParamString
- DBWriteContactSettingString(hContact, modname, "ProgramParamString", programparam);
- // copy the group
- DBWriteContactSettingString(hContact, "CList", "Group", group);
- // copy the ToolTip
- DBWriteContactSettingString(hContact, modname, "ToolTip", tooltip);
- // timer
- DBWriteContactSettingByte(hContact, modname, "UseTimer", (BYTE)usetimer);
- DBWriteContactSettingByte(hContact, modname, "Minutes", (BYTE)minutes);
- DBWriteContactSettingWord(hContact, modname, "Timer", (WORD)timer);
- //icon
- DBWriteContactSettingWord(hContact, modname, "Icon", (WORD)icon);
- replaceAllStrings(hContact);
- }
- free(msg);
- contactDone = 0;
- name[0] = '\0';
- program[0] = '\0';
- programparam[0] = '\0';
- group[0] = '\0';
- tooltip[0] = '\0';
- line[0] = '\0';
- icon = 40072;
- usetimer = 0;
- minutes = 1;
- timer = 0;
- }
- }
- fclose(file);
- // ask if they want to import this contact
- }
- }
- return 1;
-}
diff --git a/plugins/!NotAdopted/Non-IM Contact/files.c b/plugins/!NotAdopted/Non-IM Contact/files.c deleted file mode 100644 index 00950db655..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/files.c +++ /dev/null @@ -1,367 +0,0 @@ -#include "commonheaders.h"
-
-int exportContacts(WPARAM wParam,LPARAM lParam)
-{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- char fn[MAX_PATH];
- FILE* file;
- char DBVar[1024];
- int tmp;
- if (Openfile(fn, 0))
- {
- if (tmp = MessageBox(0, "Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append these contacts to the end of the file.",modFullname, MB_YESNO) == IDYES)
- file = fopen(fn, "w");
- else file = fopen(fn, "a");
- if (file)
- {
- while (hContact)
- {
- const char* proto = (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (proto && !strcmp(proto, modname))
- {
- if (DBGetContactSettingString(hContact, modname, "Name", DBVar))
- {
- fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ProgramString", DBVar))
- fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ProgramParamString", DBVar))
- fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (DBGetContactSettingString(hContact, modname, "ToolTip", DBVar))
- fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (DBGetContactSettingString(hContact, "CList", "Group", DBVar))
- fprintf(file, "Group=%s\r\n", DBVar);
- if (tmp = DBGetContactSettingWord(hContact, modname, "Icon", 40072))
- fprintf(file, "Icon=%d\r\n", tmp);
- if (tmp = DBGetContactSettingByte(hContact, modname, "UseTimer", 0))
- fprintf(file, "UseTimer=%d\r\n", tmp);
- if (tmp = DBGetContactSettingByte(hContact, modname, "Minutes", 1))
- fprintf(file, "Minutes=%d\r\n", tmp);
- if (tmp = DBGetContactSettingWord(hContact, modname, "Timer", 0))
- fprintf(file, "Timer=%d\r\n", tmp);
- fprintf(file, "[/Non-IM Contact]\r\n");
- }
- }
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
- }
- fclose(file);
- }
- else return 0;
- }
- else return 0;
- return 1;
-}
-
-
-int Openfile(char * outputFile, int saveOpen) //0=save, 1=open
-{
- OPENFILENAME ofn;
- char filename[MAX_PATH] = "";
- char *filter = "All Files\0*.*\0";
- int r;
- char title[16];
- if (saveOpen)
- strcpy(title, "Open file");
- else strcpy(title, "Save to file");
- ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
- ofn.lpstrFile = filename;
- ofn.lpstrFilter = filter;
- ofn.Flags = saveOpen? OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_SHAREAWARE | OFN_PATHMUSTEXIST: OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST;
- ofn.lpstrTitle = title;
- ofn.nMaxFile = MAX_PATH;
-
- if (saveOpen)
- r = GetOpenFileName((LPOPENFILENAME)&ofn);
- else r = GetSaveFileName((LPOPENFILENAME)&ofn);
- if (!r)
- return 0;
- lstrcpy(outputFile,filename);
- return 1;
-}
-
-
-void reloadFiles(HWND fileList)
-{
- int i, index;
- char file[MAX_PATH], fn[6];
- SendMessage(fileList,CB_RESETCONTENT, 0,0);
- for (i=0; ;i++)
- {
- wsprintf(fn, "fn%d", i);
- if (DBGetContactSettingString(NULL, modname, fn, file))
- {
- index = SendMessage(fileList,CB_ADDSTRING,0, (LPARAM)(char*)file);
- SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)(int)i);
- SendMessage(fileList,CB_SETCURSEL, index,0);
- SetDlgItemText(GetParent(fileList), IDC_FN, itoa(i, fn, 10));
- /* add the file contents to the edit box */
- }
- else break;
- }
-}
-
-int savehtml(char* outFile)
-{
- FILE* file = fopen(outFile, "w");
- if (!file)
- {
- fclose(file);
- return 0;
- }
- fprintf(file, "%s", szInfo);
- fclose(file);
- return 1;
-}
-
-void readFile(HWND hwnd)
-{
- int lineNumber, fileLength=0, width=0;
- char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
- FILE* filen;
- int fileNumber = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
- wsprintf(fn, "fn%d", fileNumber);
- if (!DBGetContactSettingString(NULL, modname, fn, szFileName))
- {
- msg(Translate("File couldn't be opened"),fn);
- return;
- }
-
- if ( (!strncmp("http://", szFileName, strlen("http://"))) || (!strncmp("https://", szFileName, strlen("https://"))) )
- wsprintf(szFileName,"%s\\plugins\\fn%d.html",getMimDir(temp), fileNumber);
-
- filen = fopen(szFileName,"r");
- if (!filen)
- {
- MessageBox(0, Translate("File couldn't be opened,2"), modFullname,MB_OK);
- return;
- }
- lineNumber = 0;
- SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_RESETCONTENT, 0,0);
- while (lineNumber < (MAXLINES) && (fgets(temp, MAX_STRING_LENGTH, filen)))
- {
- if (temp[0] == '\t') temp[0] = ' ';
- if(temp[strlen(temp)-1]=='\n' && temp[strlen(temp)-2]=='\r')
- temp[strlen(temp)-2]='\0';
- else if(temp[strlen(temp)-1]=='\n')
- temp[strlen(temp)-1]='\0';
- else temp[strlen(temp)]='\0';
- wsprintf( temp1, Translate("line(%-3d) = | %s"), lineNumber, temp);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_ADDSTRING,0,(LPARAM)(char*)temp1);
- lineNumber++;
- fileLength++;
- if ((unsigned int)SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_GETHORIZONTALEXTENT,0,0) <= (strlen(temp1)*DBGetContactSettingByte(NULL, modname, "WidthMultiplier", 5)))
- SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_SETHORIZONTALEXTENT,(strlen(temp1)*DBGetContactSettingByte(NULL, modname, "WidthMultiplier", 5)),0);
- }
- fclose(filen);
-
- return ;
-}
-#define WM_RELOADWINDOW (WM_USER+11)
-BOOL CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_RELOADWINDOW:
- {
- int i;
- char fn[MAX_PATH], string[MAX_STRING_LENGTH], tmp[MAX_STRING_LENGTH];
- reloadFiles(GetDlgItem(hwnd, IDC_FILE_LIST));
- i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
- wsprintf(fn , "fn%d", i);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_RESETCONTENT, 0,0);
- if (DBGetContactSettingString(NULL, modname, fn, string) )
- {
- if ( (!strncmp("http://", string, strlen("http://"))) || (!strncmp("https://", string, strlen("https://"))) )
- {
- SetDlgItemText(hwnd,IDC_URL, string);
- SetDlgItemText(hwnd, IDC_WWW_TIMER, itoa(DBGetContactSettingWord(NULL, modname, strcat(fn, "_timer"), 60), tmp, 10));
- }
- readFile(hwnd);
- }
- }
- break;
-
- case WM_INITDIALOG:
- {
- SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
- TranslateDialogDefault(hwnd);
- }
- return TRUE;
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch(LOWORD(wParam)) {
- case IDC_ADD_URL:
- {
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_URL)))
- {
- char text[512], url[512], fn[10] = "fn0", szFileName[MAX_PATH], temp[512];
- int i, timer;
- GetDlgItemText(hwnd,IDC_URL,text,sizeof(text));
- strcpy(url, text);
- if (!InternetDownloadFile(text))
- {
- for (i=0; ;i++)
- {
- wsprintf(fn, "fn%d", i);
- if (!DBGetContactSettingString(NULL, modname, fn, text))
- break;
- }
- wsprintf(szFileName,"%s\\plugins\\%s.html",getMimDir(temp), fn);
- if (savehtml(szFileName))
- {
- wsprintf(fn, "fn%d", i);
- DBWriteContactSettingString(NULL, modname, fn, url);
- if(!GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER)))
- timer = 60;
- else
- {
- GetDlgItemText(hwnd,IDC_WWW_TIMER,text,sizeof(text));
- timer = atoi(text);
- }
- DBWriteContactSettingWord(NULL, modname, strcat(fn, "_timer"), (WORD)timer);
- SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
- }
- }
- }
- }
- break;
- case IDC_WWW_TIMER:
- if (HIWORD(wParam) == EN_CHANGE)
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_ADD_FILE:
- {
- int i, index;
- char file[MAX_PATH], fn[6];
- for (i=0; ;i++)
- {
- wsprintf(fn, "fn%d", i);
- if (!DBGetContactSettingString(NULL, modname, fn, file))
- break;
- }
- if (Openfile(file,1))
- {
- DBWriteContactSettingString(NULL, modname, fn, file);
- index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_ADDSTRING,0,(LPARAM)(char*)file);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETITEMDATA,index,(LPARAM)(int)i);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETCURSEL, index ,0);
- SetDlgItemText(hwnd, IDC_FN, itoa(i, fn, 10));
- wsprintf(fn , "fn%d", index);
- readFile(hwnd);
- }
-
- }
- break;
- case IDC_DEL_FILE:
- {
- int index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0),i= (int)SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETITEMDATA, index,0);
- char fn[6], fn1[4], tmp[256];
- int count = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCOUNT, 0,0) -1;
- if (index == count)
- {
- wsprintf(fn, "fn%d", index);
- DBDeleteContactSetting(NULL, modname, fn);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
- SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
- if (!index)
- {
- SetDlgItemText(hwnd, IDC_FN,"");
- SetDlgItemText(hwnd, IDC_FILE_CONTENTS,"");
- }
-
- }
- else
- {
- wsprintf(fn, "fn%d", i);
- while (DBGetContactSettingString(NULL, modname, fn,tmp))
- {
- wsprintf(fn1, "fn%d", i-1);
- DBWriteContactSettingString(NULL, modname, fn1 , tmp);
- wsprintf(fn, "fn%d", ++i);
- }
- wsprintf(fn, "fn%d", --i);
- DBDeleteContactSetting(NULL, modname, fn);
- SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
- SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
- }
-
- }
- break;
-
-
- case IDC_FILE_LIST:
- if (HIWORD(wParam) == CBN_SELCHANGE )
- {
- int index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
- char fn[6], tmp[MAX_PATH];
- SetDlgItemText(hwnd, IDC_FN, itoa(index, fn, 10));
- wsprintf(fn, "fn%d", index);
- if (DBGetContactSettingString(NULL, modname, fn, tmp) )
- {
- if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://")))
- {
- SetDlgItemText(hwnd,IDC_URL, tmp);
- SetDlgItemText(hwnd, IDC_WWW_TIMER, itoa(DBGetContactSettingWord(NULL, modname, strcat(fn, "_timer"), 60), tmp, 10));
- }
- else
- {
- SetDlgItemText(hwnd,IDC_URL, "");
- SetDlgItemText(hwnd, IDC_WWW_TIMER,"");
- }
- readFile(hwnd);
- }
- }
- break;
- case IDCANCEL:
- DestroyWindow(hwnd);
- break;
- return TRUE;
- }
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- int i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
- int timer;
- char fn[MAX_PATH], string[1000];;
- wsprintf(fn , "fn%d", i);
- if(GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER)))
- {
- char text[5];
- GetDlgItemText(hwnd,IDC_WWW_TIMER,text,sizeof(text));
- timer = atoi(text);
- }
- else timer = 60;
- if (DBGetContactSettingString(NULL, modname, fn, string) )
- {
- if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://")))
- DBWriteContactSettingWord(NULL, modname, strcat(fn, "_timer"), (WORD)timer);
- }
-
- }
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
-
-char* getMimDir(char* file)
-{
- char *p1;
- GetModuleFileName(NULL,file, MAX_PATH);
-
- p1 = strrchr(file,'\\');
- if (p1)
- *p1 = '\0';
- if (file[0] == '\\')
- {
- file[strlen(file)-1] = '\0';
- }
- return file;
-}
diff --git a/plugins/!NotAdopted/Non-IM Contact/main.c b/plugins/!NotAdopted/Non-IM Contact/main.c deleted file mode 100644 index 4fa42d552f..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/main.c +++ /dev/null @@ -1,272 +0,0 @@ -
-
-//=====================================================
-// Includes
-//=====================================================
-#include "commonheaders.h"
-
-#pragma comment(linker,"/MERGE:.rdata=.text")
-#pragma comment(linker,"/FILEALIGN:512 /SECTION:.text,EWRX /IGNORE:4078")
-
-HINSTANCE hinstance;
-PLUGINLINK *pluginLink;
-
-PLUGININFO pluginInfo={
- sizeof(PLUGININFO),
- "Non-IM Contact",
- PLUGIN_MAKE_VERSION(0,5,0,1),
- "Non-IM Contact allows you to add \"contacts\" that can act as shortcuts to other programs, or links to web pages.\r\nThe contacts name can be read from a text file (includes any ASCII file).\r\nThis plugin is a combination of Favorites and Text Reader plugins both made by me)",
- "Jonathan Gordon",
- "ICQ 98791178, MSN jonnog@hotmail.com",
- "© 2003-2004 Jonathan Gordon, jdgordy@gmail.com",
- "",
- 0,
- 0
-};
-
-int doubleClick(WPARAM wParam,LPARAM lParam)
-{
- char program[MAX_PATH], params[MAX_PATH];
- int shellEXEerror = 0;
- char* proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)wParam, 0);
- if (proto && !strcmp(proto, modname))
- {
- if (GetKeyState(VK_CONTROL)&0x8000) // ctrl is pressed
- editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL); // for later when i add a second double click setting
- else if (DBGetContactSettingString((HANDLE)wParam, modname, "Program", program) && strcmp(program, ""))
- {
- if (!DBGetContactSettingString((HANDLE)wParam, modname, "ProgramParams", params) )
- strcpy(params, "");
- if (strstr(program, "http://") || strstr(program, "https://"))
- CallService(MS_UTILS_OPENURL,1,(LPARAM)program);
- else shellEXEerror = (int)ShellExecute(NULL,NULL,program,params,NULL,SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :)
- if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND)
- CallService(MS_UTILS_OPENURL,1,(LPARAM)program);
- }
- else editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL);
- return 1;
- }
- return 0;
-}
-
-//=====================================================
-// Definitions
-//=====================================================
-int LCStatus = ID_STATUS_OFFLINE;
-//=====================================================
-
-//=====================================================
-// Name : MainInit
-// Parameters: wparam , lparam
-// Returns : int
-// Description : Called at very beginning of plugin
-//=====================================================
-int NimcOptInit(WPARAM wParam,LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp;
-
- ZeroMemory(&odp,sizeof(odp));
- odp.cbSize=sizeof(odp);
- odp.position=0;
- odp.hInstance=hInst;
- odp.pszTemplate=MAKEINTRESOURCE(IDD_OPTIONS);
- odp.pszGroup= Translate("Plugins");
- odp.pszTitle=Translate("Non-IM Contacts");
- odp.pfnDlgProc=DlgProcNimcOpts;
- odp.expertOnlyControls=NULL;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
-
- return 0;
-}
-
-int MainInit(WPARAM wparam,LPARAM lparam)
-{
- return 0;
-}
-
-//=====================================================
-// Name : __declspec(dllexport) PLUGININFO* MirandaPluginInfo
-// Parameters: (DWORD mirandaVersion)
-// Returns :
-// Description : Sets plugin info
-//=====================================================
-
-__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
-{
-return &pluginInfo;
-}
-
-//=====================================================
-// Name : Unload
-// Parameters: void
-// Returns :
-// Description : Unloads plugin
-//=====================================================
-
-__declspec(dllexport)int Unload(void)
-{
- return 0;
-}
-
-//=====================================================
-// Name : WINAPI DllMain
-// Parameters: HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved
-// Returns : BOOL
-// Description :
-//=====================================================
-
-BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved)
-{
- hInst=hinst;
- return TRUE;
-}
-HANDLE hModulesLoadedHook;
-int ModulesLoaded(WPARAM wParam,LPARAM lParam)
-{
- NetlibInit();
- UnhookEvent(hModulesLoadedHook);
- return 0;
-}
-
-//=====================================================
-// Name : Load
-// Parameters: PLUGINLINK *link
-// Returns : int
-// Description : Called when plugin is loaded into Miranda
-//=====================================================
-
-int __declspec(dllexport)Load(PLUGINLINK *link)
-{
-
- PROTOCOLDESCRIPTOR pd;
- CLISTMENUITEM mi;
-
- pluginLink=link;
-
- HookEvent(ME_CLIST_DOUBLECLICKED,doubleClick);
- HookEvent(ME_OPT_INITIALISE,NimcOptInit);
-
- ZeroMemory(&pd,sizeof(pd));
- pd.cbSize=sizeof(pd);
- pd.szName=modname;
- pd.type=PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
-
- //load services (the first 5 are the basic ones needed to make a new protocol)
- CreateServiceFunction(modname PS_GETCAPS,GetLCCaps);
- CreateServiceFunction(modname PS_GETNAME,GetLCName);
- CreateServiceFunction(modname PS_LOADICON,LoadLCIcon);
- HookEvent(ME_CLIST_STATUSMODECHANGE,SetLCStatus);
- CreateServiceFunction(modname PS_GETSTATUS,GetLCStatus);
-
-
- CreateServiceFunction("AddLCcontact",addContact);
- CreateServiceFunction("EditLCcontact",editContact);
- CreateServiceFunction("LoadFilesDlg",LoadFilesDlg);
- CreateServiceFunction("ExportLCcontacts",exportContacts);
- CreateServiceFunction("ImportLCcontacts",ImportContacts);
- CreateServiceFunction("TestStringReplaceLine",testStringReplacer);
- CreateServiceFunction("NIM_Contact/DoubleClick",doubleClick);
-
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=600090000;
- mi.flags=0;
- mi.pszContactOwner=NULL;
- mi.pszPopupName=Translate("&Non-IM Contact");
- mi.popupPosition=600090000;
- mi.pszName=Translate("&Add Non-IM Contact");
- mi.pszService="AddLCcontact";
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=600090001;
- mi.flags=0;
- mi.pszContactOwner=NULL;
- mi.pszPopupName=Translate("&Non-IM Contact");
- mi.popupPosition=600090000;
- mi.pszName=Translate("&View/Edit Files");
- mi.pszService="LoadFilesDlg";
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-
- if (DBGetContactSettingByte(NULL, modname, "Beta",0))
- {
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=600090000;
- mi.flags=0;
- mi.pszContactOwner=NULL;
- mi.pszPopupName=Translate("&Non-IM Contact");
- mi.popupPosition=600090000;
- mi.pszName=Translate("&Export all Non-IM Contacts");
- mi.pszService="ExportLCcontacts";
- // mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=600090000;
- mi.flags=0;
- mi.popupPosition=600090000;
- mi.pszContactOwner=NULL;
- mi.pszPopupName=Translate("&Non-IM Contact");
- mi.pszName=Translate("&Import Non-IM Contacts");
- mi.pszService="ImportLCcontacts";
- // mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
- }
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=600090000;
- mi.flags=0;
- mi.popupPosition=600090000;
- mi.pszContactOwner=NULL;
- mi.pszPopupName=Translate("&Non-IM Contact");
- mi.pszName=Translate("&String Maker");
- mi.pszService="TestStringReplaceLine";
-// mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=-2000080000;
- mi.flags=0;
- mi.pszContactOwner=modname;
- mi.pszName=Translate("E&dit Contact Settings");
- mi.pszService="EditLCcontact";
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
- CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
-
- hWindowList=(HWND)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
- hModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
-
-
- { // known modules list
- DBVARIANT dbv;
- if (DBGetContactSetting(NULL, "KnownModules","Non-IM Contact", &dbv))
- DBWriteContactSettingString(NULL, "KnownModules","Non-IM Contact", modname);
- DBFreeVariant(&dbv);
- }
-
- return 0;
-}
-/*
-//uninstall support
-int __declspec(dllexport) UninstallEx(PLUGINUNINSTALLPARAMS* ppup)
-{
- // Delete Files
- const char* apszFiles[] = {"nimcontact_readme.txt", 0};
- PUIRemoveFilesInDirectory(ppup->pszPluginsPath, apszFiles);
-
- if((ppup->bDoDeleteSettings == TRUE) && (ppup->bIsMirandaRunning == TRUE))
- {
- char szModule[] = modname;
- PUICallService(MS_PLUGINUNINSTALLER_REMOVEDBMODULE, (WPARAM)szModule, (LPARAM)NULL);
- }
- return 0;
-}*/
\ No newline at end of file diff --git a/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp b/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp deleted file mode 100644 index 51846a4ab3..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp +++ /dev/null @@ -1,155 +0,0 @@ -# Microsoft Developer Studio Project File - Name="nimcontact" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=nimcontact - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "nimcontact.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "nimcontact.mak" CFG="nimcontact - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "nimcontact - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "nimcontact - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "nimcontact - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NIMCONTACT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NIMCONTACT_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc09 /d "NDEBUG"
-# ADD RSC /l 0xc09 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "nimcontact - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NIMCONTACT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NIMCONTACT_EXPORTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc09 /d "_DEBUG"
-# ADD RSC /l 0xc09 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"h:\mim\plugins\nimcontact.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "nimcontact - Win32 Release"
-# Name "nimcontact - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\contactinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dialog.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\files.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\namereplacing.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\services.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\threads.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\timer.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\commonheaders.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\star8.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsw b/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsw deleted file mode 100644 index 79b4f45af5..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "nimcontact"=.\nimcontact.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/plugins/!NotAdopted/Non-IM Contact/services.c b/plugins/!NotAdopted/Non-IM Contact/services.c deleted file mode 100644 index 13d7876edd..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/services.c +++ /dev/null @@ -1,129 +0,0 @@ -#include "commonheaders.h"
-
-//=======================================================
-//DBGetContactSettingString
-//=======================================================
-int DBGetContactSettingString(HANDLE hContact, char* szModule, char* szSetting, char* value)
-{
- DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, szModule, szSetting, &dbv))
- {
- strcpy(value, dbv.pszVal);
- DBFreeVariant(&dbv);
- return 1;
- }
- else
- {
- DBFreeVariant(&dbv);
- return 0;
- }
-
- return 0;
-}
-
-//=======================================================
-//GetCaps
-//=======================================================
-
-int GetLCCaps(WPARAM wParam,LPARAM lParam)
-{
- if(wParam==PFLAGNUM_1)
- return 0;
- if(wParam==PFLAGNUM_2)
- return PF2_ONLINE|PF2_LONGAWAY|PF2_SHORTAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_INVISIBLE|PF2_OUTTOLUNCH|PF2_ONTHEPHONE; // add the possible statuses here.
- if(wParam==PFLAGNUM_3)
- return 0;
- return 0;
-}
-
-//=======================================================
-//GetName
-//=======================================================
-int GetLCName(WPARAM wParam,LPARAM lParam)
-{
- lstrcpyn((char*)lParam,modname,wParam);
- return 0;
-}
-
-//=======================================================
-//BPLoadIcon
-//=======================================================
-int LoadLCIcon(WPARAM wParam,LPARAM lParam)
-{
- UINT id;
-
- switch(wParam&0xFFFF) {
- case PLI_PROTOCOL: id=IDI_MAIN; break; // IDI_MAIN is the main icon for the protocol
- default: return (int)(HICON)NULL;
- }
- return (int)LoadImage(hInst,MAKEINTRESOURCE(id),IMAGE_ICON,GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON),GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON),0);
-}
-
-//=======================================================
-//SetFStatus
-//=======================================================
-int SetLCStatus(WPARAM wParam,LPARAM lParam)
-{
- int oldStatus;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- const char* szProto = (const char*)lParam;
- if (szProto && strcmp(szProto, modname)) return 0; // not nimc so ignore anyway...
- else if (!szProto && DBGetContactSettingByte(NULL, modname, "IgnoreGlobalStatusChange",0)) return 0; // global change and being ignored
- else
- {
- oldStatus = LCStatus;
- LCStatus = wParam;
- DBWriteContactSettingWord(NULL, modname, "Status", (WORD)wParam);
- DBWriteContactSettingWord(NULL, modname, "timerCount",0);
- if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !DBGetContactSettingByte(NULL, modname, "AwayAsStatus", 0)) || !DBGetContactSettingWord(NULL, modname, "Timer",1)) killTimer();
- else if (DBGetContactSettingWord(NULL, modname, "Timer",1))
- startTimer(TIMER);
- while (hContact)
- {
- const char* proto = (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (proto && !strcmp(proto, modname))
- {
- if (LCStatus != ID_STATUS_OFFLINE) replaceAllStrings(hContact);
- switch (LCStatus)
- {
- case ID_STATUS_OFFLINE:
- if (DBGetContactSettingByte(hContact, modname, "AlwaysVisible",0) && !DBGetContactSettingByte(hContact, modname, "VisibleUnlessOffline",1))
- DBWriteContactSettingWord(hContact,modname, "Status",(WORD)DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE));
- else DBWriteContactSettingWord(hContact,modname, "Status", ID_STATUS_OFFLINE);
- break;
- case ID_STATUS_ONLINE:
- DBWriteContactSettingWord(hContact,modname, "Status",(WORD)DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE));
- break;
- case ID_STATUS_AWAY:
- if (DBGetContactSettingByte(NULL, modname, "AwayAsStatus", 0) && (DBGetContactSettingByte(hContact, modname, "AlwaysVisible",0) || (DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE)==ID_STATUS_AWAY)) )
- DBWriteContactSettingWord(hContact,modname, "Status",(WORD)(WORD)DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE));
- else if (!DBGetContactSettingByte(NULL, modname, "AwayAsStatus", 0))
- DBWriteContactSettingWord(hContact,modname, "Status",(WORD)DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE));
- else DBWriteContactSettingWord(hContact,modname, "Status", ID_STATUS_OFFLINE);
- break;
- default:
- if (DBGetContactSettingByte(hContact, modname, "AlwaysVisible",0) || LCStatus == DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE))
- DBWriteContactSettingWord(hContact,modname, "Status",(WORD)DBGetContactSettingWord(hContact,modname, "Icon",ID_STATUS_ONLINE));
- break;
- }
- }
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
- }
- ProtoBroadcastAck(modname,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldStatus,wParam);
- }
- return 0;
-}
-
-
-
-//=======================================================
-//GetStatus
-//=======================================================
-int GetLCStatus(WPARAM wParam,LPARAM lParam)
-{
- if ((LCStatus >= ID_STATUS_ONLINE) && (LCStatus <= ID_STATUS_OUTTOLUNCH))
- return LCStatus;
- else
- return ID_STATUS_OFFLINE;
-}
-
diff --git a/plugins/!NotAdopted/Non-IM Contact/threads.c b/plugins/!NotAdopted/Non-IM Contact/threads.c deleted file mode 100644 index c39fae61a7..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/threads.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "commonheaders.h"
-
-// thread stuff
-
-struct FORK_ARG {
- HANDLE hEvent;
- void (__cdecl *threadcode)(void*);
- unsigned (__stdcall *threadcodeex)(void*);
- void *arg;
-};
-
-void __cdecl forkthread_r(void *param)
-{
- struct FORK_ARG *fa=(struct FORK_ARG*)param;
- void (*callercode)(void*)=fa->threadcode;
- void *arg=fa->arg;
-
- CallService(MS_SYSTEM_THREAD_PUSH,0,0);
-
- SetEvent(fa->hEvent);
-
- __try {
- callercode(arg);
- } __finally {
- CallService(MS_SYSTEM_THREAD_POP,0,0);
- }
-
- return;
-}
-
-unsigned long forkthread ( void (__cdecl *threadcode)(void*),unsigned long stacksize,void *arg)
-{
- unsigned long rc;
- struct FORK_ARG fa;
-
- fa.hEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
- fa.threadcode=threadcode;
- fa.arg=arg;
-
- rc=_beginthread(forkthread_r,stacksize,&fa);
-
- if ((unsigned long)-1L != rc) {
- WaitForSingleObject(fa.hEvent,INFINITE);
- }
- CloseHandle(fa.hEvent);
-
- return rc;
-}
-
diff --git a/plugins/!NotAdopted/Non-IM Contact/timer.c b/plugins/!NotAdopted/Non-IM Contact/timer.c deleted file mode 100644 index 8d3f6bf4de..0000000000 --- a/plugins/!NotAdopted/Non-IM Contact/timer.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "commonheaders.h"
-
-
-//=====================================================
-// Name : timerProc
-// Parameters: none
-// Returns : void
-// Description : called when the timer interval occurs
-//=====================================================
-void __cdecl timerFunc(LPVOID di)
-{
- HANDLE hContact;
- char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
- int i, timer;
- int timerCount = DBGetContactSettingWord(NULL, modname, "timerCount",1)+1;
-
-// killTimer();
- if (LCStatus == ID_STATUS_OFFLINE)
- {
- killTimer();
- return;
- }
- DBWriteContactSettingWord(NULL, modname, "timerCount", (WORD)timerCount);
- /* update the web pages*/
- for (i=0; ;i++)
- {
- sprintf(fn, "fn%d", i);
- if (!DBGetContactSettingString(NULL, modname, fn, text))
- break;
- if (!strncmp("http://", text, strlen("http://")))
- {
- strcat(fn, "_timer");
- timer = DBGetContactSettingWord(NULL,modname, fn, 60);
- if (timer && !(timerCount % timer))
- {
- if (!InternetDownloadFile(text))
- {
- wsprintf(szFileName,"%s\\plugins\\fn%d.html",getMimDir(temp), i);
- savehtml(szFileName);
- }
- }
- }
- }
- /* update all the contacts */
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hContact)
- {
- if(!lstrcmp(modname,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0)) )
- {
- timer = DBGetContactSettingWord(hContact, modname, "Timer", 15);
- if (timer && !(timerCount % timer))
- {
- if (DBGetContactSettingString(hContact, modname, "Name", text))
- replaceAllStrings(hContact);
- }
- }
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
- }
-// startTimer(TIMER);
-}
-
-
-void CALLBACK timerProc()
-{
-
-// new thread for the timer...
- forkthread(timerFunc, 0, 0);
-// timerFunc(0);
-
-}
-
-//=====================================================
-// Name : startTimer
-// Parameters: int interval
-// Returns : int
-// Description : starts the timer
-//=====================================================
-int startTimer(int interval)
-{
- timerId = SetTimer(NULL, 0, interval, timerProc);
- return 0;
-}
-
-//=====================================================
-// Name : killTimer
-// Parameters: none
-// Returns : int
-// Description : stops the timer
-//=====================================================
-int killTimer()
-{
- DBWriteContactSettingWord(NULL, modname, "timerCount",0);
- KillTimer(NULL,timerId);
- return 0;
-}
\ No newline at end of file diff --git a/plugins/!NotAdopted/Non-IM Contact/nimcontact_readme.txt b/plugins/Non-IM Contact/docs/nimcontact_readme.txt index 4ff9131aa4..4ff9131aa4 100644 --- a/plugins/!NotAdopted/Non-IM Contact/nimcontact_readme.txt +++ b/plugins/Non-IM Contact/docs/nimcontact_readme.txt diff --git a/plugins/!NotAdopted/Non-IM Contact/todo.txt b/plugins/Non-IM Contact/docs/todo.txt index 4fb4ffe442..4fb4ffe442 100644 --- a/plugins/!NotAdopted/Non-IM Contact/todo.txt +++ b/plugins/Non-IM Contact/docs/todo.txt diff --git a/plugins/Non-IM Contact/nimcontact_10.vcxproj b/plugins/Non-IM Contact/nimcontact_10.vcxproj new file mode 100644 index 0000000000..0147a23d41 --- /dev/null +++ b/plugins/Non-IM Contact/nimcontact_10.vcxproj @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>NimContact</ProjectName>
+ <ProjectGuid>{A556E0B5-73A1-4676-BA1F-133820DE7D5A}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary>true</IgnoreImportLibrary>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Full</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <MinimalRebuild>true</MinimalRebuild>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Disabled</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <MinimalRebuild>true</MinimalRebuild>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Full</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Disabled</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="src\commonheaders.h" />
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\Version.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="res\resource.rc" />
+ <ResourceCompile Include="res\Version.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\contactinfo.cpp" />
+ <ClCompile Include="src\dialog.cpp" />
+ <ClCompile Include="src\files.cpp" />
+ <ClCompile Include="src\http.cpp" />
+ <ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\namereplacing.cpp" />
+ <ClCompile Include="src\services.cpp" />
+ <ClCompile Include="src\stdafx.cpp">
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="src\timer.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/Non-IM Contact/nimcontact_10.vcxproj.filters b/plugins/Non-IM Contact/nimcontact_10.vcxproj.filters new file mode 100644 index 0000000000..d26dfe6647 --- /dev/null +++ b/plugins/Non-IM Contact/nimcontact_10.vcxproj.filters @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{08a21636-368d-4feb-8d0d-0a27f237e1a2}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{9e6f20dc-3391-4299-9f74-e91d4f984ad3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{18fd6180-ebb2-4558-b945-c4dac823f11b}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\Version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\commonheaders.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="res\resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\contactinfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\files.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\http.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\main.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\namereplacing.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\services.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\timer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/Non-IM Contact/nimcontact_11.vcxproj b/plugins/Non-IM Contact/nimcontact_11.vcxproj new file mode 100644 index 0000000000..21867e454e --- /dev/null +++ b/plugins/Non-IM Contact/nimcontact_11.vcxproj @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>NimContact</ProjectName>
+ <ProjectGuid>{A556E0B5-73A1-4676-BA1F-133820DE7D5A}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary>true</IgnoreImportLibrary>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Full</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <MinimalRebuild>true</MinimalRebuild>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Disabled</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <MinimalRebuild>true</MinimalRebuild>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Full</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <Optimization>Disabled</Optimization>
+ <WarningLevel>Level3</WarningLevel>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <ExceptionHandling>false</ExceptionHandling>
+ <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <LinkDLL>true</LinkDLL>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x30040000</BaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="src\commonheaders.h" />
+ <ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\Version.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="res\resource.rc" />
+ <ResourceCompile Include="res\Version.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\contactinfo.cpp" />
+ <ClCompile Include="src\dialog.cpp" />
+ <ClCompile Include="src\files.cpp" />
+ <ClCompile Include="src\http.cpp" />
+ <ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\namereplacing.cpp" />
+ <ClCompile Include="src\services.cpp" />
+ <ClCompile Include="src\stdafx.cpp">
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="src\timer.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/Non-IM Contact/nimcontact_11.vcxproj.filters b/plugins/Non-IM Contact/nimcontact_11.vcxproj.filters new file mode 100644 index 0000000000..d26dfe6647 --- /dev/null +++ b/plugins/Non-IM Contact/nimcontact_11.vcxproj.filters @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{08a21636-368d-4feb-8d0d-0a27f237e1a2}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{9e6f20dc-3391-4299-9f74-e91d4f984ad3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{18fd6180-ebb2-4558-b945-c4dac823f11b}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\Version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\commonheaders.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="res\resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\contactinfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\files.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\http.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\main.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\namereplacing.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\services.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\timer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/Non-IM Contact/res/Version.rc b/plugins/Non-IM Contact/res/Version.rc new file mode 100644 index 0000000000..5bfbab4754 --- /dev/null +++ b/plugins/Non-IM Contact/res/Version.rc @@ -0,0 +1,38 @@ +// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#include "afxres.h"
+#include "..\src\version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/plugins/!NotAdopted/Non-IM Contact/nimc.jpg b/plugins/Non-IM Contact/res/nimc.jpg Binary files differindex bd345bfb62..bd345bfb62 100644 --- a/plugins/!NotAdopted/Non-IM Contact/nimc.jpg +++ b/plugins/Non-IM Contact/res/nimc.jpg diff --git a/plugins/!NotAdopted/Non-IM Contact/resource.rc b/plugins/Non-IM Contact/res/resource.rc index db99c53676..0385c90289 100644 --- a/plugins/!NotAdopted/Non-IM Contact/resource.rc +++ b/plugins/Non-IM Contact/res/resource.rc @@ -1,6 +1,6 @@ //Microsoft Developer Studio generated resource script.
//
-#include "resource.h"
+#include "../src/resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/!NotAdopted/Non-IM Contact/star8.ico b/plugins/Non-IM Contact/res/star8.ico Binary files differindex a4953cd753..a4953cd753 100644 --- a/plugins/!NotAdopted/Non-IM Contact/star8.ico +++ b/plugins/Non-IM Contact/res/star8.ico diff --git a/plugins/Non-IM Contact/src/Version.h b/plugins/Non-IM Contact/src/Version.h new file mode 100644 index 0000000000..ae84abc336 --- /dev/null +++ b/plugins/Non-IM Contact/src/Version.h @@ -0,0 +1,14 @@ +#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 6
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+
+#define __PLUGIN_NAME "Non-IM Contact"
+#define __FILENAME "NimContact.dll"
+#define __DESCRIPTION "Non-IM Contact allows you to add 'contacts' that can act as shortcuts to other programs, or links to web pages.\r\nThe contacts name can be read from a text file (includes any ASCII file).\r\nThis plugin is a combination of Favorites and Text Reader plugins both made by me)"
+#define __AUTHOR "Jonathan Gordon"
+#define __AUTHOREMAIL "ICQ 98791178, MSN jonnog@hotmail.com"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2003-2004 Jonathan Gordon, jdgordy@gmail.com"
diff --git a/plugins/Non-IM Contact/src/commonheaders.h b/plugins/Non-IM Contact/src/commonheaders.h new file mode 100644 index 0000000000..a512a40b06 --- /dev/null +++ b/plugins/Non-IM Contact/src/commonheaders.h @@ -0,0 +1,128 @@ +//=====================================================
+// Includes (yea why not include lots of stuff :p )
+//=====================================================
+#ifndef COMMONHEADERS
+#define COMMONHEADERS
+
+#define _CRT_SECURE_NO_WARNINGS
+
+#include <windows.h>
+#include <commctrl.h>
+#include <winsock.h>
+#include <shlobj.h>
+
+#include <stdio.h>
+#include <time.h>
+#include <stddef.h>
+#include <process.h>
+#include <string.h>
+
+struct DLGTEMPLATEEX
+{
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x;
+ short y;
+ short cx;
+ short cy;
+};
+
+#include <newpluginapi.h>
+#include <m_clist.h>
+#include <m_clui.h>
+#include <m_skin.h>
+#include <m_langpack.h>
+#include <m_protomod.h>
+#include <m_database.h>
+#include <m_system.h>
+#include <m_protocols.h>
+#include <m_userinfo.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_utils.h>
+#include <m_ignore.h>
+#include <m_clc.h>
+#include <m_netlib.h>
+#include <win2k.h>
+
+#include "resource.h"
+
+//=======================================================
+// Definitions
+//=======================================================
+#define MODNAME "NIM_Contact"
+#define modFullname "Non-IM Contact"
+#define MAXLINES 10000
+#define MAX_STRING_LENGTH 10000
+#define LINE_LENGTH 10000
+#define msg(a,b) MessageBoxA(0,a,b,MB_OK);
+#define TIMER (db_get_w(NULL, MODNAME, "Timer", 1) * 1000)
+/* ERROR VALUES */
+#define ERROR_NO_LINE_AFTER_VAR_F -1
+#define ERROR_LINE_NOT_READ -2
+#define ERROR_NO_FILE -3
+
+//=======================================================
+// Defines
+//=======================================================
+//General
+extern HINSTANCE hInst;
+extern int LCStatus;
+static HANDLE hWindowList=NULL;
+
+//Services.c
+INT_PTR GetLCCaps(WPARAM wParam,LPARAM lParam);
+INT_PTR GetLCName(WPARAM wParam,LPARAM lParam);
+INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam);
+int SetLCStatus(WPARAM wParam,LPARAM lParam);
+INT_PTR GetLCStatus(WPARAM wParam,LPARAM lParam);
+
+// dialog.c
+INT_PTR addContact(WPARAM wParam,LPARAM lParam) ;
+INT_PTR editContact(WPARAM wParam,LPARAM lParam);
+INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR testStringReplacer(WPARAM wParam, LPARAM lParam);
+INT_PTR LoadFilesDlg(WPARAM wParam, LPARAM lParam);
+
+
+// files.c
+int Openfile(char* outputFile, int saveOpen);
+INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+int savehtml(char* outFile);
+char* getMimDir(char* file);
+INT_PTR exportContacts(WPARAM wParam,LPARAM lParam) ;
+
+// contactinfo.c
+INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+void ExportContact(HANDLE hContact);
+INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam);
+
+// stringreplacer.c
+int stringReplacer(const char* oldString, char* newString, HANDLE hContact);
+void replaceAllStrings(HANDLE hContact);
+void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module12, char* setting2);
+
+//timer.c
+extern UINT_PTR timerId;
+void CALLBACK timerProc();
+int startTimer(int interval);
+int killTimer();
+
+// http.c
+void NetlibInit();
+int InternetDownloadFile (CHAR *szUrl);
+extern char *szInfo;
+extern char *szData;
+extern HANDLE hNetlibUser;
+
+int db_get_static(HANDLE hContact, const char *moduleName, const char *fn, char *buf);
+
+#endif
+
+#pragma comment(lib,"comctl32.lib")
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp new file mode 100644 index 0000000000..7b79a6c6f2 --- /dev/null +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -0,0 +1,707 @@ +#include "commonheaders.h"
+
+INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ case WM_INITDIALOG:
+ {
+ HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
+ char name[2048];
+ TranslateDialogDefault(hwnd);
+ SetWindowLong(hwnd, GWLP_USERDATA, (LPARAM)(HANDLE)hContact);
+
+ if (!db_get_static(hContact, MODNAME, "Name", name)) break;
+ SetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, name);
+ if (!db_get_static(hContact, MODNAME, "ToolTip", name)) break;
+ SetDlgItemTextA(hwnd, IDC_TOOLTIP, name);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ return TRUE;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA);
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_DISPLAY_NAME))) {
+ char text[512];
+ GetDlgItemTextA(hwnd,IDC_DISPLAY_NAME,text,sizeof(text));
+ db_set_s(hContact, MODNAME, "Name", text);
+ WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
+ }
+ else {
+ db_unset(hContact, MODNAME, "Name");
+ db_unset(hContact, MODNAME, "Nick");
+ }
+
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_TOOLTIP))) {
+ char text[2048];
+ GetDlgItemTextA(hwnd,IDC_TOOLTIP,text,sizeof(text));
+ db_set_s(hContact, MODNAME, "ToolTip", text);
+ WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
+ }
+ else {
+ db_unset(hContact, MODNAME, "ToolTip");
+ db_unset(hContact, "UserInfo", "MyNotes");
+ }
+ }
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+static WNDPROC g_PrevBtnWndProc = 0;
+
+LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT res = CallWindowProc(g_PrevBtnWndProc, hWnd, message, wParam, lParam);
+ if (WM_PAINT == message) {
+ RECT rc;
+ HDC dc = GetDC(hWnd);
+ BOOL isPressed = BST_CHECKED == SendMessage(hWnd, BM_GETCHECK, 0, 0);
+
+ GetClientRect(hWnd, &rc);
+ rc.left += (rc.right - rc.left - 16) / 2;
+ rc.top += (rc.bottom - rc.top - 16) / 2;
+ if (isPressed)
+ OffsetRect(&rc, 1, 1);
+ DrawIconEx(dc, rc.left, rc.top, (HICON)GetWindowLong(hWnd, GWLP_USERDATA),
+ 16, 16, 0, 0, DI_NORMAL);
+ ReleaseDC(hWnd, dc);
+ }
+
+ return res;
+}
+
+void checkGroups(char* group)
+{
+ int i;
+ char str[50], name[256];
+ DBVARIANT dbv;
+
+ if (lstrlenA(group) < 1)
+ return;
+
+ for (i = 0;; i++) {
+ _itoa(i, str, 10);
+ if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ break;
+
+ if (dbv.type == DBVT_ASCIIZ) {
+ if (dbv.pszVal[0] != '\0' && !lstrcmpiA(dbv.pszVal + 1, group)) {
+ db_free(&dbv);
+ return;
+ }
+
+ db_free(&dbv);
+ }
+ }
+ name[0] = 1 | GROUPF_EXPANDED;
+ strncpy(name + 1, group, sizeof(name) - 1);
+ name[strlen(group) + 1] = '\0';
+ db_set_s(NULL, "CListGroups", str, name);
+ CallService(MS_CLUI_GROUPADDED, i + 1, 0);
+}
+
+int BrowseForFolder(HWND hwnd,char *szPath)
+{
+ int result=0;
+
+ if (SUCCEEDED(OleInitialize(NULL))) {
+ LPMALLOC pMalloc;
+ if (SUCCEEDED(CoGetMalloc(1,&pMalloc))) {
+ mir_ptr<TCHAR> tszPath( mir_a2t(szPath));
+ BROWSEINFO bi={0};
+ bi.hwndOwner = hwnd;
+ bi.pszDisplayName = tszPath;
+ bi.lpszTitle = TranslateT("Select Folder");
+ bi.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS; // Use this combo instead of BIF_USENEWUI
+ bi.lParam = (LPARAM)szPath;
+
+ ITEMIDLIST *pidlResult = SHBrowseForFolder(&bi);
+ if (pidlResult) {
+ SHGetPathFromIDListA(pidlResult, szPath);
+ lstrcatA(szPath,"\\");
+ result = 1;
+ }
+ pMalloc->Free(pidlResult);
+ pMalloc->Release();
+ }
+ OleUninitialize();
+ }
+ return result;
+}
+
+INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ case WM_INITDIALOG:
+ {
+ int i = 0;
+ DBVARIANT dbv;
+ char string[512];
+ HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
+ TranslateDialogDefault(hwnd);
+ SetWindowLong(hwnd, GWLP_USERDATA, (LPARAM)(HANDLE)hContact);
+ if (!hContact)
+ break;
+
+ /* link*/
+ if (db_get_static(hContact, MODNAME, "ProgramString", string))
+ SetDlgItemTextA(hwnd, IDC_LINK, string);
+ if (db_get_static(hContact, MODNAME, "ProgramParamsString", string))
+ SetDlgItemTextA(hwnd, IDC_PARAMS, string);
+ /* group*/
+ while (i != -1)
+ {
+ char str[3], name[256];
+ wsprintfA(str, "%d", i);
+ if (!DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ {
+ lstrcpynA(name,dbv.pszVal+1,sizeof(name));
+ SendMessage(GetDlgItem(hwnd, IDC_GROUP), CB_INSERTSTRING,0, (LPARAM)name);
+ i++;
+ }
+ else i = -1;
+ }
+ if (!DBGetContactSetting(hContact, "CList", "Group", &dbv))
+ SetDlgItemTextA(hwnd, IDC_GROUP, dbv.pszVal);
+
+ /* icons */
+ CheckRadioButton(hwnd, 40072, 40080, db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE));
+ SetWindowLong(GetDlgItem(hwnd, CHK_ONLINE), GWLP_USERDATA, (LONG)LoadSkinnedProtoIcon(MODNAME, ID_STATUS_ONLINE));
+ g_PrevBtnWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwnd, CHK_ONLINE), GWLP_WNDPROC, (LONG)ButtWndProc);
+ for (i = ID_STATUS_ONLINE; i<=ID_STATUS_OUTTOLUNCH; i++) {
+ SetWindowLong(GetDlgItem(hwnd, i), GWLP_USERDATA, (LONG)LoadSkinnedProtoIcon(MODNAME, i));
+ SetWindowLong(GetDlgItem(hwnd, i), GWLP_WNDPROC, (LONG)ButtWndProc);
+ }
+ db_free(&dbv);
+ /* timer */
+ CheckDlgButton(hwnd, CHK_USE_TIMER, db_get_b(hContact, MODNAME ,"UseTimer", 0));
+ if (db_get_w(hContact, MODNAME ,"Timer", 15)) {
+ CheckDlgButton(hwnd, CHK_USE_TIMER,1);
+ EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
+ SetDlgItemTextA(hwnd, IDC_TIMER, _itoa(db_get_w(hContact, MODNAME ,"Timer", 15), string, 10));
+ if (!db_get_w(NULL, MODNAME ,"Timer", 1))
+ SetDlgItemTextA(hwnd,IDC_TIMER_INTERVAL_MSG, "Non-IM Contact protocol timer is Disabled");
+ else {
+ _snprintf(string, sizeof(string), "Timer intervals... Non-IM Contact Protocol timer is %d seconds",db_get_w(NULL, MODNAME ,"Timer", 1));
+ SetDlgItemTextA(hwnd,IDC_TIMER_INTERVAL_MSG, string);
+ }
+ }
+ /* always visible */
+ if (db_get_b(hContact, MODNAME ,"AlwaysVisible", 0)) {
+ CheckDlgButton(hwnd, IDC_ALWAYS_VISIBLE, 1);
+ EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),1);
+ CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, db_get_b(hContact, MODNAME ,"VisibleUnlessOffline", 1));
+ }
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ switch(LOWORD(wParam)) {
+ case IDC_ALWAYS_VISIBLE:
+ if (IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE)) {
+ HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA);
+ EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),1);
+ CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, db_get_b(hContact, MODNAME ,"VisibleUnlessOffline", 1));
+ }
+ else EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),0);
+ break;
+
+ case CHK_USE_TIMER:
+ if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER)) {
+ HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA);
+ char string[4];
+ EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
+ SetDlgItemTextA(hwnd, IDC_TIMER, _itoa(db_get_w(hContact, MODNAME ,"Timer", 15), string, 10));
+ }
+ else EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 0);
+ break;
+
+ case IDC_OPEN_FILE:
+ {
+ char szFileName[512];
+ if ( Openfile(szFileName,1))
+ SetDlgItemTextA(hwnd, IDC_LINK, szFileName);
+ }
+ break;
+
+ case IDC_OPEN_FOLDER:
+ {
+ char szFileName[512];
+ if (BrowseForFolder(hwnd, szFileName)) {
+ wsprintfA(szFileName, "%s ,/e", szFileName);
+ SetDlgItemTextA(hwnd, IDC_LINK, "explorer.exe");
+ SetDlgItemTextA(hwnd, IDC_PARAMS, szFileName);
+ }
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ int status = GetLCStatus(0,0);
+ HANDLE hContact = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA);
+ int i;
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_LINK)))
+ {
+ char text[512];
+ GetDlgItemTextA(hwnd,IDC_LINK,text,sizeof(text));
+ db_set_s(hContact, MODNAME, "ProgramString", text);
+ WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
+ }
+ else db_unset(hContact, MODNAME, "ProgramString");
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_PARAMS)))
+ {
+ char text[512];
+ GetDlgItemTextA(hwnd,IDC_PARAMS,text,sizeof(text));
+ db_set_s(hContact, MODNAME, "ProgramParamsString", text);
+ WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
+ }
+ else db_unset(hContact, MODNAME, "ProgramParamsString");
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_GROUP)))
+ {
+ char text[512];
+ GetDlgItemTextA(hwnd,IDC_GROUP,text,sizeof(text));
+ checkGroups(text);
+ db_set_s(hContact, "CList", "Group", text);
+ }
+ else db_unset(hContact, "CList", "Group");
+ for (i = ID_STATUS_ONLINE; i<=ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (IsDlgButtonChecked(hwnd, i))
+ db_set_w(hContact, MODNAME, "Icon", (WORD)i);
+ }
+ /* set correct status */
+ if ( (status == ID_STATUS_ONLINE) || (status == ID_STATUS_AWAY) ||
+ (status == db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) )
+ )
+ db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE));
+ else
+ db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE);
+
+ if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER))
+ {
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_TIMER)))
+ {
+ char text[512];
+ GetDlgItemTextA(hwnd,IDC_TIMER,text,sizeof(text));
+ db_set_w(hContact, MODNAME, "Timer", (WORD)atoi(text));
+ }
+ else db_set_w(hContact, MODNAME, "Timer", 15);
+ }
+ else db_set_w(hContact, MODNAME, "Timer", 0);
+ // always visible
+ db_set_b(hContact, MODNAME, "AlwaysVisible", (BYTE)IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE));
+ db_set_b(hContact, MODNAME, "VisibleUnlessOffline", (BYTE)IsDlgButtonChecked(hwnd, IDC_VISIBLE_UNLESS_OFFLINE));
+ }
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replaceWithStr)
+{
+ int i=0;
+ while (oldStr[i] != '\0') {
+ // msg(&oldStr[i],"");
+ if (!strncmp(&oldStr[i],findStr, strlen(findStr))) {
+ strcat(newStr,replaceWithStr);
+ i += (int)strlen(findStr);
+ }
+ else {
+ strncat(newStr,&oldStr[i],1);
+ i++;
+ }
+ }
+ return newStr;
+}
+
+#define MAX_REPLACES 15
+
+INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ case WM_INITDIALOG:
+ {
+ HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
+ TranslateDialogDefault(hwnd);
+ SetWindowLong(hwnd, GWLP_USERDATA, (LPARAM)(HANDLE)hContact);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ switch(LOWORD(wParam)) {
+ case IDC_EXPORT:
+ ExportContact((HANDLE)GetWindowLong(hwnd, GWLP_USERDATA));
+ break;
+
+ case IDC_DOIT:
+ if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE))) {
+ char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
+ char newString[MAX_REPLACES][512], oldString[MAX_REPLACES][512];
+ char dbVar1[2000], dbVar2[2000];
+ int i=0,j=0, k=0;
+ char *string = oldString[k];
+ HANDLE hContact1 = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA), hContact2;
+ GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
+ if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
+ // get the list of replace strings
+ while (replace[i] != '\0') {
+ if (replace[i] == ',') {
+ string = newString[k];
+ j=0;
+ }
+ else if (!strncmp(&replace[i], "\r\n",2)) {
+ if (string == newString[k])
+ k--;
+ if (k = MAX_REPLACES) break;
+ string = oldString[++k];
+ i+=2;
+ continue;
+ }
+ else {
+ string[j] = replace[i];
+ string[++j] = '\0';
+ }
+ i++;
+ }
+ hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)MODNAME);
+ CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
+ db_set_s(hContact2, MODNAME, "Nick", Translate("New Non-IM Contact"));
+ // blank dbVar2 so the replaceing doesnt crash..
+ strcpy(dbVar2, "");
+ // copy the name (dbVar1 is the name)
+ for (i=0;i<=k;i++)
+ copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
+
+ db_set_s(hContact2, MODNAME, "Name", dbVar2);
+ // copy the ProgramString
+ if (db_get_static(hContact1, MODNAME, "ProgramString",dbVar1)) {
+ strcpy(dbVar2, "");
+ for (i=0;i<=k;i++)
+ copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
+
+ db_set_s(hContact2, MODNAME, "ProgramString", dbVar2);
+ }
+ // copy the ProgramParamString
+ if (db_get_static(hContact1, MODNAME, "ProgramParamString",dbVar1)) {
+ strcpy(dbVar2, "");
+ for (i=0;i<=k;i++)
+ copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
+
+ db_set_s(hContact2, MODNAME, "ProgramParamString", dbVar2);
+ }
+ // copy the group
+ if (db_get_static(hContact1, "CList", "Group",dbVar1)) {
+ strcpy(dbVar2, "");
+ for (i=0;i<=k;i++)
+ copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
+
+ db_set_s(hContact2, "CList", "Group", dbVar2);
+ }
+ // copy the ToolTip
+ if (db_get_static(hContact1, MODNAME, "ToolTip",dbVar1)) {
+ strcpy(dbVar2, "");
+ for (i=0;i<=k;i++)
+ copyReplaceString(dbVar1, dbVar2, oldString[i],newString[i] );
+
+ db_set_s(hContact2, MODNAME, "ToolTip", dbVar2);
+ }
+ // timer
+ db_set_b(hContact2, MODNAME, "UseTimer", (BYTE)db_get_b(hContact1, MODNAME, "UseTimer", 0));
+ db_set_b(hContact2, MODNAME, "Minutes", (BYTE)db_get_b(hContact1, MODNAME, "Minutes", 0));
+ db_set_w(hContact2, MODNAME, "Timer", (WORD)db_get_w(hContact1, MODNAME, "Timer", 0));
+ //icon
+ db_set_w(hContact2, MODNAME, "Icon", (WORD)db_get_w(hContact1, MODNAME, "Icon", 40072));
+ replaceAllStrings(hContact2);
+ }
+ }
+ else {
+ char dbVar1[2000];
+ HANDLE hContact1 = (HANDLE)GetWindowLong(hwnd, GWLP_USERDATA), hContact2;
+ if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
+ if (!(hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0))) {
+ msg("contact did not get created","");
+ return 0;
+ }
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)MODNAME);
+ CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
+ db_set_s(hContact2, MODNAME, "Nick", Translate("New Non-IM Contact"));
+ db_set_s(hContact2, MODNAME, "Name", dbVar1);
+ if (db_get_static(hContact1, MODNAME, "ProgramString",dbVar1))
+ db_set_s(hContact2, MODNAME, "ProgramString", dbVar1);
+
+ // copy the ProgramParamString
+ if (db_get_static(hContact1, MODNAME, "ProgramParamString",dbVar1))
+ db_set_s(hContact2, MODNAME, "ProgramParamString", dbVar1);
+
+ // copy the group
+ if (db_get_static(hContact1, "CList", "Group",dbVar1))
+ db_set_s(hContact2, "CList", "Group", dbVar1);
+
+ // copy the ToolTip
+ if (db_get_static(hContact1, MODNAME, "ToolTip",dbVar1))
+ db_set_s(hContact2, MODNAME, "ToolTip", dbVar1);
+
+ // timer
+ db_set_b(hContact2, MODNAME, "UseTimer", (BYTE)db_get_b(hContact1, MODNAME, "UseTimer", 0));
+ db_set_b(hContact2, MODNAME, "Minutes", (BYTE)db_get_b(hContact1, MODNAME, "Minutes", 0));
+ db_set_w(hContact2, MODNAME, "Timer", (WORD)db_get_w(hContact1, MODNAME, "Timer", 0));
+
+ //icon
+ db_set_w(hContact2, MODNAME, "Icon", (WORD)db_get_w(hContact1, MODNAME, "Icon", 40072));
+ replaceAllStrings(hContact2);
+ }
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ return TRUE;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
+void ExportContact(HANDLE hContact)
+{
+ FILE* file;
+ char szFileName[MAX_PATH];
+ char DBVar[1024];
+ int tmp;
+
+ if (Openfile(szFileName, 0))
+ {
+ // if (tmp = MessageBox(0, "Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append this contact to the end of the file.",modFullname, MB_YESNO) == IDYES)
+ // file = fopen(szFileName, "w");
+ // else
+ file = fopen(szFileName, "a");
+ if (file)
+ {
+ if (db_get_static(hContact, MODNAME, "Name", DBVar))
+ {
+ fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramString", DBVar))
+ fprintf(file, "ProgramString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar))
+ fprintf(file, "ProgramParamString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ToolTip", DBVar))
+ fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
+ if (db_get_static(hContact, "CList", "Group", DBVar))
+ fprintf(file, "Group=%s\r\n", DBVar);
+ if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
+ fprintf(file, "Icon=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "UseTimer", 0))
+ fprintf(file, "UseTimer=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "Minutes", 1))
+ fprintf(file, "Minutes=%d\r\n", tmp);
+ if (tmp = db_get_w(hContact, MODNAME, "Timer", 0))
+ fprintf(file, "Timer=%d\r\n", tmp);
+ fprintf(file, "[/Non-IM Contact]\r\n");
+ }
+ else ("Contact is invalid",modFullname);
+ fclose(file);
+ }
+ }
+}
+
+INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact;
+ char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", tooltip[3000] = "", line[2001] = "";
+ int icon = 40072, usetimer = 0, minutes = 1, timer = 0;
+ char fn[MAX_PATH];
+ int i,j, contactDone = 0;
+ if ( !Openfile(fn, 1))
+ return 1;
+
+ FILE *file = fopen(fn, "r");
+ if (!file)
+ return 1;
+
+ while (fgets(line,2000,file)) {
+ if (!strcmp(line, "\r\n\0"))
+ continue;
+ if (!strcmp(line,"[Non-IM Contact]\r\n"))
+ contactDone = 0;
+ else if (!strncmp(line, "Name=" ,strlen("Name="))) {
+ i = (int)strlen("Name=");j=0;
+ while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
+ name[j] = line[i++];
+ name[++j] = '\0';
+ }
+ contactDone =1;
+ }
+ else if (!strncmp(line, "ProgramString=" ,strlen("ProgramString="))) {
+ i = (int)strlen("ProgramString=");j=0;
+ while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
+ program[j] = line[i++];
+ program[++j] = '\0';
+ }
+ }
+ else if (!strncmp(line, "ProgramParamString=" ,strlen("ProgramParamString="))) {
+ i = (int)strlen("ProgramParamString=");j=0;
+ while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
+ programparam[j] = line[i++];
+ programparam[++j] = '\0';
+ }
+ }
+ else if (!strncmp(line, "Group=" ,strlen("Group="))) {
+ i = (int)strlen("Group=");j=0;
+ while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') {
+ group[j] = line[i++];
+ group[++j] = '\0';
+ }
+ }
+ else if (!strncmp(line, "ToolTip=" ,strlen("ToolTip="))) {
+ i = (int)strlen("ToolTip=");
+ strcpy(tooltip, &line[i]);
+ fgets(line,2000,file);
+ while (!strstr(line,"</tooltip>\r\n")) {
+ strcat(tooltip,line);
+ fgets(line,2000,file);
+ }
+ // the line that has the </tooltip>
+ strncat(tooltip,line, strlen(line) - strlen("</tooltip>\r\n"));
+ }
+ else if (!strncmp(line, "Icon=", strlen("Icon="))) {
+ i = (int)strlen("Icon=");
+ sscanf(&line[i], "%d", &icon);
+ }
+ else if (!strncmp(line, "UseTimer=", strlen("UseTimer="))) {
+ i = (int)strlen("UseTimer=");
+ sscanf(&line[i], "%d", &usetimer);
+ }
+ else if (!strncmp(line, "Timer=" ,strlen("Timer="))) {
+ i = (int)strlen("Timer=");
+ sscanf(&line[i], "%d", &timer);
+ }
+ else if (!strncmp(line, "Minutes=", strlen("Minutes="))) {
+ i = (int)strlen("Minutes=");
+ sscanf(&line[i], "%d", &minutes);
+ }
+ else if (contactDone && !strcmp(line,"[/Non-IM Contact]\r\n")) {
+ if (!name) continue;
+ char *msg = (char*)malloc(strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1);
+ wsprintfA(msg, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
+ if (program) {
+ msg = (char*)realloc(msg, strlen(msg) + strlen(program) +strlen("Program: \r\n") +1);
+ strcat(msg, "Program: ");
+ strcat(msg,program);
+ strcat(msg,"\r\n");
+ }
+ if (programparam) {
+ msg = (char*)realloc(msg, strlen(msg) + strlen(programparam) +strlen("Program Parameters: \r\n") +1);
+ strcat(msg, "Program Parameters: ");
+ strcat(msg,programparam);
+ strcat(msg,"\r\n");
+ }
+ if (tooltip) {
+ msg = (char*)realloc(msg, strlen(msg) + strlen(tooltip) +strlen("ToolTip: \r\n") +1);
+ strcat(msg, "ToolTip: ");
+ strcat(msg,tooltip);
+ strcat(msg,"\r\n");
+ }
+ if (group) {
+ msg = (char*)realloc(msg, strlen(msg) + strlen(group) +strlen("Group: \r\n") +1);
+ strcat(msg, "Group: ");
+ strcat(msg,group);
+ strcat(msg,"\r\n");
+ }
+ if (icon) {
+ char tmp[64];
+ if (icon == ID_STATUS_ONLINE)
+ wsprintfA(tmp, "Icon: Online\r\n");
+ else if (icon == ID_STATUS_AWAY)
+ wsprintfA(tmp, "Icon: Away\r\n");
+ else if (icon == ID_STATUS_NA)
+ wsprintfA(tmp, "Icon: NA\r\n");
+ else if (icon == ID_STATUS_DND)
+ wsprintfA(tmp, "Icon: DND\r\n");
+ else if (icon == ID_STATUS_OCCUPIED)
+ wsprintfA(tmp, "Icon: Occupied\r\n");
+ else if (icon == ID_STATUS_FREECHAT)
+ wsprintfA(tmp, "Icon: Free For Chat\r\n");
+ else if (icon == ID_STATUS_INVISIBLE)
+ wsprintfA(tmp, "Icon: Invisible\r\n");
+ else if (icon == ID_STATUS_ONTHEPHONE)
+ wsprintfA(tmp, "Icon: On The Phone\r\n");
+ else if (icon == ID_STATUS_OUTTOLUNCH)
+ wsprintfA(tmp, "Icon: Out To Lunch\r\n");
+ msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
+ strcat(msg,tmp);
+ }
+ if (usetimer && timer) {
+ char tmp[64],tmp2[8];
+ if (minutes)
+ strcpy(tmp2,"Minutes");
+ else strcpy(tmp2,"Seconds");
+ wsprintfA(tmp, "UseTimer: Yes\r\nTimer: %d %s",timer, tmp2);
+ msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
+ strcat(msg,tmp);
+ }
+
+ if (MessageBoxA(0,msg,modFullname,MB_YESNO) == IDYES) {
+ if (!(hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0))) {
+ msg("contact did get created","");
+ continue;
+ }
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)MODNAME);
+ CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
+ db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact"));
+ db_set_s(hContact, MODNAME, "Name", name);
+ db_set_s(hContact, MODNAME, "ProgramString", program);
+ // copy the ProgramParamString
+ db_set_s(hContact, MODNAME, "ProgramParamString", programparam);
+ // copy the group
+ db_set_s(hContact, "CList", "Group", group);
+ // copy the ToolTip
+ db_set_s(hContact, MODNAME, "ToolTip", tooltip);
+ // timer
+ db_set_b(hContact, MODNAME, "UseTimer", (BYTE)usetimer);
+ db_set_b(hContact, MODNAME, "Minutes", (BYTE)minutes);
+ db_set_w(hContact, MODNAME, "Timer", (WORD)timer);
+ //icon
+ db_set_w(hContact, MODNAME, "Icon", (WORD)icon);
+ replaceAllStrings(hContact);
+ }
+ free(msg);
+ contactDone = 0;
+ name[0] = '\0';
+ program[0] = '\0';
+ programparam[0] = '\0';
+ group[0] = '\0';
+ tooltip[0] = '\0';
+ line[0] = '\0';
+ icon = 40072;
+ usetimer = 0;
+ minutes = 1;
+ timer = 0;
+ }
+ }
+ fclose(file);
+
+ return 1;
+}
diff --git a/plugins/!NotAdopted/Non-IM Contact/dialog.c b/plugins/Non-IM Contact/src/dialog.cpp index e8623b7c9c..cf3aa6a977 100644 --- a/plugins/!NotAdopted/Non-IM Contact/dialog.c +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -1,18 +1,19 @@ #include "commonheaders.h"
+
int CALLBACK PropSheetProc(HWND hwnd, UINT uMsg, LPARAM lParam);
void DoPropertySheet(HANDLE hContact, HINSTANCE hInst)
{
char title[256], nick[256];
- PROPSHEETPAGE psp[4];
- PROPSHEETHEADER psh;
+ PROPSHEETPAGEA psp[4];
+ PROPSHEETHEADERA psh;
/* contact info */
ZeroMemory(&psp[0], sizeof(PROPSHEETPAGE));
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[0].hInstance = hInst;
- psp[0].pszTemplate = MAKEINTRESOURCE(IDD_CONTACT_INFO);
+ psp[0].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_INFO);
psp[0].pszIcon = NULL;
psp[0].pfnDlgProc = DlgProcContactInfo;
psp[0].pszTitle = "Contacts Display Info";
@@ -24,7 +25,7 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[1].hInstance = hInst;
- psp[1].pszTemplate = MAKEINTRESOURCE(IDD_OTHER_STUFF);
+ psp[1].pszTemplate = MAKEINTRESOURCEA(IDD_OTHER_STUFF);
psp[1].pszIcon = NULL;
psp[1].pfnDlgProc = DlgProcOtherStuff;
psp[1].pszTitle = "Link and CList Settings";
@@ -36,7 +37,7 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[3].hInstance = hInst;
- psp[3].pszTemplate = MAKEINTRESOURCE(IDD_ADD_FILE);
+ psp[3].pszTemplate = MAKEINTRESOURCEA(IDD_ADD_FILE);
psp[3].pszIcon = NULL;
psp[3].pfnDlgProc = DlgProcFiles;
psp[3].pszTitle = "Files";
@@ -48,7 +49,7 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
psp[2].hInstance = hInst;
- psp[2].pszTemplate = MAKEINTRESOURCE(IDD_CONTACT_COPYEXPORT);
+ psp[2].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COPYEXPORT);
psp[2].pszIcon = NULL;
psp[2].pfnDlgProc = DlgProcCopy;
psp[2].pszTitle = "Copy Contact";
@@ -62,97 +63,96 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
psh.hwndParent = NULL;
psh.hInstance = hInst;
- psh.pszIcon = MAKEINTRESOURCE(IDI_MAIN);
- DBGetContactSettingString(hContact, modname, "Nick", nick);
- wsprintf(title, "Edit Non-IM Contact \"%s\"", nick);
+ psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
+ db_get_static(hContact, MODNAME, "Nick", nick);
+ wsprintfA(title, "Edit Non-IM Contact \"%s\"", nick);
psh.pszCaption = title;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
- psh.ppsp = (LPCPROPSHEETPAGE) &psp;
+ psh.ppsp = (LPCPROPSHEETPAGEA) &psp;
psh.pfnCallback = PropSheetProc;
// Now do it and return
- PropertySheet(&psh);
- return;
+ PropertySheetA(&psh);
}
-int addContact(WPARAM wParam,LPARAM lParam)
+
+INT_PTR addContact(WPARAM wParam,LPARAM lParam)
{
char tmp[256];
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)modname);
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)MODNAME);
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
- DBWriteContactSettingString(hContact, modname, "Nick", Translate("New Non-IM Contact"));
+ db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact"));
DoPropertySheet(hContact, hInst);
- if (!DBGetContactSettingString(hContact, modname, "Name", tmp))
+ if (!db_get_static(hContact, MODNAME, "Name", tmp))
CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0);
replaceAllStrings(hContact);
return 0;
}
-int editContact(WPARAM wParam,LPARAM lParam)
+INT_PTR editContact(WPARAM wParam,LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
char tmp[256];
if (!hContact)
{
hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)modname);
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)MODNAME);
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
- DBWriteContactSettingString(hContact, modname, "Nick", Translate("New Non-IM Contact"));
+ db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact"));
}
DoPropertySheet(hContact, hInst);
- if (!DBGetContactSettingString(hContact, modname, "Name", tmp))
+ if (!db_get_static(hContact, MODNAME, "Name", tmp))
CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0);
replaceAllStrings(hContact);
return 0;
}
-
int CALLBACK PropSheetProc(HWND hwnd, UINT uMsg, LPARAM lParam)
{
if (uMsg == PSCB_PRECREATE)
{
- // Remove the DS_CONTEXTHELP style from the
- // dialog box template
- if (((LPDLGTEMPLATEEX)lParam)->signature ==
- 0xFFFF)
- {
- ((LPDLGTEMPLATEEX)lParam)->style
- &= ~DS_CONTEXTHELP;
- }
- else {
- ((LPDLGTEMPLATE)lParam)->style
- &= ~DS_CONTEXTHELP;
- }
- return TRUE;
- }
- switch (lParam)
- { /* prob not the best way but it works... i hope */
- case PSBTN_OK:
+ // Remove the DS_CONTEXTHELP style from the
+ // dialog box template
+ if (((DLGTEMPLATEEX*)lParam)->signature == 0xFFFF)
+ {
+ ((DLGTEMPLATEEX*)lParam)->style
+ &= ~DS_CONTEXTHELP;
+ }
+ else {
+ ((LPDLGTEMPLATE)lParam)->style
+ &= ~DS_CONTEXTHELP;
+ }
+ return TRUE;
+ }
+
+ /* prob not the best way but it works... i hope */
+ switch (lParam) {
+ case PSBTN_OK:
break;
- case PSBTN_CANCEL:
+ case PSBTN_CANCEL:
break;
- case PSBTN_FINISH:
+ case PSBTN_FINISH:
break;
- case PSBTN_APPLYNOW:
+ case PSBTN_APPLYNOW:
break;
}
return 0;
}
-BOOL CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
char tmp[5];
TranslateDialogDefault(hwnd);
- CheckDlgButton(hwnd, IDC_IGNORE_GLOBALSTATUS, DBGetContactSettingByte(NULL, modname, "IgnoreGlobalStatusChange", 0));
- CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, DBGetContactSettingByte(NULL, modname, "AwayAsStatus", 0));
- if (DBGetContactSettingWord(NULL, modname, "Timer", 1))
+ CheckDlgButton(hwnd, IDC_IGNORE_GLOBALSTATUS, db_get_b(NULL, MODNAME, "IgnoreGlobalStatusChange", 0));
+ CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, db_get_b(NULL, MODNAME, "AwayAsStatus", 0));
+ if (db_get_w(NULL, MODNAME, "Timer", 1))
{
EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),1);
- SetDlgItemText(hwnd, IDC_TIMER_INT, itoa(DBGetContactSettingWord(NULL, modname, "Timer", 1),tmp,10));
+ SetDlgItemTextA(hwnd, IDC_TIMER_INT, _itoa(db_get_w(NULL, MODNAME, "Timer", 1),tmp,10));
EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),1);
}
else
@@ -161,53 +161,48 @@ BOOL CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),0);
EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),0);
}
-
+
}
return TRUE;
- case WM_COMMAND:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- switch(LOWORD(wParam)) {
- case IDC_DISABLETIMER:
- if (IsDlgButtonChecked(hwnd, IDC_DISABLETIMER))
- {
- EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),0);
- EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),0);
- }
- else
- {
- EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),1);
- EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),1);
- if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT)))
- SetDlgItemText(hwnd, IDC_TIMER_INT,"1");
- }
- break;
+ case WM_COMMAND:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ switch(LOWORD(wParam)) {
+ case IDC_DISABLETIMER:
+ if (IsDlgButtonChecked(hwnd, IDC_DISABLETIMER))
+ {
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),0);
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),0);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),1);
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),1);
+ if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT)))
+ SetDlgItemTextA(hwnd, IDC_TIMER_INT,"1");
+ }
+ break;
return TRUE;
- }
+ }
break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- char tmp[5];
- DBWriteContactSettingByte(NULL, modname, "IgnoreGlobalStatusChange", (BYTE)IsDlgButtonChecked(hwnd, IDC_IGNORE_GLOBALSTATUS));
- DBWriteContactSettingByte(NULL, modname, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
- if (!IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT)))
- {
- GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, 4);
- DBWriteContactSettingWord(NULL, modname, "Timer",(WORD)atoi(tmp));
- }
- else DBWriteContactSettingWord(NULL, modname, "Timer",0);
- }
- return TRUE;
- }
- break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ char tmp[5];
+ db_set_b(NULL, MODNAME, "IgnoreGlobalStatusChange", (BYTE)IsDlgButtonChecked(hwnd, IDC_IGNORE_GLOBALSTATUS));
+ db_set_b(NULL, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
+ if (!IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) {
+ GetDlgItemTextA(hwnd, IDC_TIMER_INT, tmp, 4);
+ db_set_w(NULL, MODNAME, "Timer",(WORD)atoi(tmp));
+ }
+ else db_set_w(NULL, MODNAME, "Timer",0);
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
}
@@ -233,14 +228,14 @@ struct braces { };
int braceOrder[MAX_BRACES] = {0};
-BOOL CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
char string[10000];
TranslateDialogDefault(hwnd);
-
+
strcpy(string, Translate("String replacing variables....\r\nThe following are all the valid variables that can be used. Refer to the readme for a proper explanation.\r\n\r\n"));
strcat(string, Translate("file(X)\t\t<- specifies the file to read from\r\nMUST be followed by either start() or end() or wholeline()\r\n"));
strcat(string, Translate("filename(X)\t\t<- copyies the filename of file X.\r\n"));
@@ -256,134 +251,118 @@ BOOL CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara strcat(string, Translate("If searching for a line with u may put a + or - X after the closing ) i.e line(\"some words\")+3 to go 3 lines after the line with \"some words\".\r\n\r\n"));
strcat(string, Translate("Some Expamples...\r\n\r\n"));
strcat(string, Translate("filename(0) <- will display the filename of the 0th file\r\nfile(0)wholeline(line(0))) <- will display the whole first line of the 0th file\r\nfile(0)wholeline(line(\"hello\")-1))) <- the wholeline above the first occurance of \"hello\" in the file\r\nfile(0)start(line(lastline(1))csv(tab2))end(line(lastline())csv(tab4))) <- starts at the 2nd last line of the file, from the 2nd tab variable, untill the 4th tab variable in the last line (in the 0th file)\r\nfile(0)start(line(\"hello\")+1\"zzzz\")end(line(6)17)) <- starts from the first occurance of zzzz in the line after the first occurance of hello, untill the 17th character in the 6th line (starting from line 0) of the 0th file.\r\n"));
- SetDlgItemText(hwnd, IDC_HELPTEXT,string);
+ SetDlgItemTextA(hwnd, IDC_HELPTEXT,string);
}
return TRUE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDOK:
- DestroyWindow(hwnd);
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ DestroyWindow(hwnd);
break;
- }
+ }
return TRUE;
}
return FALSE;
}
-BOOL CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwnd);
- }
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
return TRUE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_HELPMSG:
- CreateDialog(hInst,MAKEINTRESOURCE(IDD_HELP),0,HelpWindowDlgProc);
- break;
- case IDCANCEL:
- DestroyWindow(hwnd);
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_HELPMSG:
+ CreateDialog(hInst,MAKEINTRESOURCE(IDD_HELP), 0, HelpWindowDlgProc);
+ break;
+
+ case IDCANCEL:
+ DestroyWindow(hwnd);
break;
- case IDC_STRING:
- if (HIWORD(wParam) == EN_CHANGE)
- {
- char tmp[MAX_STRING_LENGTH];
- int i=0,j;
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING)))
- {
- GetDlgItemText(hwnd, IDC_STRING, tmp, MAX_STRING_LENGTH);
- if (tmp[strlen(tmp)-1] == '(')
- {
- for (i=0; i<VARS; i++)
- {
- if (!strcmp(braceList[i].var,&tmp[strlen(tmp)-strlen(braceList[i].var)]))
- {
- for (j=0;j<MAX_BRACES;j++)
- {
- if (!braceOrder[j])
- {
- braceOrder[j]=i;
- EnableWindow(GetDlgItem(hwnd, braceList[i].idCtrl),1);
- if (j)
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-1]].idCtrl),0);
- break;
- }
+
+ case IDC_STRING:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ char tmp[MAX_STRING_LENGTH];
+ int i=0,j;
+ if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
+ GetDlgItemTextA(hwnd, IDC_STRING, tmp, MAX_STRING_LENGTH);
+ if (tmp[strlen(tmp)-1] == '(') {
+ for (i=0; i<VARS; i++) {
+ if (!strcmp(braceList[i].var,&tmp[strlen(tmp)-strlen(braceList[i].var)])) {
+ for (j=0;j<MAX_BRACES;j++) {
+ if (!braceOrder[j]) {
+ braceOrder[j]=i;
+ EnableWindow(GetDlgItem(hwnd, braceList[i].idCtrl),1);
+ if (j)
+ EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-1]].idCtrl),0);
+ break;
}
- break;
}
+ break;
}
}
- else if (tmp[strlen(tmp)-1] == ')')
- {
- for (j=0; j<MAX_BRACES; j++)
- {
- if (!braceOrder[j])
- {
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-1]].idCtrl),0);
- if (j > 1)
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-2]].idCtrl),1);
- braceOrder[j-1] = 0;
- break;
- }
+ }
+ else if (tmp[strlen(tmp)-1] == ')') {
+ for (j=0; j<MAX_BRACES; j++) {
+ if (!braceOrder[j]) {
+ EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-1]].idCtrl),0);
+ if (j > 1)
+ EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j-2]].idCtrl),1);
+ braceOrder[j-1] = 0;
+ break;
}
}
}
- else
- {
- for (j=0; j<MAX_BRACES; j++)
- {
- if (!braceOrder[j]) break;
- EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j]].idCtrl),0);
- }
+ }
+ else {
+ for (j=0; j<MAX_BRACES; j++) {
+ if (!braceOrder[j]) break;
+ EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j]].idCtrl),0);
}
-
}
-
+ }
break;
- case IDOK:
- {
- char str2replace[MAX_STRING_LENGTH], replacedString[MAX_STRING_LENGTH];
- int error;
- if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING)))
- {
- GetDlgItemText(hwnd, IDC_STRING, str2replace, MAX_STRING_LENGTH);
- switch (stringReplacer(str2replace, replacedString, NULL))
- {
- case ERROR_NO_LINE_AFTER_VAR_F:
- wsprintf(replacedString, "ERROR: no %s","%line or %wholeline or %lastline after %fn");
- error = 1;
- break;
- case ERROR_LINE_NOT_READ:
- wsprintf(replacedString, "ERROR: file couldnt be opened ");
- error = 1;
- break;
- case ERROR_NO_FILE:
- wsprintf(replacedString, "ERROR: no file specified in settings");
- error = 1;
- break;
- default:
- error = 0;
- }
- SetDlgItemText(hwnd, IDC_ANSWER, replacedString);
- }
+
+ case IDOK:
+ char str2replace[MAX_STRING_LENGTH], replacedString[MAX_STRING_LENGTH];
+ int error;
+ if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
+ GetDlgItemTextA(hwnd, IDC_STRING, str2replace, MAX_STRING_LENGTH);
+ switch (stringReplacer(str2replace, replacedString, NULL)) {
+ case ERROR_NO_LINE_AFTER_VAR_F:
+ wsprintfA(replacedString, "ERROR: no %s","%line or %wholeline or %lastline after %fn");
+ error = 1;
+ break;
+ case ERROR_LINE_NOT_READ:
+ wsprintfA(replacedString, "ERROR: file couldnt be opened ");
+ error = 1;
+ break;
+ case ERROR_NO_FILE:
+ wsprintfA(replacedString, "ERROR: no file specified in settings");
+ error = 1;
+ break;
+ default:
+ error = 0;
}
- break;
- return TRUE;
+ SetDlgItemTextA(hwnd, IDC_ANSWER, replacedString);
+ }
}
- break;
+ break;
}
return FALSE;
}
-int testStringReplacer(WPARAM wParam, LPARAM lParam)
+
+INT_PTR testStringReplacer(WPARAM wParam, LPARAM lParam)
{
- CreateDialog(hInst,MAKEINTRESOURCE(IDD_TEST_LINE),0,TestWindowDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_TEST_LINE), 0, TestWindowDlgProc);
return 0;
}
-int LoadFilesDlg(WPARAM wParam, LPARAM lParam)
+INT_PTR LoadFilesDlg(WPARAM wParam, LPARAM lParam)
{
CreateDialog(hInst,MAKEINTRESOURCE(IDD_ADD_FILE),0,DlgProcFiles);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp new file mode 100644 index 0000000000..5fdc819604 --- /dev/null +++ b/plugins/Non-IM Contact/src/files.cpp @@ -0,0 +1,350 @@ +#include "commonheaders.h"
+
+INT_PTR exportContacts(WPARAM wParam,LPARAM lParam)
+{
+ char fn[MAX_PATH];
+ if (!Openfile(fn, 0))
+ return 0;
+
+ FILE* file;
+ if (MessageBoxA(0, "Do you want to overwrite the contents of the file?\r\n\r\nPressing No will append these contacts to the end of the file.",modFullname, MB_YESNO) == IDYES)
+ file = fopen(fn, "w");
+ else
+ file = fopen(fn, "a");
+ if (!file)
+ return 0;
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ const char* proto = GetContactProto(hContact);
+ if (proto && !strcmp(proto, MODNAME)) {
+ int tmp;
+ char DBVar[1024];
+ if (db_get_static(hContact, MODNAME, "Name", DBVar)) {
+ fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramString", DBVar))
+ fprintf(file, "ProgramString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar))
+ fprintf(file, "ProgramParamString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ToolTip", DBVar))
+ fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
+ if (db_get_static(hContact, "CList", "Group", DBVar))
+ fprintf(file, "Group=%s\r\n", DBVar);
+ if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
+ fprintf(file, "Icon=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "UseTimer", 0))
+ fprintf(file, "UseTimer=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "Minutes", 1))
+ fprintf(file, "Minutes=%d\r\n", tmp);
+ if (tmp = db_get_w(hContact, MODNAME, "Timer", 0))
+ fprintf(file, "Timer=%d\r\n", tmp);
+ fprintf(file, "[/Non-IM Contact]\r\n");
+ }
+ }
+ }
+ fclose(file);
+ return 0;
+}
+
+int Openfile(char *outputFile, int saveOpen) //0=save, 1=open
+{
+ char filename[MAX_PATH] = "";
+ char *filter = "All Files\0*.*\0";
+ int r;
+ char title[16];
+ if (saveOpen)
+ strcpy(title, "Open file");
+ else strcpy(title, "Save to file");
+
+ OPENFILENAMEA ofn = { sizeof(ofn) };
+ ofn.lpstrFile = filename;
+ ofn.lpstrFilter = filter;
+ ofn.Flags = saveOpen? OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_SHAREAWARE | OFN_PATHMUSTEXIST: OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST;
+ ofn.lpstrTitle = title;
+ ofn.nMaxFile = MAX_PATH;
+
+ if (saveOpen)
+ r = GetOpenFileNameA(&ofn);
+ else
+ r = GetSaveFileNameA(&ofn);
+ if (!r)
+ return 0;
+ lstrcpyA(outputFile,filename);
+ return 1;
+}
+
+
+void reloadFiles(HWND fileList)
+{
+ int i, index;
+ char file[MAX_PATH], fn[6];
+ SendMessage(fileList,CB_RESETCONTENT, 0,0);
+ for (i=0; ;i++)
+ {
+ wsprintfA(fn, "fn%d", i);
+ if (db_get_static(NULL, MODNAME, fn, file)) {
+ index = SendMessageA(fileList, CB_ADDSTRING,0, (LPARAM)(char*)file);
+ SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)(int)i);
+ SendMessage(fileList, CB_SETCURSEL, index,0);
+ SetDlgItemTextA(GetParent(fileList), IDC_FN, _itoa(i, fn, 10));
+ /* add the file contents to the edit box */
+ }
+ else break;
+ }
+}
+
+int savehtml(char* outFile)
+{
+ FILE* file = fopen(outFile, "w");
+ if (!file)
+ {
+ fclose(file);
+ return 0;
+ }
+ fprintf(file, "%s", szInfo);
+ fclose(file);
+ return 1;
+}
+
+void readFile(HWND hwnd)
+{
+ int lineNumber, fileLength=0, width=0;
+ char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
+ FILE* filen;
+ int fileNumber = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
+ wsprintfA(fn, "fn%d", fileNumber);
+ if (!db_get_static(NULL, MODNAME, fn, szFileName)) {
+ msg(Translate("File couldn't be opened"),fn);
+ return;
+ }
+
+ if ( (!strncmp("http://", szFileName, strlen("http://"))) || (!strncmp("https://", szFileName, strlen("https://"))) )
+ wsprintfA(szFileName,"%s\\plugins\\fn%d.html",getMimDir(temp), fileNumber);
+
+ filen = fopen(szFileName,"r");
+ if (!filen) {
+ MessageBoxA(0, Translate("File couldn't be opened,2"), modFullname,MB_OK);
+ return;
+ }
+ lineNumber = 0;
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_RESETCONTENT, 0,0);
+ while (lineNumber < (MAXLINES) && (fgets(temp, MAX_STRING_LENGTH, filen)))
+ {
+ if (temp[0] == '\t') temp[0] = ' ';
+ if (temp[strlen(temp)-1]=='\n' && temp[strlen(temp)-2]=='\r')
+ temp[strlen(temp)-2]='\0';
+ else if (temp[strlen(temp)-1]=='\n')
+ temp[strlen(temp)-1]='\0';
+ else temp[strlen(temp)]='\0';
+ wsprintfA( temp1, Translate("line(%-3d) = | %s"), lineNumber, temp);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_ADDSTRING,0,(LPARAM)(char*)temp1);
+ lineNumber++;
+ fileLength++;
+ if ((unsigned int)SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_GETHORIZONTALEXTENT,0,0) <= (strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)))
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_SETHORIZONTALEXTENT,(strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)),0);
+ }
+ fclose(filen);
+
+ return ;
+}
+
+#define WM_RELOADWINDOW (WM_USER+11)
+
+INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ case WM_RELOADWINDOW:
+ {
+ char fn[MAX_PATH], string[MAX_STRING_LENGTH], tmp[MAX_STRING_LENGTH];
+ reloadFiles(GetDlgItem(hwnd, IDC_FILE_LIST));
+ int i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
+ wsprintfA(fn , "fn%d", i);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_CONTENTS),LB_RESETCONTENT, 0,0);
+ if (db_get_static(NULL, MODNAME, fn, string) )
+ {
+ if ( (!strncmp("http://", string, strlen("http://"))) || (!strncmp("https://", string, strlen("https://"))) )
+ {
+ SetDlgItemTextA(hwnd,IDC_URL, string);
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, strcat(fn, "_timer"), 60), tmp, 10));
+ }
+ readFile(hwnd);
+ }
+ }
+ break;
+
+ case WM_INITDIALOG:
+ {
+ SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
+ TranslateDialogDefault(hwnd);
+ }
+ return TRUE;
+ case WM_COMMAND:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ switch(LOWORD(wParam)) {
+ case IDC_ADD_URL:
+ {
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_URL)))
+ {
+ char text[512], url[512], fn[10] = "fn0", szFileName[MAX_PATH], temp[512];
+ int i, timer;
+ GetDlgItemTextA(hwnd,IDC_URL,text,sizeof(text));
+ strcpy(url, text);
+ if (!InternetDownloadFile(text))
+ {
+ for (i=0; ;i++)
+ {
+ wsprintfA(fn, "fn%d", i);
+ if (!db_get_static(NULL, MODNAME, fn, text))
+ break;
+ }
+ wsprintfA(szFileName,"%s\\plugins\\%s.html",getMimDir(temp), fn);
+ if (savehtml(szFileName))
+ {
+ wsprintfA(fn, "fn%d", i);
+ db_set_s(NULL, MODNAME, fn, url);
+ if (!GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER)))
+ timer = 60;
+ else
+ {
+ GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,sizeof(text));
+ timer = atoi(text);
+ }
+ db_set_w(NULL, MODNAME, strcat(fn, "_timer"), (WORD)timer);
+ SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
+ }
+ }
+ }
+ }
+ break;
+ case IDC_WWW_TIMER:
+ if (HIWORD(wParam) == EN_CHANGE)
+ SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
+ break;
+ case IDC_ADD_FILE:
+ {
+ int i, index;
+ char file[MAX_PATH], fn[6];
+ for (i=0; ;i++)
+ {
+ wsprintfA(fn, "fn%d", i);
+ if (!db_get_static(NULL, MODNAME, fn, file))
+ break;
+ }
+ if (Openfile(file,1))
+ {
+ db_set_s(NULL, MODNAME, fn, file);
+ index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_ADDSTRING,0,(LPARAM)(char*)file);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETITEMDATA,index,(LPARAM)(int)i);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_SETCURSEL, index ,0);
+ SetDlgItemTextA(hwnd, IDC_FN, _itoa(i, fn, 10));
+ wsprintfA(fn , "fn%d", index);
+ readFile(hwnd);
+ }
+
+ }
+ break;
+ case IDC_DEL_FILE:
+ {
+ int index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0),i= (int)SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETITEMDATA, index,0);
+ char fn[6], fn1[4], tmp[256];
+ int count = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCOUNT, 0,0) -1;
+ if (index == count)
+ {
+ wsprintfA(fn, "fn%d", index);
+ db_unset(NULL, MODNAME, fn);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
+ SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
+ if (!index) {
+ SetDlgItemTextA(hwnd, IDC_FN,"");
+ SetDlgItemTextA(hwnd, IDC_FILE_CONTENTS,"");
+ }
+
+ }
+ else
+ {
+ wsprintfA(fn, "fn%d", i);
+ while (db_get_static(NULL, MODNAME, fn,tmp))
+ {
+ wsprintfA(fn1, "fn%d", i-1);
+ db_set_s(NULL, MODNAME, fn1 , tmp);
+ wsprintfA(fn, "fn%d", ++i);
+ }
+ wsprintfA(fn, "fn%d", --i);
+ db_unset(NULL, MODNAME, fn);
+ SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_DELETESTRING, index ,0);
+ SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
+ }
+
+ }
+ break;
+
+
+ case IDC_FILE_LIST:
+ if (HIWORD(wParam) == CBN_SELCHANGE )
+ {
+ int index = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0,0);
+ char fn[6], tmp[MAX_PATH];
+ SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10));
+ wsprintfA(fn, "fn%d", index);
+ if (db_get_static(NULL, MODNAME, fn, tmp) )
+ {
+ if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://")))
+ {
+ SetDlgItemTextA(hwnd,IDC_URL, tmp);
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, strcat(fn, "_timer"), 60), tmp, 10));
+ }
+ else
+ {
+ SetDlgItemTextA(hwnd,IDC_URL, "");
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER,"");
+ }
+ readFile(hwnd);
+ }
+ }
+ break;
+ case IDCANCEL:
+ DestroyWindow(hwnd);
+ break;
+ return TRUE;
+ }
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ int i = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST),CB_GETCURSEL, 0 ,0);
+ int timer;
+ char fn[MAX_PATH], string[1000];;
+ wsprintfA(fn , "fn%d", i);
+ if (GetWindowTextLength(GetDlgItem(hwnd,IDC_WWW_TIMER))) {
+ char text[5];
+ GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,sizeof(text));
+ timer = atoi(text);
+ }
+ else timer = 60;
+
+ if (db_get_static(NULL, MODNAME, fn, string) )
+ if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://")))
+ db_set_w(NULL, MODNAME, strcat(fn, "_timer"), (WORD)timer);
+
+ return TRUE;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
+char* getMimDir(char* file)
+{
+ GetModuleFileNameA(NULL, file, MAX_PATH);
+
+ char *p1 = strrchr(file,'\\');
+ if (p1)
+ *p1 = '\0';
+
+ if (file[0] == '\\')
+ file[strlen(file)-1] = '\0';
+
+ return file;
+}
diff --git a/plugins/!NotAdopted/Non-IM Contact/http.c b/plugins/Non-IM Contact/src/http.cpp index 7c78d9f8aa..502d34e585 100644 --- a/plugins/!NotAdopted/Non-IM Contact/http.c +++ b/plugins/Non-IM Contact/src/http.cpp @@ -22,8 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "commonheaders.h"
-/* thanks to noname for the following code :) */
-//============ DOWNLOAD NEW WEATHER ============
+
+char *szInfo;
+char *szData;
+HANDLE hNetlibUser;
// function to download webpage from the internet
// szUrl = URL of the webpage to be retrieved
@@ -47,28 +49,28 @@ int InternetDownloadFile (CHAR *szUrl) // download the page
nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&nlhr);
- if(nlhrReply) {
+ if (nlhrReply) {
// return error code if the recieved code is neither 200 OK or 302 Moved
- if(nlhrReply->resultCode != 200 && nlhrReply->resultCode != 302)
+ if (nlhrReply->resultCode != 200 && nlhrReply->resultCode != 302)
return (int)nlhrReply->resultCode;
// if the recieved code is 200 OK
- else if(nlhrReply->resultCode == 200)
+ else if (nlhrReply->resultCode == 200)
{
// allocate memory and save the retrieved data
- szData = (char *)malloc(lstrlen(nlhrReply->pData)+2);
- lstrcpyn(szData, nlhrReply->pData, lstrlen(nlhrReply->pData));
+ szData = (char *)malloc(lstrlenA(nlhrReply->pData)+2);
+ lstrcpynA(szData, nlhrReply->pData, lstrlenA(nlhrReply->pData));
}
// if the recieved code is 302 Moved, Found, etc
- else if(nlhrReply->resultCode == 302)
+ else if (nlhrReply->resultCode == 302)
{ // page moved
int i;
// get the url for the new location and save it to szInfo
// look for the reply header "Location"
for (i=0; i<nlhrReply->headersCount; i++) {
- if (!lstrcmp(nlhrReply->headers[i].szName, "Location")) {
+ if (!lstrcmpA(nlhrReply->headers[i].szName, "Location")) {
szData = (char *)malloc(512);
// add "Moved/Location:" in front of the new URL for identification
- wsprintf(szData, "Moved/Location: %s\n", nlhrReply->headers[i].szValue);
+ wsprintfA(szData, "Moved/Location: %s\n", nlhrReply->headers[i].szValue);
break;
}
}
@@ -84,7 +86,7 @@ int InternetDownloadFile (CHAR *szUrl) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
// the recieved data is empty, data was not recieved, so return an error code of 1
- if (!lstrcmp(szInfo, "")) return 1;
+ if (!lstrcmpA(szInfo, "")) return 1;
return 0;
}
@@ -95,7 +97,7 @@ void NetlibInit() { NETLIBUSER nlu={0};
nlu.cbSize=sizeof(nlu);
nlu.flags=NUF_OUTGOING|NUF_HTTPCONNS|NUF_NOHTTPSOPTION;
- nlu.szSettingsModule= modname;
+ nlu.szSettingsModule= MODNAME;
nlu.szDescriptiveName= Translate("Non-IM Contacts");
hNetlibUser=(HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
}
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp new file mode 100644 index 0000000000..9a96749ed5 --- /dev/null +++ b/plugins/Non-IM Contact/src/main.cpp @@ -0,0 +1,199 @@ +//=====================================================
+// Includes
+//=====================================================
+
+#include "commonheaders.h"
+
+#include "Version.h"
+
+HINSTANCE hInst;
+int hLangpack;
+
+PLUGININFOEX pluginInfoEx = {
+ sizeof(pluginInfoEx),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ //2e0d2ae3-e123-4607-8539-d4448d675ddb
+ { 0x2e0d2ae3, 0xe123, 0x4607, {0x85, 0x39, 0xd4, 0x44, 0x8d, 0x67, 0x5d, 0xdb} }
+};
+
+INT_PTR doubleClick(WPARAM wParam,LPARAM lParam)
+{
+ char program[MAX_PATH], params[MAX_PATH];
+ int shellEXEerror = 0;
+ char* proto = GetContactProto((HANDLE)wParam);
+ if (proto && !strcmp(proto, MODNAME)) {
+ if (GetKeyState(VK_CONTROL)&0x8000) // ctrl is pressed
+ editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL); // for later when i add a second double click setting
+ else if (db_get_static((HANDLE)wParam, MODNAME, "Program", program) && strcmp(program, ""))
+ {
+ if (!db_get_static((HANDLE)wParam, MODNAME, "ProgramParams", params) )
+ strcpy(params, "");
+ if (strstr(program, "http://") || strstr(program, "https://"))
+ CallService(MS_UTILS_OPENURL,1,(LPARAM)program);
+ else shellEXEerror = (int)ShellExecuteA(NULL, NULL, program, params, NULL, SW_SHOW); //ignore the warning, its M$'s backwards compatabilty screwup :)
+ if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND)
+ CallService(MS_UTILS_OPENURL,1,(LPARAM)program);
+ }
+ else editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL);
+ return 1;
+ }
+ return 0;
+}
+
+//=====================================================
+// Definitions
+//=====================================================
+int LCStatus = ID_STATUS_OFFLINE;
+//=====================================================
+
+//=====================================================
+// Name : MainInit
+// Parameters: wparam , lparam
+// Returns : int
+// Description : Called at very beginning of plugin
+//=====================================================
+int NimcOptInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.pszGroup = LPGEN("Plugins");
+ odp.pszTitle = LPGEN("Non-IM Contacts");
+ odp.pfnDlgProc = DlgProcNimcOpts;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
+
+int MainInit(WPARAM wparam,LPARAM lparam)
+{
+ return 0;
+}
+
+//=====================================================
+// Name : __declspec(dllexport) PLUGININFO* MirandaPluginInfo
+// Parameters: (DWORD mirandaVersion)
+// Returns :
+// Description : Sets plugin info
+//=====================================================
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfoEx;
+}
+
+//=====================================================
+// Name : WINAPI DllMain
+// Parameters: HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved
+// Returns : BOOL
+// Description :
+//=====================================================
+
+BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinst;
+ return TRUE;
+}
+
+int ModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+ NetlibInit();
+ return 0;
+}
+
+//=====================================================
+// Name : Load
+// Parameters: PLUGINLINK *link
+// Returns : int
+// Description : Called when plugin is loaded into Miranda
+//=====================================================
+
+extern "C" __declspec(dllexport) int Load()
+{
+ HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
+ HookEvent(ME_OPT_INITIALISE,NimcOptInit);
+ HookEvent(ME_CLIST_STATUSMODECHANGE, SetLCStatus);
+
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ pd.szName = MODNAME;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+
+ //load services (the first 5 are the basic ones needed to make a new protocol)
+ CreateServiceFunction(MODNAME PS_GETCAPS, GetLCCaps);
+ CreateServiceFunction(MODNAME PS_GETNAME, GetLCName);
+ CreateServiceFunction(MODNAME PS_LOADICON, LoadLCIcon);
+ CreateServiceFunction(MODNAME PS_GETSTATUS, GetLCStatus);
+
+ CreateServiceFunction("AddLCcontact", addContact);
+ CreateServiceFunction("EditLCcontact", editContact);
+ CreateServiceFunction("LoadFilesDlg", LoadFilesDlg);
+ CreateServiceFunction("ExportLCcontacts", exportContacts);
+ CreateServiceFunction("ImportLCcontacts", ImportContacts);
+ CreateServiceFunction("TestStringReplaceLine", testStringReplacer);
+ CreateServiceFunction("NIM_Contact/DoubleClick", doubleClick);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 600090000;
+ mi.pszPopupName = LPGEN("&Non-IM Contact");
+ mi.popupPosition = 600090000;
+ mi.pszName = LPGEN("&Add Non-IM Contact");
+ mi.pszService = "AddLCcontact";
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIN));
+ Menu_AddMainMenuItem(&mi);
+
+ mi.position = 600090001;
+ mi.pszName = LPGEN("&View/Edit Files");
+ mi.pszService = "LoadFilesDlg";
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIN));
+ Menu_AddMainMenuItem(&mi);
+
+ if (db_get_b(NULL, MODNAME, "Beta",0)) {
+ mi.position = 600090000;
+ mi.pszName = LPGEN("&Export all Non-IM Contacts");
+ mi.pszService = "ExportLCcontacts";
+ Menu_AddMainMenuItem(&mi);
+
+ mi.pszName = LPGEN("&Import Non-IM Contacts");
+ mi.pszService = "ImportLCcontacts";
+ Menu_AddMainMenuItem(&mi);
+ }
+
+ mi.position = 600090000;
+ mi.pszPopupName = LPGEN("&Non-IM Contact");
+ mi.pszName = LPGEN("&String Maker");
+ mi.pszService = "TestStringReplaceLine";
+ Menu_AddMainMenuItem(&mi);
+
+ mi.position = -2000080000;
+ mi.pszContactOwner = MODNAME;
+ mi.pszName = LPGEN("E&dit Contact Settings");
+ mi.pszService = "EditLCcontact";
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
+ Menu_AddMainMenuItem(&mi);
+
+ hWindowList = (HWND)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
+ HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
+
+ // known modules list
+ db_set_s(NULL, "KnownModules","Non-IM Contact", MODNAME);
+ return 0;
+}
+
+//=====================================================
+// Name : Unload
+// Parameters: void
+// Returns :
+// Description : Unloads plugin
+//=====================================================
+
+extern "C" __declspec(dllexport) int Unload(void)
+{
+ return 0;
+}
diff --git a/plugins/!NotAdopted/Non-IM Contact/namereplacing.c b/plugins/Non-IM Contact/src/namereplacing.cpp index 25dc8f5a3c..8f3f07e82e 100644 --- a/plugins/!NotAdopted/Non-IM Contact/namereplacing.c +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -2,29 +2,32 @@ int readFileIntoArray(int fileNumber, char *FileContents[])
{
- int i =0;
- FILE* file;
- char FileName[MAX_PATH], temp[MAX_STRING_LENGTH];
- wsprintf(FileName,"fn%d",fileNumber);
- DBGetContactSettingString(NULL,modname, FileName, FileName);
+ char dbSetting[20], temp[MAX_STRING_LENGTH];
+ wsprintfA(dbSetting, "fn%d", fileNumber);
- if (!strncmp("http://", FileName, strlen("http://")))
- wsprintf(FileName, "%s\\plugins\\fn%d.html",getMimDir(temp),fileNumber);
+ DBVARIANT dbv;
+ char tszFileName[MAX_PATH];
+ if (db_get_ts(NULL,MODNAME, dbSetting, &dbv))
+ return 0;
+
+ if (!strncmp("http://", tszFileName, 7))
+ mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
+
+ FILE* file = fopen(tszFileName, "r");
+ if (file == NULL)
+ return 0;
- file = fopen(FileName, "r");
- if (file == NULL) return 0;
// read the file into the FileContents array
// free this array before stringReplacer() returns
- while (fgets(temp, MAX_STRING_LENGTH-1,file))
- {
- if(temp[strlen(temp)-1]=='\n')
+ int i;
+ for (i=0; fgets(temp, MAX_STRING_LENGTH-1, file); i++) {
+ if (temp[strlen(temp)-1]=='\n')
temp[strlen(temp)-1]='\0';
else temp[strlen(temp)]='\0';
FileContents[i] = (char*)malloc(strlen(temp)+1);
if (FileContents[i] == NULL) return i;
strcpy(FileContents[i], temp);
- i++;
}
fclose(file);
return i;
@@ -33,7 +36,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) int getNumber(const char* line)
{
int i;
- if (sscanf(line, "%d", &i) == 1) return i; else return -1;
+ return sscanf(line, "%d", &i) == 1 ? i : -1;
}
int findWordInString(const char* line, const char* string, int* lengthOfWord, int flag) /* flag = 0 %from, flag = 1 %until */
@@ -43,10 +46,8 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in strcpy(OpenDivider, Translate("(\""));
strcpy(CloseDivider, Translate("\")"));
/* get the word we r looking for */
- if (!strncmp(string, OpenDivider, strlen(OpenDivider)))
- {
- for (i=2; strncmp(&string[i], CloseDivider, strlen(CloseDivider)); i++)
- {
+ if (!strncmp(string, OpenDivider, strlen(OpenDivider))) {
+ for (i=2; strncmp(&string[i], CloseDivider, strlen(CloseDivider)); i++) {
word[j] = string[i];
word[++j] = '\0';
}
@@ -54,10 +55,8 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in i=0;
*lengthOfWord = strlen(word)+strlen(CloseDivider)+strlen(OpenDivider);
/* find the word in the line */
- while (i < (strlen(line) - strlen(word) ) )
- {
- if (!strncmp(&line[i], word, strlen(word)))
- {
+ while (i < (strlen(line) - strlen(word))) {
+ if (!strncmp(&line[i], word, strlen(word))) {
if (!flag) return i + strlen(word); /* the next char after the word */
else return i; /* the char before the word */
}
@@ -68,161 +67,129 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in int findLine(char* FileContents[], const char* string, int linesInFile,int startLine, int *positionInOldString)
{
- int i;
char tmp[5];
- i = getNumber(&string[*positionInOldString]);
+ int i = getNumber(&string[*positionInOldString]);
+
// check if blank
if (string[*positionInOldString] == ')')
return startLine;
+
// check if its a number
- if ( i != -1)
- {
- *positionInOldString += strlen(itoa(i,tmp,10)) - 1;
+ if (i != -1) {
+ *positionInOldString += strlen(_itoa(i,tmp,10)) - 1;
return i;
}
+
// lastline
- else if (!strncmp(&string[*positionInOldString], Translate("lastline("), strlen(Translate("lastline("))))
- {
+ if (!strncmp(&string[*positionInOldString], Translate("lastline("), strlen(Translate("lastline(")))) {
*positionInOldString += strlen(Translate("lastline("));
i = getNumber(&string[*positionInOldString]);
- if ( i != -1)
- {
- *positionInOldString += strlen(itoa(i,tmp,10));
+ if ( i != -1) {
+ *positionInOldString += strlen(_itoa(i,tmp,10));
return linesInFile - (i+1);
}
- else
- {
- *positionInOldString ++;
- return (linesInFile - 1);
- }
+
+ *positionInOldString ++;
+ return (linesInFile - 1);
}
+
// string
- else if (string[*positionInOldString] == '\"')
- {
+ if (string[*positionInOldString] == '\"') {
char string2Find[256];
int j=0;
// get the word to find
- for (i=(*positionInOldString+1); strncmp(&string[i], "\")", 2); i++)
- {
+ for (i=(*positionInOldString+1); strncmp(&string[i], "\")", 2); i++) {
string2Find[j] = string[i];
string2Find[++j] = '\0';
}
+
// find the word
- for (j=startLine; j<linesInFile;j++)
- {
- if (strstr(FileContents[j], string2Find))
- {
+ for (j=startLine; j<linesInFile;j++) {
+ if (strstr(FileContents[j], string2Find)) {
i = j;
break;
}
- i=-1;
+ i = -1;
}
*positionInOldString += strlen(string2Find) + strlen(Translate("\"\")"));
if (i==-1) return i;
// allow for a +- after the word to go up or down lines
- if (string[*positionInOldString] == '+')
- {
+ if (string[*positionInOldString] == '+') {
*positionInOldString += 1;
j = getNumber(&string[*positionInOldString]);
- if (j != -1)
- {
- *positionInOldString += strlen(itoa(j,tmp,10))-2;
+ if (j != -1) {
+ *positionInOldString += strlen(_itoa(j,tmp,10))-2;
return i+j;
}
}
- else if (string[*positionInOldString] == '-')
- {
+ else if (string[*positionInOldString] == '-') {
*positionInOldString+=1;
j = getNumber(&string[*positionInOldString]);
- if (j != -1)
- {
- *positionInOldString += strlen(itoa(j,tmp,10))-2;
+ if (j != -1) {
+ *positionInOldString += strlen(_itoa(j,tmp,10))-2;
return i-j;
}
}
- else
- {
+ else {
*positionInOldString -= 2;
return i;
}
}
-/* else if (!strncmp(&string[*positionInOldString] , Translate("regexp(\""), strlen(Translate("regexp(\""))))
- {
- char string2Find[256];
- int j=0;
- // get the word to find
- for (i=(*positionInOldString+1); strncmp(&string[i], "\")", 2); i++)
- {
- string2Find[j] = string[i];
- string2Find[++j] = '\0';
- }
- *positionInOldString += strlen(Translate("regexp(\"")) + strlen(string2Find) +2;
- }
-*/ return -1;
+ return -1;
}
int findChar(char* FileContents[], const char* string, int linesInFile,int startLine, int *positionInOldString, int startChar, int startEnd) // 0=start, 1=end for startEnd
{
- int i;
char tmp[5];
- i = getNumber(&string[*positionInOldString]);
+ int i = getNumber(&string[*positionInOldString]);
// check if its a number
- if ( i != -1)
- {
- *positionInOldString += strlen(itoa(i,tmp,10)) - 1;
+ if (i != -1) {
+ *positionInOldString += strlen(_itoa(i,tmp,10)) - 1;
return i;
}
+
// string
- else if (string[*positionInOldString] == '\"')
- {
+ if (string[*positionInOldString] == '\"') {
char string2Find[256];
unsigned int j=0;
// get the word to find
- for (i=(*positionInOldString+1); strncmp(&string[i], "\")", 2); i++)
- {
+ for (i=(*positionInOldString+1); strncmp(&string[i], "\")", 2); i++) {
string2Find[j] = string[i];
string2Find[++j] = '\0';
}
// find the word
for (j=0;j<strlen(FileContents[startLine]);j++)
- {
if (!strncmp(&FileContents[startLine][j], string2Find, strlen(string2Find)))
break;
- }
- if (j==strlen(FileContents[startLine])) return -1;
- else
- {
- *positionInOldString += strlen(string2Find)+1;
- if (startEnd) return j;
- else return j+strlen(string2Find);
- }
+
+ if (j==strlen(FileContents[startLine]))
+ return -1;
+
+ *positionInOldString += strlen(string2Find)+1;
+ return (startEnd) ? j : j+strlen(string2Find);
}
+
// csv(
- else if (!strncmp(&string[*positionInOldString], Translate("csv("), strlen(Translate("csv("))))
- {
+ if (!strncmp(&string[*positionInOldString], Translate("csv("), strlen(Translate("csv(")))) {
char seperator;
int j=0, k=startChar;
*positionInOldString += strlen(Translate("csv("));
- if (!strncmp(&string[*positionInOldString], "tab",3))
- {
+ if (!strncmp(&string[*positionInOldString], "tab", 3)) {
*positionInOldString += 3;
seperator = '\t';
}
- else if (!strncmp(&string[*positionInOldString], "space",5))
- {
+ else if (!strncmp(&string[*positionInOldString], "space",5)) {
*positionInOldString += 5;
seperator = ' ';
}
- else
- {
+ else {
seperator =string[*positionInOldString];
*positionInOldString += 1;
}
i = getNumber(&string[*positionInOldString]);
if ( i == -1) return -1;
- *positionInOldString += strlen(itoa(i,tmp,10));
- while (j<i)
- {
+ *positionInOldString += strlen(_itoa(i,tmp,10));
+ while (j<i) {
if (FileContents[startLine][k] == '\0') break;
if (FileContents[startLine][k] == seperator)
j++;
@@ -232,17 +199,16 @@ int findChar(char* FileContents[], const char* string, int linesInFile,int start }
return -1;
}
+
// do the compare("A","B","X","Y")
void checkStringForcompare(char *str)
{
- char *A,*B, *X, *Y , *newStr = (char*)malloc(strlen(str)), *copyOfStr = strdup(str);
+ char *A,*B, *X, *Y , *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str);
unsigned int i, j=0, s=strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("compare(\""))) return;
- for (i=0; i<s; i++)
- {
- if (!strncmp(&str[i], Translate("compare(\""), strlen(Translate("compare(\""))))
- {
+ for (i=0; i<s; i++) {
+ if (!strncmp(&str[i], Translate("compare(\""), strlen(Translate("compare(\"")))) {
i += strlen(Translate("compare(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, "\",\"");
@@ -258,10 +224,7 @@ void checkStringForcompare(char *str) else strncat(newStr, &str[i], j);
i += j;
}
- else
- {
- strncat(newStr, &str[i], 1);
- }
+ else strncat(newStr, &str[i], 1);
}
strcpy(str, newStr);
free(newStr);
@@ -271,29 +234,23 @@ void checkStringForcompare(char *str) // do save("A","B") A is DBVar name, B is value
void checkStringForSave(HANDLE hContact, char* str)
{
- char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = strdup(str);
+ char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s=strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("save(\""))) return;
- for (i=0; i<s; i++)
- {
- if (!strncmp(&str[i], Translate("save(\""), strlen(Translate("save(\""))))
- {
+ for (i=0; i<s; i++) {
+ if (!strncmp(&str[i], Translate("save(\""), strlen(Translate("save(\"")))) {
i += strlen(Translate("save(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\")");
j = B - ©OfStr[i] + strlen(B)+1;
if (A && B)
- {
- DBWriteContactSettingString(hContact,modname, A, B);
- }
+ db_set_s(hContact,MODNAME, A, B);
+
else strncat(newStr, &str[i], j);
i += j;
}
- else
- {
- strncat(newStr, &str[i], 1);
- }
+ else strncat(newStr, &str[i], 1);
}
strcpy(str, newStr);
free(newStr);
@@ -303,34 +260,26 @@ void checkStringForSave(HANDLE hContact, char* str) // do load("A") A is DBVar name
void checkStringForLoad(HANDLE hContact, char* str)
{
- char *A,*newStr = (char*)malloc(strlen(str)),*copyOfStr = strdup(str);
+ char *A,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s=strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("load(\""))) return;
- for (i=0; i<s; i++)
- {
- if (!strncmp(&str[i], Translate("load(\""), strlen(Translate("load(\""))))
- {
+ for (i=0; i<s; i++) {
+ if (!strncmp(&str[i], Translate("load(\""), strlen(Translate("load(\"")))) {
i += strlen(Translate("load(\""));
A = strtok(©OfStr[i], "\")");
j = A - ©OfStr[i] + strlen(A)+1;
- if (A)
- {
+ if (A) {
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact,modname, A, &dbv))
- {
- if (dbv.type == DBVT_ASCIIZ)
- strcat(newStr, dbv.pszVal);
- DBFreeVariant(&dbv);
+ if ( !db_get_s(hContact, MODNAME, A, &dbv)) {
+ strcat(newStr, dbv.pszVal);
+ db_free(&dbv);
}
}
else strncat(newStr, &str[i], j);
i += j;
}
- else
- {
- strncat(newStr, &str[i], 1);
- }
+ else strncat(newStr, &str[i], 1);
}
strcpy(str, newStr);
free(newStr);
@@ -340,49 +289,42 @@ void checkStringForLoad(HANDLE hContact, char* str) // do saveN("A","B","C","D") A is module, B is setting, c is value, D is type 0/b 1/w 2/d 3/s
void checkStringForSaveN(char* str)
{
- char *A,*B,*C,*D,*newStr = (char*)malloc(strlen(str)),*copyOfStr = strdup(str);
+ char *A,*B,*C,*D,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s=strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("saveN(\""))) return;
- for (i=0; i<s; i++)
- {
- if (!strncmp(&str[i], Translate("saveN(\""), strlen(Translate("saveN(\""))))
- {
+ for (i=0; i<s; i++) {
+ if (!strncmp(&str[i], Translate("saveN(\""), strlen(Translate("saveN(\"")))) {
i += strlen(Translate("saveN(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\"");
C = strtok(NULL, ",\"");
D = strtok(NULL, ",\")");
j = D - ©OfStr[i] + strlen(D)+1;
- if (A && B && C && D)
- {
- switch (D[0])
- {
- case '0':
- case 'b':
- DBWriteContactSettingByte(NULL, A, B, (BYTE)atoi(C));
+ if (A && B && C && D) {
+ switch (D[0]) {
+ case '0':
+ case 'b':
+ db_set_b(NULL, A, B, (BYTE)atoi(C));
break;
- case '1':
- case 'w':
- DBWriteContactSettingWord(NULL, A, B, (WORD)atoi(C));
+ case '1':
+ case 'w':
+ db_set_w(NULL, A, B, (WORD)atoi(C));
break;
- case '2':
- case 'd':
- DBWriteContactSettingDword(NULL, A, B, (DWORD)atoi(C));
+ case '2':
+ case 'd':
+ db_set_dw(NULL, A, B, (DWORD)atoi(C));
break;
- case '3':
- case 's':
- DBWriteContactSettingString(NULL, A, B, C);
+ case '3':
+ case 's':
+ db_set_s(NULL, A, B, C);
break;
}
}
else strncat(newStr, &str[i], j);
i += j;
}
- else
- {
- strncat(newStr, &str[i], 1);
- }
+ else strncat(newStr, &str[i], 1);
}
strcpy(str, newStr);
free(newStr);
@@ -392,98 +334,98 @@ void checkStringForSaveN(char* str) // do loadN("A","B") A is module, B is setting
void checkStringForLoadN(char* str)
{
- char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = strdup(str), temp[32];
+ char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str), temp[32];
unsigned int i, j=0, s=strlen(str);
newStr[0] = '\0';
if (!strstr(str,Translate("loadN(\""))) return;
- for (i=0; i<s; i++)
- {
- if (!strncmp(&str[i], Translate("loadN(\""), strlen(Translate("loadN(\""))))
- {
+ for (i=0; i<s; i++) {
+ if (!strncmp(&str[i], Translate("loadN(\""), strlen(Translate("loadN(\"")))) {
i += strlen(Translate("loadN(\""));
A = strtok(©OfStr[i], "\",\"");
B = strtok(NULL, ",\")");
j = B - ©OfStr[i] + strlen(B)+1;
- if (A && B)
- {
+ if (A && B) {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL,A, B, &dbv))
- {
- switch (dbv.type)
- {
- case DBVT_BYTE:
- strcat(newStr,itoa(dbv.bVal,temp,10));
+ if ( !db_get(NULL, A, B, &dbv)) {
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ strcat(newStr,_itoa(dbv.bVal,temp,10));
break;
- case DBVT_WORD:
- strcat(newStr,itoa(dbv.wVal,temp,10));
+ case DBVT_WORD:
+ strcat(newStr,_itoa(dbv.wVal,temp,10));
break;
- case DBVT_DWORD:
- strcat(newStr,itoa(dbv.dVal,temp,10));
+ case DBVT_DWORD:
+ strcat(newStr,_itoa(dbv.dVal,temp,10));
break;
- case DBVT_ASCIIZ:
- strcat(newStr, dbv.pszVal);
+ case DBVT_ASCIIZ:
+ strcat(newStr, dbv.pszVal);
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else strncat(newStr, &str[i], j);
i += j;
}
- else
- {
- strncat(newStr, &str[i], 1);
- }
+ else strncat(newStr, &str[i], 1);
}
strcpy(str, newStr);
free(newStr);
free(copyOfStr);
}
-BOOL GetLastWriteTime(HANDLE hFile, LPTSTR lpszString)
+BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString)
{
- FILETIME ftCreate, ftAccess, ftWrite;
- SYSTEMTIME stUTC, stLocal;
+ FILETIME ftCreate, ftAccess, ftWrite;
+ SYSTEMTIME stUTC, stLocal;
- // Retrieve the file times for the file.
- if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite))
- return FALSE;
+ // Retrieve the file times for the file.
+ if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite))
+ return FALSE;
- // Convert the last-write time to local time.
- FileTimeToSystemTime(&ftWrite, &stUTC);
- SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
+ // Convert the last-write time to local time.
+ FileTimeToSystemTime(&ftWrite, &stUTC);
+ SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
- // Build a string showing the date and time.
- wsprintf(lpszString, TEXT("%02d/%02d/%d %02d:%02d"),
- stLocal.wDay, stLocal.wMonth, stLocal.wYear,
- stLocal.wHour, stLocal.wMinute);
+ // Build a string showing the date and time.
+ wsprintfA(lpszString, "%02d/%02d/%d %02d:%02d",
+ stLocal.wDay, stLocal.wMonth, stLocal.wYear,
+ stLocal.wHour, stLocal.wMinute);
- return TRUE;
+ return TRUE;
}
// do lastchecked(file(X)) returns amount of chars to add to str pointer
-int lastChecked(char* newStr, const char* str)
+int lastChecked(char *newStr, const char *str)
{
- if (!strncmp(str, Translate("lastchecked(file("), strlen(Translate("lastchecked(file("))))
- {
+ char *szPattern = Translate("lastchecked(file(");
+ size_t cbPattern = strlen(szPattern);
+
+ if (!strncmp(str, szPattern, cbPattern)) {
int file;
- HANDLE hFile;
- char FileName[MAX_PATH], temp[MAX_PATH];
- sscanf(&str[strlen(Translate("lastchecked(file("))], "%d", &file);
- _snprintf(FileName, MAX_PATH, "fn%d", file);
- DBGetContactSettingString(NULL,modname, FileName, FileName);
-
- if (!strncmp("http://", FileName, strlen("http://")) || !strncmp("https://", FileName, strlen("https://")))
- wsprintf(FileName, "%s\\plugins\\fn%d.html",getMimDir(temp),file);
- hFile= CreateFile(FileName, 0 , FILE_SHARE_READ , 0 ,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL );
- if (hFile == INVALID_HANDLE_VALUE) return 0;
- if (GetLastWriteTime(hFile, FileName))
- {
- strcat(newStr, FileName);
- _snprintf(FileName, MAX_PATH, "%s%d))",Translate("lastchecked(file("), file);
- return strlen(FileName);
+ char tszFileName[MAX_PATH], temp[MAX_PATH], szSetting[20];
+ sscanf(&str[cbPattern], "%d", &file);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "fn%d", file);
+
+ DBVARIANT dbv;
+ if (db_get_s(NULL, MODNAME, szSetting, &dbv))
+ return 0;
+
+ if (!strncmp("http://", dbv.pszVal, 7) || !strncmp("https://", dbv.pszVal, 8))
+ mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), file);
+ else
+ strncpy(tszFileName, dbv.pszVal, SIZEOF(tszFileName));
+ HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ return 0;
+
+ if (GetLastWriteTime(hFile, tszFileName)) {
+ CloseHandle(hFile);
+ strcat(newStr, tszFileName);
+ _snprintf(tszFileName, MAX_PATH, "%s%d))", szPattern, file);
+ return strlen(tszFileName);
}
- return 0;
+ CloseHandle(hFile);
}
return 0;
}
@@ -493,13 +435,10 @@ int lastChecked(char* newStr, const char* str) void checkIcon(HANDLE hContact, char* string)
{
char* str = strstr(string,"icon(");
- if (str)
- {
+ if (str) {
int icon = getNumber(str+5);
if (icon >=0)
- {
- DBWriteContactSettingWord(hContact, modname, "Status", (WORD)(ID_STATUS_OFFLINE+icon));
- }
+ db_set_w(hContact, MODNAME, "Status", (WORD)(ID_STATUS_OFFLINE+icon));
}
}
@@ -508,15 +447,14 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) char var_file[8];
int tempInt;
int startLine = 0, endLine = 0, startChar=0, endChar = 0, wholeLine=-1, linesInFile;
- unsigned int positionInOldString = 0;
+ int positionInOldString = 0;
char *fileContents[MAXLINES] = {NULL}, tempString[MAX_STRING_LENGTH];
-
-// setup the variable names
+
+ // setup the variable names
strcpy(newString, "");
strcpy(var_file, Translate("file("));
-
- while ((positionInOldString < strlen(oldString)) && (oldString[positionInOldString] != '\0'))
+ while ((positionInOldString < (int)strlen(oldString)) && (oldString[positionInOldString] != '\0'))
{
// load the file... must be first
if (!strncmp(&oldString[positionInOldString], var_file, strlen(var_file)))
@@ -533,8 +471,8 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) // read the file
linesInFile = readFileIntoArray(tempInt, fileContents);
if (linesInFile == 0) return ERROR_NO_FILE;
- positionInOldString += strlen(itoa(tempInt, tempString,10)) + 1; // +1 for the closing )
-
+ positionInOldString += strlen(_itoa(tempInt, tempString,10)) + 1; // +1 for the closing )
+
// wholeline()
if (!strncmp(&oldString[positionInOldString], Translate("wholeline(line("), strlen(Translate("wholeline(line("))))
{
@@ -545,7 +483,7 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) else wholeLine =tempInt;
positionInOldString += 3; // add 2 for the )) for wholeline(line())
}
-
+
if (!strncmp(&oldString[positionInOldString], Translate("start("), strlen(Translate("start("))))
{
positionInOldString += strlen(Translate("start(line("));
@@ -617,11 +555,11 @@ int stringReplacer(const char* oldString, char* newString, HANDLE hContact) }
else
{
- wsprintf(tempString, "fn%d", tempInt);
- if (DBGetContactSettingString(NULL, modname,tempString, tempString))
+ wsprintfA(tempString, "fn%d", tempInt);
+ if (db_get_static(NULL, MODNAME,tempString, tempString))
strcat(newString, tempString);
else return ERROR_NO_FILE;
- positionInOldString += strlen(itoa(tempInt, tempString, 10))+1;
+ positionInOldString += strlen(_itoa(tempInt, tempString, 10))+1;
}
}
// lastchecked(file(X))
@@ -668,60 +606,57 @@ void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module2 {
char text[MAX_STRING_LENGTH], newString[MAX_STRING_LENGTH];
int error = 0, status = GetLCStatus(0,0);
- if (DBGetContactSettingString(hContact, module1, setting1, text))
- {
- switch (stringReplacer(text, newString, hContact))
- {
- case ERROR_NO_LINE_AFTER_VAR_F:
- wsprintf(newString, Translate("%s - ERROR: no line specified or line not found (in %s)"),text, setting1);
- error = 1;
+ if (db_get_static(hContact, module1, setting1, text)) {
+ switch (stringReplacer(text, newString, hContact)) {
+ case ERROR_NO_LINE_AFTER_VAR_F:
+ wsprintfA(newString, Translate("%s - ERROR: no line specified or line not found (in %s)"),text, setting1);
+ error = 1;
break;
- case ERROR_LINE_NOT_READ:
- wsprintf(newString, Translate("%s - ERROR: file couldnt be opened (in %s)"), text, setting1);
- error = 1;
+ case ERROR_LINE_NOT_READ:
+ wsprintfA(newString, Translate("%s - ERROR: file couldnt be opened (in %s)"), text, setting1);
+ error = 1;
break;
- case ERROR_NO_FILE:
- wsprintf(newString, Translate("%s - ERROR: no file specified in settings (in %s)"), text, setting1);
- error = 1;
+ case ERROR_NO_FILE:
+ wsprintfA(newString, Translate("%s - ERROR: no file specified in settings (in %s)"), text, setting1);
+ error = 1;
break;
- default:
- error = 0;
+ default:
+ error = 0;
break;
}
// strip the tab and new lines from all except the tooltip
if (!error && strcmp(setting1, "ToolTip")) stripWhiteSpace(newString);
- DBWriteContactSettingString(hContact, module2, setting2, newString);
+ db_set_s(hContact, module2, setting2, newString);
}
- else DBWriteContactSettingString(hContact, module2, setting2, "");
+ else db_set_s(hContact, module2, setting2, "");
if (!error)
{
if ( (status == ID_STATUS_ONLINE) || (status == ID_STATUS_AWAY) ||
- (status == DBGetContactSettingWord(hContact, modname, "Icon", ID_STATUS_ONLINE) ) ||
- DBGetContactSettingByte(hContact, modname ,"AlwaysVisible", 0)
- )
- DBWriteContactSettingWord(hContact, modname, "Status", (WORD)DBGetContactSettingWord(hContact, modname, "Icon", ID_STATUS_ONLINE));
- else DBWriteContactSettingWord(hContact, modname, "Status", ID_STATUS_OFFLINE);
+ (status == db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) ) ||
+ db_get_b(hContact, MODNAME ,"AlwaysVisible", 0)
+ )
+ db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE));
+ else db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE);
}
- else DBWriteContactSettingWord(hContact, modname, "Status", ID_STATUS_OFFLINE);
+ else db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE);
}
-
+
void replaceAllStrings(HANDLE hContact)
{
char tmp1[256], tmp2[256], tmp3[256];
- WriteSetting(hContact, modname, "Name", modname, "Nick");
- WriteSetting(hContact, modname, "ProgramString", modname, "Program");
- WriteSetting(hContact, modname, "ProgramParamsString", modname, "ProgramParams");
+ WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
+ WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
+ WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
/* tooltips*/
- WriteSetting(hContact, modname, "ToolTip", "UserInfo", "MyNotes");
- if (DBGetContactSettingString(hContact, modname, "Program", tmp1) && DBGetContactSettingString(hContact, modname, "ProgramParams", tmp2))
- {
- wsprintf(tmp3, "%s %s", tmp1, tmp2);
- DBWriteContactSettingString(hContact, "UserInfo", "FirstName", tmp3);
+ WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
+ if (db_get_static(hContact, MODNAME, "Program", tmp1) && db_get_static(hContact, MODNAME, "ProgramParams", tmp2)) {
+ wsprintfA(tmp3, "%s %s", tmp1, tmp2);
+ db_set_s(hContact, "UserInfo", "FirstName", tmp3);
}
- else if (DBGetContactSettingString(hContact, modname, "Program", tmp1))
+ else if (db_get_static(hContact, MODNAME, "Program", tmp1))
{
- DBWriteContactSettingString(hContact, "UserInfo", "FirstName", tmp1);
+ db_set_s(hContact, "UserInfo", "FirstName", tmp1);
}
- else DBWriteContactSettingString(hContact, "UserInfo", "FirstName", "");
+ else db_set_s(hContact, "UserInfo", "FirstName", "");
}
diff --git a/plugins/!NotAdopted/Non-IM Contact/resource.h b/plugins/Non-IM Contact/src/resource.h index 928cde8564..928cde8564 100644 --- a/plugins/!NotAdopted/Non-IM Contact/resource.h +++ b/plugins/Non-IM Contact/src/resource.h diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp new file mode 100644 index 0000000000..1e547fb80c --- /dev/null +++ b/plugins/Non-IM Contact/src/services.cpp @@ -0,0 +1,127 @@ +#include "commonheaders.h"
+
+//=======================================================
+//db_get_static
+//=======================================================
+int db_get_static(HANDLE hContact, const char *szModule, const char *szSetting, char *value)
+{
+ DBVARIANT dbv;
+ if (!DBGetContactSetting(hContact, szModule, szSetting, &dbv))
+ {
+ strcpy(value, dbv.pszVal);
+ db_free(&dbv);
+ return 1;
+ }
+ else
+ {
+ db_free(&dbv);
+ return 0;
+ }
+
+ return 0;
+}
+
+//=======================================================
+//GetCaps
+//=======================================================
+
+INT_PTR GetLCCaps(WPARAM wParam,LPARAM lParam)
+{
+ if (wParam==PFLAGNUM_1)
+ return 0;
+ if (wParam==PFLAGNUM_2)
+ return PF2_ONLINE|PF2_LONGAWAY|PF2_SHORTAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_INVISIBLE|PF2_OUTTOLUNCH|PF2_ONTHEPHONE; // add the possible statuses here.
+ if (wParam==PFLAGNUM_3)
+ return 0;
+ return 0;
+}
+
+//=======================================================
+//GetName
+//=======================================================
+INT_PTR GetLCName(WPARAM wParam,LPARAM lParam)
+{
+ lstrcpynA((char*)lParam, MODNAME, wParam);
+ return 0;
+}
+
+//=======================================================
+//BPLoadIcon
+//=======================================================
+INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam)
+{
+ UINT id;
+
+ switch(wParam & 0xFFFF) {
+ case PLI_PROTOCOL: id=IDI_MAIN; break; // IDI_MAIN is the main icon for the protocol
+ default: return (int)(HICON)NULL;
+ }
+ return (int)LoadImage(hInst,MAKEINTRESOURCE(id),IMAGE_ICON,GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON),GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON),0);
+}
+
+//=======================================================
+//SetFStatus
+//=======================================================
+int SetLCStatus(WPARAM wParam,LPARAM lParam)
+{
+ int oldStatus;
+ HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ const char* szProto = (const char*)lParam;
+ if (szProto && strcmp(szProto, MODNAME)) return 0; // not nimc so ignore anyway...
+ else if (!szProto && db_get_b(NULL, MODNAME, "IgnoreGlobalStatusChange",0)) return 0; // global change and being ignored
+ else {
+ oldStatus = LCStatus;
+ LCStatus = wParam;
+ db_set_w(NULL, MODNAME, "Status", (WORD)wParam);
+ db_set_w(NULL, MODNAME, "timerCount",0);
+ if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !db_get_b(NULL, MODNAME, "AwayAsStatus", 0)) || !db_get_w(NULL, MODNAME, "Timer",1)) killTimer();
+ else if (db_get_w(NULL, MODNAME, "Timer",1))
+ startTimer(TIMER);
+ while (hContact) {
+ char* proto = GetContactProto(hContact);
+ if (proto && !strcmp(proto, MODNAME)) {
+ if (LCStatus != ID_STATUS_OFFLINE) replaceAllStrings(hContact);
+ switch (LCStatus) {
+ case ID_STATUS_OFFLINE:
+ if (db_get_b(hContact, MODNAME, "AlwaysVisible",0) && !db_get_b(hContact, MODNAME, "VisibleUnlessOffline",1))
+ db_set_w(hContact,MODNAME, "Status",(WORD)db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE));
+ else
+ db_set_w(hContact,MODNAME, "Status", ID_STATUS_OFFLINE);
+ break;
+ case ID_STATUS_ONLINE:
+ db_set_w(hContact,MODNAME, "Status",(WORD)db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE));
+ break;
+ case ID_STATUS_AWAY:
+ if (db_get_b(NULL, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible",0) || (db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE)==ID_STATUS_AWAY)) )
+ db_set_w(hContact,MODNAME, "Status",(WORD)(WORD)db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE));
+ else if (!db_get_b(NULL, MODNAME, "AwayAsStatus", 0))
+ db_set_w(hContact,MODNAME, "Status",(WORD)db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE));
+ else
+ db_set_w(hContact,MODNAME, "Status", ID_STATUS_OFFLINE);
+ break;
+ default:
+ if (db_get_b(hContact, MODNAME, "AlwaysVisible",0) || LCStatus == db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE))
+ db_set_w(hContact,MODNAME, "Status",(WORD)db_get_w(hContact,MODNAME, "Icon",ID_STATUS_ONLINE));
+ break;
+ }
+ }
+ hContact = db_find_next(hContact);
+ }
+ ProtoBroadcastAck(MODNAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldStatus,wParam);
+ }
+ return 0;
+}
+
+
+
+//=======================================================
+//GetStatus
+//=======================================================
+INT_PTR GetLCStatus(WPARAM wParam,LPARAM lParam)
+{
+ if ((LCStatus >= ID_STATUS_ONLINE) && (LCStatus <= ID_STATUS_OUTTOLUNCH))
+ return LCStatus;
+ else
+ return ID_STATUS_OFFLINE;
+}
+
diff --git a/plugins/Non-IM Contact/src/stdafx.cpp b/plugins/Non-IM Contact/src/stdafx.cpp new file mode 100644 index 0000000000..e7e41dae3c --- /dev/null +++ b/plugins/Non-IM Contact/src/stdafx.cpp @@ -0,0 +1,18 @@ +/*
+Copyright (C) 2012-13 Miranda NG Project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "commonheaders.h"
\ No newline at end of file diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp new file mode 100644 index 0000000000..42e2b47df1 --- /dev/null +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -0,0 +1,84 @@ +#include "commonheaders.h"
+
+UINT_PTR timerId;
+
+//=====================================================
+// Name : timerProc
+// Parameters: none
+// Returns : void
+// Description : called when the timer interval occurs
+//=====================================================
+
+void timerFunc(LPVOID di)
+{
+ char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
+
+ int timerCount = db_get_w(NULL, MODNAME, "timerCount",1)+1;
+
+ if (LCStatus == ID_STATUS_OFFLINE) {
+ killTimer();
+ return;
+ }
+ db_set_w(NULL, MODNAME, "timerCount", (WORD)timerCount);
+
+ /* update the web pages*/
+ for (int i=0; ;i++) {
+ sprintf(fn, "fn%d", i);
+ if (!db_get_static(NULL, MODNAME, fn, text))
+ break;
+
+ if (!strncmp("http://", text, strlen("http://"))) {
+ strcat(fn, "_timer");
+ int timer = db_get_w(NULL, MODNAME, fn, 60);
+ if (timer && !(timerCount % timer)) {
+ if (!InternetDownloadFile(text)) {
+ mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), i);
+ savehtml(szFileName);
+ }
+ }
+ }
+ }
+
+ /* update all the contacts */
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ if (!strcmp(MODNAME, GetContactProto(hContact))) {
+ int timer = db_get_w(hContact, MODNAME, "Timer", 15);
+ if (timer && !(timerCount % timer))
+ if (db_get_static(hContact, MODNAME, "Name", text))
+ replaceAllStrings(hContact);
+ }
+ }
+}
+
+void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
+{
+ // new thread for the timer...
+ forkthread(timerFunc, 0, 0);
+}
+
+//=====================================================
+// Name : startTimer
+// Parameters: int interval
+// Returns : int
+// Description : starts the timer
+//=====================================================
+
+int startTimer(int interval)
+{
+ timerId = SetTimer(NULL, 0, interval, timerProc);
+ return 0;
+}
+
+//=====================================================
+// Name : killTimer
+// Parameters: none
+// Returns : int
+// Description : stops the timer
+//=====================================================
+
+int killTimer()
+{
+ db_set_w(NULL, MODNAME, "timerCount",0);
+ KillTimer(NULL,timerId);
+ return 0;
+}
|