// ---------------------------------------------------------------------------80 // ICQ plugin for Miranda Instant Messenger // ________________________________________ // // Copyright © 2000,2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede // Copyright © 2001,2002 Jon Keating, Richard Hughes // Copyright © 2002,2003,2004 Martin Öberg, Sam Kothari, Robert Rainwater // Copyright © 2004,2005,2006 Joe Kucera // // 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. // // ----------------------------------------------------------------------------- // // File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/utilities.h,v $ // Revision : $Revision: 3130 $ // Last change on : $Date: 2006-06-13 23:02:57 +0200 (Tue, 13 Jun 2006) $ // Last change by : $Author: jokusoftware $ // // DESCRIPTION: // // Describe me here please... // // ----------------------------------------------------------------------------- #ifndef __UTILITIES_H #define __UTILITIES_H typedef struct icq_ack_args_s { HANDLE hContact; int nAckType; int nAckResult; HANDLE hSequence; LPARAM pszMessage; } icq_ack_args; typedef struct icq_contacts_cache_s { HANDLE hContact; DWORD dwUin; DWORD flags; } icq_contacts_cache; #define F_TEMPVIS 1 /*---------* Functions *---------------*/ void EnableDlgItem(HWND hwndDlg, UINT control, int state); void icq_EnableMultipleControls(HWND hwndDlg, const UINT* controls, int cControls, int state); void icq_ShowMultipleControls(HWND hwndDlg, const UINT* controls, int cControls, int state); int IcqStatusToMiranda(WORD wStatus); WORD MirandaStatusToIcq(int nStatus); int MirandaStatusToSupported(int nMirandaStatus); char *MirandaStatusToString(int); char *MirandaStatusToStringUtf(int); char**MirandaStatusToAwayMsg(int nStatus); int IDFromCacheByUin(DWORD dwUin); int CacheIDCount(void); int SetCacheFlagsByID(int ID, DWORD flags); int GetCacheByID(int ID, icq_contacts_cache *icc); int GetFromCacheByID(int ID, HANDLE *hContact, DWORD *dwUin); int AwayMsgTypeToStatus(int nMsgType); void SetGatewayIndex(HANDLE hConn, DWORD dwIndex); DWORD GetGatewayIndex(HANDLE hConn); void FreeGatewayIndex(HANDLE hConn); void AddToSpammerList(DWORD dwUIN); BOOL IsOnSpammerList(DWORD dwUIN); void InitCache(); void UninitCache(); void DeleteFromCache(HANDLE hContact); HANDLE HContactFromUIN(DWORD dwUin, int *Added); HANDLE HContactFromUID(DWORD dwUIN, char *pszUID, int *Added); char *NickFromHandle(HANDLE hContact); char *NickFromHandleUtf(HANDLE hContact); char *strUID(DWORD dwUIN, char *pszUID); void NickFromHandleStatic(HANDLE hContact, char *szNick, WORD wLen); void SetContactHidden(HANDLE hContact, BYTE bHidden); void makeUserOffline(HANDLE hContact); size_t __fastcall strlennull(const char *string); int __fastcall strcmpnull(const char *str1, const char *str2); int null_snprintf(char *buffer, size_t count, const char* fmt, ...); char* __fastcall null_strdup(const char *string); void parseServerAddress(char *szServer, WORD* wPort); char *DemangleXml(const char *string, int len); char *MangleXml(const char *string, int len); char *EliminateHtml(const char *string, int len); void ResetSettingsOnListReload(void); void ResetSettingsOnConnect(void); void ResetSettingsOnLoad(void); int RandRange(int nLow, int nHigh); BOOL IsStringUIN(char* pszString); void __cdecl icq_ProtocolAckThread(icq_ack_args* pArguments); void icq_SendProtoAck(HANDLE hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage); void SetCurrentStatus(int nStatus); BOOL writeDbInfoSettingString(HANDLE hContact, const char* szSetting, char** buf, WORD* pwLength); BOOL writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, char **buf, WORD* pwLength); BOOL writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szSetting, struct fieldnames_t *table, char **buf, WORD* pwLength); BOOL writeDbInfoSettingByte(HANDLE hContact, const char *szSetting, char **buf, WORD* pwLength); BOOL writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szSetting, struct fieldnames_t *table, char **buf, WORD* pwLength); int GetGMTOffset(void); BOOL validateStatusMessageRequest(HANDLE hContact, WORD byMessageType); #define icqOnline ((gnCurrentStatus != ID_STATUS_OFFLINE) && (gnCurrentStatus != ID_STATUS_CONNECTING)) void __fastcall SAFE_FREE(void** p); void* __fastcall SAFE_MALLOC(size_t size); void LinkContactPhotoToFile(HANDLE hContact, char* szFile); void ContactPhotoSettingChanged(HANDLE hContact); HANDLE NetLib_OpenConnection(HANDLE hUser, NETLIBOPENCONNECTION* nloc); int NetLog_Server(const char *fmt,...); int NetLog_Direct(const char *fmt,...); int NetLog_Uni(BOOL bDC, const char *fmt,...); int ICQBroadcastAck(HANDLE hContact,int type,int result,HANDLE hProcess,LPARAM lParam); int __fastcall ICQTranslateDialog(HWND hwndDlg); char* __fastcall ICQTranslate(const char* src); char* __fastcall ICQTranslateUtf(const char* src); char* __fastcall ICQTranslateUtfStatic(const char* src, char* buf); char* GetUserPassword(BOOL bAlways); WORD GetMyStatusFlags(); /* Unicode UI utility functions */ wchar_t* GetWindowTextUcs(HWND hWnd); void SetWindowTextUcs(HWND hWnd, wchar_t *text); char* GetWindowTextUtf(HWND hWnd); char* GetDlgItemTextUtf(HWND hwndDlg, int iItem); void SetWindowTextUtf(HWND hWnd, const char* szText); void SetDlgItemTextUtf(HWND hwndDlg, int iItem, const char* szText); LONG SetWindowLongUtf(HWND hWnd, int nIndex, LONG dwNewLong); LRESULT CallWindowProcUtf(WNDPROC OldProc, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); int ComboBoxAddStringUtf(HWND hCombo, const char* szString, DWORD data); int ListBoxAddStringUtf(HWND hList, const char* szString); int MessageBoxUtf(HWND hWnd, const char* szText, const char* szCaption, UINT uType); HWND DialogBoxUtf(BOOL bModal, HINSTANCE hInstance, const char* szTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); HWND CreateDialogUtf(HINSTANCE hInstance, const char* lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc); #endif /* __UTILITIES_H */