diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-22 04:29:25 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-22 04:29:25 +0000 |
commit | 319ec9408e1f8beda226481058a864477d156715 (patch) | |
tree | 425057d8b44023fec5e6cfeac4a816ab0bf75b6d /plugins/!NotAdopted | |
parent | 116a7a99f40e0b0de8dc29c02238c0a8c0cb38cd (diff) |
Non-IM Contact added to not adopted
git-svn-id: http://svn.miranda-ng.org/main/trunk@4158 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted')
18 files changed, 4007 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/Non-IM Contact/commonheaders.h b/plugins/!NotAdopted/Non-IM Contact/commonheaders.h new file mode 100644 index 0000000000..596c0b4403 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/commonheaders.h @@ -0,0 +1,142 @@ +//=====================================================
+// 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 new file mode 100644 index 0000000000..2a6fb5cea7 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/contactinfo.c @@ -0,0 +1,785 @@ +#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/dialog.c b/plugins/!NotAdopted/Non-IM Contact/dialog.c new file mode 100644 index 0000000000..e8623b7c9c --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/dialog.c @@ -0,0 +1,389 @@ +#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;
+
+ /* 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].pszIcon = NULL;
+ psp[0].pfnDlgProc = DlgProcContactInfo;
+ psp[0].pszTitle = "Contacts Display Info";
+ psp[0].lParam = (LPARAM)(HANDLE)hContact;
+ psp[0].pfnCallback = NULL;
+
+ /* other settings */
+ ZeroMemory(&psp[1], sizeof(PROPSHEETPAGE));
+ 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].pszIcon = NULL;
+ psp[1].pfnDlgProc = DlgProcOtherStuff;
+ psp[1].pszTitle = "Link and CList Settings";
+ psp[1].lParam = (LPARAM)(HANDLE)hContact;
+ psp[1].pfnCallback = NULL;
+
+ /* files */
+ ZeroMemory(&psp[3], sizeof(PROPSHEETPAGE));
+ 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].pszIcon = NULL;
+ psp[3].pfnDlgProc = DlgProcFiles;
+ psp[3].pszTitle = "Files";
+ psp[3].lParam = 0;
+ psp[3].pfnCallback = NULL;
+
+ /* copy contact */
+ ZeroMemory(&psp[2], sizeof(PROPSHEETPAGE));
+ 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].pszIcon = NULL;
+ psp[2].pfnDlgProc = DlgProcCopy;
+ psp[2].pszTitle = "Copy Contact";
+ psp[2].lParam = (LPARAM)(HANDLE)hContact;
+ psp[2].pfnCallback = NULL;
+
+
+ /* propery sheet header.. dont touch !!!! */
+ ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+ psh.dwSize = sizeof(PROPSHEETHEADER);
+ 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.pszCaption = title;
+ psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+ psh.nStartPage = 0;
+ psh.ppsp = (LPCPROPSHEETPAGE) &psp;
+ psh.pfnCallback = PropSheetProc;
+
+ // Now do it and return
+ PropertySheet(&psh);
+ return;
+}
+int 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_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
+ DBWriteContactSettingString(hContact, modname, "Nick", Translate("New Non-IM Contact"));
+ DoPropertySheet(hContact, hInst);
+ if (!DBGetContactSettingString(hContact, modname, "Name", tmp))
+ CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0);
+ replaceAllStrings(hContact);
+ return 0;
+}
+
+int 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_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE);
+ DBWriteContactSettingString(hContact, modname, "Nick", Translate("New Non-IM Contact"));
+ }
+ DoPropertySheet(hContact, hInst);
+ if (!DBGetContactSettingString(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:
+ break;
+ case PSBTN_CANCEL:
+ break;
+ case PSBTN_FINISH:
+ break;
+ case PSBTN_APPLYNOW:
+ break;
+ }
+ return 0;
+}
+
+BOOL CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ 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))
+ {
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_INT),1);
+ SetDlgItemText(hwnd, IDC_TIMER_INT, itoa(DBGetContactSettingWord(NULL, modname, "Timer", 1),tmp,10));
+ EnableWindow(GetDlgItem(hwnd,IDC_TIMER_TEXT),1);
+ }
+ else
+ {
+ CheckDlgButton(hwnd, IDC_DISABLETIMER, 1);
+ 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;
+
+
+ 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;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+
+// string replace test window thingamijig....
+
+// struct to keep track of ()'s in the test sring window
+#define MAX_BRACES 32
+#define VARS 7
+struct braces {
+ char var[64];
+ int idCtrl;
+} braceList[VARS] =
+{
+ {"file(", IDC_FILE},
+ {"start(", IDC_START},
+ {"end(", IDC_END},
+ {"csv(", IDC_CSV},
+ {"wholeline(", IDC_WHOLELINE},
+ {"filename(", IDC_FILENAME},
+ {"line(", IDC_LINE}
+};
+int braceOrder[MAX_BRACES] = {0};
+
+BOOL CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg) {
+ 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"));
+ strcat(string, Translate("start(...)\t\t<-specifies where to start copying from.\r\n"));
+ strcat(string, Translate("end(...)\t\t<-specifies where to stop copying.\r\n"));
+ strcat(string, Translate("wholeline(line(...))\t<-specifies a whole line to copy\r\n\r\n"));
+ strcat(string, Translate("start() and end() explained\r\n.........................\r\n"));
+ strcat(string, Translate("MUST start with line() followed by a number or a string inside \" marks, OR csv(seperatorX) variable\r\n"));
+ strcat(string, Translate("The number specifies which character in the line to start/end copying.\r\nThe string specifies a string in the line to start/end copying.\r\n"));
+ strcat(string, Translate("csv(seperatorX) explained...\r\nseperator is either \"tab\" or \"space\" or any SINGLE character.\r\nX is the Xth seperator to pass before copying, (or to stop before)\r\n\r\n"));
+ strcat(string, Translate("Lastly the line(...) variable...\r\n"));
+ strcat(string, Translate("Inside the brackets must be either a number (to specify the line number), or a string inside \" marks (to use the line with that string), or lastline(X).\r\nthe X in lastline is the Xth line above the last line. i.e lastline(1) will use the 2nd last line of the file.\r\n"));
+ 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);
+ }
+ return TRUE;
+ 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)
+{
+ switch(msg) {
+ 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);
+ 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;
+ }
+ }
+ 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);
+ }
+ }
+
+ }
+
+ 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);
+ }
+ }
+ break;
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+int testStringReplacer(WPARAM wParam, LPARAM lParam)
+{
+ CreateDialog(hInst,MAKEINTRESOURCE(IDD_TEST_LINE),0,TestWindowDlgProc);
+ return 0;
+}
+
+int 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/!NotAdopted/Non-IM Contact/files.c b/plugins/!NotAdopted/Non-IM Contact/files.c new file mode 100644 index 0000000000..00950db655 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/files.c @@ -0,0 +1,367 @@ +#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/http.c b/plugins/!NotAdopted/Non-IM Contact/http.c new file mode 100644 index 0000000000..7c78d9f8aa --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/http.c @@ -0,0 +1,101 @@ +/*
+Weather Protocol plugin for Miranda IM
+Copyright (C) 2002-2004 Calvin Che
+
+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; either version 2
+of the License, or (at your option) any later version.
+
+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, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/* This file contain the source related to downloading weather info
+ from the web using netlib
+*/
+
+#include "commonheaders.h"
+/* thanks to noname for the following code :) */
+//============ DOWNLOAD NEW WEATHER ============
+
+// function to download webpage from the internet
+// szUrl = URL of the webpage to be retrieved
+// return value = 0 for success, 1 or HTTP error code for failure
+// global var used: szData, szInfo = containing the retrieved data
+int InternetDownloadFile (CHAR *szUrl)
+{
+ NETLIBHTTPREQUEST nlhr={0}, *nlhrReply;
+
+ // initialize the netlib request
+ nlhr.cbSize=sizeof(nlhr);
+ nlhr.requestType=REQUEST_GET;
+ nlhr.flags=NLHRF_DUMPASTEXT;
+ nlhr.szUrl= szUrl;
+ // change the header so the plugin is pretended to be IE 6 + WinXP
+ nlhr.headersCount++;
+ nlhr.headers=(NETLIBHTTPHEADER*)malloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
+ CopyMemory(nlhr.headers,nlhr.headers,sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
+ nlhr.headers[nlhr.headersCount-1].szName="User-Agent";
+ nlhr.headers[nlhr.headersCount-1].szValue="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+
+ // download the page
+ nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&nlhr);
+ if(nlhrReply) {
+ // return error code if the recieved code is neither 200 OK or 302 Moved
+ if(nlhrReply->resultCode != 200 && nlhrReply->resultCode != 302)
+ return (int)nlhrReply->resultCode;
+ // if the recieved code is 200 OK
+ 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));
+ }
+ // if the recieved code is 302 Moved, Found, etc
+ 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")) {
+ 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);
+ break;
+ }
+ }
+ // log the new url into netlib log
+ CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szData);
+ }
+ }
+ // if the data does not downloaded successfully (ie. disconnected), then return 1 as error code
+ else return 1;
+
+ // make a copy of the retrieved data, then free the memory of the http reply
+ szInfo = szData;
+ 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;
+ return 0;
+}
+
+//============ NETLIB INITIALIZATION ============
+
+// initialize netlib support from weather protocol
+void NetlibInit() {
+ NETLIBUSER nlu={0};
+ nlu.cbSize=sizeof(nlu);
+ nlu.flags=NUF_OUTGOING|NUF_HTTPCONNS|NUF_NOHTTPSOPTION;
+ nlu.szSettingsModule= modname;
+ nlu.szDescriptiveName= Translate("Non-IM Contacts");
+ hNetlibUser=(HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
+}
diff --git a/plugins/!NotAdopted/Non-IM Contact/main.c b/plugins/!NotAdopted/Non-IM Contact/main.c new file mode 100644 index 0000000000..4fa42d552f --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/main.c @@ -0,0 +1,272 @@ +
+
+//=====================================================
+// 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/namereplacing.c b/plugins/!NotAdopted/Non-IM Contact/namereplacing.c new file mode 100644 index 0000000000..25dc8f5a3c --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/namereplacing.c @@ -0,0 +1,727 @@ +#include "commonheaders.h"
+
+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);
+
+ if (!strncmp("http://", FileName, strlen("http://")))
+ wsprintf(FileName, "%s\\plugins\\fn%d.html",getMimDir(temp),fileNumber);
+
+ 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')
+ 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;
+}
+
+int getNumber(const char* line)
+{
+ int i;
+ if (sscanf(line, "%d", &i) == 1) return i; else return -1;
+}
+
+int findWordInString(const char* line, const char* string, int* lengthOfWord, int flag) /* flag = 0 %from, flag = 1 %until */
+{
+ unsigned int i, j=0;
+ char word[64]="", OpenDivider[8], CloseDivider[8];
+ 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++)
+ {
+ word[j] = string[i];
+ word[++j] = '\0';
+ }
+ }
+ 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)))
+ {
+ if (!flag) return i + strlen(word); /* the next char after the word */
+ else return i; /* the char before the word */
+ }
+ i++;
+ }
+ return -1;
+}
+
+int findLine(char* FileContents[], const char* string, int linesInFile,int startLine, int *positionInOldString)
+{
+ int i;
+ char tmp[5];
+ 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;
+ return i;
+ }
+ // lastline
+ else 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));
+ return linesInFile - (i+1);
+ }
+ else
+ {
+ *positionInOldString ++;
+ return (linesInFile - 1);
+ }
+ }
+ // string
+ else if (string[*positionInOldString] == '\"')
+ {
+ 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';
+ }
+ // find the word
+ for (j=startLine; j<linesInFile;j++)
+ {
+ if (strstr(FileContents[j], string2Find))
+ {
+ i = j;
+ break;
+ }
+ 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] == '+')
+ {
+ *positionInOldString += 1;
+ j = getNumber(&string[*positionInOldString]);
+ if (j != -1)
+ {
+ *positionInOldString += strlen(itoa(j,tmp,10))-2;
+ return i+j;
+ }
+ }
+ else if (string[*positionInOldString] == '-')
+ {
+ *positionInOldString+=1;
+ j = getNumber(&string[*positionInOldString]);
+ if (j != -1)
+ {
+ *positionInOldString += strlen(itoa(j,tmp,10))-2;
+ return i-j;
+ }
+ }
+ 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;
+}
+
+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]);
+ // check if its a number
+ if ( i != -1)
+ {
+ *positionInOldString += strlen(itoa(i,tmp,10)) - 1;
+ return i;
+ }
+ // string
+ else if (string[*positionInOldString] == '\"')
+ {
+ char string2Find[256];
+ unsigned int j=0;
+ // get the word to find
+ 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);
+ }
+ }
+ // csv(
+ else 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))
+ {
+ *positionInOldString += 3;
+ seperator = '\t';
+ }
+ else if (!strncmp(&string[*positionInOldString], "space",5))
+ {
+ *positionInOldString += 5;
+ seperator = ' ';
+ }
+ else
+ {
+ seperator =string[*positionInOldString];
+ *positionInOldString += 1;
+ }
+ i = getNumber(&string[*positionInOldString]);
+ if ( i == -1) return -1;
+ *positionInOldString += strlen(itoa(i,tmp,10));
+ while (j<i)
+ {
+ if (FileContents[startLine][k] == '\0') break;
+ if (FileContents[startLine][k] == seperator)
+ j++;
+ k++;
+ }
+ return k;
+ }
+ 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);
+ 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(\""))))
+ {
+ i += strlen(Translate("compare(\""));
+ A = strtok(©OfStr[i], "\",\"");
+ B = strtok(NULL, "\",\"");
+ X = strtok(NULL, "\",\"");
+ Y = strtok(NULL, ",\")");
+ j = Y - ©OfStr[i] + strlen(Y)+1;
+ if (A && B && X && Y)
+ {
+ if (!strcmp(A,B))
+ strcat(newStr, X);
+ else strcat(newStr, Y);
+ }
+ else strncat(newStr, &str[i], j);
+ i += j;
+ }
+ else
+ {
+ strncat(newStr, &str[i], 1);
+ }
+ }
+ strcpy(str, newStr);
+ free(newStr);
+ free(copyOfStr);
+}
+
+// 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);
+ 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(\""))))
+ {
+ 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);
+ }
+ else strncat(newStr, &str[i], j);
+ i += j;
+ }
+ else
+ {
+ strncat(newStr, &str[i], 1);
+ }
+ }
+ strcpy(str, newStr);
+ free(newStr);
+ free(copyOfStr);
+}
+
+// do load("A") A is DBVar name
+void checkStringForLoad(HANDLE hContact, char* 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(\""))))
+ {
+ i += strlen(Translate("load(\""));
+ A = strtok(©OfStr[i], "\")");
+ j = A - ©OfStr[i] + strlen(A)+1;
+ if (A)
+ {
+ DBVARIANT dbv;
+ if (!DBGetContactSetting(hContact,modname, A, &dbv))
+ {
+ if (dbv.type == DBVT_ASCIIZ)
+ strcat(newStr, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+ }
+ else strncat(newStr, &str[i], j);
+ i += j;
+ }
+ else
+ {
+ strncat(newStr, &str[i], 1);
+ }
+ }
+ strcpy(str, newStr);
+ free(newStr);
+ free(copyOfStr);
+}
+
+// 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);
+ 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(\""))))
+ {
+ 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));
+ break;
+ case '1':
+ case 'w':
+ DBWriteContactSettingWord(NULL, A, B, (WORD)atoi(C));
+ break;
+ case '2':
+ case 'd':
+ DBWriteContactSettingDword(NULL, A, B, (DWORD)atoi(C));
+ break;
+ case '3':
+ case 's':
+ DBWriteContactSettingString(NULL, A, B, C);
+ break;
+ }
+ }
+ else strncat(newStr, &str[i], j);
+ i += j;
+ }
+ else
+ {
+ strncat(newStr, &str[i], 1);
+ }
+ }
+ strcpy(str, newStr);
+ free(newStr);
+ free(copyOfStr);
+}
+
+// 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];
+ 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(\""))))
+ {
+ i += strlen(Translate("loadN(\""));
+ A = strtok(©OfStr[i], "\",\"");
+ B = strtok(NULL, ",\")");
+ j = B - ©OfStr[i] + strlen(B)+1;
+ if (A && B)
+ {
+ DBVARIANT dbv;
+ if (!DBGetContactSetting(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));
+ break;
+ case DBVT_DWORD:
+ strcat(newStr,itoa(dbv.dVal,temp,10));
+ break;
+ case DBVT_ASCIIZ:
+ strcat(newStr, dbv.pszVal);
+ break;
+ }
+ DBFreeVariant(&dbv);
+ }
+ }
+ else strncat(newStr, &str[i], j);
+ i += j;
+ }
+ else
+ {
+ strncat(newStr, &str[i], 1);
+ }
+ }
+ strcpy(str, newStr);
+ free(newStr);
+ free(copyOfStr);
+}
+
+BOOL GetLastWriteTime(HANDLE hFile, LPTSTR lpszString)
+{
+ FILETIME ftCreate, ftAccess, ftWrite;
+ SYSTEMTIME stUTC, stLocal;
+
+ // 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);
+
+ // 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);
+
+ return TRUE;
+}
+
+// do lastchecked(file(X)) returns amount of chars to add to str pointer
+int lastChecked(char* newStr, const char* str)
+{
+ if (!strncmp(str, Translate("lastchecked(file("), strlen(Translate("lastchecked(file("))))
+ {
+ 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);
+ }
+ return 0;
+ }
+ return 0;
+}
+
+
+// do icon(x) 0=offline, 1=online, 10=lunch
+void checkIcon(HANDLE hContact, char* string)
+{
+ char* str = strstr(string,"icon(");
+ if (str)
+ {
+ int icon = getNumber(str+5);
+ if (icon >=0)
+ {
+ DBWriteContactSettingWord(hContact, modname, "Status", (WORD)(ID_STATUS_OFFLINE+icon));
+ }
+ }
+}
+
+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;
+ char *fileContents[MAXLINES] = {NULL}, tempString[MAX_STRING_LENGTH];
+
+// setup the variable names
+ strcpy(newString, "");
+ strcpy(var_file, Translate("file("));
+
+
+ while ((positionInOldString < strlen(oldString)) && (oldString[positionInOldString] != '\0'))
+ {
+ // load the file... must be first
+ if (!strncmp(&oldString[positionInOldString], var_file, strlen(var_file)))
+ {
+ positionInOldString += strlen(var_file);
+ // check if its a number
+ tempInt = getNumber(&oldString[positionInOldString]);
+ if (tempInt == -1)
+ {
+ // not a number so check vars..
+ // there are none yet
+ return ERROR_NO_FILE;
+ }
+ // 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 )
+
+ // wholeline()
+ if (!strncmp(&oldString[positionInOldString], Translate("wholeline(line("), strlen(Translate("wholeline(line("))))
+ {
+ positionInOldString += strlen(Translate("wholeline(line("));
+ tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
+ if (tempInt == -1|| !fileContents[tempInt])
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ 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("));
+ tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
+ if (tempInt == -1 || !fileContents[tempInt])
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ else
+ {
+ positionInOldString+=2;
+ startLine = tempInt;
+ if (!endChar ) endChar = strlen(fileContents[startLine]);
+ tempInt = findChar(fileContents,oldString, linesInFile, startLine,&positionInOldString, startChar,0);
+ if (tempInt == -1)
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ else startChar = tempInt;
+ }
+ positionInOldString += 2; // add 2 for the )) for start(line())
+ }
+ if (!strncmp(&oldString[positionInOldString], Translate("end("), strlen(Translate("end("))))
+ {
+ positionInOldString += strlen(Translate("end(line("));
+ tempInt = findLine(fileContents,oldString, linesInFile, startLine,&positionInOldString);
+ if (tempInt == -1 || !fileContents[tempInt])
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ else
+ {
+ positionInOldString+=2;
+ endLine = tempInt;
+ tempInt = findChar(fileContents,oldString, linesInFile, startLine,&positionInOldString, startChar,1);
+ if (tempInt == -1)
+ return ERROR_NO_LINE_AFTER_VAR_F;
+ else endChar = tempInt;
+ }
+ positionInOldString += 2; // add 2 for the )) for end(line())
+ }
+ // check for both start() and end() otherwise, only copying 1 line
+ if (!strstr(oldString, Translate("start("))) startLine = endLine;
+ if (!strstr(oldString, Translate("end("))) endLine = startLine;
+ // after all the options copy the line across and add 2 to positionInOldString for the file(print(....))
+ if (wholeLine >= 0) strcat(newString, fileContents[wholeLine]);
+ else
+ {
+ // only copying from 1 line
+ if (startLine == endLine)
+ strncat(newString, &fileContents[startLine][startChar], endChar - startChar);
+ else
+ {
+ int i;
+ // copy the whole first line from startChar
+ strcat(newString, &fileContents[startLine][startChar]);
+ // copy the middle lines across
+ for (i=(startLine+1);i<endLine;i++)
+ {
+ strcat(newString, fileContents[i]);
+ }
+ // copy the last line untill endChar
+ strncat(newString, fileContents[endLine], endChar);
+ }
+ }
+ }
+ // filename()
+ else if (!strncmp(&oldString[positionInOldString], Translate("filename("), strlen(Translate("filename("))))
+ {
+ positionInOldString += strlen(Translate("filename("));
+ tempInt = getNumber(&oldString[positionInOldString]);
+ if (tempInt == -1)
+ {
+ return ERROR_NO_FILE;
+ }
+ else
+ {
+ wsprintf(tempString, "fn%d", tempInt);
+ if (DBGetContactSettingString(NULL, modname,tempString, tempString))
+ strcat(newString, tempString);
+ else return ERROR_NO_FILE;
+ positionInOldString += strlen(itoa(tempInt, tempString, 10))+1;
+ }
+ }
+ // lastchecked(file(X))
+ else if (!strncmp(&oldString[positionInOldString], Translate("lastchecked(file("), strlen(Translate("lastchecked(file("))))
+ {
+ positionInOldString += lastChecked(newString, &oldString[positionInOldString]);
+ }
+ else
+ {
+ strncat(newString, &oldString[positionInOldString], 1);
+ positionInOldString++;
+ }
+ }
+ // free the file strings
+ for (tempInt=0; (fileContents[tempInt] != NULL) && (tempInt<MAXLINES); tempInt++)
+ free(fileContents[tempInt]);
+
+
+
+ // check for load("A","B")
+ checkStringForLoad(hContact, newString);
+ // and loadN(...)
+ checkStringForLoadN(newString);
+ // check for compare("A","B","X","Y")
+ checkStringForcompare(newString);
+ // check for save("A","B")
+ checkStringForSave(hContact, newString);
+ // and saveN(...)
+ checkStringForSaveN(newString);
+ return 1;
+}
+
+void stripWhiteSpace(char* string)
+{
+ int i=0;
+ while (string[i] != '\0')
+ {
+ if ( (string[i] == '\t') || (string[i] == '\r') || (string[i] == '\n') )
+ string[i] = ' ';
+ i++;
+ }
+}
+void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module2, char* setting2)
+{
+ 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;
+ break;
+ case ERROR_LINE_NOT_READ:
+ wsprintf(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;
+ break;
+ 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);
+ }
+ else DBWriteContactSettingString(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);
+ }
+ else DBWriteContactSettingWord(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");
+ /* 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);
+ }
+ else if (DBGetContactSettingString(hContact, modname, "Program", tmp1))
+ {
+ DBWriteContactSettingString(hContact, "UserInfo", "FirstName", tmp1);
+ }
+ else DBWriteContactSettingString(hContact, "UserInfo", "FirstName", "");
+}
+
diff --git a/plugins/!NotAdopted/Non-IM Contact/nimc.jpg b/plugins/!NotAdopted/Non-IM Contact/nimc.jpg Binary files differnew file mode 100644 index 0000000000..bd345bfb62 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/nimc.jpg diff --git a/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp b/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp new file mode 100644 index 0000000000..51846a4ab3 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsp @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 0000000000..79b4f45af5 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/nimcontact.dsw @@ -0,0 +1,29 @@ +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/nimcontact_readme.txt b/plugins/!NotAdopted/Non-IM Contact/nimcontact_readme.txt new file mode 100644 index 0000000000..4ff9131aa4 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/nimcontact_readme.txt @@ -0,0 +1,305 @@ +Non-IM Contact
+--------------
+
+Non-IM Contact allows you to add "contacts" that can act as shortcuts to other programs, or links to web pages.
+The contacts name can be read from a text file (includes any ASCII file).
+(This plugin is a combination of Favorites and Text Reader plugins both made by me)
+
+Why would you use this plugin?
+Well... lets say you are lazy and want to be able to load up the c:\ drive by double clicking a contact in your CList. So what you do to set this up is create a new contact (from the main menu), give the contact a name, then in the "Link and CList settings" tab, type c:\ into the link field.
+This is the very simplest way of using NimC.
+Now lets take this contact 1 step further.
+Lets say you have a script that you have scheduled to run every 30min or so that prints the available disk space into a text file.
+This script for example. http://www.coolmon.org/extensions/extension.php?id=154 prints something like this
+"
+Last Updated: 5/17/2004 7:04:13 PM
+
+C:
+Fixed : NTFS
+25.35gb
+6.13gb
+19.5%
+80.5%
+[++========]
+"
+into a txt file. So, what can we do with information?
+Lets set our contact to display as its nick the available disk space on the drive (i.e it would look like "C:\ 25.35gb free" )
+all we need to do is load the file in the "files" tab then type something like this into the "display Name" field "file(0)wholeline(line(2))\ file(0)wholeline(line(4)) free".
+This may look cryptic but it really is very simple !!! (see Explanation of Variables below)
+
+
+Detailed Explanation of Non-IM Contact Settings
+--------------------------------------------------
+
+"Contacts Display Info" tab
+-> "Contacts display name" this is the only compulsary field.. this is what the contact will display as their nick, more info below how to make it kewl :)
+-> "Contacts tooltip" well this isnt really their tooltip becuase to make it easier for me, the info u type here after being replaced with info from the files gets copied into the user "notes" field in their "user info" display, so u can use this is mtooltip with the %notes variable (dont know about other tooltip plugins)
+
+"Link and CList settings" tab
+-> "Link" the file to load/ program to run/ web page to open etc, when u double click the contact
+-> "program parameters" any parameters for the program
+-> "status icon" the contacts status icon. (See below)
+
+"Timer settings"
+-> "use timer", if this is set then the contact can be updated using the timer
+-> the blank text field... the number of intervals between checking... the intervals are set in the options... default of 1 second)
+
+"Copy Contact"
+this dialog is explained below..
+
+"Files"
+here is a list of all the available files (and eventually web pages) that u can use in all the contacts. the %fn ID box shows the text to type to use the file (explained below)
+the big text box shows the contents and line numbers of the file, and the drop list has a list of availablew files.
+
+Options window...
+-> "ignore global status change" with this set, nimc will only change status if manually set (using the status bar icon, or status menu)
+-> "aways as another status" changes the way away status works. if set then only contacts with away set as their icon will be displayed when the protocol chnages to away, and timer wont be turned off.. otherwise away acts the same as online but with the timer off)
+-> "disable timer" disables the timer, no web pages or contacts will be updated if this is checked
+-> "timer interval" this is the global timer interval. the individual contact timers are a multiple of this timer. so if this is set to 15 and a contacts individual timer is set to 3, then that contact will be updated every 45 seconds. (same for web pages)
+
+String Maker window...
+-> "string to test" you can type anything here, when you press Test String this string will get parsed and the result will be displayed in the other edit box
+-> the row of varables is used to tell you which variable you are in.
+
+
+Explanation of Variables
+-------------------------
+
+NEW VARIABLES IN 0.5
+--------------------
+lastchecked(file(X)) <- displays the time and date the file was last modified (im 2 lazy to make it editable, so live with it.. its DD/MM/YY HH:MM) (X is the file number)
+
+for the next 5 the "" marks are compulsary... if they arnt there it wont work as expected!
+the following are all done after the string has been complety replaced, and compare(..) is done the very last....
+
+compare("A","B","X","Y") <- what this does is after all the strings have been replaced it compares A and B, if they are the same then X will get inserted into the final string, otherwise Y will be inserted. (this is the last variable that is checked so u can put file(x)start(.....)...) inside it and it will work the way u want it to. )
+
+save("A","B") <- this saves whatever B is to a db variable named A in the contact's "NIM_Contact" module
+
+load("A") <- this loads the setting A from the contact and inserts it into the string.
+
+saveN("A","B","C","D") <- this is the same as save(...) except it lets you save to the setting contact in the db. A is module, B is setting, C is value, D is type (0 or b = byte, 1 or w = word, 2 or d = dword, 3 or s = string) (not 100% sure this is safe or useful.. but i dunno. an examlpe use of this might be to wright a quick script that spits out the name of a picture (from a defined list) and it will set your clist background pic to it... ?)
+
+loadN("A","B") <- same as load(...) except it loads from the settings contact from the module A and setting B
+
+REMEMBER... THE "" MARKS ARE NESCASSERY
+------------------------------------------
+
+from version 0.4 the variables have all been changed.. this new system is slightly worse but allows much better control over what u can display...
+
+firstly the easiest variable.... filename(X) <- displays the filename of the Xth file in the files tab
+
+now the hard variables...
+each string replace thingy must look losmething like this...
+file(X)start(line(...)...)end(line(...)...) or file(X)wholeline(line(...))
+confused? good :)
+
+file(X) <- choose which file to read from
+start(...) and/or end(...) must follow. You can use both, or only 1 of them. If you use both start MUST be before end.. (obvious???).
+OR you can follow file() with wholeline(line(...)), which as u can guess will display the entire line.
+
+So, how does start(...) and end() work?
+... Like this...
+start(line(...)X) where X is either a number, or s string in "" marks, or the csv() variable. (we will get to the line() part in a minute).
+ - If X a number then it will start or finish copying from the Xth character in the line (remember, 0 is the frst char).
+ - If X is a string inside "" marks, then the line will be searched for the string and either start or stop copying depening if you are in start() or end().
+ - If X is csv(seperatorY) then the line is expected a comma seperated variable list (or similar). the seperator must either be "tab" (for tab seperated list), "space" (for space seperated list), or any SINGLE character (e.g , or ;). and Y is which variable to start or finish copying from
+simple isnt it? *head falls off in fit of laughter*
+
+Now ill explain the line(...) var and then show some examples
+line(...) is very similar to start() and end() with some slight changes...
+line(X) where X is a number, string in "" marks, or lastline(...)
+ - If X is a number then the rest of the start() or end() or wholeline() will use the Xth line of the file (remember 0 is the first line)
+ - If X is a string it will search through the file (starting from the first line if in start() or wholeline() OR the line used by start() if in end() and will use the first line with the string if it is found.
+ - You can add a +Y or -Y after the closing ) to go Y lines up (- sign) or down (+ sign) from the line found (e.g ...line("hello")+5... will find the word hello and use the 5ht line after it)
+ - If X is lastline(Y) then it will use the line Y lines up from the last line of the file. (e.g 0 or blank is the very last line of the file, 1 is the 2nd last line etc...)
+
+and thats it.... so lets c some examples...
+.
+filename(0) <- will display the filename of the 0th file
+
+file(0)wholeline(line(0)) <- will display the whole first line of the 0th file
+
+file(0)wholeline(line("hello")-1)) <- the wholeline above the first occurance of \"hello\" in the file
+
+file(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)
+
+file(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.
+
+i plan on adding regexp ability and some other vars (tell me what u want...)
+EVERY EDITABLE TEXT FIELD (EXCEPT GROUP FIELD) CAN USE THESE STRINGS
+
+The Copy Contact Dialog
+-----------------------
+Since the oriognal text reader (plugin this is based on, no longer available..) i wanted to be able to copy a contact easily, so this is how you do it.
+The Edit box in this window lets you automatically change any string in the new contact. i.e this lets you change all occurances of %fn2 to %fn3 in the contacts settings (i.e their name, tooltip, etc).
+the way you do is like this. if you want to change fn2 to fn3 you type fn2,fn3 in the box. ONE PER LINE... and make sure you dont forget the , or miranda may crash, and WILL KILL YOUR DB IF IT DOES.
+You can do a maximum of 15 of the replaces.
+
+press Copy Non-IM Contact to copy with the replaced strings.
+
+To export the single contact to a txt file press export contact. (you cant import contacts yet, but ill add that soon..ish)
+
+ToolTip stuff
+--------------
+OK.. if you want to actually use the "ToolTip" field then you'll need either mToolTip or another tooltip plugin.
+NimC copies the string (after having all the variables replaced) from the "ToolTip" field into the Notes field in the contacts User Details window. in mToolTip use the variable %notes to display this.
+NimC also copies the program (or link) that the contact points to when you double click it as the contacts First Name field in the contacts User Details window. in mToolTip use the variable %first to display this.
+
+
+Contact Status Icon
+-------------------
+I have included all available statuses so you can seperate contacts by thier status icons, and so you can quickly differentiate between different "types" of contacts (by this i mean, you can set all web links to one icon, and all local folders to another, etc.)
+BUT...
+- ONLINE icon - this contact will always be displayed as online unless the plugin's status is set to offline
+- AWAY icon - same as online (unless u choose to use away as any other status, i.e contacts wont be online if not set to away)
+- all other icons means only display this contact if the plugins' status is set to that status or set to away or online.
+
+Plugin Status's
+---------------
+If the plugins' status is:
+- ONLINE - all contacts are displayed and the timer is ON (so names get updates)
+- AWAY - all contacts are displayed and the timer is OFF (so names dont get updates ... unless u choose to use away as any other status)
+- OFFLINE - all contacts are displayed as offline and the timer is OFF (so names dont get updates)
+- other - only contacts set to online, away or the set status are shown as not offline and the timer is ON (so names get updates)
+
+
+Last Minute Stuff To Remember
+-----------------------------
+- If you hold CTRL down when you double click a contact it will open the contacts settings (this also happens if no link is set)
+- the file(X) variable is "global" in that all contacts with file(X) will be reading the same file. this also means that if you remove the file(X) file from the list, then all other files will get pushed up and any contact with file(X) set will be reading the new file, not the one you were expecting.
+
+IMPORTANT NOTES ON WEB PAGES:
+-----------------------------
+- in the files tab you can enter urls into the URL box, it must be the full url.. i.e http://www.miranda-im.org/ (nothing happens if the url doesnt work)
+- web pages can then be used as any of file.
+- the files are downloaded into the \plugins dir with the filename fnX.html where X is the %fn number in the plugin. im lazy and want to get this release out so the files arent deleted when u remove the link yet. (soz)
+
+
+Todo list
+---------
+- fix any mistakes with the string replacing (i dont know if there are any :) )
+- add a program schedular to execute the scripts before updating the contacts' names
+- suggestions?
+
+Change-log
+-----------
+0.1
+- Initial public release.. pretty much everything works
+
+0.1.1
+- fixed some stupid bugs (the timer actually works now, and it wont crash if you stuff up the string to replace (hopefully))
+- made it ignore global status change
+
+0.2
+- added heaps of code to hopefully eliminate most of the crashes
+ - files tab wont crash anymore if the file is too long
+ - wont crash if you try to make a string too long (hard-coded max to 10000 chars which should be big enough)
+- added support for web pages
+
+0.2.0.1
+- fixed it so it returns to the previous status when you start miranda
+- fixed it so only status changes to Non-IM contacts protocol change the status
+- fixed it so that you can change the timer for the web pages in the files tab (change the number and press apply)
+- did a big plug on the overclockers australia forums :) (http://www.overclockers.com.au)
+
+0.2.0.2
+- removed the startup status thing to hopefully finally fix the status changing bugs.. if you want to have it start with a status use the startupstatus plugin
+- fixed it so nconvers doesnt popup its msg dialoge when you double click a Non-IM Contact
+
+0.3
+- added multi-threading support so it doesnt freeze miranda while it waits for the websites to download. (thans Matrix)
+- added ability to import/export/copy contacts
+
+0.3.1
+- sorry, didnt do enouhg testing again and the fiiles tab vanished...
+
+0.3.2.1
+- added %csv variable
+- fixed status changing bug (hopefully the last 1)
+- fixed timer so it works again
+- fixed the contact copying
+- fixed a crash when you want to show the tooltip for the contact
+- got the menu items where i want them
+
+0.4
+- changed the vairable system
+- added multi-threading so miranda doesnt freeze while it updates web sites (thanx Matrix and noname)
+- removed contact importing coz i wanted to release this build but importing needed a rewrite and i cbf...
+- added a String Maker window to help make strings to get replaced.. (with a kewl display that tells youn which variable you are in..)
+- timer _MAY_ be a bit screwy if we pages dont update fast enough, but shouldnt...
+- added options dialog
+- fixed status changing bug (hopefully the last 1.. again)
+
+0.4.0.1
+-fixed the timer..
+
+0.4.1.0
+- fixed a bug where the files tab would crash if more than 10 files were loaded. (now wont crash untill 1000 files are loaded)
+- added the "NIM_Contact/DoubleClick" service for other devs if they want to simulate a double click on a non-im contact. (wparam=hcontact, lparam=0)
+- added some error-checking to the string replacing code so it doesnt crash..
+
+0.5
+- added 6 new variables..
+- fixed some minor stuff
+- new stanslation strings...
+
+0.5.0.1
+- fixed bug where you couldnt add new contacts if u are running the mwclist.dll plugin
+- fixed the netlib code so its not naughty...
+Translation strings
+--------------------
+im pretty sure i havn't set up all the strings as translatable, so if i miss any, email or msg me on the forums and ill fix it.
+this is the lot....
+
+New strings for 0.5
+[lastchecked(file(]
+[loadN(\"]
+[load(\"]
+[saveN(\"]
+[save[(\"]
+{compare(\"]
+
+
+
+[Select Folder]
+[New Non-IM Contact]
+[File couldn't be opened]
+[line(%-3d) = | %s]
+[Non-IM Contacts]
+[&Non-IM Contact]
+[&Add Non-IM Contact]
+[&View/Edit Files]
+[&Export all Non-IM Contacts]
+[&Import Non-IM Contacts] <- will be back in the next release...
+[&String Maker]
+[E&dit Contact Settings]
+[(\"]
+[\")]
+[lastline(]
+[csv(]
+[file(]
+[wholeline(line(]
+[start(]
+[start(line(]
+[end(]
+[end(line(]
+[filename(]
+[%s - ERROR: no line specified or line not found (in %s)]
+[%s - ERROR: file couldnt be opened (in %s)]
+[%s - ERROR: no file specified in settings (in %s)]
+[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]
+[file(X)\t\t<- specifies the file to read from\r\nMUST be followed by either start() or end() or wholeline()\r\n]
+[filename(X)\t\t<- copyies the filename of file X.\r\n]
+[start(...)\t\t<-specifies where to start copying from.\r\n]
+[end(...)\t\t<-specifies where to stop copying.\r\n]
+[wholeline(line(...))\t<-specifies a whole line to copy\r\n\r\n]
+[start() and end() explained\r\n.........................\r\n]
+[MUST start with line() followed by a number or a string inside \" marks, OR csv(seperatorX) variable\r\n]
+[The number specifies which character in the line to start/end copying.\r\nThe string specifies a string in the line to start/end copying.\r\n]
+[csv(seperatorX) explained...\r\nseperator is either \"tab\" or \"space\" or any SINGLE character.\r\nX is the Xth seperator to pass before copying, (or to stop before)\r\n\r\n]
+[Lastly the line(...) variable...\r\n]
+[Inside the brackets must be either a number (to specify the line number), or a string inside \" marks (to use the line with that string), or lastline(X).\r\nthe X in lastline is the Xth line above the last line. i.e lastline(1) will use the 2nd last line of the file.\r\n]
+[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]
+[Some Expamples...\r\n\r\n]
+[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]
diff --git a/plugins/!NotAdopted/Non-IM Contact/resource.h b/plugins/!NotAdopted/Non-IM Contact/resource.h new file mode 100644 index 0000000000..928cde8564 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/resource.h @@ -0,0 +1,77 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define IDD_ADD_FILE 101
+#define IDI_MAIN 103
+#define IDD_CONTACT_INFO 104
+#define IDD_OTHER_STUFF 105
+#define IDI_ICON1 106
+#define IDD_CONTACT_COPYEXPORT 108
+#define IDD_OPTIONS 109
+#define IDD_TEST_LINE 110
+#define IDD_HELP 111
+#define IDC_FN 1000
+#define IDC_FILE_LIST 1001
+#define IDC_ADD_FILE 1002
+#define IDC_ADD_FILE2 1003
+#define IDC_DEL_FILE 1004
+#define IDC_FILE_CONTENTS 1005
+#define IDC_URL 1006
+#define IDC_ADD_URL 1007
+#define IDC_DISPLAY_NAME 1007
+#define IDC_TOOLTIP 1008
+#define IDC_GROUP 1008
+#define IDC_HELPMSG 1009
+#define IDC_LINK 1010
+#define IDC_PARAMS 1011
+#define IDC_OPEN_FILE 1012
+#define IDC_OPEN_FOLDER 1013
+#define CHK_USE_TIMER 1016
+#define IDC_TIMER 1017
+#define IDC_MINUTES 1018
+#define IDC_SECONDS 1019
+#define CHK_CTRL 1020
+#define IDC_WWW_TIMER 1022
+#define IDC_STRING_REPLACE 1025
+#define IDC_DOIT 1026
+#define IDC_EXPORT 1027
+#define IDC_ALWAYS_VISIBLE 1028
+#define IDC_VISIBLE_UNLESS_OFFLINE 1029
+#define IDC_IGNORE_GLOBALSTATUS 1030
+#define IDC_DISABLETIMER 1031
+#define IDC_TIMER_INT 1036
+#define IDC_AWAYISNOTONLINE 1037
+#define IDC_TIMER_TEXT 1039
+#define IDC_TIMER_MSG 1040
+#define IDC_STRING 1041
+#define IDC_ANSWER 1042
+#define IDC_LINE 1043
+#define IDC_START 1045
+#define IDC_END 1046
+#define IDC_WHOLELINE 1047
+#define IDC_CSV 1048
+#define IDC_FILE 1049
+#define IDC_FILENAME 1050
+#define IDC_TIMER_INTERVAL_MSG 1053
+#define IDC_HELPTEXT 1055
+#define CHK_ONLINE 40072
+#define CHK_AWAY 40073
+#define CHK_DND 40074
+#define CHK_NA 40075
+#define CHK_OCC 40076
+#define CHK_FFC 40077
+#define CHK_INVISIBLE 40078
+#define CHK_PHONE 40079
+#define CHK_LUNCH 40080
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 112
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1057
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/plugins/!NotAdopted/Non-IM Contact/resource.rc b/plugins/!NotAdopted/Non-IM Contact/resource.rc new file mode 100644 index 0000000000..db99c53676 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/resource.rc @@ -0,0 +1,356 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ADD_FILE DIALOG DISCARDABLE 0, 0, 283, 190
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "View/Edit Files"
+FONT 8, "MS Sans Serif"
+BEGIN
+ COMBOBOX IDC_FILE_LIST,49,4,227,99,CBS_DROPDOWNLIST |
+ CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_URL,26,20,250,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_WWW_TIMER,69,37,30,12,ES_NUMBER
+ PUSHBUTTON "Add File",IDC_ADD_FILE,201,37,34,12
+ PUSHBUTTON "Add URL",IDC_ADD_URL,237,37,39,12
+ PUSHBUTTON "Remove Selected File",IDC_DEL_FILE,202,52,74,12
+ LISTBOX IDC_FILE_CONTENTS,4,70,272,113,LBS_NOINTEGRALHEIGHT |
+ LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL |
+ WS_TABSTOP
+ LTEXT "file(#)",IDC_STATIC,4,6,18,8
+ EDITTEXT IDC_FN,26,4,16,12,ES_READONLY | ES_NUMBER
+ LTEXT "URL",IDC_STATIC,4,22,16,8
+ LTEXT "Update URL every",IDC_STATIC,4,39,60,8
+ LTEXT "Intervals",IDC_STATIC,105,39,28,8
+ LTEXT "If the protocol timer is disabled web pages wont be updated",
+ IDC_STATIC,4,52,188,8
+END
+
+IDD_CONTACT_INFO DIALOG DISCARDABLE 0, 0, 283, 190
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "contact display info"
+FONT 8, "MS Sans Serif"
+BEGIN
+ EDITTEXT IDC_DISPLAY_NAME,88,6,188,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_TOOLTIP,7,40,269,143,ES_MULTILINE | ES_AUTOVSCROLL |
+ ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
+ LTEXT "Contacts display name",IDC_STATIC,7,8,72,8
+ LTEXT "Contacts Tooltip",IDC_STATIC,7,26,52,8
+END
+
+IDD_OTHER_STUFF DIALOG DISCARDABLE 0, 0, 283, 190
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "other settings"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "Link",IDC_STATIC,12,18,14,8
+ EDITTEXT IDC_LINK,39,16,233,12,ES_AUTOHSCROLL
+ LTEXT "Program parameters:",IDC_STATIC,12,33,66,8
+ EDITTEXT IDC_PARAMS,91,31,181,12,ES_AUTOHSCROLL
+ PUSHBUTTON "O&pen File",IDC_OPEN_FILE,161,47,50,14
+ PUSHBUTTON "O&pen Folder",IDC_OPEN_FOLDER,222,47,50,14
+ GROUPBOX "Link Settings",IDC_STATIC,7,4,269,60
+ GROUPBOX "CList Settings",IDC_STATIC,7,68,269,64
+ COMBOBOX IDC_GROUP,39,79,161,74,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",CHK_ONLINE,"Button",BS_AUTORADIOBUTTON | BS_PUSHLIKE |
+ WS_TABSTOP,58,95,16,16
+ CONTROL "",CHK_AWAY,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,77,95,16,16
+ CONTROL "",CHK_NA,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,96,95,16,16
+ CONTROL "",CHK_OCC,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,115,95,16,16
+ CONTROL "",CHK_DND,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,134,95,16,16
+ CONTROL "",CHK_FFC,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,153,95,16,16
+ CONTROL "",CHK_INVISIBLE,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,172,95,16,16
+ CONTROL "",CHK_PHONE,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,191,95,16,16
+ CONTROL "",CHK_LUNCH,"Button",BS_AUTORADIOBUTTON | BS_ICON |
+ BS_PUSHLIKE | WS_TABSTOP,210,95,16,16
+ LTEXT "Group:",IDC_STATIC,12,81,22,8
+ LTEXT "Status Icon",IDC_STATIC,12,99,37,8
+ LTEXT "Group\\Sub-Group",IDC_STATIC,211,81,61,8
+ GROUPBOX "Timer Settings",IDC_STATIC,7,139,269,44
+ CONTROL "Use Timer",CHK_USE_TIMER,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,12,148,48,10
+ EDITTEXT IDC_TIMER,22,162,35,12,ES_NUMBER | WS_DISABLED
+ CONTROL "Contact is always visible",IDC_ALWAYS_VISIBLE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,12,115,92,10
+ CONTROL "Unless Non-IM Contacts protocol is OFFLINE",
+ IDC_VISIBLE_UNLESS_OFFLINE,"Button",BS_AUTOCHECKBOX |
+ WS_DISABLED | WS_TABSTOP,112,115,158,10
+ LTEXT "Timer Intervals. ",IDC_TIMER_INTERVAL_MSG,61,166,205,8
+END
+
+IDD_OPTIONS DIALOG DISCARDABLE 0, 0, 291, 180
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "Ignore global status change",IDC_IGNORE_GLOBALSTATUS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,28,103,10
+ CONTROL "Away as another status",IDC_AWAYISNOTONLINE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,42,89,10
+ CONTROL "Disable timer",IDC_DISABLETIMER,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,99,56,10
+ LTEXT "Timer interval (in seconds)",IDC_TIMER_TEXT,13,111,83,8
+ EDITTEXT IDC_TIMER_INT,102,109,20,12,ES_NUMBER
+ LTEXT "This will take affect after Non-IM Contacts' status is changed",
+ IDC_TIMER_MSG,13,123,192,8
+ GROUPBOX "Timer Options",IDC_STATIC,7,87,277,49
+END
+
+IDD_TEST_LINE DIALOG DISCARDABLE 0, 0, 435, 119
+STYLE DS_MODALFRAME | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE |
+ WS_CAPTION | WS_SYSMENU
+CAPTION "String Maker"
+FONT 8, "MS Sans Serif"
+BEGIN
+ EDITTEXT IDC_STRING,15,17,409,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "&Test String",IDOK,385,56,43,14
+ PUSHBUTTON "&Exit",IDCANCEL,385,92,43,14
+ GROUPBOX "String to test",IDC_STATIC,7,7,421,41
+ GROUPBOX "Returns....",IDC_STATIC,7,51,371,61
+ EDITTEXT IDC_ANSWER,15,62,353,43,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
+ LTEXT "line()",IDC_LINE,73,36,16,8,WS_DISABLED
+ LTEXT "start()",IDC_START,32,36,18,8,WS_DISABLED
+ LTEXT "end()",IDC_END,53,36,17,8,WS_DISABLED
+ LTEXT "wholeline()",IDC_WHOLELINE,111,36,34,8,WS_DISABLED
+ LTEXT "csv()",IDC_CSV,92,36,16,8,WS_DISABLED
+ LTEXT "file()",IDC_FILE,15,36,14,8,WS_DISABLED
+ LTEXT "filename()",IDC_FILENAME,148,36,31,8,WS_DISABLED
+ PUSHBUTTON "Help",IDC_HELPMSG,385,73,43,14
+END
+
+IDD_HELP DIALOG DISCARDABLE 0, 0, 280, 161
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | DS_CENTERMOUSE |
+ WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Help!!!"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,223,140,50,14
+ EDITTEXT IDC_HELPTEXT,7,7,266,128,ES_MULTILINE | ES_READONLY |
+ WS_VSCROLL | WS_HSCROLL
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ADD_FILE, DIALOG
+ BEGIN
+ LEFTMARGIN, 4
+ RIGHTMARGIN, 276
+ VERTGUIDE, 26
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 183
+ HORZGUIDE, 4
+ HORZGUIDE, 26
+ HORZGUIDE, 37
+ HORZGUIDE, 43
+ HORZGUIDE, 52
+ END
+
+ IDD_CONTACT_INFO, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 276
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 183
+ HORZGUIDE, 12
+ HORZGUIDE, 34
+ END
+
+ IDD_OTHER_STUFF, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 276
+ VERTGUIDE, 12
+ VERTGUIDE, 39
+ VERTGUIDE, 272
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 183
+ HORZGUIDE, 22
+ HORZGUIDE, 37
+ HORZGUIDE, 47
+ HORZGUIDE, 85
+ HORZGUIDE, 103
+ HORZGUIDE, 120
+ HORZGUIDE, 149
+ HORZGUIDE, 174
+ END
+
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 284
+ VERTGUIDE, 13
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 173
+ HORZGUIDE, 99
+ HORZGUIDE, 115
+ END
+
+ IDD_TEST_LINE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 428
+ VERTGUIDE, 15
+ VERTGUIDE, 385
+ VERTGUIDE, 424
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 112
+ HORZGUIDE, 36
+ END
+
+ IDD_HELP, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 273
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 154
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MAIN ICON DISCARDABLE "star8.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONTACT_COPYEXPORT DIALOG DISCARDABLE 0, 0, 283, 190
+STYLE DS_MODALFRAME | WS_CHILD | WS_CAPTION | WS_SYSMENU
+CAPTION "Copy / Export contact"
+FONT 8, "MS Sans Serif"
+BEGIN
+ EDITTEXT IDC_STRING_REPLACE,13,43,254,108,ES_MULTILINE |
+ ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
+ PUSHBUTTON "&Export Non-IM Contact",IDC_EXPORT,13,159,94,14
+ PUSHBUTTON "Co&py Non-IM Contact",IDC_DOIT,173,159,94,14
+ GROUPBOX "",IDC_STATIC,7,7,269,176
+ CONTROL "Type one replace string per line in the format ""origional text,new text""",
+ IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,13,18,
+ 243,10
+ LTEXT "EXAMPLE: %fn1,%fn2",IDC_STATIC,13,31,71,8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CONTACT_COPYEXPORT, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 276
+ VERTGUIDE, 13
+ VERTGUIDE, 267
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 183
+ HORZGUIDE, 159
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/!NotAdopted/Non-IM Contact/services.c b/plugins/!NotAdopted/Non-IM Contact/services.c new file mode 100644 index 0000000000..13d7876edd --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/services.c @@ -0,0 +1,129 @@ +#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/star8.ico b/plugins/!NotAdopted/Non-IM Contact/star8.ico Binary files differnew file mode 100644 index 0000000000..a4953cd753 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/star8.ico diff --git a/plugins/!NotAdopted/Non-IM Contact/threads.c b/plugins/!NotAdopted/Non-IM Contact/threads.c new file mode 100644 index 0000000000..c39fae61a7 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/threads.c @@ -0,0 +1,49 @@ +#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 new file mode 100644 index 0000000000..8d3f6bf4de --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/timer.c @@ -0,0 +1,95 @@ +#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/todo.txt b/plugins/!NotAdopted/Non-IM Contact/todo.txt new file mode 100644 index 0000000000..4fb4ffe442 --- /dev/null +++ b/plugins/!NotAdopted/Non-IM Contact/todo.txt @@ -0,0 +1,29 @@ +file() vars
+ plain number
+ ??????
+
+line() vars
+ plain number
+ lastline(X)... where X is the number of lines above the last i.e 0 is last, 1 is second last
+ "Word"...
+ random... between 0 and LinesInFile-1 ?????
+
+print()
+ wholeline(line()).. line as above
+ start()
+ number (first char to start coping from)
+ line()
+ "" ... find the word inside
+ csv(line()seperator()) seperator is any single CHAR and "space" or "tab" without ""'s
+ end()
+ same as start
+
+
+- ignore global status change
+- only show contacts with protocols visibility (i.e if nimc is set to dnd then only contacts with dnd will be shown) and somehow an option to reverse this...
+- a fwe other hidden options which no1 else but me knows about... :D
+- hide the protocol status icon in the status menu.. (may as well c how hard it is to add...)
+- treat away as another status. (i.e not the same as online where the contacts r always online)
+- never allow timer
+
+
\ No newline at end of file |