summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-23 13:52:57 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-23 13:52:57 +0000
commit89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d (patch)
tree18f09394ce3b811e3df7d15de747e842000bd4ad /protocols
parenta9580df150d799246eaecbf3c1fb5cecf9f8ab49 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Skype/Skript1.apsbin122080 -> 0 bytes
-rw-r--r--protocols/Skype/Skript1.rc484
-rw-r--r--protocols/Skype/Skype_protocol.dsp394
-rw-r--r--protocols/Skype/Skype_protocol.dsw29
-rw-r--r--protocols/Skype/Skype_protocol.mak238
-rw-r--r--protocols/Skype/Skype_protocol.sln44
-rw-r--r--protocols/Skype/Skype_protocol.vcproj2843
-rw-r--r--protocols/Skype/alogon.c129
-rw-r--r--protocols/Skype/alogon.h1
-rw-r--r--protocols/Skype/changelog.txt330
-rw-r--r--protocols/Skype/contacts.c417
-rw-r--r--protocols/Skype/contacts.h11
-rw-r--r--protocols/Skype/debug.c75
-rw-r--r--protocols/Skype/debug.h23
-rw-r--r--protocols/Skype/deploy.bat15
-rw-r--r--protocols/Skype/ezxml/ezxml.c1033
-rw-r--r--protocols/Skype/ezxml/ezxml.h167
-rw-r--r--protocols/Skype/gchat.c910
-rw-r--r--protocols/Skype/gchat.h47
-rw-r--r--protocols/Skype/m_popup.h307
-rw-r--r--protocols/Skype/m_toptoolbar.h107
-rw-r--r--protocols/Skype/make.bat6
-rw-r--r--protocols/Skype/make_w32.bat5
-rw-r--r--protocols/Skype/make_w64.bat6
-rw-r--r--protocols/Skype/memlist.c248
-rw-r--r--protocols/Skype/memlist.h43
-rw-r--r--protocols/Skype/msglist.c86
-rw-r--r--protocols/Skype/msglist.h15
-rw-r--r--protocols/Skype/msgq.c90
-rw-r--r--protocols/Skype/msgq.h64
-rw-r--r--protocols/Skype/pthread.c70
-rw-r--r--protocols/Skype/pthread.h26
-rw-r--r--protocols/Skype/readme.txt47
-rw-r--r--protocols/Skype/res/8060.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/Copy of online.icobin1406 -> 0 bytes
-rw-r--r--protocols/Skype/res/DND.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/Invite.icobin1886 -> 0 bytes
-rw-r--r--protocols/Skype/res/NA.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/add.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/add2.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/auth.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/away.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/call.bmpbin214 -> 0 bytes
-rw-r--r--protocols/Skype/res/call.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/chat.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/conference.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/error.icobin9062 -> 0 bytes
-rw-r--r--protocols/Skype/res/hang_up.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/history.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/hold.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/import.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/invisible.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/message.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/occupied.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/offline.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/online.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/pause.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/phone.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/resume.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/search.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/skype.icobin13270 -> 0 bytes
-rw-r--r--protocols/Skype/res/skypeout.icobin2550 -> 0 bytes
-rw-r--r--protocols/Skype/res/skyping.icobin2038 -> 0 bytes
-rw-r--r--protocols/Skype/resource.h124
-rw-r--r--protocols/Skype/skype.c3465
-rw-r--r--protocols/Skype/skype.h188
-rw-r--r--protocols/Skype/skypeapi.c1699
-rw-r--r--protocols/Skype/skypeapi.h69
-rw-r--r--protocols/Skype/skypeopt.c969
-rw-r--r--protocols/Skype/skypeopt.h49
-rw-r--r--protocols/Skype/skypeprofile.c145
-rw-r--r--protocols/Skype/skypeprofile.h33
-rw-r--r--protocols/Skype/skypeproxy.h7
-rw-r--r--protocols/Skype/skypeproxy/skypeproxy.c651
-rw-r--r--protocols/Skype/skypeproxy/skypeproxy.h36
-rw-r--r--protocols/Skype/skypesvc.c188
-rw-r--r--protocols/Skype/skypesvc.h24
-rw-r--r--protocols/Skype/utf8.c334
-rw-r--r--protocols/Skype/utf8.h47
-rw-r--r--protocols/Skype/util.c57
-rw-r--r--protocols/Skype/util.h7
-rw-r--r--protocols/Skype/voiceservice.c156
-rw-r--r--protocols/Skype/voiceservice.h18
-rw-r--r--protocols/Tlen/codec/gsm.h65
-rw-r--r--protocols/Tlen/codec/gsm_codec.c283
-rw-r--r--protocols/Tlen/codec/gsm_long.c183
-rw-r--r--protocols/Tlen/codec/gsm_lpc.c208
-rw-r--r--protocols/Tlen/codec/gsm_preprocess.c103
-rw-r--r--protocols/Tlen/codec/gsm_rpe.c248
-rw-r--r--protocols/Tlen/codec/gsm_short.c211
-rw-r--r--protocols/Tlen/commons.h32
-rw-r--r--protocols/Tlen/crypto/aes.c1336
-rw-r--r--protocols/Tlen/crypto/bignum.c2097
-rw-r--r--protocols/Tlen/crypto/padlock.c162
-rw-r--r--protocols/Tlen/crypto/polarssl/aes.h167
-rw-r--r--protocols/Tlen/crypto/polarssl/bignum.h587
-rw-r--r--protocols/Tlen/crypto/polarssl/bn_mul.h738
-rw-r--r--protocols/Tlen/crypto/polarssl/config.h625
-rw-r--r--protocols/Tlen/crypto/polarssl/padlock.h100
-rw-r--r--protocols/Tlen/docs/InstallScript.xml27
-rw-r--r--protocols/Tlen/docs/changelog_tlen.txt269
-rw-r--r--protocols/Tlen/docs/gpl.txt340
-rw-r--r--protocols/Tlen/docs/gpl_comment.txt20
-rw-r--r--protocols/Tlen/docs/readme_tlen.txt60
-rw-r--r--protocols/Tlen/docs/tlen-translation.txt153
-rw-r--r--protocols/Tlen/icos/auth_grant.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/auth_request.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/groupchats.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/image.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/mail.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/microphone.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/speaker.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/tlen.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/tlenchats.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/icos/voicechat.icobin2550 -> 0 bytes
-rw-r--r--protocols/Tlen/jabber.h438
-rw-r--r--protocols/Tlen/jabber_iq.c114
-rw-r--r--protocols/Tlen/jabber_iq.h61
-rw-r--r--protocols/Tlen/jabber_iqid.c629
-rw-r--r--protocols/Tlen/jabber_list.c314
-rw-r--r--protocols/Tlen/jabber_list.h90
-rw-r--r--protocols/Tlen/jabber_misc.c219
-rw-r--r--protocols/Tlen/jabber_opt.c708
-rw-r--r--protocols/Tlen/jabber_svc.c1300
-rw-r--r--protocols/Tlen/jabber_thread.c1465
-rw-r--r--protocols/Tlen/jabber_util.c635
-rw-r--r--protocols/Tlen/jabber_ws.c159
-rw-r--r--protocols/Tlen/jabber_xml.c568
-rw-r--r--protocols/Tlen/jabber_xml.h78
-rw-r--r--protocols/Tlen/resource.h147
-rw-r--r--protocols/Tlen/tlen.c636
-rw-r--r--protocols/Tlen/tlen.rc439
-rw-r--r--protocols/Tlen/tlen_10.vcxproj928
-rw-r--r--protocols/Tlen/tlen_advsearch.c113
-rw-r--r--protocols/Tlen/tlen_avatar.c422
-rw-r--r--protocols/Tlen/tlen_avatar.h34
-rw-r--r--protocols/Tlen/tlen_czaty/AdminWindow.cpp490
-rw-r--r--protocols/Tlen/tlen_czaty/AdminWindow.h63
-rw-r--r--protocols/Tlen/tlen_czaty/ChatContainer.cpp480
-rw-r--r--protocols/Tlen/tlen_czaty/ChatContainer.h100
-rw-r--r--protocols/Tlen/tlen_czaty/ChatEvent.cpp174
-rw-r--r--protocols/Tlen/tlen_czaty/ChatEvent.h60
-rw-r--r--protocols/Tlen/tlen_czaty/ChatGroup.cpp99
-rw-r--r--protocols/Tlen/tlen_czaty/ChatGroup.h55
-rw-r--r--protocols/Tlen/tlen_czaty/ChatRoom.cpp68
-rw-r--r--protocols/Tlen/tlen_czaty/ChatRoom.h51
-rw-r--r--protocols/Tlen/tlen_czaty/ChatUser.cpp83
-rw-r--r--protocols/Tlen/tlen_czaty/ChatUser.h49
-rw-r--r--protocols/Tlen/tlen_czaty/ChatWindow.cpp2108
-rw-r--r--protocols/Tlen/tlen_czaty/ChatWindow.h196
-rw-r--r--protocols/Tlen/tlen_czaty/FontList.cpp206
-rw-r--r--protocols/Tlen/tlen_czaty/FontList.h90
-rw-r--r--protocols/Tlen/tlen_czaty/HelperDialog.cpp589
-rw-r--r--protocols/Tlen/tlen_czaty/HelperDialog.h95
-rw-r--r--protocols/Tlen/tlen_czaty/ManagerWindow.cpp1067
-rw-r--r--protocols/Tlen/tlen_czaty/ManagerWindow.h93
-rw-r--r--protocols/Tlen/tlen_czaty/Options.cpp789
-rw-r--r--protocols/Tlen/tlen_czaty/Options.h75
-rw-r--r--protocols/Tlen/tlen_czaty/Utils.cpp138
-rw-r--r--protocols/Tlen/tlen_czaty/Utils.h38
-rw-r--r--protocols/Tlen/tlen_czaty/icos/admin.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/administration.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/blank.icobin318 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/bold.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/chat.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/delete.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/glowner.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/invite.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/italic.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/message.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/next.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/options.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/owner.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/prev.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/r_anon.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/r_memb.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/r_mod.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/registered.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/save.icobin318 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/search.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/sendmail.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/smile.icobin1406 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/tlenbig.icobin2238 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/tlensmall.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/icos/underline.icobin894 -> 0 bytes
-rw-r--r--protocols/Tlen/tlen_czaty/mucc.cpp188
-rw-r--r--protocols/Tlen/tlen_czaty/mucc.h106
-rw-r--r--protocols/Tlen/tlen_czaty/mucc.rc579
-rw-r--r--protocols/Tlen/tlen_czaty/mucc.vcxproj1245
-rw-r--r--protocols/Tlen/tlen_czaty/mucc_services.cpp140
-rw-r--r--protocols/Tlen/tlen_czaty/mucc_services.h35
-rw-r--r--protocols/Tlen/tlen_czaty/resource.h218
-rw-r--r--protocols/Tlen/tlen_file.c718
-rw-r--r--protocols/Tlen/tlen_file.h34
-rw-r--r--protocols/Tlen/tlen_muc.c1071
-rw-r--r--protocols/Tlen/tlen_muc.h45
-rw-r--r--protocols/Tlen/tlen_p2p_new.c361
-rw-r--r--protocols/Tlen/tlen_p2p_old.c536
-rw-r--r--protocols/Tlen/tlen_p2p_old.h66
-rw-r--r--protocols/Tlen/tlen_picture.c320
-rw-r--r--protocols/Tlen/tlen_picture.h41
-rw-r--r--protocols/Tlen/tlen_presence.c314
-rw-r--r--protocols/Tlen/tlen_presence.h37
-rw-r--r--protocols/Tlen/tlen_userinfo.c335
-rw-r--r--protocols/Tlen/tlen_voice.c1122
-rw-r--r--protocols/Tlen/tlen_voice.h68
206 files changed, 0 insertions, 48922 deletions
diff --git a/protocols/Skype/Skript1.aps b/protocols/Skype/Skript1.aps
deleted file mode 100644
index d99f14a71e..0000000000
--- a/protocols/Skype/Skript1.aps
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/Skript1.rc b/protocols/Skype/Skript1.rc
deleted file mode 100644
index b2052187b7..0000000000
--- a/protocols/Skype/Skript1.rc
+++ /dev/null
@@ -1,484 +0,0 @@
-//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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_SETAVATAR DIALOGEX 0, 0, 222, 131
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- PUSHBUTTON "Set",IDC_SETAVATAR,10,108,45,13,WS_GROUP
- PUSHBUTTON "Delete",IDC_DELETEAVATAR,57,108,45,13
- CONTROL "",IDC_AVATAR,"Static",SS_BITMAP | SS_CENTERIMAGE |
- SS_SUNKEN | WS_GROUP,10,10,96,93
-END
-
-IDD_OPT_DEFAULT DIALOGEX 0, 0, 310, 223
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Start Skype with Miranda IM if not running using the following command line options:",
- IDC_STARTSKYPE,"Button",BS_AUTOCHECKBOX | WS_GROUP |
- WS_TABSTOP,10,4,290,10
- CONTROL "/NOSPLASH - Don't show splash screen on startup",
- IDC_NOSPLASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,17,
- 264,12
- CONTROL "/MINIMIZED - Start Skype minimized",IDC_MINIMIZED,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,28,264,12
- CONTROL "/NOTRAY - Skype tray icon becomes grey and is therefore ""invisible""",
- IDC_NOTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,40,
- 264,12
- CONTROL "/REMOVEABLE - For running portable skype",
- IDC_REMOVEABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,
- 51,264,12
- CONTROL "/SECONDARY - This is the second instance",IDC_SECONDARY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,62,264,12
- CONTROL "/DATAPATH - Specify Skype data folder*",IDC_DATAPATHO,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,74,264,12
- EDITTEXT IDC_DATAPATH,47,88,236,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_BROWSEDP,285,87,16,15
- CONTROL "Use custom Skype executable*",IDC_CUSTOMCOMMAND,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,36,103,264,10
- EDITTEXT IDC_COMMANDLINE,47,116,236,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_BROWSECMDL,285,115,16,15
- CTEXT "* Relative path root is Miranda IM folder",
- IDC_STATIC_PATHINFO,10,136,290,8,NOT WS_GROUP
- CONTROL "Shutdown Skype when you close Miranda IM",IDC_SHUTDOWN,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,151,
- 290,10
- CONTROL "Unload Skype when you change to Offline status",
- IDC_UNLOADOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 10,164,290,11
- LTEXT "Try at least",IDC_STATIC,10,185,39,8
- EDITTEXT IDC_CONNATTEMPTS,52,183,21,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "times to connect to Skype API before giving up",
- IDC_STATIC,78,185,224,8,NOT WS_GROUP
- LTEXT "User name:",IDC_STATIC,10,206,38,8
- EDITTEXT IDC_USERNAME,52,204,79,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,148,206,34,8
- EDITTEXT IDC_PASSWORD,186,204,79,12,ES_PASSWORD | ES_AUTOHSCROLL
-END
-
-IDD_DIAL DIALOGEX 0, 0, 198, 46
-STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU
-CAPTION "Dial"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Number:",IDC_STATIC,7,8,30,11
- COMBOBOX IDC_NUMBER,41,6,149,13,CBS_DROPDOWN | WS_VSCROLL |
- WS_TABSTOP
- DEFPUSHBUTTON "Dial",IDDIAL,88,25,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,141,25,50,14
-END
-
-IDD_CALLSTAT DIALOGEX 0, 0, 220, 67
-STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "%s is calling"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Join conference with %s",IDC_JOIN,"Button",
- BS_AUTORADIOBUTTON | WS_GROUP,7,7,206,10
- CONTROL "Answer call; set call to %s on hold",IDC_HOLD,"Button",
- BS_AUTORADIOBUTTON,7,19,206,10
- CONTROL "Hang up",IDC_HANGUP,"Button",BS_AUTORADIOBUTTON,7,31,
- 206,10
- DEFPUSHBUTTON "OK",IDOK,163,46,50,14,WS_GROUP
-END
-
-IDD_INPUTBOX DIALOGEX 0, 0, 221, 46
-STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Dialog"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- EDITTEXT IDC_TEXT,7,7,207,13,ES_AUTOHSCROLL | WS_GROUP
- DEFPUSHBUTTON "OK",IDOK,112,25,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,165,25,50,14
-END
-
-IDD_OPTIONS DIALOGEX 0, 0, 313, 249
-STYLE DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Tab1",IDC_OPTIONSTAB,"SysTabControl32",0x0,0,-1,313,250
-END
-
-IDD_OPT_PROXY DIALOGEX 0, 0, 310, 223
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Use Skype proxy connection over network instead of local Skype API",
- IDC_USES2S,"Button",BS_AUTOCHECKBOX | WS_GROUP |
- WS_TABSTOP,10,4,290,9
- LTEXT "Host:",IDC_STATIC_HOST,20,21,18,10
- EDITTEXT IDC_HOST,41,19,133,12,ES_AUTOHSCROLL
- LTEXT "Port:",IDC_STATIC_PORT,180,21,16,10,0,WS_EX_RIGHT
- EDITTEXT IDC_PORT,200,19,29,12,ES_AUTOHSCROLL | ES_NUMBER
- CTEXT "* You must restart Miranda IM in order to let the settings take effect",
- IDC_STATIC_RESTART,10,54,290,8,NOT WS_GROUP
- CONTROL "This Skype proxy requires password authentication:",
- IDC_REQPASS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
- WS_TABSTOP,20,38,176,9
- EDITTEXT IDC_PASSWORD,200,36,82,12,ES_PASSWORD | ES_AUTOHSCROLL
-END
-
-IDD_SETDETAILS DIALOGEX 0, 0, 216, 151
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Name:",IDC_STATIC,7,6,61,9
- EDITTEXT IDC_FULLNAME,73,4,141,12,ES_AUTOHSCROLL
- LTEXT "Birthday:",IDC_STATIC,7,20,61,9
- CONTROL "DateTimePicker1",IDC_BIRTHDAY,"SysDateTimePick32",
- DTS_RIGHTALIGN | DTS_APPCANPARSE | WS_TABSTOP,73,18,62,
- 12
- LTEXT "Sex:",IDC_STATIC,7,34,61,9
- COMBOBOX IDC_SEX,73,32,141,12,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "City:",IDC_STATIC,7,48,61,9
- EDITTEXT IDC_CITY,73,46,141,12,ES_AUTOHSCROLL
- LTEXT "Country:",IDC_STATIC,7,62,61,9
- EDITTEXT IDC_COUNTRY,73,60,141,12,ES_AUTOHSCROLL
- LTEXT "Province:",IDC_STATIC,7,76,61,9
- EDITTEXT IDC_PROVINCE,73,74,141,12,ES_AUTOHSCROLL
- LTEXT "Home phone:",IDC_STATIC,7,90,61,9
- EDITTEXT IDC_HOMEPHONE,73,88,141,12,ES_AUTOHSCROLL
- LTEXT "Office phone:",IDC_STATIC,7,104,61,9
- EDITTEXT IDC_OFFICEPHONE,73,102,141,12,ES_AUTOHSCROLL
- LTEXT "Homepage:",IDC_STATIC,7,118,61,9
- EDITTEXT IDC_HOMEPAGE,73,116,141,12,ES_AUTOHSCROLL
- PUSHBUTTON "Save",IDC_SAVEDETAILS,170,134,45,14,WS_GROUP
-END
-
-IDD_OPT_ADVANCED DIALOGEX 0, 0, 310, 223
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Enable Skype menu options (currently: Find/Add user)",
- IDC_ENABLEMENU,"Button",BS_AUTOCHECKBOX | WS_GROUP |
- WS_TABSTOP,10,4,290,9
- CONTROL "Use popup plugin for displaying messages ",IDC_USEPOPUP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,19,290,9
- CONTROL "Suppress all error messages (not recommended, but if it annoys you... ;)",
- IDC_NOERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,34,
- 290,9
- CONTROL "Use group chat interface for conversations (requires group chat module)",
- IDC_GROUPCHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,
- 49,290,9
- CONTROL "Mark group chat message as read to avoid notification",
- IDC_GROUPCHATREAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 10,64,290,9
- CONTROL "Keep requested online status on startup under every circumstance",
- IDC_KEEPSTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,
- 79,290,9
- CONTROL "Use time zone patch",IDC_TIMEZONE,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,10,94,290,9
- CONTROL "Ignore time zones",IDC_IGNTZ,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,10,109,290,9
- CONTROL "Show default skype avatar for contacts",
- IDC_SHOWDEFAULTAVATAR,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,10,124,290,9
- CONTROL "Suppress call summary chat message",
- IDC_SUPPRESSCALLSUMMARYMESSAGE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,10,139,290,9
- CONTROL "Disable support for N/A and SkypeMe status (for Skype 4+)",
- IDC_NOSKYPE3STATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 10,154,290,9
- CONTROL "Show full name in contact list instead of nickname",
- IDC_SHOWFULLNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 10,169,290,9
- LTEXT "SkypeOut contacts are in status:",IDC_STATIC,10,186,108,
- 8
- COMBOBOX IDC_SKYPEOUTSTAT,120,184,79,54,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Cleanup Nicknames",IDC_CLEANUP,9,201,80,14,BS_MULTILINE |
- WS_GROUP
-END
-
-IDD_OPT_POPUP DIALOGEX 0, 0, 310, 228
-STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Skype Popups",IDC_STATIC,0,1,309,227
- GROUPBOX "Incoming Calls",IDC_STATIC,6,16,297,62,WS_GROUP
- CONTROL "Show incoming calls",IDC_POPUPINCOMING,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,28,278,8
- EDITTEXT IDC_POPUPTIME,16,41,20,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "seconds",IDC_STATIC,41,43,92,8,NOT WS_GROUP
- CONTROL "",IDC_POPUPBACKCOLOR,"ColourPicker",WS_GROUP |
- WS_TABSTOP,142,40,39,12
- LTEXT "Background",IDC_STATIC_POPUPBACKCOLOR,186,42,50,8,
- SS_CENTERIMAGE | NOT WS_GROUP
- CONTROL "Use Windows colors",IDC_USEWINCOLORS,"Button",
- BS_AUTOCHECKBOX | BS_NOTIFY | BS_FLAT | WS_TABSTOP,16,58,
- 121,8
- CONTROL "",IDC_POPUPTEXTCOLOR,"ColourPicker",WS_TABSTOP,142,55,
- 39,12
- LTEXT "Text",IDC_STATIC_POPUPTEXTCOLOR,186,56,50,8,
- SS_CENTERIMAGE | NOT WS_GROUP
- PUSHBUTTON "Preview",IDC_PREVIEW,247,58,50,14,WS_GROUP
- GROUPBOX "Error Messages",IDC_STATIC,6,81,297,62,WS_GROUP
- CONTROL "Display error messages",IDC_POPUPERROR,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,94,278,8
- EDITTEXT IDC_POPUPTIMEERR,16,107,20,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "seconds",IDC_STATIC,41,109,92,8,NOT WS_GROUP
- CONTROL "",IDC_POPUPBACKCOLORERR,"ColourPicker",WS_GROUP |
- WS_TABSTOP,142,106,39,12
- LTEXT "Background",IDC_STATIC_POPUPBACKCOLORERR,186,108,50,8,
- SS_CENTERIMAGE | NOT WS_GROUP
- CONTROL "Use Windows colors",IDC_USEWINCOLORSERR,"Button",
- BS_AUTOCHECKBOX | BS_NOTIFY | BS_FLAT | WS_TABSTOP,16,
- 124,121,8
- CONTROL "",IDC_POPUPTEXTCOLORERR,"ColourPicker",WS_TABSTOP,142,
- 121,39,12
- LTEXT "Text",IDC_STATIC_POPUPTEXTCOLORERR,186,123,50,8,
- SS_CENTERIMAGE | NOT WS_GROUP
- PUSHBUTTON "Preview",IDC_PREVIEWERR,247,124,50,14,WS_GROUP
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO MOVEABLE PURE
-BEGIN
- IDD_SETAVATAR, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 212
- TOPMARGIN, 10
- BOTTOMMARGIN, 121
- END
-
- IDD_OPT_DEFAULT, DIALOG
- BEGIN
- LEFTMARGIN, 1
- VERTGUIDE, 10
- VERTGUIDE, 300
- TOPMARGIN, 4
- END
-
- IDD_DIAL, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 190
- TOPMARGIN, 6
- BOTTOMMARGIN, 39
- END
-
- IDD_CALLSTAT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 213
- TOPMARGIN, 7
- BOTTOMMARGIN, 60
- END
-
- IDD_INPUTBOX, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 214
- TOPMARGIN, 7
- BOTTOMMARGIN, 39
- END
-
- IDD_OPTIONS, DIALOG
- BEGIN
- RIGHTMARGIN, 311
- BOTTOMMARGIN, 243
- END
-
- IDD_OPT_PROXY, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 300
- TOPMARGIN, 4
- BOTTOMMARGIN, 221
- END
-
- IDD_SETDETAILS, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 214
- TOPMARGIN, 4
- BOTTOMMARGIN, 148
- END
-
- IDD_OPT_ADVANCED, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 300
- TOPMARGIN, 4
- BOTTOMMARGIN, 221
- HORZGUIDE, 4
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_SKYPE ICON DISCARDABLE "res\\skype.ico"
-IDI_INVITE ICON DISCARDABLE "res\\Invite.ico"
-IDI_ADD ICON DISCARDABLE "res\\add.ico"
-IDI_IMPORT ICON DISCARDABLE "res\\import.ico"
-IDI_ERRORS ICON DISCARDABLE "res\\error.ico"
-IDI_MESSAGE ICON DISCARDABLE "res\\message.ico"
-IDI_CALL ICON DISCARDABLE "res\\call.ico"
-IDI_CALLSKYPEOUT ICON DISCARDABLE "res\\skypeout.ico"
-IDI_HOLD ICON DISCARDABLE "res\\hold.ico"
-IDI_RESUME ICON DISCARDABLE "res\\resume.ico"
-IDI_HANGUP ICON DISCARDABLE "res\\hang_up.ico"
-IDI_ONLINE ICON DISCARDABLE "res\\online.ico"
-IDI_CHAT ICON DISCARDABLE "res\\chat.ico"
-IDI_AWAY ICON DISCARDABLE "res\\away.ico"
-IDI_NA ICON DISCARDABLE "res\\na.ico"
-IDI_OCCUPIED ICON DISCARDABLE "res\\occupied.ico"
-IDI_DND ICON DISCARDABLE "res\\dnd.ico"
-IDI_INVISIBLE ICON DISCARDABLE "res\\invisible.ico"
-IDI_OFFLINE ICON DISCARDABLE "res\\offline.ico"
-IDI_PHONE ICON DISCARDABLE "res\\phone.ico"
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,0,53
- PRODUCTVERSION 0,0,0,53
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "Miranda IM community\0"
- VALUE "FileDescription", "Skype\0"
- VALUE "FileVersion", "0, 0, 0, 53\0"
- VALUE "InternalName", "Skype\0"
- VALUE "LegalCopyright", "Copyright © 2007-2011 leecher - tweety - jls17\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "Skype.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "Skype Protocol for Miranda IM\0"
- VALUE "ProductVersion", "0, 0, 0, 53\0"
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_CALL BITMAP MOVEABLE PURE "res\\call.bmp"
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Deutsch (Österreich) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
-#ifdef _WIN32
-LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // Deutsch (Österreich) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/protocols/Skype/Skype_protocol.dsp b/protocols/Skype/Skype_protocol.dsp
deleted file mode 100644
index 3c9191838e..0000000000
--- a/protocols/Skype/Skype_protocol.dsp
+++ /dev/null
@@ -1,394 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Skype_protocol" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** NICHT BEARBEITEN **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=Skype_protocol - Win32 Debug UNICODE
-!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
-!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
-!MESSAGE
-!MESSAGE NMAKE /f "Skype_protocol.mak".
-!MESSAGE
-!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
-!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
-!MESSAGE
-!MESSAGE NMAKE /f "Skype_protocol.mak" CFG="Skype_protocol - Win32 Debug UNICODE"
-!MESSAGE
-!MESSAGE Für die Konfiguration stehen zur Auswahl:
-!MESSAGE
-!MESSAGE "Skype_protocol - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "Skype_protocol - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "Skype_protocol - Win32 Debug UNICODE" (basierend auf "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=xicl6.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Skype_protocol - 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 "SKYPE_PROTOCOL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /YX /FD /c
-# SUBTRACT CPP /Fr
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc07 /d "NDEBUG"
-# ADD RSC /l 0xc07 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=xilink6.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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib comctl32.lib Rpcrt4.lib /nologo /dll /machine:I386 /out:"../../bin/release/plugins/skype.dll"
-
-!ELSEIF "$(CFG)" == "Skype_protocol - 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 "SKYPE_PROTOCOL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /YX /FD /GZ /c
-# SUBTRACT CPP /Fr
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc07 /d "_DEBUG"
-# ADD RSC /l 0xc07 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=xilink6.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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib comctl32.lib Rpcrt4.lib /nologo /dll /debug /machine:I386 /out:"../../../miranda-testaim/Miranda/plugins/Skype.dll" /pdbtype:sept
-# SUBTRACT LINK32 /map
-
-!ELSEIF "$(CFG)" == "Skype_protocol - Win32 Debug UNICODE"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Skype_protocol___Win32_Debug_UNICODE"
-# PROP BASE Intermediate_Dir "Skype_protocol___Win32_Debug_UNICODE"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Skype_protocol___Win32_Debug_UNICODE"
-# PROP Intermediate_Dir "Skype_protocol___Win32_Debug_UNICODE"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /YX /FD /GZ /c
-# SUBTRACT BASE CPP /Fr
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /D "UNICODE" /D "_UNICODE" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0xc07 /d "_DEBUG"
-# ADD RSC /l 0xc07 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=xilink6.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 wsock32.lib comctl32.lib Rpcrt4.lib /nologo /dll /debug /machine:I386 /out:"../../bin/debug/plugins/Skype.dll" /pdbtype:sept
-# SUBTRACT BASE LINK32 /map
-# ADD 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 wsock32.lib comctl32.lib Rpcrt4.lib /nologo /dll /debug /machine:I386 /out:"../../bin/debug Unicode/plugins/Skype.dll" /pdbtype:sept
-# SUBTRACT LINK32 /map
-
-!ENDIF
-
-# Begin Target
-
-# Name "Skype_protocol - Win32 Release"
-# Name "Skype_protocol - Win32 Debug"
-# Name "Skype_protocol - Win32 Debug UNICODE"
-# Begin Group "Quellcodedateien"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\alogon.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\contacts.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\debug.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gchat.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\memlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\msglist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\msgq.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\pthread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\skype.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeapi.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeprofile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypesvc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\util.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\voiceservice.c
-# End Source File
-# End Group
-# Begin Group "Header-Dateien"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\alogon.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\contacts.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\debug.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\gchat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_popup.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_toptoolbar.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\memlist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\msglist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\msgq.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pthread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\skype.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeapi.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypeprofile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\skypesvc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\voiceservice.h
-# End Source File
-# End Group
-# Begin Group "Ressourcendateien"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\res\add.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\away.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\bitmap1.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\call.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Call.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\call.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\chat.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\DND.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\error.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\hang_up.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\Hangup.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\hold.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\holdcall.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\icon1.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\icon2.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\import.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\invisible.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\Invite.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\message.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\NA.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\occupied.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\offline.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\online.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\phone.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\resume.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\resumecall.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\Skript1.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\skype.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\skypeout.ico
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\changelog.txt
-# End Source File
-# End Target
-# End Project
diff --git a/protocols/Skype/Skype_protocol.dsw b/protocols/Skype/Skype_protocol.dsw
deleted file mode 100644
index 3965e55d3e..0000000000
--- a/protocols/Skype/Skype_protocol.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
-
-###############################################################################
-
-Project: "Skype_protocol"=.\Skype_protocol.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/protocols/Skype/Skype_protocol.mak b/protocols/Skype/Skype_protocol.mak
deleted file mode 100644
index cf43334fb3..0000000000
--- a/protocols/Skype/Skype_protocol.mak
+++ /dev/null
@@ -1,238 +0,0 @@
-!IF "$(CFG)" == ""
-CFG=Win32 Debug
-!MESSAGE Keine Konfiguration angegeben. Win32 Debug wird als Standard verwendet.
-!ENDIF
-
-!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" && "$(CFG)" != "Win64 Release" && "$(CFG)" != "Win64 Debug" && "$(CFG)" != "Win32 UNICODE Release" && "$(CFG)" != "Win32 UNICODE Debug" && "$(CFG)" != "Win64 UNICODE Release" && "$(CFG)" != "Win64 UNICODE Debug"
-!MESSAGE Ungültige Konfiguration "$(CFG)" angegeben.
-!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
-!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
-!MESSAGE
-!MESSAGE NMAKE /f "Skype_protocol.mak" CFG="Win32 Debug"
-!MESSAGE
-!MESSAGE Für die Konfiguration stehen zur Auswahl:
-!MESSAGE
-!MESSAGE "Win32 Release"
-!MESSAGE "Win32 Debug"
-!MESSAGE "Win64 Release"
-!MESSAGE "Win64 Debug"
-!MESSAGE "Win32 UNICODE Release"
-!MESSAGE "Win32 UNICODE Debug"
-!MESSAGE "Win64 UNICODE Release"
-!MESSAGE "Win64 UNICODE Debug"
-
-!MESSAGE
-!ERROR Eine ungültige Konfiguration wurde angegeben.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-LINK32=link.exe
-
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib comctl32.lib Rpcrt4.lib /nologo /dll /pdb:"$(INTDIR)\skype.pdb" /out:"$(OUTDIR)/skype.dll" /implib:"$(INTDIR)\skype.lib"
-
-!IF "$(CFG)" == "Win64 Release"
-OUTDIR=.\Release64
-INTDIR=.\Release64
-CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:no
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "NDEBUG"
-!ELSEIF "$(CFG)" == "Win32 Release"
-OUTDIR=.\Release
-INTDIR=.\Release
-CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:no
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "NDEBUG"
-!ELSEIF "$(CFG)" == "Win64 Debug"
-OUTDIR=Debug64
-INTDIR=$(OUTDIR)
-CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:yes /debug /pdbtype:sept
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "_DEBUG"
-!ELSEIF "$(CFG)" == "Win32 Debug"
-OUTDIR=.\Debug
-INTDIR=$(OUTDIR)
-CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:yes /debug /pdbtype:sept
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "_DEBUG"
-!ELSEIF "$(CFG)" == "Win64 UNICODE Release"
-OUTDIR=.\Release64-UNICODE
-INTDIR=.\Release64-UNICODE
-CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:no
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "NDEBUG"
-!ELSEIF "$(CFG)" == "Win32 UNICODE Release"
-OUTDIR=.\Release-UNICODE
-INTDIR=.\Release-UNICODE
-CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:no
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "NDEBUG"
-!ELSEIF "$(CFG)" == "Win64 UNICODE Debug"
-OUTDIR=Debug64-UNICODE
-INTDIR=$(OUTDIR)
-CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-LINK32_FLAGS= $(LINK32_FLAGS) /incremental:yes /debug /pdbtype:sept
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "_DEBUG"
-!ELSEIF "$(CFG)" == "Win32 UNICODE Debug"
-OUTDIR=.\Debug-UNICODE
-INTDIR=$(OUTDIR)
-CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SKYPE_PROTOCOL_EXPORTS" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\Skype_protocol.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-LINK32_FLAGS=$(LINK32_FLAGS) /incremental:yes /debug /pdbtype:sept
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-RSC_PROJ=/l 0xc07 /fo"$(INTDIR)\Skript1.res" /d "_DEBUG"
-!ENDIF
-
-LINK32_OBJS= \
- "$(INTDIR)\contacts.obj" \
- "$(INTDIR)\debug.obj" \
- "$(INTDIR)\gchat.obj" \
- "$(INTDIR)\pthread.obj" \
- "$(INTDIR)\skype.obj" \
- "$(INTDIR)\skypeapi.obj" \
- "$(INTDIR)\skypeopt.obj" \
- "$(INTDIR)\skypeprofile.obj" \
- "$(INTDIR)\skypesvc.obj" \
- "$(INTDIR)\utf8.obj" \
- "$(INTDIR)\voiceservice.obj" \
- "$(INTDIR)\msglist.obj" \
- "$(INTDIR)\memlist.obj" \
- "$(INTDIR)\util.obj" \
- "$(INTDIR)\msgq.obj" \
- "$(INTDIR)\alogon.obj" \
- "$(INTDIR)\Skript1.res"
-
-ALL : "$(OUTDIR)\skype.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\contacts.obj"
- -@erase "$(INTDIR)\debug.obj"
- -@erase "$(INTDIR)\gchat.obj"
- -@erase "$(INTDIR)\pthread.obj"
- -@erase "$(INTDIR)\Skript1.res"
- -@erase "$(INTDIR)\skype.obj"
- -@erase "$(INTDIR)\skypeapi.obj"
- -@erase "$(INTDIR)\skypeopt.obj"
- -@erase "$(INTDIR)\skypeprofile.obj"
- -@erase "$(INTDIR)\skypesvc.obj"
- -@erase "$(INTDIR)\msglist.obj"
- -@erase "$(INTDIR)\memlist.obj"
- -@erase "$(INTDIR)\util.obj"
- -@erase "$(INTDIR)\msgq.obj" \
- -@erase "$(INTDIR)\alogon.obj" \
- -@erase "$(INTDIR)\utf8.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\voiceservice.obj"
- -@erase "$(INTDIR)\skype.exp"
- -@erase "$(INTDIR)\skype.pdb"
- -@erase "$(INTDIR)\skype.lib"
- -@erase "$(OUTDIR)\skype.dll"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-"$(OUTDIR)\skype.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("Skype_protocol.dep")
-!INCLUDE "Skype_protocol.dep"
-!ELSE
-!MESSAGE Warning: cannot find "Skype_protocol.dep"
-!ENDIF
-!ENDIF
-
-
-SOURCE=.\alogon.c
-
-"$(INTDIR)\alogon.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\contacts.c
-
-"$(INTDIR)\contacts.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\debug.c
-
-"$(INTDIR)\debug.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\gchat.c
-
-"$(INTDIR)\gchat.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\msgq.c
-
-"$(INTDIR)\msgq.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\pthread.c
-
-"$(INTDIR)\pthread.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\skype.c
-
-"$(INTDIR)\skype.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\skypeapi.c
-
-"$(INTDIR)\skypeapi.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\skypeopt.c
-
-"$(INTDIR)\skypeopt.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\skypeprofile.c
-
-"$(INTDIR)\skypeprofile.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\skypesvc.c
-
-"$(INTDIR)\skypesvc.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\utf8.c
-
-"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\voiceservice.c
-
-"$(INTDIR)\voiceservice.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\Skript1.rc
-
-"$(INTDIR)\Skript1.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) $(RSC_PROJ) $(SOURCE)
-
diff --git a/protocols/Skype/Skype_protocol.sln b/protocols/Skype/Skype_protocol.sln
deleted file mode 100644
index 0ea2547268..0000000000
--- a/protocols/Skype/Skype_protocol.sln
+++ /dev/null
@@ -1,44 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Skype_protocol", "Skype_protocol.vcproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- ANSI Debug|Win32 = ANSI Debug|Win32
- ANSI Debug|x64 = ANSI Debug|x64
- ANSI Release|Win32 = ANSI Release|Win32
- ANSI Release|x64 = ANSI Release|x64
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- x64 Debug|Win32 = x64 Debug|Win32
- x64 Debug|x64 = x64 Debug|x64
- x64 Release|Win32 = x64 Release|Win32
- x64 Release|x64 = x64 Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Debug|Win32.ActiveCfg = ANSI Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Debug|Win32.Build.0 = ANSI Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Debug|x64.ActiveCfg = ANSI Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Release|Win32.ActiveCfg = ANSI Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Release|Win32.Build.0 = ANSI Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.ANSI Release|x64.ActiveCfg = ANSI Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Debug|Win32.ActiveCfg = x64 Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Debug|x64.ActiveCfg = x64 Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Debug|x64.Build.0 = x64 Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Release|Win32.ActiveCfg = x64 Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Release|x64.ActiveCfg = x64 Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.x64 Release|x64.Build.0 = x64 Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/protocols/Skype/Skype_protocol.vcproj b/protocols/Skype/Skype_protocol.vcproj
deleted file mode 100644
index 74e7e4bac0..0000000000
--- a/protocols/Skype/Skype_protocol.vcproj
+++ /dev/null
@@ -1,2843 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="Skype_protocol"
- ProjectGUID="{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
- RootNamespace="Skype_protocol"
- TargetFrameworkVersion="0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_USE_32BIT_TIME_T;WIN32;_DEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="_USE_32BIT_TIME_T;WIN32;NDEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="x64 Debug|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_WIN64;_DEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile=""
- ProgramDataBaseFileName=""
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="x64 Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_WIN64;_DEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="x64 Release|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="_WIN64;NDEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="x64 Release|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="_WIN64;NDEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ANSI Debug|Win32"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_USE_32BIT_TIME_T;WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ANSI Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- ExceptionHandling="0"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Skype.pdb"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ANSI Release|Win32"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="_USE_32BIT_TIME_T;WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ANSI Release|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=""
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- WholeProgramOptimization="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SKYPE_PROTOCOL_EXPORTS;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="false"
- RuntimeTypeInfo="false"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=""
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
- WarningLevel="4"
- SuppressStartupBanner="true"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="0"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib comctl32.lib"
- OutputFile="$(OutDir)\skype.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=""
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="0"
- RandomizedBaseAddress="0"
- DataExecutionPrevention="0"
- ImportLibrary=""
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=""
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Quellcodedateien"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="contacts.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="debug.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="gchat.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="memlist.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="msglist.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="pthread.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="skype.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="skypeapi.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="skypeopt.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="skypeprofile.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="skypesvc.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="utf8.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\util.c"
- >
- </File>
- <File
- RelativePath="voiceservice.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header-Dateien"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath="contacts.h"
- >
- </File>
- <File
- RelativePath="debug.h"
- >
- </File>
- <File
- RelativePath="gchat.h"
- >
- </File>
- <File
- RelativePath="m_popup.h"
- >
- </File>
- <File
- RelativePath="m_toptoolbar.h"
- >
- </File>
- <File
- RelativePath="memlist.h"
- >
- </File>
- <File
- RelativePath="msglist.h"
- >
- </File>
- <File
- RelativePath="pthread.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath="skype.h"
- >
- </File>
- <File
- RelativePath="skypeapi.h"
- >
- </File>
- <File
- RelativePath="skypeopt.h"
- >
- </File>
- <File
- RelativePath="skypeprofile.h"
- >
- </File>
- <File
- RelativePath="skypesvc.h"
- >
- </File>
- <File
- RelativePath="utf8.h"
- >
- </File>
- <File
- RelativePath=".\util.h"
- >
- </File>
- <File
- RelativePath="voiceservice.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Ressourcendateien"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- <File
- RelativePath="res\add.ico"
- >
- </File>
- <File
- RelativePath="res\away.ico"
- >
- </File>
- <File
- RelativePath="bitmap1.bmp"
- >
- </File>
- <File
- RelativePath="res\call.bmp"
- >
- </File>
- <File
- RelativePath="res\call.ico"
- >
- </File>
- <File
- RelativePath="Call.ico"
- >
- </File>
- <File
- RelativePath="res\chat.ico"
- >
- </File>
- <File
- RelativePath="res\DND.ico"
- >
- </File>
- <File
- RelativePath="res\error.ico"
- >
- </File>
- <File
- RelativePath="res\hang_up.ico"
- >
- </File>
- <File
- RelativePath="Hangup.ico"
- >
- </File>
- <File
- RelativePath="res\hold.ico"
- >
- </File>
- <File
- RelativePath="holdcall.ico"
- >
- </File>
- <File
- RelativePath="icon1.ico"
- >
- </File>
- <File
- RelativePath="icon2.ico"
- >
- </File>
- <File
- RelativePath="res\import.ico"
- >
- </File>
- <File
- RelativePath="res\invisible.ico"
- >
- </File>
- <File
- RelativePath="res\Invite.ico"
- >
- </File>
- <File
- RelativePath="res\message.ico"
- >
- </File>
- <File
- RelativePath="res\NA.ico"
- >
- </File>
- <File
- RelativePath="res\occupied.ico"
- >
- </File>
- <File
- RelativePath="res\offline.ico"
- >
- </File>
- <File
- RelativePath="res\online.ico"
- >
- </File>
- <File
- RelativePath="res\phone.ico"
- >
- </File>
- <File
- RelativePath="res\resume.ico"
- >
- </File>
- <File
- RelativePath="resumecall.ico"
- >
- </File>
- <File
- RelativePath="Skript1.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="x64 Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ANSI Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="res\skype.ico"
- >
- </File>
- <File
- RelativePath="res\skypeout.ico"
- >
- </File>
- </Filter>
- <File
- RelativePath="changelog.txt"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/protocols/Skype/alogon.c b/protocols/Skype/alogon.c
deleted file mode 100644
index 90c3510944..0000000000
--- a/protocols/Skype/alogon.c
+++ /dev/null
@@ -1,129 +0,0 @@
-#include "skype.h"
-#include "debug.h"
-
-extern char g_szProtoName[];
-extern HANDLE SkypeReady;
-
-/**
- * Purpose: Retrieves class name from window
- *
- * Note: This is some sort of hack to return static local variable,
- * but it works :)
- */
-static const TCHAR* getClassName(HWND wnd)
-{
- static TCHAR className[256];
-
- *className=0;
- GetClassName(wnd, &className[0], sizeof(className)/sizeof(className[0]));
- return className;
-}
-
-/**
- * Purpose: Finds a window
- *
- * Note: This function relies on Skype window placement.
- * It should work for Skype 3.x
- */
-static HWND findWindow(HWND parent, const TCHAR* childClassName)
-{
- // Get child window
- // This window is not combo box or edit box
- HWND wnd = GetWindow(parent, GW_CHILD);
- while(wnd != NULL && _tcscmp(getClassName(wnd), childClassName) != 0)
- wnd = GetWindow(wnd, GW_HWNDNEXT);
-
- return wnd;
-}
-
-static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
-{
- DWORD dwPID;
- const TCHAR *lpszClassName;
-
-
- GetWindowThreadProcessId(hWnd,&dwPID);
- if (lParam != 0 && dwPID != (DWORD)lParam) return TRUE;
- lpszClassName = getClassName(hWnd);
- if(_tcscmp(lpszClassName, _T("tSkMainForm.UnicodeClass")) == 0 ||
- _tcscmp(lpszClassName, _T("TLoginForm.UnicodeClass")) == 0)
- {
- HWND loginControl = GetWindow(hWnd, GW_CHILD);
-
- LOG(("setUserNamePasswordThread: Skype window found!"));
-
- // Sleep for some time, while Skype is loading
- // It loads slowly :(
- //Sleep(5000);
- LOG (("TLoginControl = %S", getClassName(loginControl)));
-
- // Check for login control
- if(_tcscmp(getClassName(loginControl), _T("TLoginControl")) == 0)
- {
- // Find user name window
- HWND userName = findWindow(loginControl, _T("TNavigableTntComboBox.UnicodeClass"));
- HWND password = findWindow(loginControl, _T("TNavigableTntEdit.UnicodeClass"));
-
- LOG (("userName=%08X; password=%08X", userName, password));
- if (userName && password)
- {
- // Set user name and password
- DBVARIANT dbv;
-
- if(!DBGetContactSettingWString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv))
- {
- SendMessageW(userName, WM_SETTEXT, 0, (LPARAM)dbv.pwszVal);
- DBFreeVariant(&dbv);
- }
-
- if(!DBGetContactSettingWString(NULL,SKYPE_PROTONAME,"LoginPassword",&dbv))
- {
- SendMessageW(password, WM_SETTEXT, 0, (LPARAM)dbv.pwszVal);
- DBFreeVariant(&dbv);
- SendMessageW(password, WM_CHAR, 13, 0);
- }
-
-
- SendMessageW(hWnd,
- WM_COMMAND,
- 0x4a8, // sign-in button; WARNING: This ID can change during newer Skype versions
- (LPARAM)findWindow(loginControl, _T("TTntButton.UnicodeClass")));
- }
- return FALSE;
- }
-
- }
- return TRUE;
-}
-
-DWORD WINAPI setUserNamePasswordThread(LPVOID lpDummy)
-{
- DWORD dwPid = (DWORD)lpDummy;
- HANDLE mutex = CreateMutex(NULL, TRUE, _T("setUserNamePasswordMutex"));
-
- // Check double entrance
- if(GetLastError() == ERROR_ALREADY_EXISTS)
- return 0;
-
- WaitForSingleObject(SkypeReady, 5000);
- EnumWindows (EnumWindowsProc, dwPid);
-
- ReleaseMutex(mutex);
- CloseHandle(mutex);
- return 0;
-}
-
-/**
- * Purpose: Finds Skype window and sets user name and password.
- *
- * Note: This function relies on Skype window placement.
- * It should work for Skype 3.x
- */
-void setUserNamePassword(int dwPid)
-{
- DWORD threadId;
- CreateThread(NULL, 0, &setUserNamePasswordThread, (LPVOID)dwPid, 0, &threadId);
-
- // Give time to thread
- Sleep(100);
-}
diff --git a/protocols/Skype/alogon.h b/protocols/Skype/alogon.h
deleted file mode 100644
index 00d2e7e703..0000000000
--- a/protocols/Skype/alogon.h
+++ /dev/null
@@ -1 +0,0 @@
-void setUserNamePassword(int dwPid);
diff --git a/protocols/Skype/changelog.txt b/protocols/Skype/changelog.txt
deleted file mode 100644
index 60526b1116..0000000000
--- a/protocols/Skype/changelog.txt
+++ /dev/null
@@ -1,330 +0,0 @@
-NOTES
------
-
- You have to manually disable popup of messages in SKYPE, as there is
- currently no function in the API to do this
- Got to File/Options/Instant messages and disable the checkboxes there
-
-
-CODE
-----
- Currently a real mess. At least I splitted it up a bit now.
- But hey, it kinda works... ;)
-
-HISTORY
--------
-
-0.0.0.45 - ! "NA" and "Free for chat" status are available again; NA is supported by skype and Free for chat
- uses skypes "Skype Me" status; better leave it that way
- ! changes to the mood message of a contact were only visible after a status change
- ! plugin was crashing when status changed to offline and a proxy is used
-
-0.0.0.44 - ! menu item "Hang up (Skype)" was show on none skype contacts
- ! fixed serveral bugs in skype startup (including starting skype twice)
- ! show connecting state correctly
- ! hangup while ringing caused a state where contact isnt callable anymore
- * removed "NA" and "Free for chat" status
-
-0.0.0.43 - + Added option to suppress summary chat message after call is finished (jls17)
- ! Fix hangup causes a dial command if opponent hangs up a little bit earlier (jls17)
- ! removed empty chat message on incoming call
- ! empty mood message is send to skype correctly
-
-
-0.0.0.42 - + Added a trick to identify skype 3 version (fingerprint)
-0.0.0.41 - + Added option to enter user name and password. (Patch by NN)
-
-0.0.0.40 - + Support for new core service: get avatar caps
- + Option to show/hide default avatar for contacts
- + Hide Skype Avatar page in user details if >= #27
-
-0.0.0.39 - + Voice service support in normall calls - no support for SkypeOut yet (pescuma)
- ! Made options dialog a little bit smaller, removed frame and set bold frame for popups (pescuma)
- + Add more status to manage for away message
-
-0.0.0.38 - ! Fix the load for pre 0.7.0 #17 build
- * Patch by pescuma for avatar.
-
-0.0.0.37 - ! Avoid empty message from myself on first message received.
- + Add the Get user avatar interface
- * Change the get user info thread
- * code cleanup
- + Support for miranda 0.8
- ! Correct use of folder plugin (using "avatar cache folder"\SKYPE).
-
-0.0.0.36 - ! When settings skype offline, first set proto off then contacts.
- * move the broadcast of status change out of if statement in status change.
- * Set contacts ofline on plugin load (avoid skype contact to be online if starts skype is not checked)
- ! Fix the use of datapath for portable skype
- * Allow to choose no splash - no tray - minimized even if start skype with miranda is not checked.
- ! Fix bug with timestamp in irc
-
-0.0.0.35 - * Use unicode nick, status message, city and country in skype profile.
- ! Fix for sending status change when offline
- * Do not send message to skype if not attached (avoid trying to connect to api at startup)
- ! Fix crash on recieving message with groupchat checked.
-
-0.0.0.34 - + Try to identify if chat message comes from a group chat or not
- + Add a option to flag group chat message as read if not using chat.dll for group chat.
- ! Fix the check of message type (group chat or normal)
-
-0.0.0.33 - ! Fix for flags of event and metacontact (thanks SJE)
- * Next step to custom popup support (in popup option page)
- ! Fix infinite for error popup
-
-0.0.0.32 - ! Improvemnt of the Action message support.
- ! Fix empty message on first chat with a contact.
-
-0.0.0.31 - + First step to Action Message support ( /me )
- + Updater support for File Listing.
- + First step to a custom popup for call notification.
-
-0.0.0.30 - + Add an option to enable/disable the timezone patch
-
-0.0.0.29 - ! Try to fix the bug (set skype offline when closing miranda)
-
-0.0.0.28 - * Improved portable skype integration
-
-0.0.0.27 - * Try to fix the start using custom command line
- + Close skype using custom command line too
-
-0.0.0.26 - + Add a way to use a custom command line to start skype.
-
-0.0.0.25 - ! patch from markcs about timezones.
- ! shutdown patch by sje
-
-0.0.0.24 - * Change options dialog (use tabsrmm uxtheme)
-
-0.0.0.23 - ! Wrong db entry name for cellular (cellucar)
- + Set mirver using is video capabale to identify skype 2.0 user
-
-0.0.0.22 - * Options page redesigned
- * Work around to force refresh of avatar in MyDetail (w8 the avatar change service)
- * Change Skype protocol to Skype in options->Network
- * Free buffer in status message retrieve
- * First step to a details info page.
-
-0.0.0.21 - * Some minor bugfixes
- * Severe bugfix: Message sending routine worked incorrectly (no errors were shown
- even if there were sending-errors)
- * Removed PingPong - thread in favour of WM_TIMER
- * Fixed critical section unlocking in skypeapi.c. In certain cases, critical sections
- were not left correctly.
- * Fixed a bug that caused Miranda to crash on exit with Newstatusnotify plugin
- (thanks to TioDuke for reporting)
- * Hopefully fixed the nasty bug that caused Miranda to lockup on exit.
-
-0.0.0.20 - * Split service and options in two new cpp file.
- * Put the default attemps number to 10
-
-0.0.0.19 - * Add avatar support for own user only (no api to ge contacts avatar)
- * Add set status message.
- * Add Get status message for contact where viewing contact details
- * Change icons (thanks to Faith Healer)
- * Updater support (BETA ONLY)
- * DBeEditor known module support
- * Mods to avoid warning in VC++ 8
- * Implement the MyDetail requested services
-
-0.0.0.18 - * HOTFIX - Double File-Transfer icon removed. Please note that you can't send files
- via drag & drop, because of the nature of Skype API - Skype wants to open its own
- "File/Open" dialog, so I cannot supply a path to the file to be sent, therefore I
- had to add a seperate File-sending function rather than using Miranda's function.
-
-0.0.0.17 - * Startup of Skype in a seperate thread was not solved properly. Now it should really
- start in background
- * The hack for the statusmode-bug is optional in the settings and is turned off
- per default. (Thx to Eddie Hung for reporting problems and help)
- * Added an ugly hack for the Skype-API offline bug (grr.. )
- * Nickname is now set correctly. To cleanup the existing Nicks, please go to
- the options page an push the "Cleanup Nicknames" button.
- This will clean out entries where the Nick was set to the Skype handle
- * Fixed a bug in the message sending routine that caused errors in communication
- (missed messages in Skype that were not fetched..)
- * Added "Hold call" feature while calling
- * Added support for conference calls (if a second user is calling while you
- are in a conversation, you can now choose whether to block the call or let
- the user join you in a conference with the existing caller or to put the
- other caller on hold)
- * Fixed a bug in the code for adding users that were just searched via the
- Skype search-window but never have been in contact list.
- * Fixed some bugs (memleak, nick error, ..) in the Search-Routine for
- Skype-contacts. (thx to Deadman for reporting)
- * Fixed a bug with unknown SKYPE_IN contacts
- * Added file-sending capability (requires new Skype-version)
- * Did a litte code-cleanup
- * Adding / Removing contacts can now be done via the Miranda standard-dialogs if
- you use the newest Skype-Version
- * With the new Skype-version you are able to handle Authorisation-Requests via Miranda
- now.
-
-0.0.0.16 - * Fixed a severe memory-allocation bug in utf8-encoded messages that caused random
- crashes (oops :-O) - Thanks to Ary Dvoretz for reporting.
- * Bug in SkypeStatusMode-Bug fix from last release fixed (protocol stayed offline)
- * Now onlinestatus for SkypeOut-Contacts is configurable
- * Made Menu-Options translatable
- * Added support for calling SkypeOut-Phonenumbers. You can now dial a PSTN-Number
- by calling "Do a SkypeOut call" in the main menu (or top toolbar if the
- toptoolbar plugin is installed) and entering a number or
- by right-clicking on a non-Skype contact and selecting "Call using SkypeOut",
- if there is a phone-Number entry in the User's-Details.
- This, of course, is only working if you have SkypeOut privilege
-
-0.0.0.15 - * Fixed a crash on Miranda-exit when error occured on Skype-Protocol start
- * Fixed Bug #0000006: Now user is asked if he wants to enable the Protocol
- for the current profile, if he starts with a new profile.
- * Fixed Bug #0000002: Now interfacing with Skype is really stopped on going
- offline if the option is enabled. (PingPong-thread killed)
- - This also applies on closing Skype
- * Fixed a memory leak in MsgFetchThread that appeared in the last version because
- of the groupchat-implementation (free() within wrong if clause, ooops ;)
- * Fixed Bug #0000005: When there is a msg from a user that is not on Skype's contact
- list, the user is now added PALF_TEMPORARY and disappears again on next Miranda-start
- * Implemented a fix for Skype API's statusmode bug reported by Markus Mützel:
- If you change the online status while Skype is still connecting, Skype changes to
- the FIRST state that it was requested to change to, after going online, instead of
- the LAST state. However the bug was not reproducable for me.
- * Fixed broken popup-support (I hope)
- * CHANGE of behaviour (inspired by Bug #0000007):
- If you turn off "Start Skype with Miranda", the plugin wouldn't search for a
- running Skype instance anymore.
- * Now when going online and Skype is not launched, Skype will be launched via a
- seperate thread (in background) so that Miranda isn't blocked while Skype is loading
- * Options Dlg. should now be translateable too.
-
-0.0.0.14 -
- * Miranda crash on exit if Skype was not found installed should be
- fixed by now.
- * Implemented compatibility layer for Skype API Protocol V3 and above.
- * Removed some useless code introduced in 0.0.0.12
- * Added some fixes made by TioDuke (thank you!)
- - Using your own Nick instead of your Skype-Handle in conversations
- - LastName 3rd token & above are not ignored any more
- - Status modes "On the phone" and "out to lunch" are mapped now
- * Fixed a bug that caused "Skype API not available" messages under high load.
- (thanks to Romeo28 for testing!)
- * Fixed a bug that caused Message sending thread to wait forever if sending
- a message times out (causing dead threads)
- * Skype contact list should be synced now when Skype-Status changes.
- (thx to Markus Mützel for Bugreport)
- * Implemented a garbage collector that removes old messages from queue
- in order to prevent possible memory exhaustion
- * Added option to disable all modal Error-message dialog boxes (as people
- keep telling me that they are annoyed by them)
- * Added langpack support for error messages
- * Added option to increase the time the protocol is waiting for Skype
- * Added groupchat functions. WARNING: For testing purposes only!
- Currently there is a memleak which I cannot find, but even worse,
- Skype API doesn't seem to support sending to a groupchat, inviting etc.
- So this is currently only experimental! When you send to a groupchat you
- currently send single messages to every user seperately. Skype staff
- didn't answer my question about sending to groupchats so far, so it
- depends on them when this feature will be available for real use.
-
-0.0.0.13 - A few minor fixes:
- * Logging off users shouldn't flood the StatusNotify-Plugin now.
- * Popup-plugin can be enabled/disabled in the options dlg.
- * Implemented support for SkypeOut contacts (they caused crashes)
- * Now using Nick instead of Skype-Handle as Contact list name on
- adding new users, if it is available.
-
-0.0.0.12 - Bugfixing because of strange Skype API behaviour:
- * Adding of contacts that are just searched, but not added in Skype
- should be prevented now.
- * Version number correct again.
-
-0.0.0.11 - Only minor bugfixes:
- * The gender in user-details is now saved correctly to the DB
- (thanks to LeON for the hint!)
- * The Apply-Button should now be disabled in the options DLG by default
- (thanks to sje for the bug report)
- * Contactlist should be reinitialized after a SYNC-Problem now.
- * Bug with usernames that contain commas should be fixed
- * Protocol messages are now shown as popups if Popup-plugin is installed
-
-0.0.0.10 - * Hopefully recovery after sync problem works a bit better now
- (Sync-Problem Messages are no longer shown)
- * Now you can hang up a call directly from a contact's context menu
- * Now implemented support for using Skype over a network. You can use
- the included skypeproxy service to in/output Skype API messages
- on a socket and can connect to it with the plugin.
- So you can, for example, launch the skypeproxy service on your
- Windows-server (eeek! :P) and control Skype from your workstation
- using Miranda. (requested feature by foosmate)
- * Now you can accept incoming calls via Miranda (or hang them up)
- * The status mode bug (clist status menu was not updated properly)
- should be fixed by now.
- * The logfile in the dbeug-build should now always be written to the
- Miranda directory.
-
-0.0.0.9 - * Fixed bug with error when starting Skype with Miranda ("Wheee...")
- * As Skype seems to use new, UNDOCUMENTED Message types (I think it's
- a severe Skype-API bug) I adapted the plugin so that it works
- with new API now. This fixes the problem of not being able to receive
- messages in new Skype versions.
- Skype now sends "MESSAGE TYPE SAID" instead of "MESSAGE TYPE TEXT",
- the bug has been reported to Skype forum.
- (http://forum.skype.com/viewtopic.php?t=15435)
- * Fixed a memory leak in Message-receiving routine
- * Added UTF8-support for Contact properties (does this fix something?)
- * Fixed a memory leak in Startup-routine
- * Finally renamed Plugin from SKYPE_PROTOCOL to SKYPE internally.
- Hopefully it will upgrade your existing DB seamlessly.
- * Now all threads should be sync with Miranda as I'm using the pthread-
- functions "borrowed" from Yahoo protocol.
-
-0.0.0.8 - * Now there is support for the "Occupied" mode, which is mapped to DND
- This is useful for users who do a global statusmodechange so that Skype
- gets to "Occupied" state instead of staying online.
- * Now the protocol doesn't disable itself when you chose to not start
- Skype on startup, instead it stays offline and starts Skype when you
- try to go online.
-
-0.0.0.7 - * Fixed a bug that caused a lockup on Plugin startup (when a Window was not
- reacting to the HWND_BROADCAST) (thx to Cool Blue)
- * Fixed a bug in the Startup-procedure..
- * Now Skype doesn't go offline when you close Miranda (thx to Egodust)
- * Now it should really work unter WIN98 (thx to TioDuke for testing)
- * Implemented feature for Shutting down Skype on going offline and
- restarting Skype on changing to online mode again, as many people requested.
-
-0.0.0.6 - * Added feature requests from kreisquadratur:
- * Option to disable Skype-Menuitems
- * Fixed bug with Apply-Button
- * Using a nicer Skype-Icon now
- * Now using Skype-Timestamp for messages
- * Implementing importing history from skype (see contextmenu of contact)
- * Fixed bug with processing first message of MESSAGES - List
- * Found out, that RegisterClass() doesn't work for UNICODE-Programs on
- non-UNICODE win98, therefore return-value check for RegisterClass removed
- * Fixed a bug that caused a "We got a Sync problem :("
-
-0.0.0.5 - * Fixed a bug that caused the plugin to crash with bigger contact lists
- (Skype API was flooded on startup)
-
-0.0.0.4 - * Missed messages are fetched now
- * User details work now
- * More verbose error msgs now (to help Win98 user debugging his problem)
- * Added option for starting skype with miranda and shutting down
- Skype when closing miranda.
- * You can now chose the command line options to pass to Skype on startup
- * Hopefully the bug with multiple Call - Entries per user is fixed now
- * Protocol name is now "Skype", not "Skype_protocol" - Remember this
- when updating, so DELETE skype_protocol.dll first!!
- * Secured Message Queue with a Mutex
- * Fixed a Message-receiving bug that could cause delays in message-processing
- * Adding a Contact in Skype now also adds it to Miranda immediately
- (Deleting should also work, but doesn't because of a Skype API bug)
- * Added searching for contacts, but this feature seems to be quite useless,
- as Skype API doesn't support adding contacts, so you still have to add
- your contacts in the Skype program, sorry
- In order to do this comfortably, I added a Miranda Menu-Item for adding
- Skype-contacts.
-
-0.0.0.3 - * I hope it's thread-safe now
- * Changing the Online-Status should work correctly now
- * Fixed "We got a sync problem :(" bug - big thx to Azzie
- * Now starts Skype more in the background as proposed by Kreisquadratur
- * Implemented PING-PONG with Skype to detect if Connection to Skype API
- was lost
- * Launching of Skype by Miranda improved
diff --git a/protocols/Skype/contacts.c b/protocols/Skype/contacts.c
deleted file mode 100644
index c83d3294a1..0000000000
--- a/protocols/Skype/contacts.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Contactlist management functions
- */
-
-#include "skype.h"
-#include "skypeapi.h"
-#include "debug.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "voiceservice.h"
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include "../../include/m_langpack.h"
-#pragma warning (pop)
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-// Imported Globals
-extern HINSTANCE hInst;
-extern BOOL bSkypeOut, bIsImoproxy;
-extern char protocol, g_szProtoName[];
-
-// Handles
-static HANDLE hMenuCallItem, hMenuCallHangup, hMenuSkypeOutCallItem, hMenuHoldCallItem, hMenuFileTransferItem, hMenuChatInitItem;
-
-// Check if alpha blending icons are supported
-// Seems to be not neccessary
-/*
-BOOL SupportAlphaIcons(void) {
- HANDLE hMod;
- DLLVERSIONINFO tDVI={0};
- BOOL retval=FALSE;
- FARPROC pDllGetVersion;
-
- if (!(hMod=LoadLibrary("comctl32.dll"))) return FALSE;
- if (pDllGetVersion=GetProcAddress(hMod, "DllGetVersion")) {
- tDVI.cbSize=sizeof(tDVI);
- if (!pDllGetVersion ((DLLVERSIONINFO *)&tDVI)) {
- if (GetDeviceCaps(GetDC(NULL), BITSPIXEL)*GetDeviceCaps(GetDC(NULL), PLANES)>=32 &&
- tDVI.dwMajorVersion>=6)
- retval=TRUE;
- }
- }
- FreeLibrary(hMod);
- return retval;
-}
-*/
-
-CLISTMENUITEM CallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Call (Skype)");
- mi.pszService=SKYPE_CALL;
-
- return mi;
-}
-
-CLISTMENUITEM SkypeOutCallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.ptszName=LPGENT("Call using SkypeOut");
- mi.pszService=SKYPEOUT_CALL;
-
- return mi;
-}
-
-CLISTMENUITEM HupItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HANGUP));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Hang up call (Skype)");
- mi.pszService=SKYPE_CALLHANGUP;
-
- return mi;
-}
-
-CLISTMENUITEM SkypeOutHupItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HANGUP));
- mi.ptszName=LPGENT("Hang up SkypeOut call");
- mi.pszService=SKYPEOUT_CALL;
- return mi;
-}
-
-CLISTMENUITEM HoldCallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HOLD));
- mi.ptszName=LPGENT("Hold call");
- mi.pszService=SKYPE_HOLDCALL;
- return mi;
-}
-
-CLISTMENUITEM ResumeCallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_RESUME));
- mi.ptszName=LPGENT("Resume call");
- mi.pszService=SKYPE_HOLDCALL;
- return mi;
-}
-
-CLISTMENUITEM FileTransferItem(void) {
- CLISTMENUITEM mi={0};
-
- // Stolen from file.c of Miranda core
- mi.cbSize=sizeof(mi);
- mi.position=-2000020000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadSkinnedIcon(SKINICON_EVENT_FILE);
- mi.ptszName=LPGENT("&File");
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszService=SKYPE_SENDFILE;
- return mi;
-}
-
-CLISTMENUITEM ChatInitItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000020000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon( hInst, MAKEINTRESOURCE( IDI_INVITE ));
- mi.ptszName=LPGENT("&Open groupchat");
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszService=SKYPE_CHATNEW;
- return mi;
-}
-
-HANDLE add_contextmenu(HANDLE hContact) {
- CLISTMENUITEM mi;
-
- UNREFERENCED_PARAMETER(hContact);
-
- if (!HasVoiceService()) {
- mi=CallItem();
- hMenuCallItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
- mi=HupItem();
- hMenuCallHangup=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
- }
-
- mi=SkypeOutCallItem();
- hMenuSkypeOutCallItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
-
- if (!HasVoiceService()) {
- mi=HoldCallItem();
- hMenuHoldCallItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
- }
-
- // We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
- // sendfile-Dialog.
- mi=FileTransferItem();
- hMenuFileTransferItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
-
- mi=ChatInitItem();
- hMenuChatInitItem=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
-
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_IMPORT));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Import Skype history");
- mi.pszService=SKYPE_IMPORTHISTORY;
- return (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,(LPARAM)&mi);
-}
-
-HANDLE add_mainmenu(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ADD));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Add Skype contact");
- mi.pszService=SKYPE_ADDUSER;
- return (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)NULL,(LPARAM)&mi);
-
-}
-
-int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- CLISTMENUITEM mi;
- char *szProto;
- BOOL callAvailable = FALSE;
- BOOL hangupAvailable = FALSE;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!(szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0))) return 0;
-
- if (!HasVoiceService()) {
- // Clear hold-Item in case it exists
- mi=HoldCallItem();
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi);
- }
-
- if (!strcmp(szProto, SKYPE_PROTONAME)) {
- if (!HasVoiceService()) {
- if (!DBGetContactSetting((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "OnHold", 0))
- mi=ResumeCallItem(); else mi=HoldCallItem();
- mi.flags=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi);
-
- callAvailable = FALSE;
- hangupAvailable = TRUE;
-
- DBFreeVariant(&dbv);
- } else { callAvailable = TRUE; hangupAvailable = FALSE; }
-
- if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)!=0) {
- callAvailable = FALSE;
- hangupAvailable = FALSE;
- }
-
- mi = CallItem();
- mi.flags |= CMIM_ALL | (!callAvailable?CMIF_HIDDEN:0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem,(LPARAM)&mi);
-
- mi = HupItem();
- mi.flags |= CMIM_ALL | (!hangupAvailable?CMIF_HIDDEN:0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup,(LPARAM)&mi);
- }
-
- // Clear SkypeOut menu in case it exists
- mi=SkypeOutCallItem();
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi);
-
- // File sending and groupchat-creation works starting with protocol version 5
- if (protocol>=5) {
- mi=FileTransferItem();
- if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- mi.flags ^= CMIF_HIDDEN;
- mi.flags |= CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuFileTransferItem,(LPARAM)&mi);
-
- mi=ChatInitItem();
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- mi.flags ^= CMIF_HIDDEN;
- mi.flags |= CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem,(LPARAM)&mi);
- }
-
- } else if (bSkypeOut) {
- if (!DBGetContactSetting((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- mi=SkypeOutHupItem();
- DBFreeVariant(&dbv);
- } else {
- mi=SkypeOutCallItem();
- if(!DBGetContactSetting((HANDLE)wParam,"UserInfo","MyPhone0",&dbv)) {
- DBFreeVariant(&dbv);
- mi.flags=0;
- }
- }
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi);
- }
-
- return 0;
-}
-
-/*
-int ClistDblClick(WPARAM wParam, LPARAM lParam) {
- char *szProto;
-
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- DBGetContactSettingWord((HANDLE)wParam, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_ONTHEPHONE) {
- SkypeCall(wParam, 0);
- }
-
- return 0;
-}
-*/
-
-HANDLE find_contact(char *name) {
- char *szProto;
- int tCompareResult;
- HANDLE hContact;
- DBVARIANT dbv;
-
- // already on list?
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = strcmp(dbv.pszVal, name);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-HANDLE find_contactT(TCHAR *name) {
- char *szProto;
- int tCompareResult;
- HANDLE hContact;
- DBVARIANT dbv;
-
- // already on list?
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- {
- if (DBGetContactSettingTString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = _tcscmp(dbv.ptszVal, name);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-
-
-HANDLE add_contact(char *name, DWORD flags) {
- HANDLE hContact;
-
- // already on list?
- if (hContact=find_contact(name)) {
- if (!(flags & PALF_TEMPORARY) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 1)) {
- DBDeleteContactSetting( hContact, "CList", "NotOnList" );
- DBDeleteContactSetting( hContact, "CList", "Hidden" );
- }
- LOG(("add_contact: Found %s", name));
- return hContact; // already there, return handle
- }
- // no, so add
-
- LOG(("add_contact: Adding %s", name));
- hContact=(HANDLE)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0);
- if (hContact) {
- if (CallServiceSync(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)SKYPE_PROTONAME)!=0) {
- LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason"));
- CallServiceSync(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- return NULL;
- }
- if (name[0]) DBWriteContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, name);
-
- if (flags & PALF_TEMPORARY ) {
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
- }
- if (name[0]) {
- SkypeSend("GET USER %s DISPLAYNAME", name);
- } else {LOG(("add_contact: Info: The contact added has no name."));}
- } else {LOG(("add_contact: Ouch! MS_DB_CONTACT_ADD failed for some reason"));}
- LOG(("add_contact succeeded"));
- return hContact;
-}
-
-void logoff_contacts(BOOL bCleanup) {
- HANDLE hContact;
- char *szProto;
- DBVARIANT dbv={0};
-
- LOG(("logoff_contacts: Logging off contacts."));
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME))
- {
- if (DBGetContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE);
-
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "CallId");
- if (DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
- {
- if (DBGetContactSettingTString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue;
- RemChat (dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv) == 0)
- {
- if (bCleanup) SkypeSend ("ALTER APPLICATION libpurple_typing DISCONNECT %s", dbv.pszVal);
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "Typing_Stream");
- }
-
- }
- }
- if (bCleanup && (protocol>=5 || bIsImoproxy)) SkypeSend ("DELETE APPLICATION libpurple_typing");
-}
diff --git a/protocols/Skype/contacts.h b/protocols/Skype/contacts.h
deleted file mode 100644
index 35a400c3e9..0000000000
--- a/protocols/Skype/contacts.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// Prototypes
-HANDLE add_contextmenu(HANDLE hContact);
-HANDLE find_contact(char *name);
-HANDLE find_contactT(TCHAR *name);
-HANDLE add_contact(char *name, DWORD flags);
-HANDLE add_mainmenu(void);
-CLISTMENUITEM HupItem(void);
-CLISTMENUITEM CallItem(void);
-void logoff_contacts(BOOL bCleanup);
-int PrebuildContactMenu(WPARAM, LPARAM);
-//int ClistDblClick(WPARAM, LPARAM); \ No newline at end of file
diff --git a/protocols/Skype/debug.c b/protocols/Skype/debug.c
deleted file mode 100644
index a1267d8d8a..0000000000
--- a/protocols/Skype/debug.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _DEBUG
-#pragma warning (disable: 4206) // nonstandard extension used : translation unit is empty
-#else
-#include "debug.h"
-
-#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <stdio.h>
-//#include <time.h>
-#include "skype.h"
-#include <string.h>
-#include <stdlib.h>
-
-#define INITBUF 1024 /* Initial size of buffer */
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-extern char g_szProtoName[];
-
-static CRITICAL_SECTION m_WriteFileMutex;
-static FILE *m_fpLogFile = INVALID_HANDLE_VALUE;
-static char *m_szLogBuf = NULL;
-static DWORD m_iBufSize = 0;
-
-void init_debug(void) {
- char *p;
- char logfile[MAX_PATH];
-
- ZeroMemory(logfile, sizeof(logfile));
- p=logfile+GetModuleFileNameA(NULL, logfile, sizeof(logfile));
- if (!(p=strrchr (logfile, '\\'))) p=logfile; else p++;
- sprintf (p, "%s_log.txt", SKYPE_PROTONAME);
- m_szLogBuf = calloc (1, (m_iBufSize = INITBUF));
- m_fpLogFile = fopen(logfile, "a");
- InitializeCriticalSection(&m_WriteFileMutex);
-}
-
-void end_debug (void) {
- if (m_szLogBuf) free (m_szLogBuf);
- if (m_fpLogFile) fclose (m_fpLogFile);
- DeleteCriticalSection(&m_WriteFileMutex);
-}
-
-void do_log(const char *pszFormat, ...) {
- char *ct, *pNewBuf;
- va_list ap;
- time_t lt;
- int iLen;
-
- if (!m_szLogBuf || !m_fpLogFile) return;
- EnterCriticalSection(&m_WriteFileMutex);
- time(&lt);
- ct=ctime(&lt);
- ct[strlen(ct)-1]=0;
- do
- {
- va_start(ap, pszFormat);
- iLen = _vsnprintf(m_szLogBuf, m_iBufSize, pszFormat, ap);
- va_end(ap);
- if (iLen == -1)
- {
- if (!(pNewBuf = (char*)realloc (m_szLogBuf, m_iBufSize*2)))
- {
- iLen = strlen (m_szLogBuf);
- break;
- }
- m_szLogBuf = pNewBuf;
- m_iBufSize*=2;
- }
- } while (iLen == -1);
- fprintf (m_fpLogFile, sizeof(time_t) == sizeof(int) ? "%s (%ld) [%08X] %s\n" : "%s (%lld) [%08X] %s\n", ct, lt, GetCurrentThreadId(), m_szLogBuf);
- fflush (m_fpLogFile);
- LeaveCriticalSection(&m_WriteFileMutex);
-}
-#endif \ No newline at end of file
diff --git a/protocols/Skype/debug.h b/protocols/Skype/debug.h
deleted file mode 100644
index 9582246251..0000000000
--- a/protocols/Skype/debug.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//#define DEBUG_RELEASE 1
-
-#ifdef DEBUG_RELEASE
- #define _DEBUG 1
-#endif
-
-#ifdef _DEBUG
- void init_debug(void);
- void end_debug (void);
- void do_log(const char *pszFormat, ...);
- #define DEBUG_OUT(a) OUTPUT(a)
- #define TRACE(a) OutputDebugString(a)
- #define TRACEA(a) OutputDebugStringA(a)
- #define TRACEW(a) OutputDebugStringW(a)
- #define LOG(a) do_log a
-#else
- #define DEBUG_OUT(a)
- #define LOG(a)
- #define TRACE(a)
- #define TRACEA(a)
- #define TRACEW(a)
-#endif
-
diff --git a/protocols/Skype/deploy.bat b/protocols/Skype/deploy.bat
deleted file mode 100644
index eee9e164d1..0000000000
--- a/protocols/Skype/deploy.bat
+++ /dev/null
@@ -1,15 +0,0 @@
-@echo off
-set PATH=%PATH%;C:\Programme\WinRAR
-echo Deploying..
-winrar a -apPlugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol.zip Release\skype.dll
-rem There is no ANSI x64 Build
-rem winrar a -apPlugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_x64.zip Release64\skype.dll
-winrar a -apPlugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_unicode.zip Release-UNICODE\skype.dll
-winrar a -apPlugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_unicode_x64.zip Release64-UNICODE\skype.dll
-
-winrar a -apDebug -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug\skype.pdb
-winrar a -apDebug\Plugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug\skype.dll
-winrar a -apDebug64-UNICODE -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug64-UNICODE\skype.pdb
-winrar a -apDebug64-UNICODE\Plugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug64-UNICODE\skype.dll
-winrar a -apDebug-UNICODE -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug-UNICODE\skype.pdb
-winrar a -apDebug-UNICODE\Plugins -ep1 \\linux01\leecher\webserver\Skype\Skype_protocol_debug.zip Debug-UNICODE\skype.dll
diff --git a/protocols/Skype/ezxml/ezxml.c b/protocols/Skype/ezxml/ezxml.c
deleted file mode 100644
index 24c02fbd70..0000000000
--- a/protocols/Skype/ezxml/ezxml.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/* ezxml.c
- *
- * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if defined(WIN32) || defined(_WIN32)
-#include <io.h>
-#ifndef EZXML_NOMMAP
-#define EZXML_NOMMAP
-#endif
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#if !defined(WIN32) && !defined(_WIN32)
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#ifndef EZXML_NOMMAP
-#include <sys/mman.h>
-#endif // EZXML_NOMMAP
-#include <sys/stat.h>
-#include "ezxml.h"
-
-#if defined(WIN32) || defined(_WIN32)
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
-#define open _open
-#define read _read
-#define write _write
-#define close _close
-#endif
-
-#define EZXML_WS "\t\r\n " // whitespace
-#define EZXML_ERRL 128 // maximum error string length
-
-typedef struct ezxml_root *ezxml_root_t;
-struct ezxml_root { // additional data for the root tag
- struct ezxml xml; // is a super-struct built on top of ezxml struct
- ezxml_t cur; // current xml tree insertion point
- char *m; // original xml string
- size_t len; // length of allocated memory for mmap, -1 for malloc
- char *u; // UTF-8 conversion of string if original was UTF-16
- char *s; // start of work area
- char *e; // end of work area
- char **ent; // general entities (ampersand sequences)
- char ***attr; // default attributes
- char ***pi; // processing instructions
- short standalone; // non-zero if <?xml standalone="yes"?>
- char err[EZXML_ERRL]; // error string
-};
-
-char *EZXML_NIL[] = { NULL }; // empty, null terminated array of strings
-
-// returns the first child tag with the given name or NULL if not found
-ezxml_t ezxml_child(ezxml_t xml, const char *name)
-{
- xml = (xml) ? xml->child : NULL;
- while (xml && strcmp(name, xml->name)) xml = xml->sibling;
- return xml;
-}
-
-// returns the Nth tag with the same name in the same subsection or NULL if not
-// found
-ezxml_t ezxml_idx(ezxml_t xml, int idx)
-{
- for (; xml && idx; idx--) xml = xml->next;
- return xml;
-}
-
-// returns the value of the requested tag attribute or NULL if not found
-const char *ezxml_attr(ezxml_t xml, const char *attr)
-{
- int i = 0, j = 1;
- ezxml_root_t root = (ezxml_root_t)xml;
-
- if (! xml || ! xml->attr) return NULL;
- while (xml->attr[i] && strcmp(attr, xml->attr[i])) i += 2;
- if (xml->attr[i]) return xml->attr[i + 1]; // found attribute
-
- while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
- for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++);
- if (! root->attr[i]) return NULL; // no matching default attributes
- while (root->attr[i][j] && strcmp(attr, root->attr[i][j])) j += 3;
- return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL; // found default
-}
-
-// same as ezxml_get but takes an already initialized va_list
-ezxml_t ezxml_vget(ezxml_t xml, va_list ap)
-{
- char *name = va_arg(ap, char *);
- int idx = -1;
-
- if (name && *name) {
- idx = va_arg(ap, int);
- xml = ezxml_child(xml, name);
- }
- return (idx < 0) ? xml : ezxml_vget(ezxml_idx(xml, idx), ap);
-}
-
-// Traverses the xml tree to retrieve a specific subtag. Takes a variable
-// length list of tag names and indexes. The argument list must be terminated
-// by either an index of -1 or an empty string tag name. Example:
-// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
-// This retrieves the title of the 3rd book on the 1st shelf of library.
-// Returns NULL if not found.
-ezxml_t ezxml_get(ezxml_t xml, ...)
-{
- va_list ap;
- ezxml_t r;
-
- va_start(ap, xml);
- r = ezxml_vget(xml, ap);
- va_end(ap);
- return r;
-}
-
-// returns a null terminated array of processing instructions for the given
-// target
-const char **ezxml_pi(ezxml_t xml, const char *target)
-{
- ezxml_root_t root = (ezxml_root_t)xml;
- int i = 0;
-
- if (! root) return (const char **)EZXML_NIL;
- while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
- while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target
- return (const char **)((root->pi[i]) ? root->pi[i] + 1 : EZXML_NIL);
-}
-
-// set an error string and return root
-ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...)
-{
- va_list ap;
- int line = 1;
- char *t, fmt[EZXML_ERRL];
-
- for (t = root->s; t < s; t++) if (*t == '\n') line++;
- snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
-
- va_start(ap, err);
- vsnprintf(root->err, EZXML_ERRL, fmt, ap);
- va_end(ap);
-
- return &root->xml;
-}
-
-// Recursively decodes entity and character references and normalizes new lines
-// ent is a null terminated array of alternating entity names and values. set t
-// to '&' for general entity decoding, '%' for parameter entity decoding, 'c'
-// for cdata sections, ' ' for attribute normalization, or '*' for non-cdata
-// attribute normalization. Returns s, or if the decoded string is longer than
-// s, returns a malloced string that must be freed.
-char *ezxml_decode(char *s, char **ent, char t)
-{
- char *e, *r = s, *m = s;
- long b, c, d, l;
-
- for (; *s; s++) { // normalize line endings
- while (*s == '\r') {
- *(s++) = '\n';
- if (*s == '\n') memmove(s, (s + 1), strlen(s));
- }
- }
-
- for (s = r; ; ) {
- while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s)) s++;
-
- if (! *s) break;
- else if (t != 'c' && ! strncmp(s, "&#", 2)) { // character reference
- if (s[2] == 'x') c = strtol(s + 3, &e, 16); // base 16
- else c = strtol(s + 2, &e, 10); // base 10
- if (! c || *e != ';') { s++; continue; } // not a character ref
-
- if (c < 0x80) *(s++) = c; // US-ASCII subset
- else { // multi-byte UTF-8 sequence
- for (b = 0, d = c; d; d /= 2) b++; // number of bits in c
- b = (b - 2) / 5; // number of bytes in payload
- *(s++) = (0xFF << (7 - b)) | (c >> (6 * b)); // head
- while (b) *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
- }
-
- memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';')));
- }
- else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) ||
- (*s == '%' && t == '%')) { // entity reference
- for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b]));
- b += 2); // find entity in entity list
-
- if (ent[b++]) { // found a match
- if ((c = strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
- l = (d = (s - r)) + c + strlen(e); // new length
- r = (r == m) ? strcpy(malloc(l), r) : realloc(r, l);
- e = strchr((s = r + d), ';'); // fix up pointers
- }
-
- memmove(s + c, e + 1, strlen(e)); // shift rest of string
- strncpy(s, ent[b], c); // copy in replacement text
- }
- else s++; // not a known entity
- }
- else if ((t == ' ' || t == '*') && isspace(*s)) *(s++) = ' ';
- else s++; // no decoding needed
- }
-
- if (t == '*') { // normalize spaces for non-cdata attributes
- for (s = r; *s; s++) {
- if ((l = strspn(s, " "))) memmove(s, s + l, strlen(s + l) + 1);
- while (*s && *s != ' ') s++;
- }
- if (--s >= r && *s == ' ') *s = '\0'; // trim any trailing space
- }
- return r;
-}
-
-// called when parser finds start of new tag
-void ezxml_open_tag(ezxml_root_t root, char *name, char **attr)
-{
- ezxml_t xml = root->cur;
-
- if (xml->name) xml = ezxml_add_child(xml, name, strlen(xml->txt));
- else xml->name = name; // first open tag
-
- xml->attr = attr;
- root->cur = xml; // update tag insertion point
-}
-
-// called when parser finds character content between open and closing tag
-void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t)
-{
- ezxml_t xml = root->cur;
- char *m = s;
- size_t l;
-
- if (! xml || ! xml->name || ! len) return; // sanity check
-
- s[len] = '\0'; // null terminate text (calling functions anticipate this)
- len = strlen(s = ezxml_decode(s, root->ent, t)) + 1;
-
- if (! *(xml->txt)) xml->txt = s; // initial character content
- else { // allocate our own memory and make a copy
- xml->txt = (xml->flags & EZXML_TXTM) // allocate some space
- ? realloc(xml->txt, (l = strlen(xml->txt)) + len)
- : strcpy(malloc((l = strlen(xml->txt)) + len), xml->txt);
- strcpy(xml->txt + l, s); // add new char content
- if (s != m) free(s); // free s if it was malloced by ezxml_decode()
- }
-
- if (xml->txt != m) ezxml_set_flag(xml, EZXML_TXTM);
-}
-
-// called when parser finds closing tag
-ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s)
-{
- if (! root->cur || ! root->cur->name || strcmp(name, root->cur->name))
- return ezxml_err(root, s, "unexpected closing tag </%s>", name);
-
- root->cur = root->cur->parent;
- return NULL;
-}
-
-// checks for circular entity references, returns non-zero if no circular
-// references are found, zero otherwise
-int ezxml_ent_ok(char *name, char *s, char **ent)
-{
- int i;
-
- for (; ; s++) {
- while (*s && *s != '&') s++; // find next entity reference
- if (! *s) return 1;
- if (! strncmp(s + 1, name, strlen(name))) return 0; // circular ref.
- for (i = 0; ent[i] && strncmp(ent[i], s + 1, strlen(ent[i])); i += 2);
- if (ent[i] && ! ezxml_ent_ok(name, ent[i + 1], ent)) return 0;
- }
-}
-
-// called when the parser finds a processing instruction
-void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len)
-{
- int i = 0, j = 1;
- char *target = s;
-
- s[len] = '\0'; // null terminate instruction
- if (*(s += strcspn(s, EZXML_WS))) {
- *s = '\0'; // null terminate target
- s += strspn(s + 1, EZXML_WS) + 1; // skip whitespace after target
- }
-
- if (! strcmp(target, "xml")) { // <?xml ... ?>
- if ((s = strstr(s, "standalone")) && ! strncmp(s + strspn(s + 10,
- EZXML_WS "='\"") + 10, "yes", 3)) root->standalone = 1;
- return;
- }
-
- if (! root->pi[0]) *(root->pi = malloc(sizeof(char **))) = NULL; //first pi
-
- while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target
- if (! root->pi[i]) { // new target
- root->pi = realloc(root->pi, sizeof(char **) * (i + 2));
- root->pi[i] = malloc(sizeof(char *) * 3);
- root->pi[i][0] = target;
- root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list
- root->pi[i][2] = strdup(""); // empty document position list
- }
-
- while (root->pi[i][j]) j++; // find end of instruction list for this target
- root->pi[i] = realloc(root->pi[i], sizeof(char *) * (j + 3));
- root->pi[i][j + 2] = realloc(root->pi[i][j + 1], j + 1);
- strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<");
- root->pi[i][j + 1] = NULL; // null terminate pi list for this target
- root->pi[i][j] = s; // set instruction
-}
-
-// called when the parser finds an internal doctype subset
-short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len)
-{
- char q, *c, *t, *n = NULL, *v, **ent, **pe;
- int i, j;
-
- pe = memcpy(malloc(sizeof(EZXML_NIL)), EZXML_NIL, sizeof(EZXML_NIL));
-
- for (s[len] = '\0'; s; ) {
- while (*s && *s != '<' && *s != '%') s++; // find next declaration
-
- if (! *s) break;
- else if (! strncmp(s, "<!ENTITY", 8)) { // parse entity definitions
- c = s += strspn(s + 8, EZXML_WS) + 8; // skip white space separator
- n = s + strspn(s, EZXML_WS "%"); // find name
- *(s = n + strcspn(n, EZXML_WS)) = ';'; // append ; to name
-
- v = s + strspn(s + 1, EZXML_WS) + 1; // find value
- if ((q = *(v++)) != '"' && q != '\'') { // skip externals
- s = strchr(s, '>');
- continue;
- }
-
- for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++);
- ent = realloc(ent, (i + 3) * sizeof(char *)); // space for next ent
- if (*c == '%') pe = ent;
- else root->ent = ent;
-
- *(++s) = '\0'; // null terminate name
- if ((s = strchr(v, q))) *(s++) = '\0'; // null terminate value
- ent[i + 1] = ezxml_decode(v, pe, '%'); // set value
- ent[i + 2] = NULL; // null terminate entity list
- if (! ezxml_ent_ok(n, ent[i + 1], ent)) { // circular reference
- if (ent[i + 1] != v) free(ent[i + 1]);
- ezxml_err(root, v, "circular entity declaration &%s", n);
- break;
- }
- else ent[i] = n; // set entity name
- }
- else if (! strncmp(s, "<!ATTLIST", 9)) { // parse default attributes
- t = s + strspn(s + 9, EZXML_WS) + 9; // skip whitespace separator
- if (! *t) { ezxml_err(root, t, "unclosed <!ATTLIST"); break; }
- if (*(s = t + strcspn(t, EZXML_WS ">")) == '>') continue;
- else *s = '\0'; // null terminate tag name
- for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++);
-
- while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') {
- if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; // attr name
- else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
-
- s += strspn(s + 1, EZXML_WS) + 1; // find next token
- c = (strncmp(s, "CDATA", 5)) ? "*" : " "; // is it cdata?
- if (! strncmp(s, "NOTATION", 8))
- s += strspn(s + 8, EZXML_WS) + 8;
- s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, EZXML_WS);
- if (! s) { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
-
- s += strspn(s, EZXML_WS ")"); // skip white space separator
- if (! strncmp(s, "#FIXED", 6))
- s += strspn(s + 6, EZXML_WS) + 6;
- if (*s == '#') { // no default value
- s += strcspn(s, EZXML_WS ">") - 1;
- if (*c == ' ') continue; // cdata is default, nothing to do
- v = NULL;
- }
- else if ((*s == '"' || *s == '\'') && // default value
- (s = strchr(v = s + 1, *s))) *s = '\0';
- else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
-
- if (! root->attr[i]) { // new tag name
- root->attr = (! i) ? malloc(2 * sizeof(char **))
- : realloc(root->attr,
- (i + 2) * sizeof(char **));
- root->attr[i] = malloc(2 * sizeof(char *));
- root->attr[i][0] = t; // set tag name
- root->attr[i][1] = (char *)(root->attr[i + 1] = NULL);
- }
-
- for (j = 1; root->attr[i][j]; j += 3); // find end of list
- root->attr[i] = realloc(root->attr[i],
- (j + 4) * sizeof(char *));
-
- root->attr[i][j + 3] = NULL; // null terminate list
- root->attr[i][j + 2] = c; // is it cdata?
- root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c)
- : NULL;
- root->attr[i][j] = n; // attribute name
- }
- }
- else if (! strncmp(s, "<!--", 4)) s = strstr(s + 4, "-->"); // comments
- else if (! strncmp(s, "<?", 2)) { // processing instructions
- if ((s = strstr(c = s + 2, "?>")))
- ezxml_proc_inst(root, c, s++ - c);
- }
- else if (*s == '<') s = strchr(s, '>'); // skip other declarations
- else if (*(s++) == '%' && ! root->standalone) break;
- }
-
- free(pe);
- return ! *root->err;
-}
-
-// Converts a UTF-16 string to UTF-8. Returns a new string that must be freed
-// or NULL if no conversion was needed.
-char *ezxml_str2utf8(char **s, size_t *len)
-{
- char *u;
- size_t l = 0, sl, max = *len;
- long c, d;
- int b, be = (**s == '\xFE') ? 1 : (**s == '\xFF') ? 0 : -1;
-
- if (be == -1) return NULL; // not UTF-16
-
- u = malloc(max);
- for (sl = 2; sl < *len - 1; sl += 2) {
- c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) //UTF-16BE
- : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF); //UTF-16LE
- if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) { // high-half
- d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)
- : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);
- c = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
- }
-
- while (l + 6 > max) u = realloc(u, max += EZXML_BUFSIZE);
- if (c < 0x80) u[l++] = c; // US-ASCII subset
- else { // multi-byte UTF-8 sequence
- for (b = 0, d = c; d; d /= 2) b++; // bits in c
- b = (b - 2) / 5; // bytes in payload
- u[l++] = (0xFF << (7 - b)) | (c >> (6 * b)); // head
- while (b) u[l++] = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
- }
- }
- return *s = realloc(u, *len = l);
-}
-
-// frees a tag attribute list
-void ezxml_free_attr(char **attr) {
- int i = 0;
- char *m;
-
- if (! attr || attr == EZXML_NIL) return; // nothing to free
- while (attr[i]) i += 2; // find end of attribute list
- m = attr[i + 1]; // list of which names and values are malloced
- for (i = 0; m[i]; i++) {
- if (m[i] & EZXML_NAMEM) free(attr[i * 2]);
- if (m[i] & EZXML_TXTM) free(attr[(i * 2) + 1]);
- }
- free(m);
- free(attr);
-}
-
-// parse the given xml string and return an ezxml structure
-ezxml_t ezxml_parse_str(char *s, size_t len)
-{
- ezxml_root_t root = (ezxml_root_t)ezxml_new(NULL);
- char q, e, *d, **attr, **a = NULL; // initialize a to avoid compile warning
- int l, i, j;
-
- root->m = s;
- if (! len) return ezxml_err(root, NULL, "root tag missing");
- root->u = ezxml_str2utf8(&s, &len); // convert utf-16 to utf-8
- root->e = (root->s = s) + len; // record start and end of work area
-
- e = s[len - 1]; // save end char
- s[len - 1] = '\0'; // turn end char into null terminator
-
- while (*s && *s != '<') s++; // find first tag
- if (! *s) return ezxml_err(root, s, "root tag missing");
-
- for (; ; ) {
- attr = (char **)EZXML_NIL;
- d = ++s;
-
- if (isalpha(*s) || *s == '_' || *s == ':' || *s < '\0') { // new tag
- if (! root->cur)
- return ezxml_err(root, d, "markup outside of root element");
-
- s += strcspn(s, EZXML_WS "/>");
- while (isspace(*s)) *(s++) = '\0'; // null terminate tag name
-
- if (*s && *s != '/' && *s != '>') // find tag in default attr list
- for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++);
-
- for (l = 0; *s && *s != '/' && *s != '>'; l += 2) { // new attrib
- attr = (l) ? realloc(attr, (l + 4) * sizeof(char *))
- : malloc(4 * sizeof(char *)); // allocate space
- attr[l + 3] = (l) ? realloc(attr[l + 1], (l / 2) + 2)
- : malloc(2); // mem for list of maloced vals
- strcpy(attr[l + 3] + (l / 2), " "); // value is not malloced
- attr[l + 2] = NULL; // null terminate list
- attr[l + 1] = ""; // temporary attribute value
- attr[l] = s; // set attribute name
-
- s += strcspn(s, EZXML_WS "=/>");
- if (*s == '=' || isspace(*s)) {
- *(s++) = '\0'; // null terminate tag attribute name
- q = *(s += strspn(s, EZXML_WS "="));
- if (q == '"' || q == '\'') { // attribute value
- attr[l + 1] = ++s;
- while (*s && *s != q) s++;
- if (*s) *(s++) = '\0'; // null terminate attribute val
- else {
- ezxml_free_attr(attr);
- return ezxml_err(root, d, "missing %c", q);
- }
-
- for (j = 1; a && a[j] && strcmp(a[j], attr[l]); j +=3);
- attr[l + 1] = ezxml_decode(attr[l + 1], root->ent, (a
- && a[j]) ? *a[j + 2] : ' ');
- if (attr[l + 1] < d || attr[l + 1] > s)
- attr[l + 3][l / 2] = EZXML_TXTM; // value malloced
- }
- }
- while (isspace(*s)) s++;
- }
-
- if (*s == '/') { // self closing tag
- *(s++) = '\0';
- if ((*s && *s != '>') || (! *s && e != '>')) {
- if (l) ezxml_free_attr(attr);
- return ezxml_err(root, d, "missing >");
- }
- ezxml_open_tag(root, d, attr);
- ezxml_close_tag(root, d, s);
- }
- else if ((q = *s) == '>' || (! *s && e == '>')) { // open tag
- *s = '\0'; // temporarily null terminate tag name
- ezxml_open_tag(root, d, attr);
- *s = q;
- }
- else {
- if (l) ezxml_free_attr(attr);
- return ezxml_err(root, d, "missing >");
- }
- }
- else if (*s == '/') { // close tag
- s += strcspn(d = s + 1, EZXML_WS ">") + 1;
- if (! (q = *s) && e != '>') return ezxml_err(root, d, "missing >");
- *s = '\0'; // temporarily null terminate tag name
- if (ezxml_close_tag(root, d, s)) return &root->xml;
- if (isspace(*s = q)) s += strspn(s, EZXML_WS);
- }
- else if (! strncmp(s, "!--", 3)) { // xml comment
- if (! (s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) ||
- (! *s && e != '>')) return ezxml_err(root, d, "unclosed <!--");
- }
- else if (! strncmp(s, "![CDATA[", 8)) { // cdata
- if ((s = strstr(s, "]]>")))
- ezxml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
- else return ezxml_err(root, d, "unclosed <![CDATA[");
- }
- else if (! strncmp(s, "!DOCTYPE", 8)) { // dtd
- for (l = 0; *s && ((! l && *s != '>') || (l && (*s != ']' ||
- *(s + strspn(s + 1, EZXML_WS) + 1) != '>')));
- l = (*s == '[') ? 1 : l) s += strcspn(s + 1, "[]>") + 1;
- if (! *s && e != '>')
- return ezxml_err(root, d, "unclosed <!DOCTYPE");
- d = (l) ? strchr(d, '[') + 1 : d;
- if (l && ! ezxml_internal_dtd(root, d, s++ - d)) return &root->xml;
- }
- else if (*s == '?') { // <?...?> processing instructions
- do { s = strchr(s, '?'); } while (s && *(++s) && *s != '>');
- if (! s || (! *s && e != '>'))
- return ezxml_err(root, d, "unclosed <?");
- else ezxml_proc_inst(root, d + 1, s - d - 2);
- }
- else return ezxml_err(root, d, "unexpected <");
-
- if (! s || ! *s) break;
- *s = '\0';
- d = ++s;
- if (*s && *s != '<') { // tag character content
- while (*s && *s != '<') s++;
- if (*s) ezxml_char_content(root, d, s - d, '&');
- else break;
- }
- else if (! *s) break;
- }
-
- if (! root->cur) return &root->xml;
- else if (! root->cur->name) return ezxml_err(root, d, "root tag missing");
- else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
-}
-
-// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
-// stream into memory and then parses it. For xml files, use ezxml_parse_file()
-// or ezxml_parse_fd()
-ezxml_t ezxml_parse_fp(FILE *fp)
-{
- ezxml_root_t root;
- size_t l, len = 0;
- char *s;
-
- if (! (s = malloc(EZXML_BUFSIZE))) return NULL;
- do {
- len += (l = fread((s + len), 1, EZXML_BUFSIZE, fp));
- if (l == EZXML_BUFSIZE) s = realloc(s, len + EZXML_BUFSIZE);
- } while (s && l == EZXML_BUFSIZE);
-
- if (! s) return NULL;
- root = (ezxml_root_t)ezxml_parse_str(s, len);
- root->len = -1; // so we know to free s in ezxml_free()
- return &root->xml;
-}
-
-// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
-// attempts to mem map the file. Failing that, reads the file into memory.
-// Returns NULL on failure.
-ezxml_t ezxml_parse_fd(int fd)
-{
- ezxml_root_t root;
- struct stat st;
- size_t l;
- void *m;
-
- if (fd < 0) return NULL;
- fstat(fd, &st);
-
-#ifndef EZXML_NOMMAP
- l = (st.st_size + sysconf(_SC_PAGESIZE) - 1) & ~(sysconf(_SC_PAGESIZE) -1);
- if ((m = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) !=
- MAP_FAILED) {
- madvise(m, l, MADV_SEQUENTIAL); // optimize for sequential access
- root = (ezxml_root_t)ezxml_parse_str(m, st.st_size);
- madvise(m, root->len = l, MADV_NORMAL); // put it back to normal
- }
- else { // mmap failed, read file into memory
-#endif // EZXML_NOMMAP
- l = read(fd, m = malloc(st.st_size), st.st_size);
- root = (ezxml_root_t)ezxml_parse_str(m, l);
- root->len = -1; // so we know to free s in ezxml_free()
-#ifndef EZXML_NOMMAP
- }
-#endif // EZXML_NOMMAP
- return &root->xml;
-}
-
-// a wrapper for ezxml_parse_fd that accepts a file name
-ezxml_t ezxml_parse_file(const char *file)
-{
- int fd = open(file, O_RDONLY, 0);
- ezxml_t xml = ezxml_parse_fd(fd);
-
- if (fd >= 0) close(fd);
- return xml;
-}
-
-// Encodes ampersand sequences appending the results to *dst, reallocating *dst
-// if length excedes max. a is non-zero for attribute encoding. Returns *dst
-char *ezxml_ampencode(const char *s, size_t len, char **dst, size_t *dlen,
- size_t *max, short a)
-{
- const char *e;
-
- for (e = s + len; s != e; s++) {
- while (*dlen + 10 > *max) *dst = realloc(*dst, *max += EZXML_BUFSIZE);
-
- switch (*s) {
- case '\0': return *dst;
- case '&': *dlen += sprintf(*dst + *dlen, "&amp;"); break;
- case '<': *dlen += sprintf(*dst + *dlen, "&lt;"); break;
- case '>': *dlen += sprintf(*dst + *dlen, "&gt;"); break;
- case '"': *dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\""); break;
- case '\n': *dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n"); break;
- case '\t': *dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t"); break;
- case '\r': *dlen += sprintf(*dst + *dlen, "&#xD;"); break;
- default: (*dst)[(*dlen)++] = *s;
- }
- }
- return *dst;
-}
-
-// Recursively converts each tag to xml appending it to *s. Reallocates *s if
-// its length excedes max. start is the location of the previous tag in the
-// parent tag's character content. Returns *s.
-char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
- size_t start, char ***attr)
-{
- int i, j;
- char *txt = (xml->parent) ? xml->parent->txt : "";
- size_t off = 0;
-
- // parent character content up to this tag
- *s = ezxml_ampencode(txt + start, xml->off - start, s, len, max, 0);
-
- while (*len + strlen(xml->name) + 4 > *max) // reallocate s
- *s = realloc(*s, *max += EZXML_BUFSIZE);
-
- *len += sprintf(*s + *len, "<%s", xml->name); // open tag
- for (i = 0; xml->attr[i]; i += 2) { // tag attributes
- if (ezxml_attr(xml, xml->attr[i]) != xml->attr[i + 1]) continue;
- while (*len + strlen(xml->attr[i]) + 7 > *max) // reallocate s
- *s = realloc(*s, *max += EZXML_BUFSIZE);
-
- *len += sprintf(*s + *len, " %s=\"", xml->attr[i]);
- ezxml_ampencode(xml->attr[i + 1], -1, s, len, max, 1);
- *len += sprintf(*s + *len, "\"");
- }
-
- for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++);
- for (j = 1; attr[i] && attr[i][j]; j += 3) { // default attributes
- if (! attr[i][j + 1] || ezxml_attr(xml, attr[i][j]) != attr[i][j + 1])
- continue; // skip duplicates and non-values
- while (*len + strlen(attr[i][j]) + 7 > *max) // reallocate s
- *s = realloc(*s, *max += EZXML_BUFSIZE);
-
- *len += sprintf(*s + *len, " %s=\"", attr[i][j]);
- ezxml_ampencode(attr[i][j + 1], -1, s, len, max, 1);
- *len += sprintf(*s + *len, "\"");
- }
- *len += sprintf(*s + *len, ">");
-
- *s = (xml->child) ? ezxml_toxml_r(xml->child, s, len, max, 0, attr) //child
- : ezxml_ampencode(xml->txt, -1, s, len, max, 0); //data
-
- while (*len + strlen(xml->name) + 4 > *max) // reallocate s
- *s = realloc(*s, *max += EZXML_BUFSIZE);
-
- *len += sprintf(*s + *len, "</%s>", xml->name); // close tag
-
- while (txt[off] && off < xml->off) off++; // make sure off is within bounds
- return (xml->ordered) ? ezxml_toxml_r(xml->ordered, s, len, max, off, attr)
- : ezxml_ampencode(txt + off, -1, s, len, max, 0);
-}
-
-// Converts an ezxml structure back to xml. Returns a string of xml data that
-// must be freed.
-char *ezxml_toxml(ezxml_t xml)
-{
- ezxml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL;
- ezxml_root_t root = (ezxml_root_t)xml;
- size_t len = 0, max = EZXML_BUFSIZE;
- char *s = strcpy(malloc(max), ""), *t, *n;
- int i, j, k;
-
- if (! xml || ! xml->name) return realloc(s, len + 1);
- while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
-
- for (i = 0; ! p && root->pi[i]; i++) { // pre-root processing instructions
- for (k = 2; root->pi[i][k - 1]; k++);
- for (j = 1; (n = root->pi[i][j]); j++) {
- if (root->pi[i][k][j - 1] == '>') continue; // not pre-root
- while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
- s = realloc(s, max += EZXML_BUFSIZE);
- len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n);
- }
- }
-
- xml->parent = xml->ordered = NULL;
- s = ezxml_toxml_r(xml, &s, &len, &max, 0, root->attr);
- xml->parent = p;
- xml->ordered = o;
-
- for (i = 0; ! p && root->pi[i]; i++) { // post-root processing instructions
- for (k = 2; root->pi[i][k - 1]; k++);
- for (j = 1; (n = root->pi[i][j]); j++) {
- if (root->pi[i][k][j - 1] == '<') continue; // not post-root
- while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
- s = realloc(s, max += EZXML_BUFSIZE);
- len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n);
- }
- }
- return realloc(s, len + 1);
-}
-
-// free the memory allocated for the ezxml structure
-void ezxml_free(ezxml_t xml)
-{
- ezxml_root_t root = (ezxml_root_t)xml;
- int i, j;
- char **a, *s;
-
- if (! xml) return;
- ezxml_free(xml->child);
- ezxml_free(xml->ordered);
-
- if (! xml->parent) { // free root tag allocations
- for (i = 10; root->ent[i]; i += 2) // 0 - 9 are default entites (<>&"')
- if ((s = root->ent[i + 1]) < root->s || s > root->e) free(s);
- free(root->ent); // free list of general entities
-
- for (i = 0; (a = root->attr[i]); i++) {
- for (j = 1; a[j++]; j += 2) // free malloced attribute values
- if (a[j] && (a[j] < root->s || a[j] > root->e)) free(a[j]);
- free(a);
- }
- if (root->attr[0]) free(root->attr); // free default attribute list
-
- for (i = 0; root->pi[i]; i++) {
- for (j = 1; root->pi[i][j]; j++);
- free(root->pi[i][j + 1]);
- free(root->pi[i]);
- }
- if (root->pi[0]) free(root->pi); // free processing instructions
-
- if (root->len == -1) free(root->m); // malloced xml data
-#ifndef EZXML_NOMMAP
- else if (root->len) munmap(root->m, root->len); // mem mapped xml data
-#endif // EZXML_NOMMAP
- if (root->u) free(root->u); // utf8 conversion
- }
-
- ezxml_free_attr(xml->attr); // tag attributes
- if ((xml->flags & EZXML_TXTM)) free(xml->txt); // character content
- if ((xml->flags & EZXML_NAMEM)) free(xml->name); // tag name
- free(xml);
-}
-
-// return parser error message or empty string if none
-const char *ezxml_error(ezxml_t xml)
-{
- while (xml && xml->parent) xml = xml->parent; // find root tag
- return (xml) ? ((ezxml_root_t)xml)->err : "";
-}
-
-// returns a new empty ezxml structure with the given root tag name
-ezxml_t ezxml_new(const char *name)
-{
- static char *ent[] = { "lt;", "&#60;", "gt;", "&#62;", "quot;", "&#34;",
- "apos;", "&#39;", "amp;", "&#38;", NULL };
- ezxml_root_t root = (ezxml_root_t)memset(malloc(sizeof(struct ezxml_root)),
- '\0', sizeof(struct ezxml_root));
- root->xml.name = (char *)name;
- root->cur = &root->xml;
- strcpy(root->err, root->xml.txt = "");
- root->ent = memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
- root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL);
- return &root->xml;
-}
-
-// inserts an existing tag into an ezxml structure
-ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off)
-{
- ezxml_t cur, prev, head;
-
- xml->next = xml->sibling = xml->ordered = NULL;
- xml->off = off;
- xml->parent = dest;
-
- if ((head = dest->child)) { // already have sub tags
- if (head->off <= off) { // not first subtag
- for (cur = head; cur->ordered && cur->ordered->off <= off;
- cur = cur->ordered);
- xml->ordered = cur->ordered;
- cur->ordered = xml;
- }
- else { // first subtag
- xml->ordered = head;
- dest->child = xml;
- }
-
- for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name);
- prev = cur, cur = cur->sibling); // find tag type
- if (cur && cur->off <= off) { // not first of type
- while (cur->next && cur->next->off <= off) cur = cur->next;
- xml->next = cur->next;
- cur->next = xml;
- }
- else { // first tag of this type
- if (prev && cur) prev->sibling = cur->sibling; // remove old first
- xml->next = cur; // old first tag is now next
- for (cur = head, prev = NULL; cur && cur->off <= off;
- prev = cur, cur = cur->sibling); // new sibling insert point
- xml->sibling = cur;
- if (prev) prev->sibling = xml;
- }
- }
- else dest->child = xml; // only sub tag
-
- return xml;
-}
-
-// Adds a child tag. off is the offset of the child tag relative to the start
-// of the parent tag's character content. Returns the child tag.
-ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off)
-{
- ezxml_t child;
-
- if (! xml) return NULL;
- child = (ezxml_t)memset(malloc(sizeof(struct ezxml)), '\0',
- sizeof(struct ezxml));
- child->name = (char *)name;
- child->attr = EZXML_NIL;
- child->txt = "";
-
- return ezxml_insert(child, xml, off);
-}
-
-// sets the character content for the given tag and returns the tag
-ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt)
-{
- if (! xml) return NULL;
- if (xml->flags & EZXML_TXTM) free(xml->txt); // existing txt was malloced
- xml->flags &= ~EZXML_TXTM;
- xml->txt = (char *)txt;
- return xml;
-}
-
-// Sets the given tag attribute or adds a new attribute if not found. A value
-// of NULL will remove the specified attribute. Returns the tag given.
-ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value)
-{
- int l = 0, c;
-
- if (! xml) return NULL;
- while (xml->attr[l] && strcmp(xml->attr[l], name)) l += 2;
- if (! xml->attr[l]) { // not found, add as new attribute
- if (! value) return xml; // nothing to do
- if (xml->attr == EZXML_NIL) { // first attribute
- xml->attr = malloc(4 * sizeof(char *));
- xml->attr[1] = strdup(""); // empty list of malloced names/vals
- }
- else xml->attr = realloc(xml->attr, (l + 4) * sizeof(char *));
-
- xml->attr[l] = (char *)name; // set attribute name
- xml->attr[l + 2] = NULL; // null terminate attribute list
- xml->attr[l + 3] = realloc(xml->attr[l + 1],
- (c = strlen(xml->attr[l + 1])) + 2);
- strcpy(xml->attr[l + 3] + c, " "); // set name/value as not malloced
- if (xml->flags & EZXML_DUP) xml->attr[l + 3][c] = EZXML_NAMEM;
- }
- else if (xml->flags & EZXML_DUP) free((char *)name); // name was strduped
-
- for (c = l; xml->attr[c]; c += 2); // find end of attribute list
- if (xml->attr[c + 1][l / 2] & EZXML_TXTM) free(xml->attr[l + 1]); //old val
- if (xml->flags & EZXML_DUP) xml->attr[c + 1][l / 2] |= EZXML_TXTM;
- else xml->attr[c + 1][l / 2] &= ~EZXML_TXTM;
-
- if (value) xml->attr[l + 1] = (char *)value; // set attribute value
- else { // remove attribute
- if (xml->attr[c + 1][l / 2] & EZXML_NAMEM) free(xml->attr[l]);
- memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char*));
- xml->attr = realloc(xml->attr, (c + 2) * sizeof(char *));
- memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1,
- (c / 2) - (l / 2)); // fix list of which name/vals are malloced
- }
- xml->flags &= ~EZXML_DUP; // clear strdup() flag
- return xml;
-}
-
-// sets a flag for the given tag and returns the tag
-ezxml_t ezxml_set_flag(ezxml_t xml, short flag)
-{
- if (xml) xml->flags |= flag;
- return xml;
-}
-
-// removes a tag along with its subtags without freeing its memory
-ezxml_t ezxml_cut(ezxml_t xml)
-{
- ezxml_t cur;
-
- if (! xml) return NULL; // nothing to do
- if (xml->next) xml->next->sibling = xml->sibling; // patch sibling list
-
- if (xml->parent) { // not root tag
- cur = xml->parent->child; // find head of subtag list
- if (cur == xml) xml->parent->child = xml->ordered; // first subtag
- else { // not first subtag
- while (cur->ordered != xml) cur = cur->ordered;
- cur->ordered = cur->ordered->ordered; // patch ordered list
-
- cur = xml->parent->child; // go back to head of subtag list
- if (strcmp(cur->name, xml->name)) { // not in first sibling list
- while (strcmp(cur->sibling->name, xml->name))
- cur = cur->sibling;
- if (cur->sibling == xml) { // first of a sibling list
- cur->sibling = (xml->next) ? xml->next
- : cur->sibling->sibling;
- }
- else cur = cur->sibling; // not first of a sibling list
- }
-
- while (cur->next && cur->next != xml) cur = cur->next;
- if (cur->next) cur->next = cur->next->next; // patch next list
- }
- }
- xml->ordered = xml->sibling = xml->next = NULL;
- return xml;
-}
-
-#ifdef EZXML_TEST // test harness
-int main(int argc, char **argv)
-{
- ezxml_t xml;
- char *s;
- int i;
-
- if (argc != 2) return fprintf(stderr, "usage: %s xmlfile\n", argv[0]);
-
- xml = ezxml_parse_file(argv[1]);
- printf("%s\n", (s = ezxml_toxml(xml)));
- free(s);
- i = fprintf(stderr, "%s", ezxml_error(xml));
- ezxml_free(xml);
- return (i) ? 1 : 0;
-}
-#endif // EZXML_TEST
diff --git a/protocols/Skype/ezxml/ezxml.h b/protocols/Skype/ezxml/ezxml.h
deleted file mode 100644
index 3e020788b4..0000000000
--- a/protocols/Skype/ezxml/ezxml.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* ezxml.h
- *
- * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _EZXML_H
-#define _EZXML_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <fcntl.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define EZXML_BUFSIZE 1024 // size of internal memory buffers
-#define EZXML_NAMEM 0x80 // name is malloced
-#define EZXML_TXTM 0x40 // txt is malloced
-#define EZXML_DUP 0x20 // attribute name and value are strduped
-
-typedef struct ezxml *ezxml_t;
-struct ezxml {
- char *name; // tag name
- char **attr; // tag attributes { name, value, name, value, ... NULL }
- char *txt; // tag character content, empty string if none
- size_t off; // tag offset from start of parent tag character content
- ezxml_t next; // next tag with same name in this section at this depth
- ezxml_t sibling; // next tag with different name in same section and depth
- ezxml_t ordered; // next tag, same section and depth, in original order
- ezxml_t child; // head of sub tag list, NULL if none
- ezxml_t parent; // parent tag, NULL if current tag is root tag
- short flags; // additional information
-};
-
-// Given a string of xml data and its length, parses it and creates an ezxml
-// structure. For efficiency, modifies the data by adding null terminators
-// and decoding ampersand sequences. If you don't want this, copy the data and
-// pass in the copy. Returns NULL on failure.
-ezxml_t ezxml_parse_str(char *s, size_t len);
-
-// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
-// attempts to mem map the file. Failing that, reads the file into memory.
-// Returns NULL on failure.
-ezxml_t ezxml_parse_fd(int fd);
-
-// a wrapper for ezxml_parse_fd() that accepts a file name
-ezxml_t ezxml_parse_file(const char *file);
-
-// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
-// stream into memory and then parses it. For xml files, use ezxml_parse_file()
-// or ezxml_parse_fd()
-ezxml_t ezxml_parse_fp(FILE *fp);
-
-// returns the first child tag (one level deeper) with the given name or NULL
-// if not found
-ezxml_t ezxml_child(ezxml_t xml, const char *name);
-
-// returns the next tag of the same name in the same section and depth or NULL
-// if not found
-#define ezxml_next(xml) ((xml) ? xml->next : NULL)
-
-// Returns the Nth tag with the same name in the same section at the same depth
-// or NULL if not found. An index of 0 returns the tag given.
-ezxml_t ezxml_idx(ezxml_t xml, int idx);
-
-// returns the name of the given tag
-#define ezxml_name(xml) ((xml) ? xml->name : NULL)
-
-// returns the given tag's character content or empty string if none
-#define ezxml_txt(xml) ((xml) ? xml->txt : "")
-
-// returns the value of the requested tag attribute, or NULL if not found
-const char *ezxml_attr(ezxml_t xml, const char *attr);
-
-// Traverses the ezxml sturcture to retrieve a specific subtag. Takes a
-// variable length list of tag names and indexes. The argument list must be
-// terminated by either an index of -1 or an empty string tag name. Example:
-// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
-// This retrieves the title of the 3rd book on the 1st shelf of library.
-// Returns NULL if not found.
-ezxml_t ezxml_get(ezxml_t xml, ...);
-
-// Converts an ezxml structure back to xml. Returns a string of xml data that
-// must be freed.
-char *ezxml_toxml(ezxml_t xml);
-
-// returns a NULL terminated array of processing instructions for the given
-// target
-const char **ezxml_pi(ezxml_t xml, const char *target);
-
-// frees the memory allocated for an ezxml structure
-void ezxml_free(ezxml_t xml);
-
-// returns parser error message or empty string if none
-const char *ezxml_error(ezxml_t xml);
-
-// returns a new empty ezxml structure with the given root tag name
-ezxml_t ezxml_new(const char *name);
-
-// wrapper for ezxml_new() that strdup()s name
-#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM)
-
-// Adds a child tag. off is the offset of the child tag relative to the start
-// of the parent tag's character content. Returns the child tag.
-ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off);
-
-// wrapper for ezxml_add_child() that strdup()s name
-#define ezxml_add_child_d(xml, name, off) \
- ezxml_set_flag(ezxml_add_child(xml, strdup(name), off), EZXML_NAMEM)
-
-// sets the character content for the given tag and returns the tag
-ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt);
-
-// wrapper for ezxml_set_txt() that strdup()s txt
-#define ezxml_set_txt_d(xml, txt) \
- ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM)
-
-// Sets the given tag attribute or adds a new attribute if not found. A value
-// of NULL will remove the specified attribute. Returns the tag given.
-ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value);
-
-// Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL
-#define ezxml_set_attr_d(xml, name, value) \
- ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), strdup(name), strdup(value))
-
-// sets a flag for the given tag and returns the tag
-ezxml_t ezxml_set_flag(ezxml_t xml, short flag);
-
-// removes a tag along with its subtags without freeing its memory
-ezxml_t ezxml_cut(ezxml_t xml);
-
-// inserts an existing tag into an ezxml structure
-ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off);
-
-// Moves an existing tag to become a subtag of dest at the given offset from
-// the start of dest's character content. Returns the moved tag.
-#define ezxml_move(xml, dest, off) ezxml_insert(ezxml_cut(xml), dest, off)
-
-// removes a tag along with all its subtags
-#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _EZXML_H
diff --git a/protocols/Skype/gchat.c b/protocols/Skype/gchat.c
deleted file mode 100644
index 282e7834e2..0000000000
--- a/protocols/Skype/gchat.c
+++ /dev/null
@@ -1,910 +0,0 @@
-#include "skype.h"
-#include "skypeapi.h"
-#include "gchat.h"
-#include "contacts.h"
-#include "debug.h"
-#include "utf8.h"
-#include "pthread.h"
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include "../../include/m_langpack.h"
-#include "../../include/m_userinfo.h"
-#include "../../include/m_history.h"
-#include "../../include/m_contacts.h"
-#pragma warning (pop)
-
-#ifndef DWLP_USER
-#define DWLP_USER DWL_USER
-#endif
-
-#ifdef _UNICODE
-#define STR "%S"
-#else
-#define STR "%s"
-#endif
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-extern HANDLE hInitChat;
-extern HINSTANCE hInst;
-extern char protocol, g_szProtoName[];
-extern DWORD mirandaVersion;
-
-static gchat_contacts *chats=NULL;
-static int chatcount=0;
-static CRITICAL_SECTION m_GCMutex;
-
-// TODO: Disable groupchat for Protocol verisons <5
-
-/****************************************************************************/
-/* Chat management helper functions */
-/****************************************************************************/
-
-/* Get the gchat_contacts entry for the chat with the id szChatId
- If the chat doesn't already exist in the list, it is added.
-
- Parameters: szChatId - String with the chat ID of the chat to be found
- Returns: Pointer to the gchat_contacts entry for the given id.
- NULL on failure (not enough memory)
-*/
-gchat_contacts *GetChat(TCHAR *szChatId) {
- int i;
-
- for (i=0;i<chatcount;i++)
- if (!_tcscmp(chats[i].szChatName, szChatId)) return &chats[i];
- if (chats = (gchat_contacts *)realloc(chats, sizeof(gchat_contacts)*(++chatcount))) {
- memset(&chats[chatcount-1], 0, sizeof(gchat_contacts));
- chats[chatcount-1].szChatName=_tcsdup(szChatId);
- return &chats[chatcount-1];
- }
- return NULL;
-}
-
-/* Removes the gchat_contacts entry for the chat with the id szChatId,
- if it exists.
-
- Parameters: szChatId - String with the chat ID to be removed from list
- */
-void RemChat(TCHAR *szChatId) {
- int i;
-
- for (i=0;i<chatcount;i++)
- if (!_tcscmp(chats[i].szChatName, szChatId)) {
- if (chats[i].szChatName) free(chats[i].szChatName);
- if (chats[i].mJoinedContacts) free(chats[i].mJoinedContacts);
- if (i<--chatcount) memmove(&chats[i], &chats[i+1], (chatcount-i)*sizeof(gchat_contacts));
- chats = (gchat_contacts *)realloc(chats, sizeof(gchat_contacts)*chatcount);
- return;
- }
-}
-
-/* Checks, if the contact with the handle hContact exists in the groupchat
- given in gc
-
- Parameters: gc - gchat_contacts entry for the chat session to be searched
- who - Name of member
- Returns: -1 = Not found
- >=0 = Number of found item
- */
-static int ExistsChatContact(gchat_contacts *gc, const TCHAR *who) {
- int i;
-
- for (i=0;i<gc->mJoinedCount;i++)
- if (_tcscmp(gc->mJoinedContacts[i].who, who)==0) return i;
- return -1;
-}
-
-gchat_contact *GetChatContact(gchat_contacts *gc, const TCHAR *who) {
- int i = ExistsChatContact (gc, who);
-
- if (i==-1) return NULL;
- return &gc->mJoinedContacts[i];
-}
-
-/* Adds contact with the name who to the groupchat given in gc
-
- Parameters: gc -
- Returns: -1 = Contact not found
- -2 = On failure
- >=0 = Number of added item
- */
-static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole) {
- int i = -2;
- HANDLE hContact;
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- TCHAR *twho;
-
- LOG (("AddChatContact %s", who));
- if (!(twho = make_nonutf_tchar_string((const unsigned char*)who)))
- return -2;
- if ((i=ExistsChatContact(gc, twho))>=0) return i;
- hContact=find_contact(who);
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = gc->szChatName;
- gcd.iType = GC_EVENT_JOIN;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszStatus = pszRole?pszRole:_T("USER");
- gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
-
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = hContact;
-
- if (hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=twho;
-
- gce.ptszUID=twho;
- if (!CallService(MS_GC_EVENT, 0, (LPARAM)&gce)) {
- if ((gc->mJoinedContacts=realloc(gc->mJoinedContacts, (gc->mJoinedCount+1)*sizeof(gchat_contact))))
- {
- gc->mJoinedContacts[i=gc->mJoinedCount].hContact=hContact;
- _tcscpy (gc->mJoinedContacts[i].szRole, gce.ptszStatus);
- _tcscpy (gc->mJoinedContacts[i].who, twho);
- gc->mJoinedCount++;
- }
- }
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- free_nonutf_tchar_string (twho);
- return i;
-}
-
-void RemChatContact(gchat_contacts *gc, const TCHAR *who) {
- int i;
-
- if (!gc) return;
- for (i=0;i<gc->mJoinedCount;i++)
- if (_tcscmp(gc->mJoinedContacts[i].who, who)==0) {
- if (i<--gc->mJoinedCount)
- memmove(&gc->mJoinedContacts[i], &gc->mJoinedContacts[i+1], (gc->mJoinedCount-i)*sizeof(gchat_contact));
- if (gc->mJoinedCount) gc->mJoinedContacts = realloc(gc->mJoinedContacts, sizeof(gchat_contact)*gc->mJoinedCount);
- else {free (gc->mJoinedContacts); gc->mJoinedContacts = NULL; }
- return;
- }
-}
-
-HANDLE find_chat(TCHAR *chatname) {
- char *szProto;
- int tCompareResult;
- HANDLE hContact;
- DBVARIANT dbv;
-
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
- {
- if (DBGetContactSettingTString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue;
- tCompareResult = _tcscmp(dbv.ptszVal, chatname);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-
-#ifdef _UNICODE
-HANDLE find_chatA(char *chatname) {
- char *szProto;
- int tCompareResult;
- HANDLE hContact;
- DBVARIANT dbv;
-
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
- {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue;
- tCompareResult = strcmp(dbv.pszVal, chatname);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-#endif
-
-
-
-int __cdecl AddMembers(char *szSkypeMsg) {
- BYTE *contactmask=NULL;
- DBVARIANT dbv2;
- CONTACTINFO ci={0};
- char *ptr, *who, *nextoken;
- TCHAR *szChatId;
- int i, iRet = 0;
- gchat_contacts *gc;
-
- LOG(("AddMembers STARTED"));
- if (!(ptr=strstr(szSkypeMsg, " MEMBERS"))) return -1;
- EnterCriticalSection(&m_GCMutex);
- ptr[0]=0;
- szChatId = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5);
- ptr+=9;
- if (find_chat(szChatId) && (gc=GetChat(szChatId)) &&
- !DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2))
- {
- char *pszMemObjs, *token;
-
- if (protocol>=7 && (pszMemObjs = SkypeGet ("CHAT", szSkypeMsg+5, "MEMBEROBJECTS"))) {
- // Add new contacts (protocol 7+ with memberobjects, supports roles)
- for (token=strtok_r(pszMemObjs, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- if (!(who = SkypeGet ("CHATMEMBER", token, "IDENTITY"))) continue;
- if (strcmp(who, dbv2.pszVal)) {
- char *pszRole;
- TCHAR *ptszRole = NULL;
-
- if (pszRole = SkypeGet ("CHATMEMBER", token, "ROLE"))
- ptszRole = make_nonutf_tchar_string((const unsigned char*)pszRole);
-
- i=AddChatContact(gc, who, ptszRole);
- free_nonutf_tchar_string (ptszRole);
- if (pszRole) free (pszRole);
- if (i>=0 && !contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) i=-2;
- if (!(contactmask= (unsigned char *) realloc(contactmask, gc->mJoinedCount))) {
- iRet = -1;
- free (who);
- break;
- }
- contactmask[i]=TRUE;
- }
- free (who);
- }
- free (pszMemObjs);
- }
- else
- {
- // Add new contacts (normal)
- for (who=strtok_r(ptr, " ", &nextoken); who; who=strtok_r(NULL, " ", &nextoken)) {
- if (strcmp(who, dbv2.pszVal)) {
- i=AddChatContact(gc, who, NULL);
- if (i>=0 && !contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) i=-2;
- if (i<0 || !(contactmask= (unsigned char *) realloc(contactmask, gc->mJoinedCount))) {
- iRet = -1;
- break;
- }
- contactmask[i]=TRUE;
- }
- }
- }
- // Quit contacts which are no longer there
- if (iRet == 0 && contactmask) {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = szChatId;
- gcd.iType = GC_EVENT_QUIT;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
-
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY;
-
- for (i=0;i<gc->mJoinedCount;i++)
- if (!contactmask[i])
- {
- ci.hContact = gc->mJoinedContacts[i].hContact;
- ci.dwFlag = CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gc->mJoinedContacts[i].who;
- RemChatContact(gc, gc->mJoinedContacts[i].who);
- gce.ptszUID = gc->mJoinedContacts[i].who;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- if (ci.pszVal) {
- miranda_sys_free (ci.pszVal);
- ci.pszVal=NULL;
- }
- }
- // We don't do this, because the dialog group-chat may have been started intentionally
- /*
- if (gc->mJoinedCount == 1) {
- // switch back to normal session
- KillChatSession(&gcd);
- }
- */
- }
- if (contactmask) free(contactmask);
- DBFreeVariant(&dbv2);
- } else iRet = -1;
- free_nonutf_tchar_string (szChatId);
- LeaveCriticalSection(&m_GCMutex);
- LOG(("AddMembers DONE"));
- return iRet;
-}
-
-void AddMembersThread(char *szSkypeMsg)
-{
- AddMembers (szSkypeMsg);
- free (szSkypeMsg);
-}
-
-/****************************************************************************/
-/* Window procedures */
-/****************************************************************************/
-BOOL CALLBACK InputBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- SetWindowLong (hwndDlg, DWLP_USER, lParam);
- SetDlgItemText (hwndDlg, IDC_TEXT, (TCHAR*)lParam);
- return TRUE;
- }
-
- case WM_COMMAND:
- switch ( LOWORD( wParam )) {
- case IDOK:
- {
- GetDlgItemText(hwndDlg, IDC_TEXT, (TCHAR*)GetWindowLong(hwndDlg, DWLP_USER), MAX_BUF-1*sizeof(TCHAR));
- EndDialog(hwndDlg, 1);
- break;
- }
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- break;
- } }
- return FALSE;
-}
-
-/****************************************************************************/
-/* Core Chat management functions */
-/****************************************************************************/
-
-/* We have a new Groupchat
-
- This hook is called when a new chat is initialised.
- Parameters: wParam = (char *)Name of new chat session [Has to be ASCIIZ/UTF8]
- lParam = 1 - Create groupchat, but don't open it
- 0 - Default - open groupchat after init
-*/
-int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) {
- GCSESSION gcw = {0};
- GCEVENT gce = {0};
- GCDEST gcd = {0};
- DBVARIANT dbv, dbv2;
- char *szChatName;
- int iRet = -1;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- gcw.cbSize = sizeof(GCSESSION);
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = SKYPE_PROTONAME;
- gcw.dwFlags = GC_TCHAR;
-
- if (!(szChatName = SkypeGet ("CHAT", (char *)wParam, "FRIENDLYNAME")) || !*szChatName)
- gcw.ptszName=TranslateT("Unknown"); else {
-#ifdef _UNICODE
- gcw.ptszName=make_unicode_string((const unsigned char*)szChatName);
- free (szChatName);
- szChatName = (char*)gcw.ptszName;
-#else
- gcw.ptszName=szChatName;
-#endif
- }
- gcw.ptszID = make_nonutf_tchar_string((const unsigned char*)wParam);
- gcw.pszStatusbarText = NULL;
- EnterCriticalSection(&m_GCMutex);
- if (!CallService(MS_GC_NEWSESSION, 0, (LPARAM)&gcw)) {
- char *szChatRole;
-
- gce.cbSize = sizeof(GCEVENT);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = (TCHAR*)gcw.ptszID;
- gcd.iType = GC_EVENT_ADDGROUP;
- gce.pDest = &gcd;
- gce.ptszStatus = _T("CREATOR");
- gce.dwFlags = GC_TCHAR;
- // BUG: Groupchat returns nonzero on success here in earlier versions, so we don't check
- // it here
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gce.ptszStatus = _T("MASTER");
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gce.ptszStatus = _T("HELPER");
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gce.ptszStatus = _T("USER");
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gce.ptszStatus = _T("LISTENER");
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gce.ptszStatus = _T("APPLICANT");
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
-
- gcd.iType = GC_EVENT_JOIN;
- gce.ptszStatus = NULL;
- if (protocol >=7 && (szChatRole = SkypeGet ("CHAT", (char *)wParam, "MYROLE"))) {
- if (strncmp(szChatRole, "ERROR", 5))
- {
-#ifdef _UNICODE
- gce.ptszStatus = make_unicode_string((const unsigned char*)szChatRole);
- free (szChatRole);
-#else
- gce.ptszStatus = szChatRole;
-#endif
- }
- }
- if (!gce.ptszStatus) gce.ptszStatus=_tcsdup(_T("CREATOR"));
-
- if (!DBGetContactSettingTString(NULL, SKYPE_PROTONAME, "Nick", &dbv)) {
- if (!DBGetContactSettingTString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2)) {
- gce.ptszNick = dbv.ptszVal;
- gce.ptszUID = dbv2.ptszVal;
- gce.time = 0;
- gce.bIsMe = TRUE;
- gce.dwFlags |= GCEF_ADDTOLOG;
- if (!CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce)) {
- gce.cbSize = sizeof(GCEVENT);
- gcd.iType = GC_EVENT_CONTROL;
- gce.pDest = &gcd;
- if (!lParam) CallService(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallService(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- CallService(MS_GC_EVENT, lParam?WINDOW_HIDDEN:WINDOW_VISIBLE, (LPARAM)&gce);
- SkypeSend ("GET CHAT %s MEMBERS", (char *)wParam);
- iRet = 0;
- } else {LOG (("ChatInit: Joining 'me' failed."));}
- }
- DBFreeVariant(&dbv2);
- }
- free ((void*)gce.ptszStatus);
- DBFreeVariant(&dbv);
- }
- free (szChatName);
- free_nonutf_tchar_string ((void*)gcw.ptszID);
- LeaveCriticalSection(&m_GCMutex);
- return iRet;
-}
-
-/* Open new Groupchat
-
- Parameters: szChatId = (char *)Name of new chat session
-*/
-int __cdecl ChatStart(char *szChatId, BOOL bJustCreate) {
- LOG(("ChatStart: New groupchat started"));
- if (!szChatId || NotifyEventHooks(hInitChat, (WPARAM)szChatId, bJustCreate)) return -1;
- return 0;
-}
-
-
-void KillChatSession(GCDEST *gcd) {
- GCEVENT gce = {0};
-
- EnterCriticalSection(&m_GCMutex);
- LOG(("KillChatSession: Groupchatsession terminated."));
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR;
- gce.pDest = gcd;
- gcd->iType = GC_EVENT_CONTROL;
- if (SkypeSend ("ALTER CHAT "STR" LEAVE", gcd->ptszID) == 0)
- {
- CallService(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallService(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
- }
- LeaveCriticalSection(&m_GCMutex);
-}
-
-void InviteUser(TCHAR *szChatId) {
- HMENU tMenu = CreatePopupMenu();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0), hInvitedUser;
- DBVARIANT dbv;
- HWND tWindow;
- POINT pt;
- gchat_contacts *gc;
- int j;
-
- if (!szChatId || !(gc=GetChat(szChatId))) return;
-
- // add the heading
- AppendMenu(tMenu, MF_STRING|MF_GRAYED|MF_DISABLED, (UINT_PTR)0, TranslateT("&Invite user..."));
- AppendMenu(tMenu, MF_SEPARATOR, (UINT_PTR)1, NULL);
-
- // generate a list of contact
- while (hContact) {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact,0 );
- if (szProto && !strcmp(SKYPE_PROTONAME, szProto) &&
- !DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0) &&
- DBGetContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE)
- {
- BOOL alreadyInSession = FALSE;
- for (j=0; j<gc->mJoinedCount; j++) {
- if (gc->mJoinedContacts[j].hContact==hContact) {
- alreadyInSession = TRUE;
- break;
- }
- }
- if (!alreadyInSession)
- AppendMenu(tMenu, MF_STRING, (UINT_PTR)hContact,
- (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
- }
- hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0);
- }
-
- tWindow = CreateWindow(_T("EDIT"),_T(""),0,1,1,1,1,NULL,NULL,hInst,NULL);
-
- GetCursorPos (&pt);
- hInvitedUser = (HANDLE)TrackPopupMenu(tMenu, TPM_NONOTIFY | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, tWindow, NULL);
- DestroyMenu(tMenu);
- DestroyWindow(tWindow);
-
- if (!hInvitedUser || DBGetContactSettingString(hInvitedUser, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return;
- SkypeSend ("ALTER CHAT "STR" ADDMEMBERS %s", szChatId, dbv.pszVal);
- DBFreeVariant(&dbv);
-
-}
-
-static void KickUser (HANDLE hContact, GCHOOK *gch)
-{
- char *ptr;
-
- EnterCriticalSection(&m_GCMutex);
- if (SkypeSend ("ALTER CHAT "STR" KICK "STR, gch->pDest->ptszID, gch->ptszUID)!=-1) {
- if (ptr=SkypeRcv("ALTER CHAT KICK", 2000)) {
- if (strncmp(ptr, "ERROR", 5)) {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- DBVARIANT dbv;
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = (TCHAR*)gch->pDest->ptszID;
- gcd.iType = GC_EVENT_KICK;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.ptszUID= gch->ptszUID;
-
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = hContact;
- if (hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
- if (!DBGetContactSettingTString(NULL, SKYPE_PROTONAME, "Nick", &dbv)) {
- gce.ptszStatus = dbv.ptszVal;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- RemChatContact (GetChat(gcd.ptszID), gch->ptszUID);
- DBFreeVariant(&dbv);
- }
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- }
- free (ptr);
- }
- }
- LeaveCriticalSection(&m_GCMutex);
-}
-
-void SetChatTopic (TCHAR *szChatId, TCHAR *szTopic, BOOL bSet)
-{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- HANDLE hContact = find_chat (szChatId);
- char *szUTFTopic;
-
- gce.cbSize = sizeof(GCEVENT);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = szChatId;
- gcd.iType = GC_EVENT_TOPIC;
- gce.pDest = &gcd;
- gce.ptszText = szTopic;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.time = (DWORD)time (NULL);
- gce.dwFlags = GC_TCHAR;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- gcd.iType = GC_EVENT_SETSBTEXT;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
-
- if (bSet) {
-#ifdef _UNICODE
- szUTFTopic=(char*)make_utf8_string(szTopic);
-#else
- if (utf8_encode(szTopic, &szUTFTopic)==-1) szUTFTopic = NULL;
-#endif
- if (szUTFTopic) {
- SkypeSend ("ALTER CHAT "STR" SETTOPIC %s", szChatId, szUTFTopic);
- free (szUTFTopic);
- }
- testfor ("ALTER CHAT SETTOPIC", INFINITE);
- }
-
- if (hContact)
- DBWriteContactSettingTString(hContact, SKYPE_PROTONAME, "Nick", szTopic);
-}
-
-
-int GCEventHook(WPARAM wParam,LPARAM lParam) {
- GCHOOK *gch = (GCHOOK*) lParam;
- gchat_contacts *gc = GetChat(gch->pDest->ptszID);
-
- UNREFERENCED_PARAMETER(wParam);
-
- if(gch) {
- if (!_stricmp(gch->pDest->pszModule, SKYPE_PROTONAME)) {
-
- switch (gch->pDest->iType) {
- case GC_SESSION_TERMINATE: {
- HANDLE hContact;
-
- if (gc->mJoinedCount == 1) {
- // switch back to normal session
- // I don't know if this behaviour isn't a bit annoying, therefore, we
- // don't do this now, until a user requests this feature :)
-
- // open up srmm dialog when quit while 1 person left
-// CallService(MS_MSG_SENDMESSAGE, (WPARAM)gc->mJoinedContacts[0].hContact, 0);
-
- RemChatContact(gc, gc->mJoinedContacts[0].who);
- }
- // Delete Chatroom from Contact list, as we don't need it anymore...?
- if (hContact = find_chat(gc->szChatName))
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- RemChat(gc->szChatName);
-
- break;
- }
- case GC_USER_MESSAGE:
- if(gch && gch->ptszText && _tcslen(gch->ptszText) > 0) {
- DBVARIANT dbv, dbv2;
- CCSDATA ccs = {0};
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- TCHAR *pEnd;
-
- // remove the ending linebreak
- for (pEnd = &gch->ptszText[_tcslen(gch->ptszText) - 1];
- *pEnd==_T('\r') || *pEnd==_T('\n'); pEnd--) *pEnd=0;
- // Send message to the chat-contact
- if (ccs.hContact = find_chat(gch->pDest->ptszID)) {
-#ifdef _UNICODE
- // If PREF_UTF is supported, just convert it to UTF8 and pass the buffer to PSS_MESSAGE
- if (mirandaVersion >= 0x070000) {
- ccs.lParam = (LPARAM)make_utf8_string(gch->ptszText);
- ccs.wParam = PREF_UTF;
- CallProtoService (SKYPE_PROTONAME, PSS_MESSAGE, 0, (LPARAM)&ccs);
- free ((void*)ccs.lParam);
- } else {
- // Otherwise create this strange dual miranda-format
- ccs.lParam = (LPARAM)calloc(3, _tcslen(gch->ptszText)+1);
- wcstombs ((char*)ccs.lParam, gch->ptszText, _tcslen(gch->ptszText)+1);
- _tcscpy ((TCHAR*)((char*)ccs.lParam+strlen((char*)ccs.lParam)+1), gch->ptszText);
- ccs.wParam = PREF_UNICODE;
- CallProtoService (SKYPE_PROTONAME, PSS_MESSAGE, 0, (LPARAM)&ccs);
- free ((void*)ccs.lParam);
- }
-#else
- ccs.lParam = (LPARAM)gch->ptszText;
- ccs.wParam = PREF_TCHAR;
- CallProtoService (SKYPE_PROTONAME, PSS_MESSAGE, 0, (LPARAM)&ccs);
-#endif
- }
-
- // Add our line to the chatlog
- gcd.pszModule = gch->pDest->pszModule;
- gcd.ptszID = gch->pDest->ptszID;
- if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && _tcslen(gch->ptszText)>4) {
- gce.ptszText = gch->ptszText+4;
- gcd.iType = GC_EVENT_ACTION;
- }
- else {
- gce.ptszText = gch->ptszText;
- gcd.iType = GC_EVENT_MESSAGE;
- }
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- if (DBGetContactSettingTString(NULL, SKYPE_PROTONAME, "Nick", &dbv)) gce.ptszNick=TranslateT("Me");
- else gce.ptszNick = dbv.ptszVal;
- DBGetContactSettingTString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2);
- gce.ptszUID = dbv2.ptszVal;
- gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.bIsMe = TRUE;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- if (dbv.pszVal) DBFreeVariant(&dbv);
- if (dbv2.pszVal) DBFreeVariant(&dbv2);
- }
- break;
- case GC_USER_CHANMGR:
- InviteUser(gch->pDest->ptszID);
- break;
- case GC_USER_PRIVMESS: {
- HANDLE hContact = find_contactT(gch->ptszUID);
- if (hContact) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
- break;
-
- }
- case GC_USER_LOGMENU:
- switch(gch->dwData) {
- case 10: InviteUser(gch->pDest->ptszID); break;
- case 20: KillChatSession(gch->pDest); break;
- case 30:
- {
- TCHAR *ptr, buf[MAX_BUF];
-
- ptr = SkypeGetT ("CHAT", gch->pDest->ptszID, "TOPIC");
- _tcscpy(buf, ptr);
- free(ptr);
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INPUTBOX), NULL, InputBoxDlgProc, (LPARAM)&buf))
- SetChatTopic (gch->pDest->ptszID, buf, TRUE);
- break;
- }
- }
- break;
- case GC_USER_NICKLISTMENU: {
- HANDLE hContact = find_contactT(gch->ptszUID);
-
- switch(gch->dwData) {
- case 10:CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break;
- case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); break;
- case 30: KickUser(hContact, gch); break;
- case 110: KillChatSession(gch->pDest); break;
- }
- break;
- }
- default:
- break;
- }
- }
-
- }
- return 0;
-}
-
-int __cdecl GCMenuHook(WPARAM wParam,LPARAM lParam) {
- GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam;
- DBVARIANT dbv;
- TCHAR* szInvite = TranslateT("&Invite user...");
- TCHAR* szLeave = TranslateT("&Leave chat session");
- TCHAR* szTopic = TranslateT("Set &Topic...");
- TCHAR* szDetails = TranslateT("User &details");
- TCHAR* szHistory = TranslateT("User &history");
- TCHAR* szKick = TranslateT("&Kick user");
-
- static struct gc_item Item_log[] = {
- {NULL, 10, MENU_ITEM, FALSE},
- {NULL, 30, MENU_ITEM, FALSE},
- {NULL, 20, MENU_ITEM, FALSE}
- };
- static struct gc_item Item_nicklist_me[] = {
- {NULL, 20, MENU_ITEM, FALSE},
- {_T(""), 100, MENU_SEPARATOR, FALSE},
- {NULL, 110, MENU_ITEM, FALSE}
- };
- static struct gc_item Item_nicklist[] = {
- {NULL, 10, MENU_ITEM, FALSE},
- {NULL, 20, MENU_ITEM, FALSE},
- {NULL, 30, MENU_ITEM, FALSE}
- };
-
- UNREFERENCED_PARAMETER(wParam);
-
- Item_log[0].pszDesc = szInvite;
- Item_log[1].pszDesc = szTopic;
- Item_log[2].pszDesc = szLeave;
- Item_nicklist_me[0].pszDesc = szHistory;
- Item_nicklist_me[2].pszDesc = szLeave;
- Item_nicklist[0].pszDesc = szDetails;
- Item_nicklist[1].pszDesc = szHistory;
- Item_nicklist[2].pszDesc = szKick;
-
- LOG (("GCMenuHook started."));
- if(gcmi) {
- if (!_stricmp(gcmi->pszModule, SKYPE_PROTONAME)) {
- switch (gcmi->Type)
- {
- case MENU_ON_LOG:
- gcmi->nItems = sizeof(Item_log)/sizeof(Item_log[0]);
- gcmi->Item = &Item_log[0];
- LOG (("GCMenuHook: Items in log window: %d", gcmi->nItems));
- break;
- case MENU_ON_NICKLIST:
- if (DBGetContactSettingTString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
- if (!lstrcmp(dbv.ptszVal, gcmi->pszUID)) {
- gcmi->nItems = sizeof(Item_nicklist_me)/sizeof(Item_nicklist_me[0]);
- gcmi->Item = &Item_nicklist_me[0];
- } else {
- gchat_contacts *gcs = GetChat(gcmi->pszID);
- gchat_contact *gc = gcs?GetChatContact(gcs, gcmi->pszUID):NULL;
- gcmi->nItems = sizeof(Item_nicklist)/sizeof(Item_nicklist[0]);
-
- Item_nicklist[2].bDisabled = FALSE;
- if (gc && !gc->hContact)
- {
- gcmi->nItems -= 2;
- gcmi->Item = &Item_nicklist[2];
- }
- else
- gcmi->Item = &Item_nicklist[0];
- /*
- if (protocol<7) Item_nicklist[2].bDisabled = TRUE;
- else {
- TCHAR *szChatRole;
- if (szChatRole = SkypeGetT ("CHAT", gcmi->pszID, "MYROLE")) {
- if (_tcscmp(szChatRole, _T("MASTER")) && _tcscmp(szChatRole, _T("CREATOR")))
- Item_nicklist[2].bDisabled = TRUE;
- free (szChatRole);
- }
- }*/
-
- }
- DBFreeVariant(&dbv);
- break;
- }
- } else {LOG (("GCMenuHook: ERROR: Not our protocol."));}
- } else {LOG (("GCMenuHook: ERROR: No gcmi"));}
- LOG (("GCMenuHook: terminated."));
- return 0;
-}
-
-INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam)
-{
- HANDLE hContact = (HANDLE)wParam;
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (DBGetContactSettingTString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0)
- {
- GCDEST gcd = {0};
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.iType = GC_EVENT_CONTROL;
- gcd.ptszID = dbv.ptszVal;
- KillChatSession(&gcd);
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM lParam)
-{
- HANDLE hContact = (HANDLE)wParam;
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0)
- {
- ChatStart (dbv.pszVal, FALSE);
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-void GCInit(void)
-{
- InitializeCriticalSection (&m_GCMutex);
-}
-
-void GCExit(void)
-{
- int i;
-
- DeleteCriticalSection (&m_GCMutex);
- for (i=0;i<chatcount;i++) {
- if (chats[i].szChatName) free(chats[i].szChatName);
- if (chats[i].mJoinedContacts) free(chats[i].mJoinedContacts);
- }
- if (chats) free (chats);
- chats = NULL;
- chatcount = 0;
-} \ No newline at end of file
diff --git a/protocols/Skype/gchat.h b/protocols/Skype/gchat.h
deleted file mode 100644
index 1bb105d8b5..0000000000
--- a/protocols/Skype/gchat.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// m_chat users these BaseTSD types, so if we are compiling with an old PSDK, these typedefs
-// are not there, so better define them, just in case...
-#ifndef LongToPtr
-#define DWORD_PTR DWORD
-#endif
-
-#pragma warning (push)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-#include "../../include/m_chat.h"
-#pragma warning (pop)
-
-#define MAX_BUF 256 // Buffer for topic-string
-
-typedef struct {
- HANDLE hContact;
- TCHAR who[33];
- TCHAR szRole[12];
-} gchat_contact;
-
-typedef struct {
- TCHAR* szChatName; // name of chat session
- gchat_contact* mJoinedContacts; // contacts
- int mJoinedCount; // contacts count
-} gchat_contacts;
-
-int ChatInit(WPARAM, LPARAM);
-int __cdecl ChatStart(char *szChatId, BOOL bJustCreate);
-gchat_contacts *GetChat(TCHAR *szChatId);
-HANDLE find_chat(TCHAR *chatname);
-#ifdef _UNICODE
-HANDLE find_chatA(char *chatname);
-#else
-#define find_chatA find_chat
-#endif
-void RemChatContact(gchat_contacts*, const TCHAR*);
-gchat_contact *GetChatContact(gchat_contacts *gc, const TCHAR *who);
-int AddMembers(char*);
-void AddMembersThread(char *szSkypeMsg);
-void RemChat(TCHAR *szChatId);
-int GCEventHook (WPARAM, LPARAM);
-int GCMenuHook (WPARAM, LPARAM);
-void KillChatSession(GCDEST*);
-INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam);
-INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM lParam);
-void GCInit(void);
-void GCExit(void);
-void SetChatTopic (TCHAR *szChatId, TCHAR *szTopic, BOOL bSet);
diff --git a/protocols/Skype/m_popup.h b/protocols/Skype/m_popup.h
deleted file mode 100644
index 243c8ac1b6..0000000000
--- a/protocols/Skype/m_popup.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
-===============================================================================
- PopUp plugin
-Plugin Name: PopUp
-Plugin authors: Luca Santarelli aka hrk (hrk@users.sourceforge.net)
- Victor Pavlychko aka zazoo (zazoo@ua.fm)
-===============================================================================
-The purpose of this plugin is to give developers a common "platform/interface"
-to show PopUps. It is born from the source code of NewStatusNotify, another
-plugin I've made.
-
-Remember that users *must* have this plugin enabled, or they won't get any
-popup. Write this in the requirements, do whatever you wish ;-)... but tell
-them!
-===============================================================================
-*/
-#ifndef M_POPUP_H
-#define M_POPUP_H
-
-/*
-NOTE! Since Popup 1.0.1.2 there is a main meun group called "PopUps" where I
-have put a "Enable/Disable" item. You can add your own "enable/disable" items
-by adding these lines before you call MS_CLIST_ADDMAINMENUITEM:
-mi.pszPopUpName = Translate("PopUps");
-mi.position = 0; //You don't need it and it's better if you put it to zero.
-*/
-
-//#define MAX_CONTACTNAME 32
-//#define MAX_SECONDLINE 40
-#define MAX_CONTACTNAME 2048
-#define MAX_SECONDLINE 2048
-
-#define POPUP_USE_SKINNED_BG 0xffffffff
-
-//This is the basic data you'll need to fill and pass to the service function.
-typedef struct {
- HANDLE lchContact; //Handle to the contact, can be NULL (main contact).
- HICON lchIcon; //Handle to a icon to be shown. Cannot be NULL.
- char lpzContactName[MAX_CONTACTNAME]; //This is the contact name or the first line in the plugin. Cannot be NULL.
- char lpzText[MAX_SECONDLINE]; //This is the second line text. Users can choose to hide it. Cannot be NULL.
- COLORREF colorBack; //COLORREF to be used for the background. Can be NULL, default will be used.
- COLORREF colorText; //COLORREF to be used for the text. Can be NULL, default will be used.
- WNDPROC PluginWindowProc; //Read below. Can be NULL; default will be used.
- void * PluginData; //Read below. Can be NULL.
-} POPUPDATA, * LPPOPUPDATA;
-
-typedef struct {
- HANDLE lchContact;
- HICON lchIcon;
- char lpzContactName[MAX_CONTACTNAME];
- char lpzText[MAX_SECONDLINE];
- COLORREF colorBack; //Set background to POPUP_USE_SKINNED_BG to turn on skinning
- COLORREF colorText;
- WNDPROC PluginWindowProc;
- void * PluginData;
- int iSeconds; //Custom delay time in seconds. -1 means "forever", 0 means "default time".
- LPCTSTR lpzClass; //PopUp class. Used with skinning. See PopUp/AddClass for details
- COLORREF skinBack; //Background color for colorizable skins
- char cZero[16 - sizeof(LPCTSTR) - sizeof(COLORREF)];
- //some unused bytes which may come useful in the future.
-} POPUPDATAEX, *LPPOPUPDATAEX;
-
-/*
-When you call MS_POPUP_ADDPOPUP, my plugin will check if the given POPUPDATA structure is filled with acceptable values. If not, the data will be rejected and no popup will be shown.
-
-- lpzText should be given, because it's really bad if a user chooses to have the second line displayed
-and it's empty :-) Just write it and let the user choose if it will be displayed or not.
-
-- PluginWindowProc is a WNDPROC address you have to give me. Why? What? Where? Calm down 8)
-My plugin will take care of the creation of the popup, of the destruction of the popup, of the come into
-view and the hiding of the popup. Transparency, animations... all this stuff.
-My plugin will not (as example) open the MessageWindow when you left click on a popup.
-Why? Because I don't know if your popup desires to open the MessageWindow :))))
-This means that you need to make a WNDPROC which takes care of the WM_messages you need.
-For example, WM_COMMAND or WM_CONTEXTMENU or WM_LMOUSEUP or whatever.
-At the end of your WNDPROC remember to "return DefWindowProc(hwnd, msg, wParam, lParam);"
-When you process a message that needs a return value (an example could be WM_CTLCOLORSTATIC,
-but you don't need to catch it 'cause it's my plugin's job), simply return the nedeed value. :)
-The default WNDPROC does nothing.
-
-- PluginData is a pointer to a void, which means a pointer to anything. You can make your own structure
-to store the data you need (example: a status information, a date, your name, whatever) and give me a
-pointer to that struct.
-You will need to destroy that structure and free the memory when the PopUp is going to be destroyed. You'll know this when you receive a UM_FREEPLUGINDATA. The name tells it all: free your own plugin data.
-
-Appendix A: Messages my plugin will handle and your WNDPROC will never see.
-WM_CREATE, WM_DESTROY, WM_TIMER, WM_ERASEBKGND
-WM_CTLCOLOR* [whatever it may be: WM_CTLCOLORDLG, WM_CTLCOLORSTATIC...]
-WM_PAINT, WM_PRINT, WM_PRINTCLIENT
-
-Appendix B: "What do I need to do?!?".
-Here is an example in C.
-
-//Your plugin is in /plugins/myPlugin/ or in miranda32/something/
-#include "../../plugins/PopUp/m_popup.h"
-
-Define your own plugin data if you need it. In this example, we need it and we'll use NewStatusNotify as example: thsi plugin shows a popup when someone in your contact list changes his/hers status. We'll need to know his status, both current and old one.
-typedef struct {
- WORD oldStatus;
- WORD newStatus;
-} MY_PLUGIN_DATA;
-
-When we need to show the popup, we do:
-{
- POPUPDATA ppd;
- hContact = A_VALID_HANDLE_YOU_GOT_FROM_SOMEWHERE;
- hIcon = A_VALID_HANDLE_YOU_GOT_SOMEWHERE;
- char * lpzContactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lhContact,0);
- //99% of the times you'll just copy this line.
- //1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
- char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
- COLORREF colorBack = GetSysColor(COLOR_BTNFACE); //The colour of Miranda's option Pages (and many other windows...)
- COLORREF colorText = RGB(255,255,255); //White.
- MY_PLUGIN_DATA * mpd = (MY_PLUGIN_DATA*)malloc(sizeof(MY_PLUGIN_DATA));
-
- ZeroMemory(ppd, sizeof(ppd)); //This is always a good thing to do.
- ppd.lchContact = (HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = hIcon;
- lstrcpy(ppd.lpzContactName, lpzContactName);
- lstrcpy(ppd.lpzText, lpzText);
- ppd.colorBack = colorBack;
- ppd.colorText = colorText;
- ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
-
- //Now the "additional" data.
- mpd->oldStatus = ID_STATUS_OFFLINE;
- mpd->newStatus = ID_STATUS_ONLINE;
-
- //Now that the plugin data has been filled, we add it to the PopUpData.
- ppd.PluginData = mpd;
-
- //Now that every field has been filled, we want to see the popup.
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
-}
-
-Obviously, you have previously declared some:
-static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message) {
- case WM_COMMAND:
- if ((HIWORD)wParam == STN_CLICKED) { //It was a click on the Popup.
- PUDeletePopUp(hWnd);
- return TRUE;
- }
- break;
- case UM_FREEPLUGINDATA: {
- MY_PLUGIN_DATA * mpd = NULL;
- mpd = (MY_PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)mpd);
- if (mdp > 0) free(mpd);
- return TRUE; //TRUE or FALSE is the same, it gets ignored.
- }
- default:
- break;
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-*/
-
-/*
-Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
-wParam = (WPARAM)(*POPUPDATA)PopUpDataAddress
-lParam = 0
-Returns: > 0 on success, 0 if creation went bad, -1 if the PopUpData contained unacceptable values.
-NOTE: it returns -1 if the PopUpData was not valid, if there were already too many popups, if the module was disabled.
-Otherwise, it can return anything else...
-*/
-#define MS_POPUP_ADDPOPUP "PopUp/AddPopUp"
-static int __inline PUAddPopUp(POPUPDATA* ppdp) {
- return CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp,0);
-}
-
-#define MS_POPUP_ADDPOPUPEX "PopUp/AddPopUpEx"
-static int __inline PUAddPopUpEx(POPUPDATAEX* ppdp) {
- return CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)ppdp,0);
-}
-
-/*
-Returns the handle to the contact associated to the specified PopUpWindow.
-You will probably need to know this handle inside your WNDPROC. Exampole: you want to open the MessageWindow. :-)
-Call MS_POPUP_GETCONTACT on the hWnd you were given in the WNDPROC.
-wParam = (WPARAM)(HWND)hPopUpWindow
-lParam = 0;
-Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure.
-*/
-#define MS_POPUP_GETCONTACT "PopUp/GetContact"
-static HANDLE __inline PUGetContact(HWND hPopUpWindow) {
- return (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopUpWindow,0);
-}
-
-/*
-wParam = (WPARAM)(HWND)hPopUpWindow
-lParam = (LPARAM)(PLUGINDATA*)PluginDataAddress;
-Returns: the address of the PLUGINDATA structure. Can return NULL, meaning nothing was given. -1 means failure.
-IMPORTANT NOTE: it doesn't seem to work if you do:
-CallService(..., (LPARAM)aPointerToAStruct);
-and then use that struct.
-Do this, instead:
-aPointerToStruct = CallService(..., (LPARAM)aPointerToAStruct);
-and it will work. Just look at the example I've written above (PopUpDlgProc).
-*/
-#define MS_POPUP_GETPLUGINDATA "PopUp/GetPluginData"
-static void __inline * PUGetPluginData(HWND hPopUpWindow) {
- long * uselessPointer = NULL;
- return (void*)CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hPopUpWindow,(LPARAM)uselessPointer);
-}
-
-/*
-wParam = 0
-lParam = 0
-Returns: 0 if the user has chosen not to have the second line, 1 if he choose to have the second line.
-*/
-#define MS_POPUP_ISSECONDLINESHOWN "PopUp/IsSecondLineShown"
-static BOOL __inline PUIsSecondLineShown() {
- return (BOOL)CallService(MS_POPUP_ISSECONDLINESHOWN,0,0);
-}
-
-/*
-Requests an action or an answer from PopUp module.
-wParam = (WPARAM)wpQuery
-returns 0 on success, -1 on error, 1 on stupid calls ;-)
-*/
-#define PUQS_ENABLEPOPUPS 1 //returns 0 if state was changed, 1 if state wasn't changed
-#define PUQS_DISABLEPOPUPS 2 // " "
-#define PUQS_GETSTATUS 3 //Returns 1 (TRUE) if popups are enabled, 0 (FALSE) if popups are disabled.
-
-#define MS_POPUP_QUERY "PopUp/Query"
-
-/*
-UM_FREEPLUGINDATA
-wParam = lParam = 0. Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
-*/
-#define UM_FREEPLUGINDATA (WM_USER + 0x0200)
-
-/*
-UM_DESTROYPOPUP
-wParam = lParam = 0. Send this message when you want to destroy the popup, or use the function below.
-*/
-#define UM_DESTROYPOPUP (WM_USER + 0x0201)
-static int __inline PUDeletePopUp(HWND hWndPopUp) {
- return (int)SendMessage(hWndPopUp, UM_DESTROYPOPUP,0,0);
-}
-
-/*
-UM_INITPOPUP
-wParam = (WPARAM)(HWND)hPopUpWindow (but this is useless, since I'll directly send it to your hPopUpWindow
-lParam = 0.
-This message is sent to the PopUp when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
-Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
-Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
-*/
-#define UM_INITPOPUP (WM_USER + 0x0202)
-
-/*
-wParam = (WPARAM)(HWND)hPopUpWindow
-lParam = (LPARAM)(char*)lpzNewText
-returns: > 0 for success, -1 for failure, 0 if the failure is due to second line not being shown. (but you could call PUIsSecondLineShown() before changing the text...)
-Changes the text displayed in the second line of the popup.
-*/
-#define MS_POPUP_CHANGETEXT "PopUp/Changetext"
-static int __inline PUChangeText(HWND hWndPopUp, LPCTSTR lpzNewText) {
- return (int)CallService(MS_POPUP_CHANGETEXT, (WPARAM)hWndPopUp, (LPARAM)lpzNewText);
-}
-
-/*
-This is mainly for developers.
-Shows a warning message in a PopUp. It's useful if you need a "MessageBox" like function, but you don't want a modal window (which will interfere with a DialogProcedure. MessageBox steals focus and control, this one not.
-wParam = (char*) lpzMessage
-lParam = 0;
-Returns: 0 if the popup was shown, -1 in case of failure.
-*/
-#define SM_WARNING 0x01 //Triangle icon.
-#define SM_NOTIFY 0x02 //Exclamation mark icon.
-#define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage"
-
-static int __inline PUShowMessage(char* lpzText, BYTE kind) {
- return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind);
-}
-
-/*
-Each skinned popup (e.g. with colorBack == POPUP_USE_SKINNED_BG) should have
-class set. Then you can choose separate skin for each class (for example, you
-can create separate class for your plugin and use it for all ypu popups. User
-would became able to choose skin for your popups independently from others)
-
-You have to register popup class before using it. To do so call "PopUp/AddClass"
-with lParam = (LPARAM)(const char *)popUpClassName.
-
-All class names are translated (via Translate()) before being added to list. You
-should use english names for them.
-
-There are three predefined classes and one for backward compatability.
-
-Note that you can add clases after popup wal loaded, e.g. you shoul intercept
-ME_SYSTEM_MODULESLOADED event
-*/
-#define MS_POPUP_ADDCLASS "PopUp/AddClass"
-#define POPUP_CLASS_DEFAULT "Default"
-#define POPUP_CLASS_WARNING "Warning"
-#define POPUP_CLASS_NOTIFY "Notify"
-#define POPUP_CLASS_OLDAPI "PopUp 1.0.1.x compatability" // for internal purposes
-
-static void __inline PUAddClass(const char *lpzClass){
- CallService(MS_POPUP_ADDCLASS, 0, (LPARAM)lpzClass);
-}
-
-#endif
diff --git a/protocols/Skype/m_toptoolbar.h b/protocols/Skype/m_toptoolbar.h
deleted file mode 100644
index 6b1a0182be..0000000000
--- a/protocols/Skype/m_toptoolbar.h
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#ifndef M_TOPTOOLBAR_H
-#define M_TOPTOOLBAR_H
-
-//button flags
-#define TTBBF_DISABLED 1
-#define TTBBF_VISIBLE 2
-#define TTBBF_PUSHED 4
-#define TTBBF_SHOWTOOLTIP 8
-#define TTBBF_DRAWBORDER 16//draw border for bitmap,bitmap must be WxH 16x12
-#define TTBBF_ISSEPARATOR 32
-
-//for internal launch buttons
-#define TTBBF_ISLBUTTON 64
-
-typedef struct {
- int cbSize;
- HBITMAP hbBitmapUp;
- HBITMAP hbBitmapDown;
- char *pszServiceUp;
- char *pszServiceDown;
- DWORD dwFlags;
- LPARAM lParamUp;
- WPARAM wParamUp;
- LPARAM lParamDown;
- WPARAM wParamDown;
- char *name;
-
-} TTBButton, * lpTTBButton;
-
-//=== EVENTS ===
-/*
-toptoolbar/moduleloaded event
-wParam = lParam = 0
-Called when the toolbar services are available
-
-!!!Warning you may work with TTB services only in this event or later.
-
-*/
-#define ME_TTB_MODULELOADED "TopToolBar/ModuleLoaded"
-
-
-
-//=== SERVICES ===
-/*
-toptoolbar/addbutton service
-wparam = (TTBButton*)lpTTBButton
-lparam = 0
-returns: hTTBButton - handle of added button on success, -1 on failure.
-*/
-#define MS_TTB_ADDBUTTON "TopToolBar/AddButton"
-
-/*
-toptoolbar/removebutton service
-wparam = (HANDLE)hTTButton
-lparam = 0
-returns: 0 on success, -1 on failure.
-*/
-#define MS_TTB_REMOVEBUTTON "TopToolBar/RemoveButton"
-
-/*
-toptoolbar/setstate service
-wparam = (HANDLE)hTTButton
-lparam = (LPARAM) state
-returns: 0 on success, -1 on failure.
-*/
-#define TTBST_PUSHED 1
-#define TTBST_RELEASED 2
-
-#define MS_TTB_SETBUTTONSTATE "TopToolBar/SetState"
-
-/*
-toptoolbar/getstate service
-wparam = (HANDLE)hTTButton
-lparam = 0
-returns: state on success, -1 on failure.
-*/
-#define MS_TTB_GETBUTTONSTATE "TopToolBar/GetState"
-
-/*
-toptoolbar/getoptions service
-(HIWORD)wparam = (HANDLE)hTTButton
-(LOWORD)wparam = TTBO_FLAG
-lparam = 0,or lparam=lpTTBButton if flag=TTBO_ALLDATA
-returns: value on success, -1 on failure.
-*/
-#define TTBO_FLAGS 0 //get/set all flags
-#define TTBO_POS 1 //position
-#define TTBO_WIDTH 2 //not impemented
-#define TTBO_HEIGHT 3 //not impemented
-#define TTBO_TIPNAME 4 //tool tip name
-#define TTBO_ALLDATA 5 //change all data via lparam=lpTTBButton
-
-
-#define MS_TTB_GETBUTTONOPTIONS "TopToolBar/GetOptions"
-
-/*
-toptoolbar/setoptions service
-(HIWORD)wparam = (HANDLE)hTTButton
-(LOWORD)wparam = TTBO_FLAG
-lparam = value
-returns: 1 on success, -1 on failure.
-*/
-#define MS_TTB_SETBUTTONOPTIONS "TopToolBar/SetOptions"
-
-
-#endif \ No newline at end of file
diff --git a/protocols/Skype/make.bat b/protocols/Skype/make.bat
deleted file mode 100644
index 0821b0041f..0000000000
--- a/protocols/Skype/make.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-cmd /c make_w32
-cmd /c make_w64
-cmd /c make_debug_w32
-cmd /c make_debug_w64
-pause
-deploy
diff --git a/protocols/Skype/make_w32.bat b/protocols/Skype/make_w32.bat
deleted file mode 100644
index ebcd4cfcb1..0000000000
--- a/protocols/Skype/make_w32.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-call "F:\Programme\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
-nmake -f Skype_protocol.mak CFG="Win32 Release" clean
-nmake -f Skype_protocol.mak CFG="Win32 Release"
-nmake -f Skype_protocol.mak CFG="Win32 UNICODE Release" clean
-nmake -f Skype_protocol.mak CFG="Win32 UNICODE Release"
diff --git a/protocols/Skype/make_w64.bat b/protocols/Skype/make_w64.bat
deleted file mode 100644
index 619679433c..0000000000
--- a/protocols/Skype/make_w64.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-call f:\PlatformSDK\SetEnv /X64 /RETAIL
-rem There is no ANSI x64 Miranda build
-rem nmake -f Skype_protocol.mak CFG="Win64 Release" clean
-rem nmake -f Skype_protocol.mak CFG="Win64 Release"
-nmake -f Skype_protocol.mak CFG="Win64 UNICODE Release" clean
-nmake -f Skype_protocol.mak CFG="Win64 UNICODE Release"
diff --git a/protocols/Skype/memlist.c b/protocols/Skype/memlist.c
deleted file mode 100644
index 3d880feb23..0000000000
--- a/protocols/Skype/memlist.c
+++ /dev/null
@@ -1,248 +0,0 @@
-// The omnipresent memory list, WIN32 implementation, thread safe
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "memlist.h"
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-struct _tagLIST
-{
- unsigned int uiCount;
- unsigned int uiCapacity;
- void **apStorage;
- HANDLE hHeap;
- CRITICAL_SECTION cs;
-};
-
-
-TYP_LIST *List_Init(unsigned int uiCapacity)
-{
- HANDLE hHeap = GetProcessHeap();
- TYP_LIST *pstHandle;
-
- pstHandle = (TYP_LIST *)HeapAlloc(hHeap, 0, sizeof(TYP_LIST));
- if (!pstHandle) return NULL;
- pstHandle->uiCount = 0;
- pstHandle->uiCapacity = uiCapacity;
- if (uiCapacity == 0)
- pstHandle->apStorage = NULL;
- else
- {
- pstHandle->apStorage = (void **)HeapAlloc(hHeap, 0, sizeof(void *)*uiCapacity);
- if (!pstHandle->apStorage)
- {
- HeapFree (hHeap, 0, pstHandle);
- return NULL;
- }
- }
- pstHandle->hHeap = hHeap;
- InitializeCriticalSection (&pstHandle->cs);
- return pstHandle;
-}
-
-void List_Exit(TYP_LIST *pstHandle)
-{
- if (pstHandle->apStorage)
- HeapFree (pstHandle->hHeap, 0, pstHandle->apStorage);
- DeleteCriticalSection (&pstHandle->cs);
- HeapFree (pstHandle->hHeap, 0, pstHandle);
-}
-
-BOOL List_Push(TYP_LIST *pstHandle, void *pItem)
-{
- return List_InsertElementAt(pstHandle, pItem,pstHandle->uiCount);
-}
-
-void *List_Pop (TYP_LIST *pstHandle)
-{
- if (pstHandle->uiCount)
- return List_RemoveElementAt(pstHandle ,pstHandle->uiCount-1);
- else return NULL;
-}
-
-BOOL List_InsertElementAt(TYP_LIST *pstHandle, void *pItem, unsigned int uiPos)
-{
- unsigned int uiStep;
- void **apNewStorage;
-
- EnterCriticalSection (&pstHandle->cs);
- if (uiPos > pstHandle->uiCount)
- uiPos = pstHandle->uiCount;
-
- if (pstHandle->uiCount >= pstHandle->uiCapacity)
- {
- uiStep = pstHandle->uiCount*2;
- if (uiStep < 8) uiStep = 8;
-
- if (!pstHandle->apStorage)
- apNewStorage = (void **)HeapAlloc(pstHandle->hHeap, 0, sizeof(void *)*uiStep);
- else
- apNewStorage = HeapReAlloc (pstHandle->hHeap, 0, pstHandle->apStorage, sizeof(void *)*uiStep);
- if (!apNewStorage)
- {
- LeaveCriticalSection (&pstHandle->cs);
- return FALSE;
- }
- pstHandle->apStorage = apNewStorage;
- pstHandle->uiCapacity = uiStep;
- }
-
- if (uiPos<pstHandle->uiCount)
- MoveMemory (&pstHandle->apStorage[uiPos+1], &pstHandle->apStorage[uiPos], (pstHandle->uiCount-uiPos)*sizeof(void*));
- pstHandle->apStorage[uiPos] = pItem;
- pstHandle->uiCount++;
- LeaveCriticalSection (&pstHandle->cs);
- return TRUE;
-}
-
-void *List_RemoveElementAt(TYP_LIST *pstHandle, unsigned int uiPos)
-{
- void *pRet;
-
- EnterCriticalSection (&pstHandle->cs);
- pRet = pstHandle->apStorage[uiPos];
- if (uiPos<pstHandle->uiCount)
- MoveMemory (&pstHandle->apStorage[uiPos], &pstHandle->apStorage[uiPos+1], (pstHandle->uiCount-uiPos)*sizeof(void*));
- pstHandle->uiCount--;
- LeaveCriticalSection (&pstHandle->cs);
- return pRet;
-}
-
-unsigned int List_Count(TYP_LIST *pstHandle)
-{
- return pstHandle->uiCount;
-}
-
-void *List_ElementAt(TYP_LIST *pstHandle,unsigned int uiPos)
-{
- void *pRet = NULL;
-
- EnterCriticalSection (&pstHandle->cs);
- if (uiPos < pstHandle->uiCount)
- pRet = pstHandle->apStorage[uiPos];
- LeaveCriticalSection (&pstHandle->cs);
- return pRet;
-}
-
-void *List_Top(TYP_LIST *pstHandle)
-{
- if (pstHandle->uiCount)
- return List_ElementAt (pstHandle, pstHandle->uiCount-1);
- else return NULL;
-}
-
-#ifdef _INC_STDLIB
-void List_Sort(TYP_LIST *pstHandle, int (*pFunc)(const void*,const void*))
-{
- EnterCriticalSection (&pstHandle->cs);
- qsort(pstHandle->apStorage,pstHandle->uiCount,sizeof(void *),pFunc);
- LeaveCriticalSection (&pstHandle->cs);
-}
-#endif
-
-
-void List_FreeElements(TYP_LIST *pstHandle)
-{
- void *pEntry;
- HANDLE hHeap = GetProcessHeap();
-
- while (pEntry = List_Pop(pstHandle))
- HeapFree (hHeap, 0, pEntry);
-}
-
-BOOL List_BinarySearch(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- const void *pstPToFind,int *piPToInsert)
-{
- unsigned int
- iStart,
- iEnd,
- iInd;
- int iRetCompare;
-
- if (hPList == NULL)
- {
- *piPToInsert = 0;
- return FALSE;
- }
-
- iStart = 0;
- if (hPList->uiCount == 0)
- {
- *piPToInsert = 0;
- return FALSE;
- }
- EnterCriticalSection (&hPList->cs);
- iEnd = hPList->uiCount-1;
-
- iRetCompare = (*pPFunc)(hPList->apStorage[0],pstPToFind);
- if (iRetCompare >= 0)
- {
- *piPToInsert = 0;
- LeaveCriticalSection (&hPList->cs);
- return iRetCompare == 0;
- }
-
- iRetCompare = (*pPFunc)(hPList->apStorage[iEnd],pstPToFind);
- if (iRetCompare < 0)
- {
- *piPToInsert = hPList->uiCount;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- }
- else if (iRetCompare == 0)
- {
- *piPToInsert = hPList->uiCount-1;
- LeaveCriticalSection (&hPList->cs);
- return TRUE;
- }
-
- // Otherwise C4702: unreachable code below
- #pragma warning (suppress: 4127) // conditional expression is constant
- while(1)
- {
- switch (iEnd-iStart)
- {
- case 0:
- *piPToInsert = iStart;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- case 1:
- *piPToInsert = iStart+1;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- default:
- iInd = iStart + (iEnd-iStart)/2;
- iRetCompare = (*pPFunc)(hPList->apStorage[iInd],pstPToFind);
- if (iRetCompare == 0)
- {
- *piPToInsert = iInd;
- LeaveCriticalSection (&hPList->cs);
- return TRUE;
- }
- if (iRetCompare < 0)
- iStart = iInd;
- else
- iEnd = iInd;
- break;
- }
- }
-
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
-}
-
-BOOL List_InsertSort(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- void *pItem)
-{
- int iListInd;
-
- if (!List_BinarySearch(hPList,pPFunc,(void *)pItem,&iListInd))
- {
- return List_InsertElementAt (hPList, pItem, iListInd);
- }
- return FALSE;
-}
-
-
diff --git a/protocols/Skype/memlist.h b/protocols/Skype/memlist.h
deleted file mode 100644
index de4d52bdd1..0000000000
--- a/protocols/Skype/memlist.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __MEMLIST_H__
-#define __MEMLIST_H__
-
-// Optional for programs linked against CRT:
-// Remove this if you want a proper plain WIN32-App
-//#include <stdlib.h>
-
-struct _tagLIST;
-typedef struct _tagLIST TYP_LIST;
-
-TYP_LIST *List_Init(unsigned int uiCapacity);
-void List_Exit(TYP_LIST *pstHandle);
-BOOL List_Push(TYP_LIST *pstHandle, void *pItem);
-void *List_Pop (TYP_LIST *pstHandle);
-BOOL List_InsertElementAt(TYP_LIST *pstHandle, void *pItem, unsigned int uiPos);
-void *List_RemoveElementAt(TYP_LIST *pstHandle, unsigned int uiPos);
-unsigned int List_Count(TYP_LIST *pstHandle);
-void *List_ElementAt(TYP_LIST *pstHandle,unsigned int uiPos);
-void *List_Top(TYP_LIST *pstHandle);
-void List_FreeElements(TYP_LIST *pstHandle);
-BOOL List_BinarySearch(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- const void *pstPToFind,int *piPToInsert);
-BOOL List_InsertSort(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- void *pItem);
-
-#ifdef _INC_STDLIB
-void List_Sort(TYP_LIST *pstHandle, int (*pFunc)(const void*,const void*));
-#else
-#undef RtlMoveMemory
-NTSYSAPI
-VOID
-NTAPI
-RtlMoveMemory (
- VOID UNALIGNED *Destination,
- CONST VOID UNALIGNED *Source,
- SIZE_T Length
- );
-
-#endif
-
-#endif \ No newline at end of file
diff --git a/protocols/Skype/msglist.c b/protocols/Skype/msglist.c
deleted file mode 100644
index 113d6e5a5d..0000000000
--- a/protocols/Skype/msglist.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "memlist.h"
-#include "debug.h"
-#include "msglist.h"
-
-#define MSGLIST_TIMEOUT 1800 // Chatmessage references will be kept for 30 minutes
-
-static TYP_LIST *m_hMsgList = NULL;
-
-static int CmpProc(const void *pstPElement,const void *pstPToFind)
-{
- return (DWORD)pstPToFind - ((TYP_MSGLENTRY*)pstPElement)->uMsgNum;
-}
-
-void MsgList_Init(void)
-{
- m_hMsgList = List_Init(128);
-}
-
-void MsgList_Exit(void)
-{
- if (!m_hMsgList) return;
- List_FreeElements (m_hMsgList);
- List_Exit(m_hMsgList);
- m_hMsgList = NULL;
-}
-
-TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, HANDLE hEvent)
-{
- TYP_MSGLENTRY *pEntry;
- int iListInd;
- BOOL bFound;
-
- LOG (("MsgList_Add (%d, %08X)", uMsgNum, hEvent));
- if (!m_hMsgList || !hEvent) return FALSE;
- bFound = List_BinarySearch(m_hMsgList,CmpProc,(void *)uMsgNum,&iListInd);
- if (!bFound) pEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYP_MSGLENTRY));
- else pEntry = List_ElementAt (m_hMsgList, iListInd);
- if (!pEntry) return NULL;
- pEntry->uMsgNum = uMsgNum;
- pEntry->hEvent = hEvent;
- pEntry->tEdited = 0;
- time(&pEntry->t);
- if (!bFound) return List_InsertElementAt (m_hMsgList, pEntry, iListInd)?pEntry:NULL;
- return pEntry;
-}
-
-
-TYP_MSGLENTRY *MsgList_FindMessage(DWORD uMsgNum)
-{
- TYP_MSGLENTRY *pEntry;
- int iPos;
-
- LOG (("MsgList_FindEvent (%d)", uMsgNum));
- if (m_hMsgList && List_BinarySearch(m_hMsgList, CmpProc, (void*)uMsgNum, &iPos))
- {
- pEntry = List_ElementAt (m_hMsgList, iPos);
- time(&pEntry->t); // Touch it, so that it doesn't get thrown away too soon
- LOG (("MsgList_FindEvent(%d): %08X", uMsgNum, pEntry->hEvent));
- return pEntry;
- }
- return NULL;
-}
-
-void MsgList_CollectGarbage(void)
-{
- unsigned int i;
- TYP_MSGLENTRY *pEntry;
- time_t t;
-
- if (!m_hMsgList) return;
- time(&t);
- t-=MSGLIST_TIMEOUT;
- for (i=0; i<List_Count(m_hMsgList); i++)
- {
- pEntry = List_ElementAt (m_hMsgList, i);
- if (pEntry->t < t)
- {
- LOG (("MsgList_CollectGarbage throwing out msg %d", pEntry->uMsgNum));
- HeapFree (GetProcessHeap(), 0, List_RemoveElementAt (m_hMsgList, i));
- i--;
- }
- }
-}
-
diff --git a/protocols/Skype/msglist.h b/protocols/Skype/msglist.h
deleted file mode 100644
index 66a271ef18..0000000000
--- a/protocols/Skype/msglist.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <time.h>
-
-typedef struct {
- DWORD uMsgNum;
- HANDLE hEvent;
- HANDLE hMetaEvent;
- time_t t;
- time_t tEdited;
-} TYP_MSGLENTRY;
-
-void MsgList_Init(void);
-void MsgList_Exit(void);
-TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, HANDLE hEvent);
-TYP_MSGLENTRY *MsgList_FindMessage(DWORD uMsgNum);
-void MsgList_CollectGarbage(void);
diff --git a/protocols/Skype/msgq.c b/protocols/Skype/msgq.c
deleted file mode 100644
index 48790e1c29..0000000000
--- a/protocols/Skype/msgq.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Implements a simple message queue for send and receive queue.
- * We could use memlist.c, but it's not efficient
- * enough for this purpose (would always memmove on removing first
- * element), therefore it's implemented as tail queue.
- */
-
-#include "skype.h"
-#include "msgq.h"
-#include "debug.h"
-
-
-void MsgQ_Init(TYP_MSGQ *q)
-{
- TAILQ_INIT(&q->l);
- InitializeCriticalSection (&q->cs);
-}
-
-void MsgQ_Exit(TYP_MSGQ *q)
-{
- struct MsgQueue *ptr;
-
- EnterCriticalSection(&q->cs);
- while (ptr=q->l.tqh_first)
- free(MsgQ_RemoveMsg(q, ptr));
- LeaveCriticalSection(&q->cs);
- DeleteCriticalSection (&q->cs);
-}
-
-BOOL MsgQ_Add(TYP_MSGQ *q, char *msg)
-{
- struct MsgQueue *ptr;
-
- if (!(ptr=(struct MsgQueue*)malloc(sizeof(struct MsgQueue))))
- return FALSE;
- ptr->message = _strdup(msg); // Don't forget to free!
- ptr->tAdded = SkypeTime(NULL);
- SkypeTime(&ptr->tReceived);
- EnterCriticalSection(&q->cs);
- TAILQ_INSERT_TAIL(&q->l, ptr, l);
- //LOG (("MsgQ_Add (%s) @%lu/%ld", msg, ptr->tReceived, ptr->tAdded));
- LeaveCriticalSection(&q->cs);
- return TRUE;
-}
-
-char *MsgQ_RemoveMsg(TYP_MSGQ *q, struct MsgQueue *ptr)
-{
- char *msg;
-
- if (!ptr) return NULL;
- TAILQ_REMOVE(&q->l, ptr, l);
- msg=ptr->message;
- free(ptr);
- return msg;
-}
-
-char *MsgQ_Get(TYP_MSGQ *q)
-{
- char *msg;
-
- EnterCriticalSection(&q->cs);
- msg=MsgQ_RemoveMsg(q, q->l.tqh_first);
- LeaveCriticalSection(&q->cs);
- return msg;
-}
-
-int MsgQ_CollectGarbage(TYP_MSGQ *q, time_t age)
-{
- struct MsgQueue *ptr;
- int i=0;
-
- EnterCriticalSection(&q->cs);
- ptr=q->l.tqh_first;
- while (ptr)
- {
- if (ptr->tAdded && SkypeTime(NULL)-ptr->tAdded>age)
- {
- struct MsgQueue *ptr_;
- LOG(("GarbageCollector throwing out message: %s", ptr->message));
- ptr_=ptr;
- ptr=ptr->l.tqe_next;
- free(MsgQ_RemoveMsg(q, ptr_));
- i++;
- continue;
- }
- ptr=ptr->l.tqe_next;
- }
- LeaveCriticalSection(&q->cs);
- return i;
-}
diff --git a/protocols/Skype/msgq.h b/protocols/Skype/msgq.h
deleted file mode 100644
index 4eb666944b..0000000000
--- a/protocols/Skype/msgq.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <time.h>
-
-// ----------------------------------------------------------------------
-// Stolen from *nix sys/queue.h
-// ----------------------------------------------------------------------
-/*
- * Tail queue definitions.
- */
-#define TAILQ_HEAD(name, type) \
-struct name { \
- struct type *tqh_first; /* first element */ \
- struct type **tqh_last; /* addr of last next element */ \
-}
-
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
-}
-
-
-/*
- * Tail queue functions.
- */
-#define TAILQ_INIT(head) { \
- (head)->tqh_first = NULL; \
- (head)->tqh_last = &(head)->tqh_first; \
-}
-
-#define TAILQ_INSERT_TAIL(head, elm, field) { \
- (elm)->field.tqe_next = NULL; \
- (elm)->field.tqe_prev = (head)->tqh_last; \
- *(head)->tqh_last = (elm); \
- (head)->tqh_last = &(elm)->field.tqe_next; \
-}
-
-#define TAILQ_REMOVE(head, elm, field) { \
- if (((elm)->field.tqe_next) != NULL) \
- (elm)->field.tqe_next->field.tqe_prev = \
- (elm)->field.tqe_prev; \
- else \
- (head)->tqh_last = (elm)->field.tqe_prev; \
- *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
-}
-// ----------------------------------------------------------------------
-
-struct MsgQueue {
- TAILQ_ENTRY(MsgQueue) l;
- char *message;
- time_t tAdded;
- time_t tReceived;
-};
-typedef struct
-{
- TAILQ_HEAD(tag_msgq, MsgQueue) l;
- CRITICAL_SECTION cs;
-} TYP_MSGQ;
-
-void MsgQ_Init(TYP_MSGQ *q);
-void MsgQ_Exit(TYP_MSGQ *q);
-BOOL MsgQ_Add(TYP_MSGQ *q, char *msg);
-char *MsgQ_RemoveMsg(TYP_MSGQ *q, struct MsgQueue *ptr);
-char *MsgQ_Get(TYP_MSGQ *q);
-int MsgQ_CollectGarbage(TYP_MSGQ *q, time_t age);
diff --git a/protocols/Skype/pthread.c b/protocols/Skype/pthread.c
deleted file mode 100644
index f9944257c2..0000000000
--- a/protocols/Skype/pthread.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: pthread.c,v 1.4 2003/12/19 12:53:36 gena01 Exp $
- *
- * Skype Miranda Plugin
- *
- * Authors: Gennady Feldman (aka Gena01)
- * Laurent Marechal (aka Peorth)
- *
- * Code borrowed for Skype plugin. Fixed to compile on Mingw by G.Feldman
- * Original Copyright (c) 2003 Robert Rainwater
- *
- * This code is under GPL and is based on AIM, MSN and Miranda source code.
- * I want to thank Robert Rainwater and George Hazan for their code and support
- * and for answering some of my questions during development of this plugin.
- */
-
-#include "skype.h"
-
-/* Gena01 - added some defined to fix compilation with mingw gcc */
-/* __try/__finally taken from abiword patch found on the web */
-#if 0
- #include <crtdbg.h>
-#else
-#define __try
-#define __except(x) if (0) /* don't execute handler */
-#define __finally
-
-#define _try __try
-#define _except __except
-#define _finally __finally
-#endif
-
-#include <excpt.h>
-
-struct pthread_arg
-{
- HANDLE hEvent;
- void (*threadcode) (void *);
- void *arg;
-};
-
-void pthread_r(struct pthread_arg *fa)
-{
- 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);
- }
-}
-
-unsigned long pthread_create(pThreadFunc parFunc, void *arg)
-{
- unsigned long rc;
- struct pthread_arg fa;
- fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- fa.threadcode = parFunc;
- fa.arg = arg;
- rc = _beginthread((pThreadFunc) pthread_r, 0, &fa);
- if ((unsigned long) -1L != rc) {
- WaitForSingleObject(fa.hEvent, INFINITE);
- }
- CloseHandle(fa.hEvent);
- return rc;
-}
-
diff --git a/protocols/Skype/pthread.h b/protocols/Skype/pthread.h
deleted file mode 100644
index 1c9f3e3924..0000000000
--- a/protocols/Skype/pthread.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * $Id: pthread.h,v 1.3 2003/10/05 04:03:05 gena01 Exp $
- *
- * Skype Miranda Plugin
- *
- * Authors: Gennady Feldman (aka Gena01)
- * Laurent Marechal (aka Peorth)
- *
- * Code borrowed for Skype plugin. Fixed to compile on Mingw by G.Feldman
- * Original Copyright (c) 2003 Robert Rainwater
- *
- * This code is under GPL and is based on AIM, MSN and Miranda source code.
- * I want to thank Robert Rainwater and George Hazan for their code and support
- * and for answering some of my questions during development of this plugin.
- */
-#ifndef PTHREAD_H
-#define PTHREAD_H
-
-unsigned long pthread_create(void (*threadcode) (void *), void *arg);
-typedef CRITICAL_SECTION pthread_mutex_t;
-#define pthread_mutex_init(pmutex) InitializeCriticalSection(pmutex)
-#define pthread_mutex_destroy(pmutex) DeleteCriticalSection(pmutex)
-#define pthread_mutex_lock(pmutex) EnterCriticalSection(pmutex)
-#define pthread_mutex_unlock(pmutex) LeaveCriticalSection(pmutex)
-
-#endif
diff --git a/protocols/Skype/readme.txt b/protocols/Skype/readme.txt
deleted file mode 100644
index 333f92d90a..0000000000
--- a/protocols/Skype/readme.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-Skype Protocol - Maybe we can call it beta now? ;)
-
-As so many people requested it, here is now a implementation of the Skype
-protocol for Miranda IM.
-Note, that this is just a wrapper for the Skype-API, which means that Skype
-has to be running while you use this plugin.
-The plugin should be able to launch Skype, if it is not running on startup.
-Please note, that I never coded a protocol-plugin for Miranda before, so
-expect it to be buggy and unstable, I hope I have some time to correct the
-severest bugs and to add more features soon.
-No warranty, whatsoever! I suggest that you back up your existing Miranda
-Database before using this plugin, just to be sure you have a backup if
-it runs amok ;-) Feel free to improve the ugly sourcecode.
-Please give me feedback, if it works for you, it would be interesting.
-
-NOTES - READ THEM CAREFULLY!
-----------------------------
-
- * You need Skype 1.0.0.97 or above in order to have access to the Skype API
- * You have to manually disable popup of messages in SKYPE, as there is
- currently no function in the API to do this
- Got to File/Options/Short messages and disable the checkboxes there
- Otherwise you would get all Skype-Messages twice (in Skype AND Miranda)
- * If you always get "Unknown event" when a call is incoming and you are using
- the NewEventNotify-plugin or Tabsrmm then go to the plugin's options
- (Sessions / Event Notifications / Announce events of type) and disable
- "other events" there.
- * Importing history for a contact can be launched by clickting "import History"
- in the context menu of a contact. The importing takes place in the background.
- AS soon, as it's finished, you will be notified by a messagebox.
- This feature is still buggy and quite a bit unpredictable.
- * There is a nice Iconset with the original Skype-Icons created by X-Byte
- Thanks for that. Grab it at http://dose.0wnz.at/Skype/Skype_icons.zip
- * Skype API bug: When you set Skype offline via API, the contacts stay online
- I made a Miranda-sie workaround for this now, but it's a Skype-API bug,
- not a plugin-bug
- * Skype API bug: when you rename Skypeout-contacts in Skype, their new nicks
- aren't sent correctly via the API, instead, the previous nick is sent and
- therefore the Miranda-name is not up-to-date after nick change.
- This is not a plugin bug either.
-BUGS
-----
-
- * To track bugs, you have to make a Debug-Build out from the source.
- The plugin then will log the Skype-API communication to a logfile
- called skype_log.txt so that we may se what caused the crash.
-
diff --git a/protocols/Skype/res/8060.ico b/protocols/Skype/res/8060.ico
deleted file mode 100644
index 0769ddb8b2..0000000000
--- a/protocols/Skype/res/8060.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/Copy of online.ico b/protocols/Skype/res/Copy of online.ico
deleted file mode 100644
index c9376943cb..0000000000
--- a/protocols/Skype/res/Copy of online.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/DND.ico b/protocols/Skype/res/DND.ico
deleted file mode 100644
index ace441c3ad..0000000000
--- a/protocols/Skype/res/DND.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/Invite.ico b/protocols/Skype/res/Invite.ico
deleted file mode 100644
index 12af3b8ab8..0000000000
--- a/protocols/Skype/res/Invite.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/NA.ico b/protocols/Skype/res/NA.ico
deleted file mode 100644
index 5bb7dba823..0000000000
--- a/protocols/Skype/res/NA.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/add.ico b/protocols/Skype/res/add.ico
deleted file mode 100644
index b0e9903bbe..0000000000
--- a/protocols/Skype/res/add.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/add2.ico b/protocols/Skype/res/add2.ico
deleted file mode 100644
index e7593bb787..0000000000
--- a/protocols/Skype/res/add2.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/auth.ico b/protocols/Skype/res/auth.ico
deleted file mode 100644
index 9bf01c59a4..0000000000
--- a/protocols/Skype/res/auth.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/away.ico b/protocols/Skype/res/away.ico
deleted file mode 100644
index 7993291dcc..0000000000
--- a/protocols/Skype/res/away.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/call.bmp b/protocols/Skype/res/call.bmp
deleted file mode 100644
index 7da6ac53cf..0000000000
--- a/protocols/Skype/res/call.bmp
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/call.ico b/protocols/Skype/res/call.ico
deleted file mode 100644
index 43516a3c0f..0000000000
--- a/protocols/Skype/res/call.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/chat.ico b/protocols/Skype/res/chat.ico
deleted file mode 100644
index cf6e01e93d..0000000000
--- a/protocols/Skype/res/chat.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/conference.ico b/protocols/Skype/res/conference.ico
deleted file mode 100644
index bd6b1518fb..0000000000
--- a/protocols/Skype/res/conference.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/error.ico b/protocols/Skype/res/error.ico
deleted file mode 100644
index e191cbf754..0000000000
--- a/protocols/Skype/res/error.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/hang_up.ico b/protocols/Skype/res/hang_up.ico
deleted file mode 100644
index dacfcd4935..0000000000
--- a/protocols/Skype/res/hang_up.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/history.ico b/protocols/Skype/res/history.ico
deleted file mode 100644
index c406120433..0000000000
--- a/protocols/Skype/res/history.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/hold.ico b/protocols/Skype/res/hold.ico
deleted file mode 100644
index 3ad69006a7..0000000000
--- a/protocols/Skype/res/hold.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/import.ico b/protocols/Skype/res/import.ico
deleted file mode 100644
index 863d45cd6b..0000000000
--- a/protocols/Skype/res/import.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/invisible.ico b/protocols/Skype/res/invisible.ico
deleted file mode 100644
index b734f6a495..0000000000
--- a/protocols/Skype/res/invisible.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/message.ico b/protocols/Skype/res/message.ico
deleted file mode 100644
index c4ca27be54..0000000000
--- a/protocols/Skype/res/message.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/occupied.ico b/protocols/Skype/res/occupied.ico
deleted file mode 100644
index a0baafec21..0000000000
--- a/protocols/Skype/res/occupied.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/offline.ico b/protocols/Skype/res/offline.ico
deleted file mode 100644
index e26af6fdec..0000000000
--- a/protocols/Skype/res/offline.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/online.ico b/protocols/Skype/res/online.ico
deleted file mode 100644
index ae1a3df64f..0000000000
--- a/protocols/Skype/res/online.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/pause.ico b/protocols/Skype/res/pause.ico
deleted file mode 100644
index de366073da..0000000000
--- a/protocols/Skype/res/pause.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/phone.ico b/protocols/Skype/res/phone.ico
deleted file mode 100644
index 1a13073ce6..0000000000
--- a/protocols/Skype/res/phone.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/resume.ico b/protocols/Skype/res/resume.ico
deleted file mode 100644
index 294bad488e..0000000000
--- a/protocols/Skype/res/resume.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/search.ico b/protocols/Skype/res/search.ico
deleted file mode 100644
index e28bef60e1..0000000000
--- a/protocols/Skype/res/search.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/skype.ico b/protocols/Skype/res/skype.ico
deleted file mode 100644
index b267bbb5fc..0000000000
--- a/protocols/Skype/res/skype.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/skypeout.ico b/protocols/Skype/res/skypeout.ico
deleted file mode 100644
index 6d135bae96..0000000000
--- a/protocols/Skype/res/skypeout.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/res/skyping.ico b/protocols/Skype/res/skyping.ico
deleted file mode 100644
index 59fdb4482d..0000000000
--- a/protocols/Skype/res/skyping.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Skype/resource.h b/protocols/Skype/resource.h
deleted file mode 100644
index 5f57feb9a3..0000000000
--- a/protocols/Skype/resource.h
+++ /dev/null
@@ -1,124 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by Skript1.rc
-//
-#define IDI_SKYPE 102
-#define IDI_ONLINE 104
-#define IDI_OFFLINE 105
-#define IDI_AWAY 128
-#define IDI_CHAT 129
-#define IDI_INVISIBLE 130
-#define IDI_NA 131
-#define IDI_DND 158
-#define IDI_OCCUPIED 159
-#define IDI_ADD 160
-#define IDI_IMPORT 161
-#define IDI_ERRORS 162
-#define IDI_MESSAGE 163
-#define IDI_CALL 164
-#define IDI_CALLSKYPEOUT 165
-#define IDI_HOLD 166
-#define IDI_RESUME 167
-#define IDI_HANGUP 168
-#define IDI_AVATAR 169
-#define IDD_OPTIONS 170
-#define IDI_INVITE 170
-#define IDD_DIAL 171
-#define IDB_CALL 172
-#define IDD_INPUTBOX 172
-#define IDD_CALLSTAT 173
-#define IDD_SETAVATAR 174
-#define IDD_OPT_DEFAULT 175
-#define IDD_OPT_PROXY 176
-#define IDD_SETDETAILS 177
-#define IDD_OPT_ADVANCED 178
-#define IDD_OPT_POPUP 179
-#define IDI_PHONE 1002
-#define IDC_SHUTDOWN 1004
-#define IDC_ENABLEMENU 1005
-#define IDC_UNLOADOFFLINE 1006
-#define IDC_USES2S 1007
-#define IDC_HOST 1008
-#define IDC_PORT 1009
-#define IDC_REQPASS 1010
-#define IDC_PASSWORD 1011
-#define IDC_USEPOPUP 1012
-#define IDC_GROUPCHAT 1014
-#define IDC_NOERRORS 1015
-#define IDC_CONNATTEMPTS 1016
-#define IDC_GROUPCHATREAD 1016
-#define IDC_SKYPEOUTSTAT 1018
-#define IDC_NUMBER 1019
-#define IDDIAL 1020
-#define IDC_KEEPSTATE 1021
-#define IDC_CLEANUP 1022
-#define IDC_JOIN 1023
-#define IDC_TIMEZONE 1023
-#define IDC_HOLD 1024
-#define IDC_SHOWDEFAULTAVATAR 1024
-#define IDC_HANGUP 1025
-#define IDC_IGNTZ 1025
-#define IDC_AVATAR 1026
-#define IDC_NOSKYPE3STATS 1026
-#define IDC_SETAVATAR 1027
-#define IDC_SHOWFULLNAME 1027
-#define IDC_DELETEAVATAR 1028
-#define IDC_STARTSKYPE 1029
-#define IDC_NOTRAY 1030
-#define IDC_NOSPLASH 1031
-#define IDC_MINIMIZED 1032
-#define IDC_TEXT 1033
-#define IDC_CUSTOMCOMMAND 1033
-#define IDC_OPTIONSTAB 1034
-#define IDC_REMOVEABLE 1034
-#define IDC_FULLNAME 1035
-#define IDC_DATAPATHO 1035
-#define IDC_BIRTHDAY 1036
-#define IDC_SECONDARY 1036
-#define IDC_SEX 1037
-#define IDC_CITY 1038
-#define IDC_COUNTRY 1039
-#define IDC_PROVINCE 1040
-#define IDC_HOMEPHONE 1041
-#define IDC_OFFICEPHONE 1042
-#define IDC_HOMEPAGE 1043
-#define IDC_SAVEDETAILS 1044
-#define IDC_COMMANDLINE 1045
-#define IDC_DATAPATH 1046
-#define IDC_POPUPINCOMING 1049
-#define IDC_PREVIEW 1050
-#define IDC_POPUPTEXTCOLOR 1051
-#define IDC_POPUPTIME 1052
-#define IDC_POPUPBACKCOLOR 1053
-#define IDC_USEWINCOLORS 1054
-#define IDC_POPUPERROR 1055
-#define IDC_USERNAME 1055
-#define IDC_PREVIEWERR 1056
-#define IDC_EDIT2 1056
-#define IDC_POPUPTIMEERR 1057
-#define IDC_POPUPBACKCOLORERR 1058
-#define IDC_POPUPTEXTCOLORERR 1059
-#define IDC_USEWINCOLORSERR 1060
-#define IDC_SUPPRESSCALLSUMMARYMESSAGE 1061
-#define IDC_AUTODETECTION 1062
-#define IDC_STATIC_HOST 1063
-#define IDC_STATIC_PORT 1064
-#define IDC_BROWSEDP 1065
-#define IDC_BROWSECMDL 1066
-#define IDC_STATIC_POPUPBACKCOLOR 1066
-#define IDC_STATIC_POPUPTEXTCOLOR 1067
-#define IDC_STATIC_POPUPTEXTCOLORERR 1068
-#define IDC_STATIC_POPUPBACKCOLORERR 1069
-#define IDC_STATIC_PATHINFO 1070
-#define IDC_STATIC_RESTART 1071
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 181
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1072
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/Skype/skype.c b/protocols/Skype/skype.c
deleted file mode 100644
index 1aea600d3f..0000000000
--- a/protocols/Skype/skype.c
+++ /dev/null
@@ -1,3465 +0,0 @@
-/*
-
-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.
-
-
-*/
-
-#include "skype.h"
-#include "debug.h"
-#include "skypeapi.h"
-#include "skypesvc.h"
-#include "contacts.h"
-#include "utf8.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "m_toptoolbar.h"
-#include "voiceservice.h"
-#include "msglist.h"
-#include "memlist.h"
-#include <sys/timeb.h>
-#ifndef INVALID_FILE_ATTRIBUTES
-#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
-#endif
-#ifdef _WIN64
-#pragma comment (lib, "bufferoverflowU.lib")
-#endif
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-struct MM_INTERFACE mmi;
-
-POPUPDATAT MessagePopup;
-
-// Exported Globals
-HWND hSkypeWnd=NULL, g_hWnd=NULL, hSkypeWndSecondary=NULL, hForbiddenSkypeWnd = NULL;
-HANDLE SkypeReady, SkypeMsgReceived, hInitChat=NULL, httbButton=NULL, FetchMessageEvent=NULL;
-BOOL SkypeInitialized=FALSE, MirandaShuttingDown=FALSE, PopupServiceExists=FALSE;
-BOOL UseSockets=FALSE, bSkypeOut=FALSE, bProtocolSet=FALSE, bIsImoproxy=FALSE;
-char skype_path[MAX_PATH], protocol=2, *pszProxyCallout=NULL, g_szProtoName[_MAX_FNAME]="SKYPE";
-int SkypeStatus=ID_STATUS_OFFLINE, hSearchThread=-1, receivers=1;
-long sendwatchers = 0, rcvwatchers = 0;
-UINT ControlAPIAttach, ControlAPIDiscover;
-LONG AttachStatus=-1;
-HINSTANCE hInst;
-HANDLE hProtocolAvatarsFolder;
-char DefaultAvatarsFolder[MAX_PATH+1];
-DWORD mirandaVersion;
-int hLangpack = 0;
-
-CRITICAL_SECTION RingAndEndcallMutex, QueryThreadMutex, TimeMutex;
-
-// Module Internal Globals
-PLUGINLINK *pluginLink;
-HANDLE MessagePumpReady;
-HANDLE hChatEvent=NULL, hChatMenu=NULL;
-HANDLE hEvInitChat=NULL, hBuddyAdded=NULL;
-HANDLE hMenuAddSkypeContact=NULL;
-
-DWORD msgPumpThreadId = 0;
-#ifdef SKYPEBUG_OFFLN
-HANDLE GotUserstatus;
-#endif
-
-BOOL bModulesLoaded=FALSE;
-char *RequestedStatus=NULL; // To fix Skype-API Statusmode-bug
-char cmdMessage[12]="MESSAGE", cmdPartner[8]="PARTNER"; // Compatibility commands
-
-
-
-// Direct assignment of user properties to a DB-Setting
-static const settings_map m_settings[]= {
- {"LANGUAGE", "Language1"},
- {"PROVINCE", "State"},
- {"CITY", "City"},
- {"PHONE_HOME", "Phone"},
- {"PHONE_OFFICE", "CompanyPhone"},
- {"PHONE_MOBILE", "Cellular"},
- {"HOMEPAGE", "Homepage"},
- {"ABOUT", "About"}
- };
-
-// Imported Globals
-extern status_map status_codes[];
-
-BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
-
-HMODULE hUxTheme = 0;
-
-// function pointers, use typedefs for casting to shut up the compiler when using GetProcAddress()
-
-typedef BOOL (WINAPI *PITA)();
-typedef HANDLE (WINAPI *POTD)(HWND, LPCWSTR);
-typedef UINT (WINAPI *PDTB)(HANDLE, HDC, int, int, RECT *, RECT *);
-typedef UINT (WINAPI *PCTD)(HANDLE);
-typedef UINT (WINAPI *PDTT)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *);
-
-PITA pfnIsThemeActive = 0;
-POTD pfnOpenThemeData = 0;
-PDTB pfnDrawThemeBackground = 0;
-PCTD pfnCloseThemeData = 0;
-PDTT pfnDrawThemeText = 0;
-
-#define FIXED_TAB_SIZE 100 // default value for fixed width tabs
-
-typedef struct {
- char msgnum[16];
- BOOL getstatus;
- BOOL bIsRead;
- BOOL bDontMarkSeen;
- BOOL QueryMsgDirection;
- TYP_MSGLENTRY *pMsgEntry;
-} fetchmsg_arg;
-
-typedef struct {
- HANDLE hContact;
- char szId[16];
-} msgsendwt_arg;
-
-/*
- * visual styles support (XP+)
- * returns 0 on failure
- */
-
-int InitVSApi()
-{
- if((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
- return 0;
-
- pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
- pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
- pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
- pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
- pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
-
- MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- if(pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
- return 1;
- }
- return 0;
-}
-
-/*
- * unload uxtheme.dll
- */
-
-int FreeVSApi()
-{
- if(hUxTheme != 0)
- FreeLibrary(hUxTheme);
- return 0;
-}
-
-// Plugin Info
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- "Skype Protocol",
- PLUGIN_MAKE_VERSION(0,0,0,52),
- "Support for Skype network",
- "leecher - tweety - jls17",
- "leecher@dose.0wnz.at - tweety@user.berlios.de",
- "© 2004-2011 leecher - tweety",
- "http://developer.berlios.de/projects/mgoodies/",
- UNICODE_AWARE,
- 0, //doesn't replace anything built-in
- { 0xa71f8335, 0x7b87, 0x4432, { 0xb8, 0xa3, 0x81, 0x47, 0x94, 0x31, 0xc6, 0xf5 } } // {A71F8335-7B87-4432-B8A3-81479431C6F5}
-};
-
-#define MAPDND 1 // Map Occupied to DND status and say that you support it
-//#define MAPNA 1 // Map NA status to Away and say that you support it
-
-/* P R O G R A M */
-
-void RegisterToDbeditorpp(void)
-{
- // known modules list
- if (ServiceExists("DBEditorpp/RegisterSingleModule"))
- CallService("DBEditorpp/RegisterSingleModule", (WPARAM)SKYPE_PROTONAME, 0);
-}
-
-void RegisterToUpdate(void)
-{
- //Use for the Updater plugin
- if(ServiceExists(MS_UPDATE_REGISTER))
- {
- Update update = {0};
- char szVersion[16];
-
- update.szComponentName = pluginInfo.shortName;
- update.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO *)&pluginInfo, szVersion);
- update.cpbVersion = (DWORD)strlen((char *)update.pbVersion);
-
-#ifdef _WIN64
-#ifdef _UNICODE
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_unicode_x64.zip";
-#else
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_x64.zip";
-#endif
- update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
- update.pbBetaVersionPrefix = (BYTE *)"SKYPE version ";
- update.szUpdateURL = update.szBetaUpdateURL; // FIXME!!
- update.szVersionURL = update.szBetaVersionURL; // FIXME
- update.pbVersionPrefix = update.pbBetaVersionPrefix; //FIXME
-#else /* _WIN64 */
-#ifdef _UNICODE
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_unicode.zip";
-#else
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol.zip";
-#endif
- update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
- update.pbBetaVersionPrefix = (BYTE *)"SKYPE version ";
-#ifdef _UNICODE
- update.szUpdateURL = update.szBetaUpdateURL; // FIXME!!
- update.szVersionURL = update.szBetaVersionURL; // FIXME
- update.pbVersionPrefix = update.pbBetaVersionPrefix; //FIXME
-#else
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=3200";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3200";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Skype Protocol</span>";
-#endif
-#endif
-
- update.cpbVersionPrefix = (DWORD)strlen((char *)update.pbVersionPrefix);
- update.cpbBetaVersionPrefix = (DWORD)strlen((char *)update.pbBetaVersionPrefix);
-
- CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
-
- }
-}
-
-/*
- * ShowMessage
- *
- * Shows a popup, if the popup plugin is enabled.
- * mustShow: 1 -> If Popup-Plugin is not available/disabled, show Message
- * in a Messagewindow
- * If the Popup-Plugin is enabled, let the message stay on
- * screen until someone clicks it away.
- * 0 -> If Popup-Plugin is not available/disabled, skip message
- * Returns 0 on success, -1 on failure
- *
- */
-int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) {
-
-
-
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressErrors", 0)) return -1;
- lpzText=TranslateTS(lpzText);
-
- if (bModulesLoaded && PopupServiceExists && ServiceExists(MS_POPUP_ADDPOPUPT) && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UsePopup", 0) && !MirandaShuttingDown) {
- BOOL showPopup, popupWindowColor;
- unsigned int popupBackColor, popupTextColor;
- int popupTimeSec;
-
- popupTimeSec = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSecErr", 4);
- popupTextColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColorErr", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColorErr", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = ( 0 != DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColorErr", TRUE));
- showPopup = ( 0 != DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE));
-
- MessagePopup.lchContact = NULL;
- MessagePopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(iconID));
- MessagePopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- MessagePopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- MessagePopup.iSeconds = popupTimeSec;
- MessagePopup.PluginData = (void *)1;
-
- lstrcpy(MessagePopup.lptzText, lpzText);
-
-#ifdef _UNICODE
- mbstowcs (MessagePopup.lptzContactName, SKYPE_PROTONAME, strlen(SKYPE_PROTONAME)+1);
-#else
- lstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME);
-#endif
-
- if(showPopup)
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&MessagePopup,0);
-
- return 0;
- }
- else {
-
- if (mustShow==1) MessageBox(NULL,lpzText,_T("Skype Protocol"), MB_OK | MB_ICONWARNING);
- return 0;
- }
-}
-#ifdef _UNICODE
-int ShowMessageA(int iconID, char *lpzText, int mustShow) {
- WCHAR *lpwText;
- int iRet;
- size_t len = mbstowcs (NULL, lpzText, strlen(lpzText));
- if (len == -1 || !(lpwText = calloc(len+1,sizeof(WCHAR)))) return -1;
- mbstowcs (lpwText, lpzText, strlen(lpzText));
- iRet = ShowMessage(iconID, lpwText, mustShow);
- free (lpwText);
- return iRet;
-}
-#endif
-
-// processing Hooks
-
-int HookContactAdded(WPARAM wParam, LPARAM lParam) {
- char *szProto;
-
- UNREFERENCED_PARAMETER(lParam);
-
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME))
- add_contextmenu((HANDLE)wParam);
- return 0;
-}
-
-int HookContactDeleted(WPARAM wParam, LPARAM lParam) {
- char *szProto;
-
- UNREFERENCED_PARAMETER(lParam);
-
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME)) {
- DBVARIANT dbv;
- int retval;
-
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 1;
- retval=SkypeSend("SET USER %s BUDDYSTATUS 1", dbv.pszVal);
- DBFreeVariant(&dbv);
- if (retval) return 1;
- }
- return 0;
-}
-
-void GetInfoThread(HANDLE hContact) {
- DBVARIANT dbv;
- int i;
- char *ptr;
- BOOL bSetNick = FALSE;
- // All properties are already handled in the WndProc, so we just consume the
- // messages here to do proper ERROR handling
- // If you add something here, be sure to handle it in WndProc, but let it
- // fall through there so that message gets added to the queue in order to be
- // consumed by SkypeGet
- char *pszProps[] = {
- "BIRTHDAY", "COUNTRY", "SEX", "MOOD_TEXT", "TIMEZONE", "IS_VIDEO_CAPABLE"};
-
-
- LOG (("GetInfoThread started."));
- EnterCriticalSection (&QueryThreadMutex);
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- {
- LOG (("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact));
- LeaveCriticalSection (&QueryThreadMutex);
- return;
- }
-
- if (ptr=SkypeGet ("USER", dbv.pszVal, "DISPLAYNAME")) {
- // WndProc sets Nick accordingly
- if (*ptr) bSetNick = TRUE;
- free (ptr);
- }
-
- if (ptr=SkypeGet ("USER", dbv.pszVal, "FULLNAME")) {
- if (*ptr && !bSetNick && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowFullname", 1)) {
- // No Displayname and FULLNAME requested
- SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "Nick", ptr);
- bSetNick = TRUE;
- }
- free (ptr);
- }
-
- if (!bSetNick) {
- // Still no nick set, so use SKYPE Nickname
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "Nick", dbv.pszVal);
- }
-
-
- if (!bIsImoproxy)
- {
- for (i=0; i<sizeof(pszProps)/sizeof(pszProps[0]); i++)
- if (ptr=SkypeGet ("USER", dbv.pszVal, pszProps[i])) free (ptr);
- } else {
- if (ptr=SkypeGet ("USER", dbv.pszVal, "MOOD_TEXT")) free (ptr);
- }
-
- if (protocol >= 7 || bIsImoproxy) {
- // Notify about the possibility of an avatar
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = ACKTYPE_AVATAR;
- ack.result = ACKRESULT_STATUS;
-
- CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
- //if (ptr=SkypeGet ("USER", dbv.pszVal, "RICH_MOOD_TEXT")) free (ptr);
- }
-
- if (!bIsImoproxy)
- {
- for (i=0; i<sizeof(m_settings)/sizeof(m_settings[0]); i++)
- if (ptr=SkypeGet ("USER", dbv.pszVal, m_settings[i].SkypeSetting)) free (ptr);
- }
-
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
- LeaveCriticalSection(&QueryThreadMutex);
- DBFreeVariant(&dbv);
- LOG (("GetInfoThread terminated gracefully."));
-}
-
-time_t SkypeTime(time_t *timer) {
- struct _timeb tb;
-
- EnterCriticalSection (&TimeMutex);
- _ftime(&tb);
- if (timer) *timer=tb.time;
- LeaveCriticalSection (&TimeMutex);
- return tb.time;
-}
-
-
-void BasicSearchThread(char *nick) {
- PROTOSEARCHRESULT psr={0};
- char *cmd=NULL, *token=NULL, *ptr=NULL, *nextoken;
- time_t st;
-
- LOG (("BasicSearchThread started."));
- EnterCriticalSection (&QueryThreadMutex);
- SkypeTime(&st);
- if (SkypeSend("SEARCH USERS %s", nick)==0 && (cmd=SkypeRcvTime("USERS", st, INFINITE))) {
- if (strncmp(cmd, "ERROR", 5)) {
- psr.cbSize=sizeof(psr);
- for (token=strtok_r(cmd+5, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- psr.nick=psr.id=token;
- psr.lastName=NULL;
- psr.firstName=NULL;
- psr.email=NULL;
- if (ptr=SkypeGet("USER", token, "FULLNAME")) {
- // We cannot use strtok() to seperate first & last name here,
- // because we already use it for parsing the user list
- // So we use our own function
- if (psr.lastName=strchr(ptr, ' ')) {
- *psr.lastName=0;
- psr.lastName++;
- LOG(("BasicSearchThread: lastName=%s", psr.lastName));
- }
- psr.firstName=ptr;
- LOG(("BasicSearchThread: firstName=%s", psr.firstName));
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)hSearchThread, (LPARAM)(PROTOSEARCHRESULT*)&psr);
- if (ptr) free(ptr);
- }
- } else {
- OUT(cmd);
- }
- free(cmd);
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)hSearchThread, 0);
- free(nick);
- LeaveCriticalSection(&QueryThreadMutex);
- LOG (("BasicSearchThread terminated gracefully."));
- return;
-}
-
-INT_PTR SkypeDBWriteContactSettingUTF8String(HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- DBCONTACTWRITESETTING cws;
- INT_PTR iRet;
-
- // Try to save it as UTF8 sting to DB. If this doesn't succeed (i.e. older Miranda version), we convert
- // accordingly and try to save again.
-
- cws.szModule=szModule;
- cws.szSetting=szSetting;
- cws.value.type=DBVT_UTF8;
- cws.value.pszVal=(char*)val;
- // DBVT_UTF8 support started with version 0.5.0.0, right...?
- if (mirandaVersion < 0x050000 || (iRet = CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)))
- {
- // Failed, try to convert and then try again
- cws.value.type=DBVT_TCHAR;
- if (!(cws.value.ptszVal = make_tchar_string((const unsigned char*)val))) return -1;
- iRet = CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
- free (cws.value.pszVal);
- }
- return iRet;
-}
-
-
-// added by TioDuke
-void GetDisplaynameThread(char *dummy) {
- DBVARIANT dbv;
- char *ptr;
-
- UNREFERENCED_PARAMETER(dummy);
-
- LOG(("GetDisplaynameThread started."));
- if (DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) {
- LOG(("GetDisplaynameThread terminated."));
- return;
- }
- EnterCriticalSection(&QueryThreadMutex);
- if ((ptr=SkypeGet("USER", dbv.pszVal, "FULLNAME"))) {
- if (*ptr) SkypeDBWriteContactSettingUTF8String(NULL, SKYPE_PROTONAME, "Nick", ptr);
- free(ptr);
- }
- DBFreeVariant(&dbv);
- LeaveCriticalSection(&QueryThreadMutex);
- LOG(("GetDisplaynameThread terminated gracefully."));
-}
-
-
-// Starts importing history from Skype
-INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)) {
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoomID", &dbv)) return 0;
- SkypeSend ("GET CHAT %s CHATMESSAGES", dbv.pszVal);
- } else {
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 0;
- SkypeSend("SEARCH %sS %s", cmdMessage, dbv.pszVal);
- }
- DBFreeVariant(&dbv);
- return 0;
-}
-
-int SearchFriends(void) {
- char *ptr, *token, *pStat, *nextoken;
- int iRet = 0;
- time_t st;
-
- SkypeTime(&st);
- if (SkypeSend("SEARCH FRIENDS")!=-1 && (ptr=SkypeRcvTime("USERS", st, INFINITE)))
- {
- if (strncmp(ptr, "ERROR", 5)) {
- if (ptr+5) {
- for (token=strtok_r(ptr+5, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- if (!(pStat = SkypeGet("USER", token, "ONLINESTATUS")))
- {
- iRet = -1;
- break;
- }
- free (pStat);
- }
- }
- } else iRet=-1;
- free(ptr);
- } else iRet=-1;
- return iRet;
-}
-
-void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) {
- char *cmd, *token, *nextoken;
-
- UNREFERENCED_PARAMETER(dummy);
-
- if (SkypeSend("#UWA SEARCH USERSWAITINGMYAUTHORIZATION")) return;
- if (!(cmd=SkypeRcv("#UWA USERS", INFINITE))) return;
- if (!strncmp(cmd, "ERROR", 5)) {
- free(cmd);
- return;
- }
-
- token=strtok_r(cmd+10, ", ", &nextoken);
- while (token) {
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
- HANDLE hContact;
- char *firstname=NULL, *lastname=NULL, *pCurBlob;
-
- LOG(("Awaiting auth: %s", token));
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact=hContact=add_contact(token, PALF_TEMPORARY);
- ccs.wParam=0;
- ccs.lParam=(LPARAM)&pre;
- pre.flags=0;
- pre.timestamp=(DWORD)SkypeTime(NULL);
-
- /* blob is: */
- //DWORD protocolSpecific HANDLE hContact
- //ASCIIZ nick, firstName, lastName, e-mail, requestReason
- if (firstname=SkypeGet("USER", token, "FULLNAME"))
- if (lastname=strchr(firstname, ' ')) {
- *lastname=0;
- lastname++;
- }
-
- pre.lParam=sizeof(DWORD)+sizeof(HANDLE)+strlen(token)+5;
- if (firstname) pre.lParam+=strlen(firstname);
- if (lastname) pre.lParam+=strlen(lastname);
- if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
- pCurBlob+=sizeof(DWORD); // Not used
- memcpy(pCurBlob,&hContact,sizeof(HANDLE)); pCurBlob+=sizeof(HANDLE);
- strcpy((char *)pCurBlob,token); pCurBlob+=strlen((char *)pCurBlob)+1;
- if (firstname) {
- strcpy((char *)pCurBlob,firstname);
- if (lastname) {
- pCurBlob+=strlen((char *)pCurBlob)+1;
- strcpy((char *)pCurBlob,lastname);
- }
- }
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
- free(pre.szMessage);
- }
- if (firstname) free(firstname);
- token=strtok_r(NULL, ", ", &nextoken);
- }
- free(cmd);
- return;
-}
-
-void SearchFriendsThread(char *dummy) {
- UNREFERENCED_PARAMETER(dummy);
-
- if (!SkypeInitialized) return;
- LOG(("SearchFriendsThread started."));
- EnterCriticalSection(&QueryThreadMutex);
- SkypeInitialized=FALSE;
- SearchFriends();
- SkypeInitialized=TRUE;
- LeaveCriticalSection(&QueryThreadMutex);
- LOG(("SearchFriendsThread terminated gracefully."));
-}
-
-void __cdecl SearchRecentChats(void *dummy) {
- char *cmd, *token, *nextoken;
-
- UNREFERENCED_PARAMETER(dummy);
-
- if (SkypeSend("#RCH SEARCH RECENTCHATS")) return;
- if (!(cmd=SkypeRcv("#RCH CHATS", INFINITE))) return;
- if (!strncmp(cmd, "ERROR", 5)) {
- free(cmd);
- return;
- }
-
- for (token=strtok_r(cmd+10, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- char *pszStatus = SkypeGet ("CHAT", token, "STATUS");
-
- if (pszStatus) {
- if (!strcmp(pszStatus, "MULTI_SUBSCRIBED")) {
- // Add chatrooms for active multisubscribed chats
- /*if (!find_chatA(token)) */{
- char *pszTopic;
-
- EnterCriticalSection (&QueryThreadMutex);
- ChatStart(token, TRUE);
- if (pszTopic = SkypeGet ("CHAT", token, "TOPIC")) {
- TCHAR *psztChatName, *psztTopic;
-
- if (!*pszTopic) {
- free (pszTopic);
- if (pszTopic = SkypeGet ("CHAT", token, "FRIENDLYNAME"));
- }
- psztChatName = make_nonutf_tchar_string((const unsigned char*)token);
- psztTopic = make_tchar_string((const unsigned char*)pszTopic);
- SetChatTopic (psztChatName, psztTopic, FALSE);
- free_nonutf_tchar_string(psztChatName);
- free (psztTopic);
- free (pszTopic);
- }
- LeaveCriticalSection (&QueryThreadMutex);
- }
- }
- free (pszStatus);
- }
- }
- free(cmd);
- return;
-}
-
-
-void __cdecl SkypeSystemInit(char *dummy) {
- static BOOL Initializing=FALSE;
- DBVARIANT dbv={0};
-
- UNREFERENCED_PARAMETER(dummy);
-
- LOG (("SkypeSystemInit thread started."));
- if (SkypeInitialized || Initializing)
- {
- LOG (("SkypeSystemInit terminated, nothing to do."));
- return;
- }
- Initializing=TRUE;
-// Do initial Skype-Tasks
- logoff_contacts(FALSE);
-// Add friends
-
- // Clear currentuserhandle entries from queue
- while (testfor ("CURRENTUSERHANDLE", 0));
- if (SkypeSend(SKYPE_PROTO)==-1 || !testfor("PROTOCOL", INFINITE) ||
- SkypeSend("GET CURRENTUSERHANDLE")==-1 ||
- SkypeSend("GET PRIVILEGE SKYPEOUT")==-1) {
- Initializing=FALSE;
- LOG (("SkypeSystemInit thread stopped with failure."));
- return;
- }
-
- if(DBGetContactSettingString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) == 0)
- {
- if (*dbv.pszVal)
- {
- char *pszUser;
-
- // Username is set in Plugin, therefore we need to match it
- // against CURRENTUSERHANDLE
- if (pszUser = SkypeRcv ("CURRENTUSERHANDLE", INFINITE))
- {
- memmove (pszUser, pszUser+18, strlen(pszUser+17));
- if (_stricmp(dbv.pszVal, pszUser))
- {
- char szError[256];
-
- // Doesn't match, maybe we have a second Skype instance we have to take
- // care of? If in doubt, let's wait a while for it to report its hWnd to us.
- LOG (("Userhandle %s doesn't match username %s from settings", pszUser, dbv.pszVal));
- if (!hSkypeWndSecondary) Sleep(3000);
- if (hSkypeWndSecondary)
- {
- hSkypeWnd = hSkypeWndSecondary;
- hSkypeWndSecondary = NULL;
- Initializing=FALSE;
- while (testfor ("CURRENTUSERHANDLE", 0));
- LOG (("Trying to init secondary Skype instance"));
- SkypeSystemInit(dummy);
- }
- else
- {
- hForbiddenSkypeWnd = hSkypeWnd;
-
- // If we need to start Skype as secondary instance, we should do it now
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) &&
- DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "secondary", 0))
- {
- int oldstatus;
-
- hSkypeWnd = NULL;
- AttachStatus=-1;
- if (g_hWnd) KillTimer (g_hWnd, 1);
- oldstatus = SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- ConnectToSkypeAPI(skype_path, 1);
- }
- if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary)
- {
- int oldstatus;
-
- sprintf (szError, "Username '%s' provided by Skype API doesn't match username '%s' in "
- "your settings. Please either remove username setting in you configuration or correct "
- "it. Will not connect!", pszUser, dbv.pszVal);
- OUTPUTA (szError);
- Initializing=FALSE;
- AttachStatus=-1;
- logoff_contacts(FALSE);
- if (g_hWnd) KillTimer (g_hWnd, 1);
- hSkypeWnd = NULL;
- oldstatus = SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- }
- }
- }
- free (pszUser);
- }
- }
- DBFreeVariant(&dbv);
- if (!Initializing) return;
- }
-
-#ifdef SKYPEBUG_OFFLN
- if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS")==-1 ||
- WaitForSingleObject(GotUserstatus, INFINITE)==WAIT_FAILED)
- {
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
- return;
- }
- if (SkypeStatus!=ID_STATUS_OFFLINE)
-#endif
- if (SearchFriends()==-1) {
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
- return;
- }
- if (protocol>=5 || bIsImoproxy) {
- SkypeSend ("CREATE APPLICATION libpurple_typing");
- testfor ("CREATE APPLICATION libpurple_typing", 2000);
- }
- if (protocol>=5) {
- SearchUsersWaitingMyAuthorization(NULL);
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
- SearchRecentChats(NULL);
- }
- SkypeSend("SEARCH MISSED%sS", cmdMessage);
-
-
-#ifndef SKYPEBUG_OFFLN
- if (SkypeSend("GET USERSTATUS")==-1)
- {
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
- return;
- }
-#endif
- SetTimer (g_hWnd, 1, PING_INTERVAL, NULL);
- SkypeInitialized=TRUE;
- Initializing=FALSE;
- LOG (("SkypeSystemInit thread terminated gracefully."));
- return;
-}
-
-void FirstLaunch(char *dummy) {
- int counter=0;
-
- UNREFERENCED_PARAMETER(dummy);
-
- LOG (("FirstLaunch thread started."));
- if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE)==-1)
- {
- int oldstatus=SkypeStatus;
-
- LOG(("OnModulesLoaded starting offline.."));
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- }
- if (AttachStatus==-1 || AttachStatus==SKYPECONTROLAPI_ATTACH_REFUSED || AttachStatus==SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) {
- LOG (("FirstLaunch thread stopped because of invalid Attachstatus."));
- return;
- }
-
- // When you launch Skype and Attach is Successfull, it still takes some time
- // until it becomes available for receiving messages.
- // Let's probe this with PINGing
- LOG(("CheckIfApiIsResponding Entering test loop"));
- for ( ;; ) {
- LOG(("Test #%d", counter));
- if (SkypeSend("PING")==-1) counter ++; else break;
- if (counter>=20) {
- OUTPUT(_T("Cannot reach Skype API, plugin disfunct."));
- LOG (("FirstLaunch thread stopped: cannot reach Skype API."));
- return;
- }
- Sleep(500);
- }
- LOG(("CheckIfApiIsResponding: Testing for PONG"));
- testfor("PONG", 2000); // Flush PONG from MsgQueue
-
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
- LOG (("FirstLaunch thread terminated gracefully."));
-}
-
-int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) {
- TTBButton ttb={0};
-
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_DRAWBORDER;
- ttb.hbBitmapDown = ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CALL));
- ttb.pszServiceDown = ttb.pszServiceUp = SKYPEOUT_CALL;
- ttb.name=Translate("Do a SkypeOut-call");
- if ((int)(httbButton=(HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0))==-1) httbButton=0;
- return 0;
-}
-
-
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
- bModulesLoaded=TRUE;
-
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- PopupServiceExists = ServiceExists(MS_POPUP_ADDPOPUPEX);
-
- logoff_contacts(FALSE);
-
- HookEventsLoaded();
- RegisterToUpdate();
- RegisterToDbeditorpp();
- VoiceServiceModulesLoaded();
- GCInit();
-
- add_contextmenu(NULL);
- if ( ServiceExists( MS_GC_REGISTER ))
- {
- GCREGISTER gcr = {0};
- static COLORREF crCols[1] = {0};
- char szEvent[MAXMODULELABELLENGTH];
-
- gcr.cbSize = sizeof( GCREGISTER );
- gcr.dwFlags = GC_CHANMGR | GC_TCHAR; // |GC_ACKMSG; // TODO: Not implemented yet
- gcr.ptszModuleDispName = _T("Skype protocol");
- gcr.pszModule = SKYPE_PROTONAME;
- if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
- {
- OUTPUT(_T("Unable to register with Groupchat module!"));
- }
- _snprintf (szEvent, sizeof(szEvent), "%s\\ChatInit", SKYPE_PROTONAME);
- hInitChat = CreateHookableEvent(szEvent);
- hEvInitChat = HookEvent(szEvent, ChatInit);
-
- hChatEvent = HookEvent(ME_GC_EVENT, GCEventHook);
- hChatMenu = HookEvent(ME_GC_BUILDMENU, GCMenuHook);
- CreateServiceFunction (SKYPE_CHATNEW, SkypeChatCreate);
- CreateProtoService (PS_LEAVECHAT, GCOnLeaveChat);
- CreateProtoService (PS_JOINCHAT, GCOnJoinChat);
- }
- // Try folder service first
- hProtocolAvatarsFolder = NULL;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- char *tmpPath;
-
- if (!ServiceExists (MS_UTILS_REPLACEVARS) || !(tmpPath = Utils_ReplaceVars("%miranda_avatarcache%")))
- tmpPath = PROFILE_PATH;
- mir_snprintf(DefaultAvatarsFolder, sizeof(DefaultAvatarsFolder), "%s\\%s", tmpPath, SKYPE_PROTONAME);
- hProtocolAvatarsFolder = (HANDLE) FoldersRegisterCustomPath(SKYPE_PROTONAME, "Avatars Cache", DefaultAvatarsFolder);
- }
-
- if (hProtocolAvatarsFolder == NULL)
- {
- // Use defaults
- CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM) DefaultAvatarsFolder);
- mir_snprintf(DefaultAvatarsFolder, sizeof(DefaultAvatarsFolder), "%s\\%s", DefaultAvatarsFolder, SKYPE_PROTONAME);
- CreateDirectoryA(DefaultAvatarsFolder, NULL);
- }
-
- pthread_create(( pThreadFunc )FirstLaunch, NULL);
- return 0;
-}
-
-void FetchMessageThread(fetchmsg_arg *pargs) {
- char *who=NULL, *type=NULL, *chat=NULL, *users=NULL, *msg=NULL, *status=NULL;
- char *ptr, *msgptr, szPartnerHandle[32], szBuf[128];
- int direction=0, msglen = 0;
- DWORD timestamp = 0, lwr=0;
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
- HANDLE hContact = NULL, hDbEvent, hChat = NULL;
- DBEVENTINFO dbei={0};
- DBVARIANT dbv={0};
- fetchmsg_arg args;
- BOOL bEmoted=FALSE, isGroupChat=FALSE, bHasPartList=FALSE;
- BOOL bUseGroupChat = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0);
-
- if (!pargs) return;
- args = *pargs;
- free (pargs);
-
- sprintf (szPartnerHandle, "%s_HANDLE", cmdPartner);
- pre.lParam = strtoul(args.msgnum, NULL, 10);
- if (args.bIsRead) pre.flags |= PREF_CREATEREAD;
- //pEvent = MsgList_FindMessage(pre.lParam);
-
- // Get Timestamp
- if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) timestamp=atol(ptr);
- else timestamp=(DWORD)SkypeTime(NULL);
- free(ptr);
- } else timestamp=(DWORD)(args.pMsgEntry->tEdited);
-
- __try {
- // Get Chatname (also to determine if we need to relay this to a groupchat)
- if (!(chat=SkypeGetErr (cmdMessage, args.msgnum, "CHATNAME"))) __leave;
- if (hChat = find_chatA(chat)) isGroupChat=TRUE;
-
- // Get chat status
- if ((status=SkypeGetErr ("CHAT", chat, "STATUS")) &&
- !strcmp(status, "MULTI_SUBSCRIBED")) isGroupChat=TRUE;
-
- // Get chat type
- if (!(type=SkypeGetErr (cmdMessage, args.msgnum, "TYPE"))) __leave;
- bEmoted = strcmp(type, "EMOTED")==0;
- if (strcmp(type, "MULTI_SUBSCRIBED")==0) isGroupChat=TRUE;
-
- // Group chat handling
- if (isGroupChat && strcmp(type, "TEXT") && strcmp(type, "SAID") && strcmp(type, "UNKNOWN") && !bEmoted) {
- if (bUseGroupChat) {
- BOOL bAddedMembers = FALSE;
-
- if (!strcmp(type,"SAWMEMBERS") || !strcmp(type, "CREATEDCHATWITH"))
- {
- // We have a new Groupchat
- LOG(("FetchMessageThread CHAT SAWMEMBERS"));
- if (!hChat) ChatStart(chat, FALSE);
- __leave;
- }
- if (!strcmp(type,"KICKED"))
- {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
- if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_KICK;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.time = timestamp;
-
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
- ci.hContact = find_contact(users);
- gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- gce.ptszStatus= make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- RemChatContact (GetChat(gcd.ptszID), gce.ptszUID);
- free_nonutf_tchar_string((void*)gce.ptszStatus);
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gce.ptszUID);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- __leave;
- }
- if (!strcmp(type,"SETROLE"))
- {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- gchat_contact *gcContact;
- char *pszRole;
-
- // FROM_HANDLE - Wer hats gesetzt
- // USERS - Wessen Rolle wurde gesetzt
- // ROLE - Die neue Rolle
- if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_REMOVESTATUS;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.time = timestamp;
-
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
- gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = find_contact(who);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) {
- gce.ptszText=_tcsdup(ci.pszVal);
- miranda_sys_free (ci.pszVal);
- ci.pszVal = NULL;
- }
- else gce.ptszText=make_tchar_string((const unsigned char*)who);
-
- ci.hContact = find_contact(users);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
- if (gcContact = GetChatContact(GetChat(gcd.ptszID), gce.ptszUID))
- {
- gce.ptszStatus = gcContact->szRole;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- }
- if (pszRole=SkypeGetErr (cmdMessage, args.msgnum, "ROLE")) {
- gce.ptszStatus = make_nonutf_tchar_string((const unsigned char*)pszRole);
- gcd.iType = GC_EVENT_ADDSTATUS;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free_nonutf_tchar_string((void*)gce.ptszStatus);
- free (pszRole);
- }
- free((void*)gce.ptszText);
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gce.ptszUID);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- __leave;
- }
- if (!strcmp(type,"SETTOPIC"))
- {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
- LOG(("FetchMessageThread CHAT SETTOPIC"));
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_TOPIC;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.time = timestamp;
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- ci.hContact = find_contact(who);
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
- if (ptr=SkypeGetErr (cmdMessage, args.msgnum, "BODY")) {
- gce.ptszText = make_tchar_string((const unsigned char*)ptr);
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free ((void*)gce.ptszText);
- free (ptr);
- }
- free_nonutf_tchar_string ((void*)gce.ptszUID);
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- __leave;
- }
- if (!strcmp(type,"LEFT") || (bAddedMembers = strcmp(type,"ADDEDMEMBERS")==0))
- {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- char *pszInvited = Translate("invited ");
-
- LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
- if (bAddedMembers) {
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_ACTION;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.time = timestamp;
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
- // We assume that users buffer has enough room for "invited" string
- memmove (users+strlen(pszInvited), users, strlen(users)+1);
- memcpy (users, pszInvited, strlen(pszInvited));
- gce.ptszText= make_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- DBVARIANT dbv;
-
- if (DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)==0) {
- gce.bIsMe = strcmp(who, dbv.pszVal)==0;
- DBFreeVariant(&dbv);
- }
- if (!gce.bIsMe) ci.hContact = find_contact(who);
- gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free_nonutf_tchar_string((void*)gce.ptszUID);
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- }
- if (gce.ptszText) free ((void*)gce.ptszText);
- }
- free_nonutf_tchar_string ((void*)gcd.ptszID);
- }
- if (!args.QueryMsgDirection) SkypeSend ("GET CHAT %s MEMBERS", chat);
- __leave;
- }
- }
- __leave;
- }
-
- // Need to get the status?
- if (args.getstatus) {
- char *status;
-
- if (protocol<4) InterlockedIncrement (&rcvwatchers);
- status=SkypeGetID(cmdMessage, args.msgnum, "STATUS");
- if (protocol<4) InterlockedDecrement (&rcvwatchers);
- if (!status) __leave;
- if (!strcmp(status, "SENT")) direction=DBEF_SENT;
- free(status);
- }
-
- // Who sent it?
- if (!(who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle))) __leave;
-
- // Get contact handle
- LOG(("FetchMessageThread Finding contact handle"));
- DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv);
- if (dbv.pszVal && !strcmp (who, dbv.pszVal))
- {
- char *pTok, *nextoken;
-
- // It's from me.. But to whom?
- // CHATMESSAGE .. USERS doesn't return anything, so we have to query the CHAT-Object
- if (!(ptr=SkypeGetErr ("CHAT", chat, "ACTIVEMEMBERS"))) {
- DBFreeVariant (&dbv);
- __leave;
- }
-
- for (pTok = strtok_r (ptr, " ", &nextoken); pTok; pTok=strtok_r(NULL, " ", &nextoken)) {
- if (strcmp (pTok, dbv.pszVal)) break; // Take the first dude in the list who is not me
- }
-
- if (!pTok) {
- free (ptr);
- DBFreeVariant (&dbv);
- __leave; // We failed
- }
- free (who);
- who=memmove (ptr, pTok, strlen(pTok)+1);
- direction = DBEF_SENT;
- }
- DBFreeVariant (&dbv);
-
- if (!(hContact=find_contact(who))) {
- // Permanent adding of user obsolete, we use the BUDDYSTATUS now (bug #0000005)
- ResetEvent(hBuddyAdded);
- SkypeSend("GET USER %s BUDDYSTATUS", who);
- WaitForSingleObject(hBuddyAdded, INFINITE);
- if (!(hContact=find_contact(who))) {
- // Arrgh, the user has been deleted from contact list.
- // In this case, we add him temp. to receive the msg at least.
- hContact=add_contact(who, PALF_TEMPORARY);
- }
- }
- // Text which was sent (on edited msg, BODY may already be in queue, check)
- sprintf (szBuf, "GET %s %s BODY", cmdMessage, args.msgnum);
- if (!args.pMsgEntry || !args.pMsgEntry->tEdited || !(ptr=SkypeRcv(szBuf+4, 1000)))
- {
- if (SkypeSend(szBuf)==-1 || !(ptr=SkypeRcv(szBuf+4, INFINITE)))
- __leave;
- }
- if (strncmp(ptr, "ERROR", 5)) {
- msgptr = ptr+strlen(szBuf+4)+1;
- bHasPartList = strncmp(msgptr,"<partlist ",10)==0;
- if (args.pMsgEntry && args.pMsgEntry->tEdited) {
- // Mark the message as edited
- if (!*msgptr && args.pMsgEntry->hEvent != INVALID_HANDLE_VALUE) {
- // Empty message and edited -> Delete event
- if ((int)(hContact = (HANDLE)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)args.pMsgEntry->hEvent, 0)) != -1) {
- CallService (MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)args.pMsgEntry->hEvent);
- free (ptr);
- __leave;
- }
- } else {
- msgptr-=9;
- memcpy (msgptr, "[EDITED] ", 9);
- }
- }
- if( bEmoted && !isGroupChat) {
- CONTACTINFO ci = {0};
- int newlen;
- char *pMsg, *pszUTFnick=NULL;
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact = hContact) {
- CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci);
- if (ci.pszVal) {
-#ifdef _UNICODE
- pszUTFnick = (char*)make_utf8_string(ci.pszVal);
-#else
- utf8_encode (ci.pszVal, &pszUTFnick);
-#endif
- miranda_sys_free (ci.pszVal);
- }
- }
- newlen = strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9;
- if (pMsg = malloc(newlen)) {
- sprintf (pMsg, "** %s%s%s **", (pszUTFnick?pszUTFnick:""),(pszUTFnick?" ":""),(char*)msgptr);
- free (ptr);
- ptr = msgptr = pMsg;
- }
- if (pszUTFnick) free(pszUTFnick);
- }
-
- if (mirandaVersion >= 0x070000 && // 0.7.0+ supports PREF_UTF flag, no need to decode UTF8
- !isGroupChat) { // I guess Groupchat doesn't support UTF8?
- msg = ptr;
- pre.flags |= PREF_UTF;
- } else { // Older version has to decode either UTF8->ANSI or UTF8->UNICODE
- // This could be replaced by mir_getUTFI - functions for Miranda 0.5+ builds, but we stay
- // 0.4 compatible for backwards compatibility. Unfortunately this requires us to link with utf8.c
-#ifdef _UNICODE
- int wcLen;
-#endif
-
- if (utf8_decode(msgptr, &msg)==-1) {
- free(ptr);
- __leave;
- }
-#ifdef _UNICODE
- msglen = strlen(msg)+1;
- msgptr = (char*)make_unicode_string ((const unsigned char*)msgptr);
- wcLen = (_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR);
- msg=realloc(msg, msglen+wcLen);
- memcpy (msg+msglen, msgptr, wcLen);
- free(msgptr);
- pre.flags |= PREF_UNICODE;
-#endif
- msgptr = msg;
- free (ptr);
- }
- msglen = strlen(msgptr)+1;
- } else {
- free (ptr);
- __leave;
- }
- // skype sends some xml statics after a call has finished. Check if thats the case and suppress it if necessary...
- if ((DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) &&
- bHasPartList) || msgptr[0]==0) __leave;
-
- if (isGroupChat && bUseGroupChat) {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- DBVARIANT dbv = {0};
- CONTACTINFO ci = {0};
-
- LOG(("FetchMessageThread This is a group chat message"));
- if (!hChat) ChatStart(chat, FALSE);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = bEmoted?GC_EVENT_ACTION:GC_EVENT_MESSAGE;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- if ((gce.bIsMe = (direction&DBEF_SENT)?TRUE:FALSE) &&
- DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)==0)
- {
- free(who);
- who = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = !gce.bIsMe?hContact:NULL;
- gce.ptszNick=gce.ptszUID;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- gce.time = timestamp>0?timestamp:(DWORD)SkypeTime(NULL);
- gce.pszText = msgptr;
- if (pre.flags & PREF_UNICODE) gce.pszText += msglen;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- MsgList_Add (pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
- if (ci.pszVal) miranda_sys_free (ci.pszVal);
- free_nonutf_tchar_string((void*)gce.ptszUID);
- free_nonutf_tchar_string(gcd.ptszID);
-
- // Yes, we have successfully read the msg
- if (!args.bDontMarkSeen)
- SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- __leave;
- }
-
- if (args.QueryMsgDirection || (direction&DBEF_SENT)) {
- // Check if the timestamp is valid
- dbei.cbSize=sizeof(dbei);
- dbei.cbBlob=0;
- if (hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRST,(WPARAM)hContact,0)) {
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- lwr=dbei.timestamp;
- }
- dbei.cbSize=sizeof(dbei);
- dbei.cbBlob=0;
- dbei.timestamp=0;
- if (hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST,(WPARAM)hContact,0))
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- LOG(("FetchMessageThread timestamp %ld between %ld and %ld", timestamp, lwr, dbei.timestamp));
- if (timestamp<lwr || (direction&DBEF_SENT)) {
- TYP_MSGLENTRY *pme;
-
- LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)))
- dbei.szModule=SKYPE_PROTONAME;
- dbei.cbBlob=msglen;
- if (pre.flags & PREF_UNICODE)
- dbei.cbBlob += sizeof(WCHAR)*( (DWORD)wcslen((WCHAR*)&msgptr[dbei.cbBlob])+1);
- dbei.pBlob=(PBYTE)msgptr;
- dbei.timestamp=timestamp>0?timestamp:(DWORD)SkypeTime(NULL);
- dbei.flags=direction;
- if (pre.flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ;
- if (pre.flags & PREF_UTF) dbei.flags|=DBEF_UTF;
- dbei.eventType=EVENTTYPE_MESSAGE;
- pme = MsgList_Add (pre.lParam, (HANDLE)CallServiceSync(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact, (LPARAM)&dbei));
-
- // We could call MS_PROTO_CHAINSEND if we want to have MetaContact adding the history for us,
- // however we all know that CCSDATA doesn't contain timestamp-information which is
- // really bad on importing history for example, as all messages would be added with current
- // timestamp. This would cause unreliable jumbled timestamps in metacontact, so we better do this
- // ourself.
- if (DBGetContactSettingByte(hContact, "MetaContacts", "IsSubcontact", 0))
- {
- DWORD dwMetaLink = DBGetContactSettingDword(hContact, "MetaContacts", "MetaLink", MAXDWORD);
- HANDLE hMetaContact;
-
- if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink)))
- {
- dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hMetaContact, 0);
- pme->hMetaEvent = (HANDLE)CallServiceSync(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hMetaContact, (LPARAM)&dbei);
- }
- }
-
- if (!args.QueryMsgDirection && !args.bDontMarkSeen)
- SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- }
- }
-
-
- if (!(direction&DBEF_SENT) && (!args.QueryMsgDirection || (args.QueryMsgDirection && timestamp>dbei.timestamp))) {
- LOG(("FetchMessageThread Normal message add..."));
- // Normal message received, process it
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- pre.flags |= direction;
- if(isGroupChat && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0))
- pre.flags |= PREF_CREATEREAD;
- pre.timestamp = timestamp>0?timestamp:(DWORD)SkypeTime(NULL);
- pre.szMessage = msgptr;
- CallServiceSync(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
-
- // Yes, we have successfully read the msg
- if (!args.bDontMarkSeen) SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- }
- }
- __finally {
- if (status) free(status);
- if (msg) free(msg);
- if (users) free(users);
- if (chat) free(chat);
- if (type) free(type);
- if (who) free (who);
- }
-
-}
-
-void FetchMessageThreadSync(fetchmsg_arg *pargs) {
- // Secure this thread with a mutex.
- // This is needed to ensure that we get called after an old msg in the queue has
- // been added so that MsgList_FindEntry will find it.
- WaitForSingleObject (FetchMessageEvent, 30000); // Wait max. 30 sec. for previous message fetch to complete
- if ((pargs->pMsgEntry = MsgList_FindMessage(strtoul(pargs->msgnum, NULL, 10))) && !pargs->pMsgEntry->tEdited) {
- // Better don't do this, as we set the msg as read and with this code, we would
- // mark messages not opened by user as read which isn't that good
- /*
- if (pargs->bIsRead && pMsgEvent->hEvent != INVALID_HANDLE_VALUE)
- {
- HANDLE hContact;
- if ((int)(hContact = (HANDLE)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1)
- CallService (MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDBEvent);
- }
- */
- free (pargs);
- }
- else FetchMessageThread (pargs);
- SetEvent (FetchMessageEvent);
-}
-
-static int MsglCmpProc(const void *pstPElement,const void *pstPToFind)
-{
- return strcmp ((char*)((fetchmsg_arg*)pstPElement)->pMsgEntry, (char*)((fetchmsg_arg*)pstPToFind)->pMsgEntry);
-}
-
-void MessageListProcessingThread(char *str) {
- char *token, *nextoken, *chat=NULL;
- fetchmsg_arg *args;
- TYP_LIST *hListMsgs = List_Init(32);
- int i, nCount;
-
- // Frst we need to sort the message timestamps
- for ((token=strtok_r(str, ", ", &nextoken)); token; token=strtok_r(NULL, ", ", &nextoken)) {
- if (args=calloc(1, sizeof(fetchmsg_arg)+sizeof(DWORD))) {
- strncpy (args->msgnum, token, sizeof(args->msgnum));
- args->getstatus=TRUE;
- args->bIsRead=TRUE;
- args->bDontMarkSeen=TRUE;
- args->QueryMsgDirection=TRUE;
- (char*)args->pMsgEntry = SkypeGet ("CHATMESSAGE", token, "TIMESTAMP"); // Bad abuse of pointer
- if (!chat) chat=SkypeGet ("CHATMESSAGE", token, "CHATNAME");
- if (args->pMsgEntry) List_InsertSort (hListMsgs, MsglCmpProc, args);
- else free(args);
- }
- }
- for (i=0, nCount=List_Count(hListMsgs); i<nCount; i++) {
- args = List_ElementAt (hListMsgs, i);
- free (args->pMsgEntry);
- args->pMsgEntry = NULL;
- FetchMessageThreadSync (args);
- }
- if (chat) {
- SkypeSend ("GET CHAT %s MEMBERS", chat);
- free (chat);
- }
- List_Exit (hListMsgs);
- free (str);
-}
-
-char *GetCallerHandle(char *szSkypeMsg) {
- return SkypeGet(szSkypeMsg, "PARTNER_HANDLE", "");
-}
-
-
-HANDLE GetCallerContact(char *szSkypeMsg) {
- char *szHandle;
- HANDLE hContact=NULL;
-
- if (!(szHandle=GetCallerHandle(szSkypeMsg))) return NULL;
- if (!(hContact=find_contact(szHandle))) {
- // If it's a SkypeOut-contact, PARTNER_HANDLE = SkypeOUT number
- DBVARIANT dbv;
- int tCompareResult;
-
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) continue;
- tCompareResult = strcmp(dbv.pszVal, szHandle);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue; else break;
- }
- }
- free(szHandle);
- if (!hContact) {LOG(("GetCallerContact Not found!"));}
- return hContact;
-}
-
-HANDLE GetMetaHandle(DWORD dwId) {
- HANDLE hContact;
- char *szProto;
-
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, "MetaContacts") &&
- DBGetContactSettingDword(hContact, "MetaContacts", "MetaID", MAXDWORD)==dwId)
- return hContact;
- }
- return 0;
-}
-
-LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
- switch(msg)
- {
- case WM_COMMAND:
- break;
-
- case WM_CONTEXTMENU:
- SendMessage(hwnd,UM_DESTROYPOPUP,0,0);
- break;
- case UM_FREEPLUGINDATA:
- //Here we'd free our own data, if we had it.
- return FALSE;
- case UM_INITPOPUP:
- break;
- case UM_DESTROYPOPUP:
- break;
- case WM_NOTIFY:
- default:
- break;
- }
- return DefWindowProc(hwnd,msg,wParam,lParam);
-}
-
-void RingThread(char *szSkypeMsg) {
- HANDLE hContact;
- DBEVENTINFO dbei={0};
- DBVARIANT dbv;
- char *ptr = NULL;
-
- // We use a single critical section for the RingThread- and the EndCallThread-functions
- // so that only one function is running at the same time. This is needed, because when
- // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype
- // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED".
- // This starts two independend threads (first: RingThread; second: EndCallThread). Now
- // the two message are processed in reverse order sometimes. This causes the EndCallThread to
- // delete the contacts "CallId" property and after that the RingThread saves the contacts
- // "CallId" again. After that its not possible to call this contact, because the plugin
- // thinks that there is already a call going and the hangup-function isnt working, because
- // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
- // the threads and the messages are processed in correct order.
- // Not the best solution, but it works.
- EnterCriticalSection (&RingAndEndcallMutex);
-
- LOG(("RingThread started."));
- if (protocol >= 5) SkypeSend ("MINIMIZE");
- if (hContact=GetCallerContact(szSkypeMsg)) {
- // Make sure that an answering thread is not already in progress so that we don't get
- // the 'Incoming call' event twice
- if (!DBGetContactSettingString(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- DBFreeVariant(&dbv);
- LOG(("RingThread terminated."));
- goto l_exitRT;
- }
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "CallId", szSkypeMsg);
- }
-
- if (!(ptr=SkypeGet(szSkypeMsg, "TYPE", ""))) {
- LOG(("RingThread terminated."));
- goto l_exitRT;;
- }
-
- if (!strncmp(ptr, "INCOMING", 8))
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_RINGING);
- else
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_CALLING);
-
- if (!strncmp(ptr, "INCOMING", 8)) {
- if (!hContact) {
- char *szHandle;
-
- if (szHandle=GetCallerHandle(szSkypeMsg)) {
- if (!(hContact=add_contact(szHandle, PALF_TEMPORARY))) {
- free(szHandle);
- goto l_exitRT;
- }
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT"));
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "SkypeOutNr", szHandle);
- free(szHandle);
- } else goto l_exitRT;
- }
- }
-
- if (HasVoiceService()) {
- // Voice service will handle it
- goto l_exitRT;
- }
-
- dbei.cbSize=sizeof(dbei);
- dbei.eventType=EVENTTYPE_CALL;
- dbei.szModule=SKYPE_PROTONAME;
- dbei.timestamp=(DWORD)SkypeTime(NULL);
- dbei.pBlob=(unsigned char*)Translate("Phonecall");
- dbei.cbBlob=strlen((const char*)dbei.pBlob)+1;
- if (!strncmp(ptr, "INCOMING", 8))
- {
- CLISTEVENT cle={0};
- char toolTip[256];
-
- if(PopupServiceExists)
- {
- BOOL showPopup, popupWindowColor;
- unsigned int popupBackColor, popupTextColor;
- int popupTimeSec;
- POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR);
-
- popupTimeSec = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
- popupTextColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColor", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = (0 != DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColor", TRUE));
- showPopup = (0 != DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "showPopup", TRUE));
-
- InCallPopup.lchContact = hContact;
- InCallPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- InCallPopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- InCallPopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- InCallPopup.iSeconds = popupTimeSec;
- InCallPopup.PluginWindowProc = (WNDPROC)InCallPopUpProc;
- InCallPopup.PluginData = (void *)1;
-
- lstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"));
-
- lstrcpy(InCallPopup.lptzContactName, lpzContactName);
-
- if(showPopup)
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&InCallPopup,0);
-
- }
- cle.cbSize=sizeof(cle);
- cle.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- cle.pszService=SKYPE_ANSWERCALL;
- dbei.flags=DBEF_READ;
- cle.hContact=hContact;
- cle.hDbEvent=(HANDLE)CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- _snprintf(toolTip,sizeof(toolTip),Translate("Incoming call from %s"),(char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0));
- cle.pszTooltip=toolTip;
- CallServiceSync(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
- }
- else
- {
- dbei.flags=DBEF_SENT;
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- }
-
-l_exitRT:
- if (ptr) free (ptr);
- free(szSkypeMsg);
- LeaveCriticalSection (&RingAndEndcallMutex);
-}
-
-void EndCallThread(char *szSkypeMsg) {
- HANDLE hContact=NULL, hDbEvent;
- DBEVENTINFO dbei={0};
- DBVARIANT dbv;
- int tCompareResult;
-
- // We use a single critical section for the RingThread- and the EndCallThread-functions
- // so that only one function is running at the same time. This is needed, because when
- // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype
- // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED".
- // This starts two independend threads (first: RingThread; second: EndCallThread). Now
- // the two message are processed in reverse order sometimes. This causes the EndCallThread to
- // delete the contacts "CallId" property and after that the RingThread saves the contacts
- // "CallId" again. After that its not possible to call this contact, because the plugin
- // thinks that there is already a call going and the hangup-function isnt working, because
- // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
- // the threads and the messages are processed in correct order.
- // Not the best solution, but it works.
- EnterCriticalSection (&RingAndEndcallMutex);
-
- LOG(("EndCallThread started."));
- if (szSkypeMsg) {
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "CallId", &dbv)) continue;
- tCompareResult = strcmp(dbv.pszVal, szSkypeMsg);
- DBFreeVariant(&dbv);
- if (tCompareResult) continue; else break;
- }
- }
- if (hContact)
- {
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ENDED);
-
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "CallId");
-
- if (!HasVoiceService()) {
- dbei.cbSize=sizeof(dbei);
- hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
- while(hDbEvent) {
- dbei.cbBlob=0;
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CALL) {
- CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT,(WPARAM)hContact,(LPARAM)hDbEvent);
- }
- if (dbei.pBlob) free(dbei.pBlob);
- hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
- }
- }
-
- if (!DBGetContactSettingString(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
- DBFreeVariant(&dbv);
- if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) &&
- DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)
- )
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- }
- }
- free(szSkypeMsg);
- LeaveCriticalSection (&RingAndEndcallMutex);
-}
-
-void HoldCallThread(char *szSkypeMsg) {
- HANDLE hContact;
-
- LOG(("HoldCallThread started"));
- if (!szSkypeMsg) {
- LOG(("HoldCallThread terminated."));
- return;
- }
- if (hContact=GetCallerContact(szSkypeMsg)) {
- DBWriteContactSettingByte(hContact, SKYPE_PROTONAME, "OnHold", 1);
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ON_HOLD);
- }
- free(szSkypeMsg);
- LOG(("HoldCallThread terminated gracefully"));
-}
-
-void ResumeCallThread(char *szSkypeMsg) {
- HANDLE hContact;
-
- LOG(("ResumeCallThread started"));
- if (!szSkypeMsg) {
- LOG(("ResumeCallThread terminated."));
- return;
- }
- if (hContact=GetCallerContact(szSkypeMsg)) {
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "OnHold");
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_TALKING);
- }
- free(szSkypeMsg);
- LOG(("ResumeCallThread terminated gracefully."));
-}
-
-int SetUserStatus(void) {
- if (RequestedStatus && AttachStatus!=-1) {
- if (SkypeSend("SET USERSTATUS %s", RequestedStatus)==-1) return 1;
- }
- return 0;
-}
-
-void LaunchSkypeAndSetStatusThread(void *newStatus) {
-
-/* if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) {
- logoff_contacts();
- return 1;
- }
-*/
- int oldStatus=SkypeStatus;
- static BOOL bLaunching = FALSE;
-
- UNREFERENCED_PARAMETER(newStatus);
-
- if (bLaunching) return;
- bLaunching = TRUE;
- LOG (("LaunchSkypeAndSetStatusThread started."));
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
-
- if (ConnectToSkypeAPI(skype_path, 1)!=-1) {
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
- //InterlockedExchange((long *)&SkypeStatus, (int)newStatus);
- //ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
- SetUserStatus();
- }
-
- LOG (("LaunchSkypeAndSetStatusThread terminated gracefully."));
- bLaunching = FALSE;
-}
-
-LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
-{
- PCOPYDATASTRUCT CopyData;
- char *ptr, *szSkypeMsg=NULL, *nick, *buf;
- static char *onlinestatus=NULL;
- static BOOL RestoreUserStatus=FALSE;
- int sstat, oldstatus, flag;
- HANDLE hContact;
- fetchmsg_arg *args;
- static int iReentranceCnt = 0;
-
- iReentranceCnt++;
- switch (message)
- {
- case WM_COPYDATA:
- LOG(("WM_COPYDATA start"));
- if(hSkypeWnd==(HWND)wParam) {
- char *pData;
- CopyData=(PCOPYDATASTRUCT)lParam;
- pData = (char*)CopyData->lpData;
- while (*pData==' ') pData++;
- szSkypeMsg=_strdup((char*)pData);
- ReplyMessage(1);
- LOG(("< %s", szSkypeMsg));
-
- if (!strncmp(szSkypeMsg, "CONNSTATUS", 10)) {
- if (!strncmp(szSkypeMsg+11, "LOGGEDOUT", 9)) {
- SkypeInitialized=FALSE;
- ResetEvent(SkypeReady);
- AttachStatus=-1;
- sstat=ID_STATUS_OFFLINE;
- if (g_hWnd) KillTimer (g_hWnd, 1);
- logoff_contacts(TRUE);
- } else
- sstat=SkypeStatusToMiranda(szSkypeMsg+11);
-
- if (sstat) {
- oldstatus=SkypeStatus;
- InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- if (sstat!=ID_STATUS_OFFLINE) {
- if (sstat!=ID_STATUS_CONNECTING && (oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING)) {
-
- SkypeInitialized=FALSE;
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
- }
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "KeepState", 0)) RestoreUserStatus=TRUE;
- }
-
-// if (SkypeStatus==ID_STATUS_ONLINE) SkypeSend("SEARCH MISSEDMESSAGES");
- }
-// break;
- }
- if (!strncmp(szSkypeMsg, "USERSTATUS", 10)) {
-// if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11)) && SkypeStatus!=ID_STATUS_CONNECTING) {
- if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11))) {
- if (RestoreUserStatus && RequestedStatus) {
- RestoreUserStatus=FALSE;
- SkypeSend ("SET USERSTATUS %s", RequestedStatus);
- }
- oldstatus=SkypeStatus;
- InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, sstat);
-#ifdef SKYPEBUG_OFFLN
- if ((oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING) &&
- SkypeStatus!=ID_STATUS_CONNECTING && SkypeStatus!=ID_STATUS_OFFLINE)
- pthread_create(( pThreadFunc )SearchFriendsThread, NULL);
-#endif
- }
-#ifdef SKYPEBUG_OFFLN
- SetEvent(GotUserstatus);
-#endif
- break;
- }
- if (!strncmp(szSkypeMsg, "APPLICATION libpurple_typing", 28)) {
- char *nextoken, *p;
-
- if (p=strtok_r(szSkypeMsg+29, " ", &nextoken))
- {
- if (!strcmp (p, "STREAMS")) {
- char *pStr;
-
- while (p=strtok_r(NULL, " ", &nextoken)) {
- if (pStr = strchr(p, ':')) {
- *pStr=0;
- if (hContact=find_contact(p)) {
- *pStr=':';
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
- }
- }
- }
- }
- else if (!strcmp (p, "DATAGRAM")) {
- if (p=strtok_r(NULL, " ", &nextoken)) {
- char *pStr;
-
- if (pStr = strchr(p, ':')) {
- *pStr=0;
- if (hContact=find_contact(p)) {
- *pStr=':';
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
-
- if (p=strtok_r(NULL, " ", &nextoken)) {
- LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
-
- if (!strcmp(p, "PURPLE_TYPING")) lTyping=PROTOTYPE_CONTACTTYPING_INFINITE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, lTyping);
- break;
- }
- }
- }
- }
- }
- }
- }
- if (!strncmp(szSkypeMsg, "USER ", 5)) {
- char *nextoken;
-
- buf=_strdup(szSkypeMsg+5);
- nick=strtok_r(buf, " ", &nextoken);
- ptr=strtok_r(NULL, " ", &nextoken);
-
- if (strcmp(ptr, "BUDDYSTATUS")) {
- if (!strcmp(ptr, "RECEIVEDAUTHREQUEST")) {
- pthread_create(( pThreadFunc )SearchUsersWaitingMyAuthorization, NULL);
- free (buf);
- break;
- }
-
- if (!(hContact=find_contact(nick)) && strcmp(ptr, "FULLNAME")) {
- SkypeSend("GET USER %s BUDDYSTATUS", nick);
- free (buf);
- break;
- }
-
- if (!strcmp(ptr, "ONLINESTATUS")) {
- if (SkypeStatus!=ID_STATUS_OFFLINE)
- {
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda(ptr+13));
- if((WORD)SkypeStatusToMiranda(ptr+13) != ID_STATUS_OFFLINE)
- {
- LOG(("WndProc Status is not offline so get user info"));
- pthread_create(GetInfoThread, hContact);
- }
- }
- }
-
-
- /* We handle the following properties right here in the wndProc, in case that
- * Skype protocol broadcasts them to us.
- *
- * However, we still let them be added to the Message queue im memory, as they
- * may get consumed by GetInfoThread.
- * This is necessary to have a proper error handling in case the property is
- * not supported (i.e. imo2sproxy).
- *
- * If one of the property GETs returns an error, the error-message has to be
- * removed from the message queue, as the error is the answer to the query.
- * If we don't remove the ERRORs from the list, another consumer may see the ERROR
- * as a reply to his query and process it.
- * In case the SKYPE Protocol really broadcasts one of these messages without being
- * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take
- * care of them and remove them after some time.
- * This may not be the most efficient way, but ensures that we finally do proper
- * error handling.
- */
- if (!strcmp(ptr, "FULLNAME")) {
- char *nm;
-
- if (nm = strtok_r(NULL, " ", &nextoken))
- {
- SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm=strtok_r(NULL, "", &nextoken))) DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "LastName");
- else
- SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "LastName", nm);
- }
- } else
- if (!strcmp(ptr, "BIRTHDAY")) {
- unsigned int y, m, d;
- if (sscanf(ptr+9, "%04d%02d%02d", &y, &m, &d)==3) {
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "BirthYear", (WORD)y);
- DBWriteContactSettingByte(hContact, SKYPE_PROTONAME, "BirthMonth", (BYTE)m);
- DBWriteContactSettingByte(hContact, SKYPE_PROTONAME, "BirthDay", (BYTE)d);
- } else {
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "BirthYear");
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "BirthMonth");
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "BirthDay");
- }
- } else
- if (!strcmp(ptr, "COUNTRY")) {
- if (ptr[8]) {
- struct CountryListEntry *countries;
- int countryCount, i;
-
- CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
- for (i=0; i<countryCount; i++) {
- if (countries[i].id == 0 || countries[i].id == 0xFFFF) continue;
- if (!_stricmp(countries[i].szName, ptr+8))
- {
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Country", (BYTE)countries[i].id);
- break;
- }
- }
- } else DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "Country");
- } else
- if (!strcmp(ptr, "SEX")) {
- if (ptr[4]) {
- BYTE sex=0;
- if (!_stricmp(ptr+4, "MALE")) sex=0x4D;
- if (!_stricmp(ptr+4, "FEMALE")) sex=0x46;
- if (sex) DBWriteContactSettingByte(hContact, SKYPE_PROTONAME, "Gender", sex);
- } else DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "Gender");
- } else
- /* if (!strcmp(ptr, "AVATAR" )){
- LOG("WndProc", "AVATAR");
- if (!(hContact=find_contact(nick)))
- SkypeSend("GET USER %s BUDDYSTATUS", nick);
- else
- {
- TCHAR *unicode = NULL;
-
- if(utf8_decode((ptr+9), &Avatar)==-1) break;
-
- if( ServiceExists(MS_AV_SETAVATAR) )
- {
- CallService(MS_AV_SETAVATAR,(WPARAM) hContact,(LPARAM) Avatar);
- }
- else
- {
-
- if(DBWriteContactSettingTString(hContact, "ContactPhoto", "File", Avatar))
- {
- #if defined( _UNICODE )
- char buff[TEXT_LEN];
- WideCharToMultiByte(code_page, 0, Avatar, -1, buff, TEXT_LEN, 0, 0);
- buff[TEXT_LEN] = 0;
- DBWriteContactSettingString(hContact, "ContactPhoto", "File", buff);
- #endif
- }
-
- }
-
-
- }
- free(buf);
- break;
- }
- */
- if (!strcmp(ptr, "MOOD_TEXT")){
-
- LOG(("WndProc MOOD_TEXT"));
- SkypeDBWriteContactSettingUTF8String (hContact, "CList", "StatusMsg", ptr+10);
- } else
- if (!strcmp(ptr, "TIMEZONE")){
- time_t temp;
- struct tm tms;
- int value=atoi(ptr+9), tz;
-
- LOG(("WndProc: TIMEZONE %s", nick));
-
- if (value && !DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "IgnoreTimeZones", 0)) {
- temp = SkypeTime(NULL);
- tms = *localtime(&temp);
- //memcpy(&tms,localtime(&temp), sizeof(tm));
- //tms = localtime(&temp)
- tz=(value >= 86400 )?(256-((2*(atoi(ptr+9)-86400))/3600)):((-2*(atoi(ptr+9)-86400))/3600);
- if (tms.tm_isdst == 1 && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0))
- {
- LOG(("WndProc: Using the TimeZonePatch"));
- DBWriteContactSettingByte(hContact, "UserInfo", "Timezone", (BYTE)(tz+2));
- }
- else
- {
- LOG(("WndProc: Not using the TimeZonePatch"));
- DBWriteContactSettingByte(hContact, "UserInfo", "Timezone", (BYTE)(tz+0));
- }
- } else {
- LOG(("WndProc: Deleting the TimeZone in UserInfo Section"));
- DBDeleteContactSetting(hContact, "UserInfo", "Timezone");
- }
- } else
- if (!strcmp(ptr, "IS_VIDEO_CAPABLE")){
- if (!_stricmp(ptr + 17, "True"))
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "MirVer", "Skype 2.0");
- else
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "MirVer", "Skype");
- } else
- if (!strcmp(ptr, "RICH_MOOD_TEXT")) {
- DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "MirVer", "Skype 3.0");
- } else
- if (!strcmp(ptr, "DISPLAYNAME")) {
- // Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-(
- if (ptr[12])
- SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "Nick", ptr+12);
- } else // Other proerties that can be directly assigned to a DB-Value
- {
- int i;
- char *pszProp;
-
- for (i=0; i<sizeof(m_settings)/sizeof(m_settings[0]); i++) {
- if (!strcmp(ptr, m_settings[i].SkypeSetting)) {
- pszProp = ptr+strlen(m_settings[i].SkypeSetting)+1;
- if (*pszProp)
- SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
- else
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
- }
- }
- }
- } else { // BUDDYSTATUS:
- flag=0;
- switch(atoi(ptr+12)) {
- case 1: if (hContact=find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); break;
- case 0: break;
- case 2: flag=PALF_TEMPORARY;
- case 3: add_contact(nick, flag);
- SkypeSend("GET USER %s ONLINESTATUS", nick);
- break;
- }
- free(buf);
- if (!SetEvent(hBuddyAdded)) TellError(GetLastError());
- break;
- }
- free(buf);
- }
- if (!strncmp(szSkypeMsg, "CURRENTUSERHANDLE", 17)) { // My username
- DBVARIANT dbv={0};
-
- if(DBGetContactSettingString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) ||
- !*dbv.pszVal || _stricmp (szSkypeMsg+18, dbv.pszVal)==0)
- {
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, szSkypeMsg+18);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "Nick", szSkypeMsg+18);
- pthread_create(( pThreadFunc )GetDisplaynameThread, NULL);
- }
- if (dbv.pszVal) DBFreeVariant(&dbv);
- }
- if (strstr(szSkypeMsg, "AUTOAWAY") || !strncmp(szSkypeMsg, "OPEN ",5) ||
- (SkypeInitialized && !strncmp (szSkypeMsg, "PONG", 4)) ||
- !strncmp (szSkypeMsg, "MINIMIZE", 8))
- {
- // Currently we do not process these messages
- break;
- }
- if (!strncmp(szSkypeMsg, "CHAT ", 5)) {
- // Currently we only process these notifications
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- (ptr = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++ptr, ' ')))
- {
- if (strncmp(ptr, " MEMBERS", 8) == 0) {
- LOG(("WndProc AddMembers"));
- pthread_create(( pThreadFunc )AddMembersThread, _strdup(szSkypeMsg));
- } else
- if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) {
- // Chat session name
- HANDLE hContact;
-
- *ptr=0;
- if (hContact = find_chatA(szSkypeMsg+5))
- {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
-
- if (DBGetContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
- ID_STATUS_OFFLINE)
- {
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5);
- gcd.iType = GC_EVENT_CHANGESESSIONAME;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszText = make_tchar_string((const unsigned char*)ptr+14);
- gce.dwFlags = GC_TCHAR;
- if (gce.ptszText) {
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- DBWriteContactSettingTString (hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
- free((void*)gce.ptszText);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- }
- }
- *ptr=' ';
- } else
- if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
- pthread_create(( pThreadFunc )MessageListProcessingThread, _strdup(ptr+14));
- break;
- }
- }
- }
- if (!strncmp(szSkypeMsg, "CALL ",5)) {
- // incoming calls are already processed by Skype, so no need for us
- // to do this.
- // However we can give a user the possibility to hang up a call via Miranda's
- // context menu
- if (ptr=strstr(szSkypeMsg, " STATUS ")) {
- ptr[0]=0; ptr+=8;
- if (!strcmp(ptr, "RINGING") || !strcmp(ptr, "ROUTING")) pthread_create(( pThreadFunc )RingThread, _strdup(szSkypeMsg));
- if (!strcmp(ptr, "FAILED") || !strcmp(ptr, "FINISHED") ||
- !strcmp(ptr, "MISSED") || !strcmp(ptr, "REFUSED") ||
- !strcmp(ptr, "BUSY") || !strcmp(ptr, "CANCELLED"))
- pthread_create(( pThreadFunc )EndCallThread, _strdup(szSkypeMsg));
- if (!strcmp(ptr, "ONHOLD") || !strcmp(ptr, "LOCALHOLD") ||
- !strcmp(ptr, "REMOTEHOLD")) pthread_create(( pThreadFunc )HoldCallThread, _strdup(szSkypeMsg));
- if (!strcmp(ptr, "INPROGRESS")) pthread_create(( pThreadFunc )ResumeCallThread, _strdup(szSkypeMsg));
- break;
- } else if ((!strstr(szSkypeMsg, "PARTNER_HANDLE") && !strstr(szSkypeMsg, "FROM_HANDLE"))
- && !strstr(szSkypeMsg, "TYPE")) break;
- }
- if (!strncmp(szSkypeMsg, "PRIVILEGE SKYPEOUT", 18)) {
- if (!strncmp(szSkypeMsg+19, "TRUE", 4)) {
- if (!bSkypeOut) {
- CLISTMENUITEM mi={0};
-
- bSkypeOut=TRUE;
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=0;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszName=Translate("Do a SkypeOut-call");
- mi.pszService=SKYPEOUT_CALL;
- CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)NULL,(LPARAM)&mi);
- }
-
- } else {
- bSkypeOut=FALSE;
- if (httbButton) {
- CallService(MS_TTB_REMOVEBUTTON, (WPARAM)httbButton, 0);
- httbButton=0;
- }
- }
- break;
- }
- if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) {
- if (strlen(szSkypeMsg)<=(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1))
- {
- LOG(( "%s %d %s %d", szSkypeMsg,(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1),
- strchr(szSkypeMsg, ' '), strlen(szSkypeMsg)));
- break;
- }
- LOG(("MessageListProcessingThread launched"));
- pthread_create(( pThreadFunc )MessageListProcessingThread, _strdup(strchr(szSkypeMsg, ' ')+1));
- break;
- }
- if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11))
- {
- char *pMsgNum;
- TYP_MSGLENTRY *pEntry;
-
- if ((pMsgNum = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++pMsgNum, ' ')))
- {
- BOOL bFetchMsg = FALSE;
-
- if (strncmp(ptr, " EDITED_TIMESTAMP", 17) == 0) {
- ptr[0]=0;
- if (pEntry = MsgList_FindMessage(strtoul(pMsgNum, NULL, 10))) {
- pEntry->tEdited = atol(ptr+18);
- }
- bFetchMsg = TRUE;
- } else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) ||
- (strncmp(ptr, " STATUS SENT", 12) == 0 && !sendwatchers);
-
- if (bFetchMsg) {
- // If new message is available, fetch it
- ptr[0]=0;
- if (!(args=(fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
- strncpy (args->msgnum, pMsgNum, sizeof(args->msgnum));
- args->getstatus=FALSE;
- //args->bIsRead = strncmp(ptr+8, "READ", 4) == 0;
- pthread_create(( pThreadFunc )FetchMessageThreadSync, args);
- break;
- }
- }
- }
- if (!strncmp(szSkypeMsg, "ERROR 68", 8)) {
- LOG(("We got a sync problem :( -> SendMessage() will try to recover..."));
- break;
- }
- if (!strncmp(szSkypeMsg, "PROTOCOL ", 9)) {
- if ((protocol=(char)atoi(szSkypeMsg+9))>=3) {
- strcpy(cmdMessage, "CHATMESSAGE");
- strcpy(cmdPartner, "FROM");
- }
- bProtocolSet = TRUE;
-
- if (protocol<5 && !hMenuAddSkypeContact &&
- DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "EnableMenu", 1))
- {
- hMenuAddSkypeContact = add_mainmenu();
- }
- }
- LOG(("SkypeMsgAdd launched"));
- SkypeMsgAdd(szSkypeMsg);
- ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
- }
- break;
-
- case WM_TIMER:
- if (iReentranceCnt>1) break;
- if (!bIsImoproxy) SkypeSend("PING");
- SkypeMsgCollectGarbage(MAX_MSG_AGE);
- MsgList_CollectGarbage();
- if (receivers>1)
- {
- LOG(("Watchdog WARNING: there are still %d receivers waiting for MSGs", receivers));
- }
- break;
-
- case WM_CLOSE:
- PostQuitMessage (0);
- break;
- case WM_DESTROY:
- KillTimer (hWndDlg, 1);
- break;
-
- default:
- if(message==ControlAPIAttach) {
- // Skype responds with Attach to the discover-message
- if ((HWND)wParam == hForbiddenSkypeWnd) {
- ResetEvent(SkypeReady);
- break;
- }
- AttachStatus=lParam;
- if (lParam==SKYPECONTROLAPI_ATTACH_SUCCESS) {
- LOG (("AttachStatus success, got hWnd %08X", (HWND)wParam));
-
- if (hSkypeWnd && (HWND)wParam!=hSkypeWnd && IsWindow(hSkypeWnd))
- hSkypeWndSecondary = (HWND)wParam;
- else {
- hSkypeWnd=(HWND)wParam; // Skype gave us the communication window handle
- hSkypeWndSecondary = NULL;
- }
- }
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_API_AVAILABLE &&
- AttachStatus!=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE)
- {
- LOG(("Attaching: SkypeReady fired, Attachstatus is %d", AttachStatus));
- SetEvent(SkypeReady);
- }
- AttachStatus=lParam;
- break;
- }
- --iReentranceCnt;
- return (DefWindowProc(hWndDlg, message, wParam, lParam));
- }
- LOG(("WM_COPYDATA exit (%08X)", message));
- if (szSkypeMsg) free(szSkypeMsg);
- --iReentranceCnt;
- return 1;
-}
-
-void TellError(DWORD err) {
- LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
- MessageBox( NULL, (TCHAR*)lpMsgBuf, _T("GetLastError"), MB_OK|MB_ICONINFORMATION );
- LocalFree( lpMsgBuf );
- return;
-}
-
-
-// SERVICES //
-INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam)
-{
- int oldStatus, iRet;
- BOOL UseCustomCommand, UnloadOnOffline;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (MirandaShuttingDown) return 0;
- LOG (("SkypeSetStatus enter"));
- UseCustomCommand = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- UnloadOnOffline = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0);
-
- //if (!SkypeInitialized && !DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) return 0;
-
- // Workaround for Skype status-bug
- if ((int)wParam==ID_STATUS_OFFLINE) logoff_contacts(TRUE);
- if (SkypeStatus==(int)wParam) return 0;
- oldStatus = SkypeStatus;
-
- if ((int)wParam==ID_STATUS_CONNECTING) return 0;
-#ifdef MAPDND
- if ((int)wParam==ID_STATUS_OCCUPIED || (int)wParam==ID_STATUS_ONTHEPHONE) wParam=ID_STATUS_DND;
- if ((int)wParam==ID_STATUS_OUTTOLUNCH) wParam=ID_STATUS_NA;
-#endif
-#ifdef MAPNA
- if ((int)wParam==ID_STATUS_NA) wParam = ID_STATUS_AWAY;
-#endif
-
- RequestedStatus=MirandaStatusToSkype((int)wParam);
-
- /*
- if (SkypeStatus != ID_STATUS_OFFLINE)
- {
- InterlockedExchange((long*)&SkypeStatus, (int)wParam);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
- }
- */
-
- if ((int)wParam==ID_STATUS_OFFLINE && UnloadOnOffline)
- {
- if(UseCustomCommand)
- {
- DBVARIANT dbv;
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- CloseSkypeAPI(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- }
- else
- {
- CloseSkypeAPI(skype_path);
- }
-
- } else if (AttachStatus==-1)
- {
- pthread_create(LaunchSkypeAndSetStatusThread, (void *)wParam);
- return 0;
- }
-
- iRet = SetUserStatus();
- LOG (("SkypeSetStatus exit"));
- return iRet;
-}
-
-int __stdcall SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam )
-{
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = type;
- ack.result = result;
- ack.hProcess = hProcess;
- ack.lParam = lParam;
- return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
-}
-
-static void __cdecl SkypeGetAwayMessageThread( HANDLE hContact )
-{
- DBVARIANT dbv;
- if ( !DBGetContactSettingString( hContact, "CList", "StatusMsg", &dbv )) {
- SendBroadcast( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )dbv.pszVal );
- DBFreeVariant( &dbv );
- }
- else SendBroadcast( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )0 );
-}
-
-INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam)
-{
- CCSDATA* ccs = ( CCSDATA* )lParam;
-
- UNREFERENCED_PARAMETER(wParam);
-
- pthread_create( SkypeGetAwayMessageThread, ccs->hContact );
- return 1;
-}
-
-#define POLYNOMIAL (0x488781ED) /* This is the CRC Poly */
-#define TOPBIT (1 << (WIDTH - 1)) /* MSB */
-#define WIDTH 32
-
-static int GetFileHash(char* filename)
-{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- int remainder = 0, byte, bit;
- char data[1024];
- DWORD dwRead;
-
- if(hFile == INVALID_HANDLE_VALUE) return 0;
-
- do
- {
- // Read file chunk
- dwRead = 0;
- ReadFile(hFile, data, 1024, &dwRead, NULL);
-
- /* loop through each byte of data */
- for (byte = 0; byte < (int) dwRead; ++byte) {
- /* store the next byte into the remainder */
- remainder ^= (data[byte] << (WIDTH - 8));
- /* calculate for all 8 bits in the byte */
- for ( bit = 8; bit > 0; --bit) {
- /* check if MSB of remainder is a one */
- if (remainder & TOPBIT)
- remainder = (remainder << 1) ^ POLYNOMIAL;
- else
- remainder = (remainder << 1);
- }
- }
- } while(dwRead == 1024);
-
- CloseHandle(hFile);
-
- return remainder;
-}
-
-static int _GetFileSize(char* filename)
-{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- int size;
-
- if(hFile == INVALID_HANDLE_VALUE)
- return 0;
- size = GetFileSize(hFile, NULL);
- CloseHandle(hFile);
- return size;
-}
-
-/* RetrieveUserAvatar
- *
- * Purpose: Get a user avatar from skype itself
- * Params : param=(void *)(HANDLE)hContact
- */
-void RetrieveUserAvatar(void *param)
-{
- HANDLE hContact = (HANDLE) param, file;
- PROTO_AVATAR_INFORMATION AI={0};
- ACKDATA ack = {0};
- DBVARIANT dbv;
- char AvatarFile[MAX_PATH+1], AvatarTmpFile[MAX_PATH+10], *ptr, *pszTempFile;
-
- if (hContact == NULL)
- return;
-
- // Mount default ack
- ack.cbSize = sizeof( ACKDATA );
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = ACKTYPE_AVATAR;
- ack.result = ACKRESULT_FAILED;
-
- AI.cbSize = sizeof( AI );
- AI.hContact = hContact;
-
- // Get skype name
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
- {
- if (dbv.pszVal)
- {
- // Get filename
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- mir_snprintf(AvatarTmpFile, sizeof(AvatarTmpFile), "AVATAR 1 %s\\%s_tmp.jpg", AvatarFile, dbv.pszVal);
- pszTempFile = AvatarTmpFile+9;
- mir_snprintf(AvatarFile, sizeof(AvatarFile), "%s\\%s.jpg", AvatarFile, dbv.pszVal);
-
- // Just to be sure
- DeleteFileA(pszTempFile);
- file = CreateFileA(pszTempFile, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (file != INVALID_HANDLE_VALUE)
- {
- CloseHandle(file);
- if (ptr=SkypeGet ("USER", dbv.pszVal, AvatarTmpFile))
- {
- if (strncmp(ptr, "ERROR", 5) &&
- GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES)
- {
- ack.result = ACKRESULT_SUCCESS;
-
- // Is no avatar image?
- if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0)
- && GetFileHash(pszTempFile) == 0x8d34e05d && _GetFileSize(pszTempFile) == 3751)
- {
- // Has no avatar
- AI.format = PA_FORMAT_UNKNOWN;
- ack.hProcess = (HANDLE)&AI;
- DeleteFileA(AvatarFile);
- }
- else
- {
- // Got it
- MoveFileExA(pszTempFile, AvatarFile, MOVEFILE_REPLACE_EXISTING);
- AI.format = PA_FORMAT_JPEG;
- strcpy(AI.filename, AvatarFile);
- ack.hProcess = (HANDLE)&AI;
- }
-
- }
- free (ptr);
- }
- DeleteFileA(pszTempFile);
- }
-
- }
- DBFreeVariant(&dbv);
- }
- CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
-}
-
-
-/* SkypeGetAvatarInfo
- *
- * Purpose: Set user avatar in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)filename
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam)
-{
-
- DBVARIANT dbv;
- PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
- if (AI->hContact == NULL) // User
- {
- if (!DBGetContactSettingString(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv))
- {
- lstrcpynA(AI->filename, dbv.pszVal, sizeof(AI->filename));
- DBFreeVariant(&dbv);
- return GAIR_SUCCESS;
- }
- else
- return GAIR_NOAVATAR;
- }
- else // Contact
- {
- DBVARIANT dbv;
- char AvatarFile[MAX_PATH+1];
-
- if (protocol < 7 && !bIsImoproxy)
- return GAIR_NOAVATAR;
-
- if (wParam & GAIF_FORCE)
- {
- // Request anyway
- pthread_create(RetrieveUserAvatar, (void *) AI->hContact);
- return GAIR_WAITFOR;
- }
-
- if (DBGetContactSettingString(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- // No skype name ??
- return GAIR_NOAVATAR;
-
- if (dbv.pszVal == NULL)
- {
- // No skype name ??
- DBFreeVariant(&dbv);
- return GAIR_NOAVATAR;
- }
-
- // Get filename
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- mir_snprintf(AvatarFile, sizeof(AvatarFile), "%s\\%s.jpg", AvatarFile, dbv.pszVal);
- DBFreeVariant(&dbv);
-
- // Check if the file exists
- if (GetFileAttributesA(AvatarFile) == INVALID_FILE_ATTRIBUTES)
- return GAIR_NOAVATAR;
-
- // Return the avatar
- AI->format = PA_FORMAT_JPEG;
- strcpy(AI->filename, AvatarFile);
- return GAIR_SUCCESS;
- }
-}
-
-
-/* SkypeGetAvatarCaps
- *
- * Purpose: Query avatar caps for a protocol
- * Params : wParam=One of AF_*
- * lParam=Depends on wParam
- * Returns: Depends on wParam
- */
-INT_PTR SkypeGetAvatarCaps(WPARAM wParam, LPARAM lParam)
-{
- switch(wParam)
- {
- case AF_MAXSIZE:
- {
- POINT *p = (POINT *) lParam;
- if (p == NULL)
- return -1;
-
- p->x = 96;
- p->y = 96;
- return 0;
- }
- case AF_PROPORTION:
- {
- return PIP_NONE;
- }
- case AF_FORMATSUPPORTED:
- {
- if (lParam == PA_FORMAT_PNG || lParam == PA_FORMAT_JPEG)
- return TRUE;
- else
- return FALSE;
- }
- case AF_ENABLED:
- {
- return TRUE;
- }
- case AF_DONTNEEDDELAYS:
- {
- return FALSE;
- }
- }
- return -1;
-}
-
-
-INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- return SkypeStatus;
-}
-
-INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
-
- UNREFERENCED_PARAMETER(wParam);
-
- pthread_create(GetInfoThread, ccs->hContact);
- return 0;
-}
-
-INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam) {
- PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)lParam;
-
- LOG(("SkypeAddToList Adding API function called"));
- if (psr->cbSize!=sizeof(PROTOSEARCHRESULT) || !psr->nick) return 0;
- LOG(("SkypeAddToList OK"));
- return (INT_PTR)add_contact(psr->nick, wParam);
-}
-
-INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
-
- LOG(("SkypeBasicSearch %s", (char *)lParam));
- if (!SkypeInitialized) return 0;
- return (hSearchThread=pthread_create(( pThreadFunc )BasicSearchThread, _strdup((char *)lParam)));
-}
-
-void MessageSendWatchThread(msgsendwt_arg *arg) {
- char *str, *err;
-
- // sendwatchers need to be incremented before starting this thread
- LOG(("MessageSendWatchThread started."));
- str=SkypeRcvMsg(arg->szId, SkypeTime(NULL)-1, arg->hContact, DBGetContactSettingDword(NULL,"SRMsg","MessageTimeout",TIMEOUT_MSGSEND)+1000);
- InterlockedDecrement (&sendwatchers);
- if (str)
- {
- if (!DBGetContactSettingByte(arg->hContact, SKYPE_PROTONAME, "ChatRoom", 0)) {
- if (err=GetSkypeErrorMsg(str)) {
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, (LPARAM)Translate(err));
- free(err);
- free(str);
- free(arg);
- LOG(("MessageSendWatchThread terminated."));
- return;
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
- }
- free(str);
- LOG(("MessageSendWatchThread terminated gracefully."));
- }
- free (arg);
-}
-
-INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
- DBVARIANT dbv;
- BOOL sendok=TRUE;
- char *msg = (char *) ccs->lParam, *utfmsg=NULL, *mymsgcmd=cmdMessage, szId[16]={0};
- static DWORD dwMsgNum = 0;
- BYTE bIsChatroom = 0 != DBGetContactSettingByte(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0);
-
- UNREFERENCED_PARAMETER(wParam);
-
- if (bIsChatroom)
- {
- if (DBGetContactSettingString(ccs->hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv))
- return 0;
- mymsgcmd="CHATMESSAGE";
- }
- else
- {
- if (DBGetContactSettingString(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 0;
- mymsgcmd="MESSAGE";
- }
-
- if (ccs->wParam & PREF_UTF) {
- utfmsg = msg;
- } else if (ccs->wParam & PREF_UNICODE) {
- utfmsg = (char*)make_utf8_string((WCHAR*)(msg+strlen(msg)+1));
- } else {
- if (utf8_encode(msg, &utfmsg)==-1) utfmsg=NULL;
- }
- if (protocol>=4) {
- InterlockedIncrement ((LONG*)&dwMsgNum);
- sprintf (szId, "#M%d ", dwMsgNum++);
- }
- InterlockedIncrement (&sendwatchers);
- if (!utfmsg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, utfmsg)) sendok=FALSE;
- if (utfmsg && utfmsg!=msg) free(utfmsg);
- DBFreeVariant(&dbv);
-
- if (sendok) {
- msgsendwt_arg *psendarg = calloc(1, sizeof(msgsendwt_arg));
-
- if (psendarg) {
- psendarg->hContact = ccs->hContact;
- strcpy (psendarg->szId, szId);
- pthread_create(MessageSendWatchThread, psendarg);
- } else InterlockedDecrement (&sendwatchers);
- return 1;
- } else InterlockedDecrement (&sendwatchers);
- if (!bIsChatroom)
- ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, (LPARAM)Translate("Connection to Skype lost"));
- return 0;
-}
-
-INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam)
-{
- DBEVENTINFO dbei={0};
- CCSDATA *ccs = (CCSDATA *) lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
-
- UNREFERENCED_PARAMETER(wParam);
-
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- if (pre->flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ;
- if (pre->flags & PREF_UTF) dbei.flags|=DBEF_UTF;
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = strlen(pre->szMessage) + 1;
- if (pre->flags & PREF_UNICODE)
- dbei.cbBlob += sizeof( wchar_t )*( (DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob] )+1 );
- dbei.pBlob = (PBYTE) pre->szMessage;
- MsgList_Add (pre->lParam, (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)ccs->hContact, (LPARAM)&dbei));
- return 0;
-}
-
-INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv={0};
- HANDLE hContact = (HANDLE)wParam;
-
- if (protocol<5 && !bIsImoproxy) return 0;
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv)) {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) {
- char szCmd[256];
- _snprintf (szCmd, sizeof(szCmd),
- "ALTER APPLICATION libpurple_typing CONNECT %s", dbv.pszVal);
- SkypeSend (szCmd);
- DBFreeVariant (&dbv);
- testfor (szCmd, 2000);
- // TODO: We should somehow cache the typing notify result and send it
- // after we got a connection, but in the meantime this notification won't
- // get sent on first run
- }
- return 0;
- }
-
- SkypeSend ("ALTER APPLICATION libpurple_typing DATAGRAM %s %s", dbv.pszVal,
- (lParam==PROTOTYPE_SELFTYPING_ON?"PURPLE_TYPING":"PURPLE_NOT_TYPING"));
- DBFreeVariant(&dbv);
- return 0;
-}
-
-
-INT_PTR SkypeSendAuthRequest(WPARAM wParam, LPARAM lParam) {
- CCSDATA* ccs = (CCSDATA*)lParam;
- DBVARIANT dbv;
- int retval;
-
- UNREFERENCED_PARAMETER(wParam);
-
- if (!ccs->lParam || DBGetContactSettingString(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 1;
- retval = SkypeSend("SET USER %s BUDDYSTATUS 2 %s", dbv.pszVal, (char *)ccs->lParam);
- DBFreeVariant(&dbv);
- if (retval) return 1; else return 0;
-}
-
-INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam) {
- DBEVENTINFO dbei = {0};
- CCSDATA* ccs = (CCSDATA*)lParam;
- PROTORECVEVENT* pre = (PROTORECVEVENT*)ccs->lParam;
-
- UNREFERENCED_PARAMETER(wParam);
-
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
-
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- dbei.flags = ((pre->flags & PREF_CREATEREAD)?DBEF_READ:0);
- dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = pre->lParam;
- dbei.pBlob = (PBYTE)pre->szMessage;
-
- CallService(MS_DB_EVENT_ADD, (WPARAM)NULL, (LPARAM)&dbei);
- return 0;
-}
-
-char *__skypeauth(WPARAM wParam) {
- DBEVENTINFO dbei={0};
-
- if (!SkypeInitialized) return NULL;
-
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, wParam, 0))==-1 ||
- !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob)))
- { return NULL; }
-
- if (CallService(MS_DB_EVENT_GET, wParam, (LPARAM)&dbei) ||
- dbei.eventType != EVENTTYPE_AUTHREQUEST ||
- strcmp(dbei.szModule, SKYPE_PROTONAME))
- {
- free(dbei.pBlob);
- return NULL;
- }
- return (char *)dbei.pBlob;
-}
-
-INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam) {
- char *pBlob;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (pBlob=__skypeauth(wParam))
- {
- int retval=SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob+sizeof(DWORD)+sizeof(HANDLE));
- free(pBlob);
- if (!retval) return 0;
- }
- return 1;
-}
-
-INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam) {
- char *pBlob;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (pBlob=__skypeauth(wParam))
- {
- int retval=SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob+sizeof(DWORD)+sizeof(HANDLE));
- free(pBlob);
- if (!retval) return 0;
- }
- return 1;
-}
-
-
-INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam) {
- char *pBlob;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (pBlob=__skypeauth(wParam))
- {
- HANDLE hContact=add_contact(pBlob+sizeof(DWORD)+sizeof(HANDLE), LOWORD(wParam));
- free(pBlob);
- if (hContact) return (int)hContact;
- }
- return 0;
-}
-
-INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
-
- if (!lParam) {
- free (pszProxyCallout);
- pszProxyCallout = NULL;
- }
- pszProxyCallout = _strdup((char*)lParam);
- bIsImoproxy = TRUE;
- return 0;
-}
-
-
-void CleanupNicknames(char *dummy) {
- HANDLE hContact;
- char *szProto;
- DBVARIANT dbv, dbv2;
-
- UNREFERENCED_PARAMETER(dummy);
-
- LOG(("CleanupNicknames Cleaning up..."));
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- {
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Nick", &dbv2)) {
- DBFreeVariant(&dbv);
- continue;
- }
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "Nick");
- GetInfoThread(hContact);
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
- }
- }
- OUTPUT(_T("Cleanup finished."));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// EnterBitmapFileName - enters a bitmap filename
-
-int __stdcall EnterBitmapFileName( char* szDest )
-{
- char szFilter[ 512 ];
- OPENFILENAMEA ofn = {0};
- *szDest = 0;
-
- CallService( MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof szFilter, ( LPARAM )szFilter );
- ofn.lStructSize = sizeof( OPENFILENAME );
- ofn.lpstrFilter = szFilter;
- ofn.lpstrFile = szDest;
- ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = "bmp";
- if ( !GetOpenFileNameA( &ofn ))
- return 1;
-
- return ERROR_SUCCESS;
-}
-
-int MirandaExit(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- MirandaShuttingDown=TRUE;
- return 0;
-}
-
-int OkToExit(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
-// logoff_contacts();
- MirandaShuttingDown=TRUE;
-
- // Trigger all semaphores and events just to be sure that there is no deadlock
- ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
- SetEvent (SkypeReady);
- SetEvent (MessagePumpReady);
-#ifdef SKYPEBUG_OFFLN
- SetEvent(GotUserstatus);
-#endif
- SetEvent (hBuddyAdded);
-
- SkypeFlush ();
- PostMessage (g_hWnd, WM_CLOSE, 0, 0);
- return 0;
-}
-
-
-struct PLUGINDI {
- char **szSettings;
- int dwCount;
-};
-
-// Taken from pluginopts.c and modified
-int EnumOldPluginName(const char *szSetting,LPARAM lParam)
-{
- struct PLUGINDI *pdi=(struct PLUGINDI*)lParam;
- if (pdi && lParam) {
- pdi->szSettings=(char**)realloc(pdi->szSettings,(pdi->dwCount+1)*sizeof(char*));
- pdi->szSettings[pdi->dwCount++]=_strdup(szSetting);
- }
- return 0;
-}
-
-// Are there any Skype users on list?
-// 1 --> Yes
-// 0 --> No
-int AnySkypeusers(void)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- int tCompareResult;
-
- // already on list?
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- hContact != NULL;
- hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- {
- // GETCONTACTBASEPROTO doesn't work on not loaded protocol, therefore get
- // protocol from DB
- if (DBGetContactSettingString(hContact, "Protocol", "p", &dbv)) continue;
- tCompareResult = !strcmp(dbv.pszVal, SKYPE_PROTONAME);
- DBFreeVariant(&dbv);
- if (tCompareResult) return 1;
- }
- return 0;
-}
-
-
-void UpgradeName(char *OldName)
-{
- DBCONTACTENUMSETTINGS cns;
- DBCONTACTWRITESETTING cws;
- DBVARIANT dbv;
- HANDLE hContact=NULL;
- struct PLUGINDI pdi;
-
- LOG(("Updating old database settings if there are any..."));
- cns.pfnEnumProc=EnumOldPluginName;
- cns.lParam=(LPARAM)&pdi;
- cns.szModule=OldName;
- cns.ofsSettings=0;
-
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
-
- for ( ;; ) {
- memset(&pdi,0,sizeof(pdi));
- CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)hContact,(LPARAM)&cns);
- // Upgrade Protocol settings to new string
- if (pdi.szSettings) {
- int i;
-
- LOG(("We're currently upgrading..."));
- for (i=0;i<pdi.dwCount;i++) {
- if (!DBGetContactSettingString(hContact, OldName, pdi.szSettings[i], &dbv)) {
- cws.szModule=SKYPE_PROTONAME;
- cws.szSetting=pdi.szSettings[i];
- cws.value=dbv;
- if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws))
- DBDeleteContactSetting(hContact,OldName,pdi.szSettings[i]);
- DBFreeVariant(&dbv);
- }
- free(pdi.szSettings[i]);
- }
- free(pdi.szSettings);
- }
- // Upgrade Protocol assignment, if we are not main contact
- if (hContact && !DBGetContactSettingString(hContact, "Protocol", "p", &dbv)) {
- if (!strcmp(dbv.pszVal, OldName))
- DBWriteContactSettingString(hContact, "Protocol", "p", SKYPE_PROTONAME);
- DBFreeVariant(&dbv);
- }
- if (!hContact) break;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
- }
-
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "UpgradeDone", (BYTE)1);
- return;
-}
-
-void __cdecl MsgPump (char *dummy)
-{
- MSG msg;
-
- WNDCLASS WndClass;
-
- UNREFERENCED_PARAMETER(dummy);
-
- // Create window class
- WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
- WndClass.lpfnWndProc = (WNDPROC)WndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = hInst;
- WndClass.hIcon = NULL;
- WndClass.hCursor = NULL;
- WndClass.hbrBackground = NULL;
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = _T("SkypeApiDispatchWindow");
- RegisterClass(&WndClass);
- // Do not check the retval of RegisterClass, because on non-unicode
- // win98 it will fail, as it is a stub that returns false() there
-
- // Create main window
- g_hWnd=CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,
- _T("SkypeApiDispatchWindow"), _T(""), WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, (HINSTANCE)WndClass.hInstance, 0);
-
- LOG (("Created Dispatch window with handle %08X", (long)g_hWnd));
- if (!g_hWnd) {
- OUTPUT(_T("Cannot create window."));
- TellError(GetLastError());
- SetEvent(MessagePumpReady);
- return;
- }
- ShowWindow(g_hWnd, 0);
- UpdateWindow(g_hWnd);
- msgPumpThreadId = GetCurrentThreadId();
- SetEvent(MessagePumpReady);
-
- LOG (("Messagepump started."));
- while (GetMessage (&msg, NULL, 0, 0) > 0 && !Miranda_Terminated()) {
- TranslateMessage (&msg);
- DispatchMessage (&msg);
- }
- UnregisterClass (WndClass.lpszClassName, hInst);
- LOG (("Messagepump stopped."));
-}
-
-// DLL Stuff //
-
-__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirVersion)
-{
- mirandaVersion = mirVersion;
-
- pluginInfo.cbSize = sizeof(PLUGININFO);
- return (PLUGININFO*) &pluginInfo;
-}
-
-__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
-{
- mirandaVersion = mirVersion;
-
- return &pluginInfo;
-}
-
-static const MUUID interfaces[] = {MUUID_SKYPE_CALL, MIID_LAST};
-__declspec(dllexport) const MUUID * MirandaPluginInterfaces(void)
-{
- return interfaces;
-}
-
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
-{
- UNREFERENCED_PARAMETER(fdwReason);
- UNREFERENCED_PARAMETER(lpvReserved);
-
- hInst = hinstDLL;
- return TRUE;
-}
-
-
-int PreShutdown(WPARAM wParam, LPARAM lParam) {
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- PostThreadMessage(msgPumpThreadId, WM_QUIT, 0, 0);
- return 0;
-}
-
-int __declspec(dllexport) Load(PLUGINLINK *link)
-{
- PROTOCOLDESCRIPTOR pd;
- DWORD Buffsize;
- HKEY MyKey;
- BOOL SkypeInstalled;
- BOOL UseCustomCommand;
- WSADATA wsaData;
- char path[MAX_PATH];
-
- pluginLink = link;
- mir_getMMI( &mmi );
- //mir_getLP(&pluginInfo);
-
- GetModuleFileNameA( hInst, path, sizeof( path ));
- _splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
- CharUpperA( SKYPE_PROTONAME );
-
- InitializeCriticalSection(&RingAndEndcallMutex);
- InitializeCriticalSection(&QueryThreadMutex);
- InitializeCriticalSection(&TimeMutex);
-
-
-#ifdef _DEBUG
- init_debug();
-#endif
-
- LOG(("Load: Skype Plugin loading..."));
-
- // We need to upgrade SKYPE_PROTOCOL internal name to Skype if not already done
- if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UpgradeDone", 0))
- UpgradeName("SKYPE_PROTOCOL");
-
- // Initialisation of Skype MsgQueue must be done because of Cleanup in end and
- // Mutex is also initialized here.
- LOG(("SkypeMsgInit initializing Skype MSG-queue"));
- if (SkypeMsgInit()==-1) {
- OUTPUT(_T("Memory allocation error on startup."));
- return 0;
- }
-
- // On first run on new profile, ask user, if he wants to enable the plugin in
- // this profile
- // --> Fixing Issue #0000006 from bugtracker.
- if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "FirstRun", 0)) {
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "FirstRun", 1);
- if (AnySkypeusers()==0) // First run, it seems :)
- if (MessageBox(NULL, TranslateT("This seems to be the first time that you're running the Skype protocol plugin. Do you want to enable the protocol for this Miranda-Profile? (If you chose NO, you can always enable it in the plugin options later."), _T("Welcome!"), MB_ICONQUESTION|MB_YESNO)==IDNO) {
- char path[MAX_PATH], *filename;
- GetModuleFileNameA(hInst, path, sizeof(path));
- if (filename = strrchr(path,'\\')+1)
- DBWriteContactSettingByte(NULL,"PluginDisable",filename,1);
- return 0;
- }
- }
-
-
- // Check if Skype is installed
- SkypeInstalled=TRUE;
- UseCustomCommand = (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- UseSockets = (BOOL)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0);
-
- if (!UseSockets && !UseCustomCommand)
- {
- if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
- {
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
- {
- SkypeInstalled=FALSE;
- }
- }
-
- Buffsize=sizeof(skype_path);
-
- if (SkypeInstalled==FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS)
- {
- //OUTPUT("Skype was not found installed :( \nMaybe you are using portable skype.");
- RegCloseKey(MyKey);
- skype_path[0]=0;
- //return 0;
- }
- RegCloseKey(MyKey);
- }
- WSAStartup(MAKEWORD(2,2), &wsaData);
-
- // Start Skype connection
- if (!(ControlAPIAttach=RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover=RegisterWindowMessage(_T("SkypeControlAPIDiscover"))))
- {
- OUTPUT(_T("Cannot register Window message."));
- return 0;
- }
-
- SkypeMsgReceived=CreateSemaphore(NULL, 0, MAX_MSGS, NULL);
- if (!(SkypeReady=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
- !(MessagePumpReady=CreateEvent(NULL, FALSE, FALSE, NULL)) ||
-#ifdef SKYPEBUG_OFFLN
- !(GotUserstatus=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
-#endif
- !(hBuddyAdded=CreateEvent(NULL, FALSE, FALSE, NULL)) ||
- !(FetchMessageEvent=CreateEvent(NULL, FALSE, TRUE, NULL))) {
- OUTPUT(_T("Unable to create Mutex!"));
- return 0;
- }
-
- /* Register the module */
- ZeroMemory(&pd, sizeof(pd));
- pd.cbSize = sizeof(pd);
- pd.szName = SKYPE_PROTONAME;
- pd.type = PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-
- VoiceServiceInit();
-
- CreateServices();
- HookEvents();
- InitVSApi();
- MsgList_Init();
-
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
- // Startup Message-pump
- pthread_create (( pThreadFunc )MsgPump, NULL);
- WaitForSingleObject(MessagePumpReady, INFINITE);
- return 0;
-}
-
-
-
-int __declspec( dllexport ) Unload(void)
-{
- BOOL UseCustomCommand = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- BOOL Shutdown = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "Shutdown", 0);
-
- LOG (("Unload started"));
-
- if ( Shutdown && ((skype_path && skype_path[0]) ||UseCustomCommand) ) {
-
- if(UseCustomCommand)
- {
- DBVARIANT dbv;
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- char szAbsolutePath[MAX_PATH];
-
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, FALSE);
- _spawnl(_P_NOWAIT, szAbsolutePath, szAbsolutePath, "/SHUTDOWN", NULL);
- LOG (("Unload Sent /shutdown to %s", szAbsolutePath));
- DBFreeVariant(&dbv);
- }
- }
- else
- {
- _spawnl(_P_NOWAIT, skype_path, skype_path, "/SHUTDOWN", NULL);
- LOG (("Unload Sent /shutdown to %s", skype_path));
- }
-
- }
- SkypeMsgCleanup();
- WSACleanup();
- FreeVSApi();
- UnhookEvents();
- UnhookEvent(hChatEvent);
- UnhookEvent (hChatMenu);
- UnhookEvent (hEvInitChat);
- DestroyHookableEvent(hInitChat);
- VoiceServiceExit();
- GCExit();
- MsgList_Exit();
-
- CloseHandle(SkypeReady);
- CloseHandle(SkypeMsgReceived);
-#ifdef SKYPEBUG_OFFLN
- CloseHandle(GotUserstatus);
-#endif
- CloseHandle(MessagePumpReady);
- CloseHandle(hBuddyAdded);
- CloseHandle(FetchMessageEvent);
-
- DeleteCriticalSection(&RingAndEndcallMutex);
- DeleteCriticalSection(&QueryThreadMutex);
-
- SkypeRegisterProxy (0, 0);
- LOG (("Unload: Shutdown complete"));
-#ifdef _DEBUG
- end_debug();
-#endif
- DeleteCriticalSection(&TimeMutex);
- return 0;
-}
-
diff --git a/protocols/Skype/skype.h b/protocols/Skype/skype.h
deleted file mode 100644
index 6439a24dc8..0000000000
--- a/protocols/Skype/skype.h
+++ /dev/null
@@ -1,188 +0,0 @@
-#pragma once
-
-#define _CRT_SECURE_NO_DEPRECATE 1
-#define TEXT_LEN 1024
-#define CP_ACP 0
-
-#define code_page CP_ACP;
-#define MIRANDA_CUSTOM_LP
-
-
-// System includes
-#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include "resource.h"
-#include <stdlib.h>
-#include <stddef.h>
-#include <shlobj.h>
-#include <time.h>
-#include "util.h"
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-
-// Miranda Includes
-#include "../../include/newpluginapi.h"
-#include "../../include/m_utils.h"
-#include "../../include/m_protosvc.h"
-#include "../../include/m_protomod.h"
-#include "../../include/m_skin.h"
-#include "../../include/m_message.h"
-#include "../../include/m_database.h"
-#include "../../include/m_clist.h"
-#include "../../include/m_system.h"
-#include "sdk/m_updater.h"
-#include "sdk/m_folders.h"
-#include "../../include/m_options.h"
-#include "../../include/m_langpack.h"
-#include "../../include/m_userinfo.h"
-#include "../../include/m_avatars.h"
-#include "../../include/m_contacts.h"
-#include "../../include/m_popup.h"
-
-#pragma warning (pop)
-
-// MyDetails defines
-
-// wParam=NULL
-// lParam=(char *) new nickname - do not free
-// return=0 for sucess
-#define PS_SETMYNICKNAME "/SetNickname"
-
-// Optional, default value is 1024
-// wParam=NULL
-// lParam=NULL
-// return= <=0 for error, >0 the max length of the nick
-#define PS_GETMYNICKNAMEMAXLENGTH "/GetMyNicknameMaxLength"
-
-// wParam=(char *)Buffer to file name
-// lParam=(int)Buffer size
-// return=0 for sucess
-#define PS_GETMYAVATAR "/GetMyAvatar"
-
-// wParam=0
-// lParam=(const char *)Avatar file name
-// return=0 for sucess
-#define PS_SETMYAVATAR "/SetMyAvatar"
-
-
-// Program defines
-#define SKYPE_NAME "Username"
-#define SKYPE_PROTO "PROTOCOL 7"
-#define SKYPE_PROTONAME g_szProtoName // Name of our protocol, taken from .DLL name
-#define MAX_MSGS 128 // Maximum messages in queue
-#define MAX_USERLEN 32 // Maximum length of a username in Skype
-#define PING_INTERVAL 10000 // Ping every 10000 msec to see if Skype is still available
-#define USEPOPUP 1 // Use the popup-plugin?
-#define TIMEOUT_MSGSEND 9000 // Stolen from msgdialog.c
-#define MAX_MSG_AGE 30 // Maximum age in seconds before a Message from queue gets trashed
-#define SKYPEBUG_OFFLN 1 // Activate fix for the SkypeAPI Offline-Bug
-
-// Program hooks
-typedef struct {
- char ChatNew[MAXMODULELABELLENGTH];
- char SetAvatar[MAXMODULELABELLENGTH];
- char SendFile[MAXMODULELABELLENGTH];
- char HoldCall[MAXMODULELABELLENGTH];
- char AnswerCall[MAXMODULELABELLENGTH];
- char ImportHistory[MAXMODULELABELLENGTH];
- char AddUser[MAXMODULELABELLENGTH];
- char SkypeOutCallUser[MAXMODULELABELLENGTH];
- char CallHangupUser[MAXMODULELABELLENGTH];
- char CallUser[MAXMODULELABELLENGTH];
-} SKYPE_SVCNAMES;
-#define SKYPE_CALL g_svcNames.CallUser
-#define SKYPE_CALLHANGUP g_svcNames.CallHangupUser
-#define SKYPEOUT_CALL g_svcNames.SkypeOutCallUser
-#define SKYPE_ADDUSER g_svcNames.AddUser
-#define SKYPE_IMPORTHISTORY g_svcNames.ImportHistory
-#define SKYPE_ANSWERCALL g_svcNames.AnswerCall
-#define SKYPE_HOLDCALL g_svcNames.HoldCall
-#define SKYPE_SENDFILE g_svcNames.SendFile
-#define SKYPE_SETAVATAR g_svcNames.SetAvatar
-#define SKYPE_CHATNEW g_svcNames.ChatNew
-#define EVENTTYPE_CALL 2000
-
-#ifndef __SKYPESVC_C__
-extern SKYPE_SVCNAMES g_svcNames;
-#endif
-
-// Skype API Communication services
-#define PSS_SKYPEAPIMSG "/SendSkypeAPIMsg"
-#define SKYPE_REGPROXY "/RegisterProxySvc"
-
-#define MUUID_SKYPE_CALL { 0x245241eb, 0x178c, 0x4b3f, { 0x91, 0xa, 0x4c, 0x4d, 0xf0, 0xa0, 0xc3, 0xb6 } }
-
-
-// Common used code-pieces
-#define OUTPUT(a) ShowMessage(IDI_ERRORS, a, 1);
-#define OUTPUTA(a) ShowMessageA(IDI_ERRORS, a, 1);
-
-typedef void ( __cdecl* pThreadFunc )( void* );
-
-// Prototypes
-
-void __cdecl SkypeSystemInit(char *);
-void __cdecl MsgPump (char *dummy);
-void PingPong(void);
-void CheckIfApiIsResponding(char *);
-void TellError(DWORD err);
-int ShowMessage(int, TCHAR*, int);
-#ifdef _UNICODE
-int ShowMessageA(int iconID, char *lpzText, int mustShow);
-#else
-#define ShowMessageA ShowMessage
-#endif
-void EndCallThread(char *);
-void GetInfoThread(HANDLE);
-int OnDetailsInit( WPARAM, LPARAM );
-INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeGetAvatarCaps(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam);
-int HookContactAdded(WPARAM wParam, LPARAM lParam);
-int HookContactDeleted(WPARAM wParam, LPARAM lParam);
-INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam);
-int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam);
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSendAuthRequest(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam);
-time_t SkypeTime(time_t *timer);
-void MessageSendWatchThread(HANDLE hContact);
-int OkToExit(WPARAM wParam, LPARAM lParam);
-int MirandaExit(WPARAM wParam, LPARAM lParam);
-int __stdcall EnterBitmapFileName( char* szDest );
-void CleanupNicknames(char *dummy);
-int InitVSApi();
-int FreeVSApi();
-HANDLE GetMetaHandle(DWORD dwId);
-void LaunchSkypeAndSetStatusThread(void *newStatus);
-
-// Write contact setting as UTF-8 for convenience, if possible. Older Miranda IM versions will store it as ANSI
-INT_PTR SkypeDBWriteContactSettingUTF8String(HANDLE hContact,const char *szModule,const char *szSetting,const char *val);
-
-// Structs
-
-typedef struct {
- char *SkypeSetting;
- char *MirandaSetting;
-} settings_map;
-
-// Optional includes
-#ifdef USEPOPUP
- #include "../../include/m_popup.h"
-#endif
diff --git a/protocols/Skype/skypeapi.c b/protocols/Skype/skypeapi.c
deleted file mode 100644
index 2a6eb1b76e..0000000000
--- a/protocols/Skype/skypeapi.c
+++ /dev/null
@@ -1,1699 +0,0 @@
-/*
- * SkypeAPI - All more or less important functions that deal with Skype
- */
-
-#include "skype.h"
-#include "skypeapi.h"
-#include "utf8.h"
-#include "debug.h"
-#include "contacts.h"
-#include "skypeproxy.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "alogon.h"
-#include "msgq.h"
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include "../../include/m_utils.h"
-#include "../../include/m_langpack.h"
-#pragma warning (push)
-#include "m_toptoolbar.h"
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-// Imported Globals
-extern HWND hSkypeWnd, g_hWnd;
-extern BOOL SkypeInitialized, UseSockets, MirandaShuttingDown, bIsImoproxy;
-extern int SkypeStatus, receivers;
-extern HANDLE SkypeReady, SkypeMsgReceived, httbButton;
-extern UINT ControlAPIAttach, ControlAPIDiscover;
-extern LONG AttachStatus;
-extern HINSTANCE hInst;
-extern PLUGININFO pluginInfo;
-extern HANDLE hProtocolAvatarsFolder, hHookSkypeApiRcv;
-extern char DefaultAvatarsFolder[MAX_PATH+1], *pszProxyCallout, protocol, g_szProtoName[];
-
-// -> Skype Message Queue functions //
-
-static TYP_MSGQ SkypeMsgs, SkypeSendQueue;
-
-status_map status_codes[] = {
- {ID_STATUS_AWAY, "AWAY"},
- {ID_STATUS_NA, "NA"},
- {ID_STATUS_DND, "DND"},
- {ID_STATUS_ONLINE, "ONLINE"},
- {ID_STATUS_FREECHAT, "SKYPEME"}, // Unfortunately Skype API tells us userstatus ONLINE, if we are free for chat
- {ID_STATUS_OFFLINE, "OFFLINE"},
- {ID_STATUS_INVISIBLE, "INVISIBLE"},
- {ID_STATUS_CONNECTING, "CONNECTING"},
- {0, NULL}
-};
-
-//status_map
-
-
-static CRITICAL_SECTION ConnectMutex;
-static BOOL rcvThreadRunning=FALSE, isConnecting = FALSE;
-static SOCKET ClientSocket=INVALID_SOCKET;
-static HANDLE SkypeMsgToSend=NULL;
-
-static char *m_szSendBuf = NULL;
-static DWORD m_iBufSize = 0;
-
-
-static int _ConnectToSkypeAPI(char *path, BOOL bStart);
-
-
-/* SkypeReceivedMessage
- *
- * Purpose: Hook to be called when a message is received, if some caller is
- * using our internal I/O services.
- * Params : wParam - Not used
- * lParam - COPYDATASTRUCT like in WM_COPYDATA
- * Returns: Result from SendMessage
- */
-INT_PTR SkypeReceivedAPIMessage(WPARAM wParam, LPARAM lParam) {
- return SendMessage(g_hWnd, WM_COPYDATA, (WPARAM)hSkypeWnd, lParam);
-}
-
-/*
- * Skype via Socket --> Skype2Socket connection
- */
-
-void rcvThread(char *dummy) {
- unsigned int length;
- char *buf;
- COPYDATASTRUCT CopyData;
- int rcv;
-
- if (!UseSockets) return;
- rcvThreadRunning=TRUE;
- for ( ;; ) {
- if (ClientSocket==INVALID_SOCKET) {
- rcvThreadRunning=FALSE;
- return;
- }
- LOG(("rcvThread Receiving from socket.."));
- if ((rcv=recv(ClientSocket, (char *)&length, sizeof(length), 0))==SOCKET_ERROR || rcv==0) {
- rcvThreadRunning=FALSE;
- if (rcv==SOCKET_ERROR) {LOG(("rcvThread Socket error"));}
- else {LOG(("rcvThread lost connection, graceful shutdown"));}
- return;
- }
- LOG(("rcvThread Received length, recieving message.."));
- buf=(char *)calloc(1, length+1);
- if ((rcv = recv(ClientSocket, buf, length, 0))==SOCKET_ERROR || rcv==0) {
- rcvThreadRunning=FALSE;
- if (rcv==SOCKET_ERROR) {LOG(("rcvThread Socket error"));}
- else {LOG(("rcvThread lost connection, graceful shutdown"));}
- free(buf);
- return;
- }
- LOG(("Received message: %s", buf));
-
- CopyData.dwData=0;
- CopyData.lpData=buf;
- CopyData.cbData=(DWORD)strlen(buf)+1;
- if (!SendMessage(g_hWnd, WM_COPYDATA, (WPARAM)hSkypeWnd, (LPARAM)&CopyData))
- {
- LOG(("SendMessage failed: %08X", GetLastError()));
- }
- free(buf);
- }
-}
-
-void sendThread(char *dummy) {
- COPYDATASTRUCT CopyData;
- LRESULT SendResult;
- int oldstatus;
- unsigned int length;
- char *szMsg;
-
- while (SkypeMsgToSend) {
- if (WaitForSingleObject(SkypeMsgToSend, INFINITE) != WAIT_OBJECT_0) return;
- if (!(szMsg = MsgQ_Get(&SkypeSendQueue))) continue;
- length=(unsigned int)strlen(szMsg);
-
- if (UseSockets) {
- if (send(ClientSocket, (char *)&length, sizeof(length), 0) != SOCKET_ERROR &&
- send(ClientSocket, szMsg, length, 0) != SOCKET_ERROR) {
- free (szMsg);
- continue;
- }
- SendResult = 0;
- } else {
- CopyData.dwData=0;
- CopyData.lpData=szMsg;
- CopyData.cbData=length+1;
-
- // Internal comm channel
- if (pszProxyCallout) {
- CallService (pszProxyCallout, 0, (LPARAM)&CopyData);
- free(szMsg);
- continue;
- }
-
- // If this didn't work, proceed with normal Skype API
- if (!hSkypeWnd)
- {
- LOG(("SkypeSend: DAMN! No Skype window handle! :("));
- }
- SendResult=SendMessage(hSkypeWnd, WM_COPYDATA, (WPARAM)g_hWnd, (LPARAM)&CopyData);
- LOG(("SkypeSend: SendMessage returned %d", SendResult));
- free(szMsg);
- }
- if (!SendResult) {
- SkypeInitialized=FALSE;
- AttachStatus=-1;
- ResetEvent(SkypeReady);
- if (g_hWnd) KillTimer (g_hWnd, 1);
- if (SkypeStatus!=ID_STATUS_OFFLINE) {
- // Go offline
- logoff_contacts(FALSE);
- oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- }
- // Reconnect to Skype
- ResetEvent(SkypeReady);
- pthread_create(LaunchSkypeAndSetStatusThread, (void *)ID_STATUS_ONLINE);
- WaitForSingleObject (SkypeReady, 10000);
- // SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- }
- }
-}
-
-
-/*
- * Skype Messagequeue - Implemented as a linked list
- */
-
-/* SkypeMsgInit
- *
- * Purpose: Initializes the Skype Message queue and API
- * Returns: 0 - Success
- * -1 - Memory allocation failure
- */
-int SkypeMsgInit(void) {
-
- MsgQ_Init(&SkypeMsgs);
- MsgQ_Init(&SkypeSendQueue);
- InitializeCriticalSection(&ConnectMutex);
- if (SkypeMsgToSend=CreateSemaphore(NULL, 0, MAX_MSGS, NULL)) {
- if (m_szSendBuf = malloc(m_iBufSize=512)) {
- if (_beginthread(( pThreadFunc )sendThread, 0, NULL)!=-1)
- return 0;
- free(m_szSendBuf);
- }
- CloseHandle (SkypeMsgToSend);
- }
- return -1;
-}
-
-/* SkypeMsgAdd
- *
- * Purpose: Add Message to linked list
- * Params : msg - Message to add to queue
- * Returns: 0 - Success
- * -1 - Memory allocation failure
- */
-int SkypeMsgAdd(char *msg) {
- return MsgQ_Add(&SkypeMsgs, msg)?0:-1;
-}
-
-/* SkypeMsgCleanup
- *
- * Purpose: Clean up the whole MESSagequeue - free() all
- */
-void SkypeMsgCleanup(void) {
- int i;
-
- LOG(("SkypeMsgCleanup Cleaning up message queue.."));
- if (receivers>1)
- {
- LOG (("SkypeMsgCleanup Releasing %d receivers", receivers));
- for (i=0;i<receivers; i++)
- {
- SkypeMsgAdd ("ERROR Semaphore was blocked");
- }
- ReleaseSemaphore (SkypeMsgReceived, receivers, NULL);
- }
-
- EnterCriticalSection(&ConnectMutex);
- MsgQ_Exit(&SkypeMsgs);
- LeaveCriticalSection(&ConnectMutex);
- DeleteCriticalSection(&ConnectMutex);
- CloseHandle(SkypeMsgToSend);
- SkypeMsgToSend=NULL;
- MsgQ_Exit(&SkypeSendQueue);
- if (m_szSendBuf)
- {
- free (m_szSendBuf);
- m_szSendBuf = NULL;
- m_iBufSize = 0;
- }
- LOG(("SkypeMsgCleanup Done."));
-}
-
-/* SkypeMsgGet
- *
- * Purpose: Fetch next message from message queue
- * Returns: The next message
- * Warning: Don't forget to free() return value!
- */
-char *SkypeMsgGet(void) {
- return MsgQ_Get(&SkypeMsgs);
-}
-
-// Message sending routine, for internal use by SkypeSend
-static int __sendMsg(char *szMsg) {
- COPYDATASTRUCT CopyData;
-
- LOG(("> %s", szMsg));
-
- // Fake PING-PONG, as PING-PONG is not supported by Skype2Socket
- if ((UseSockets || bIsImoproxy) && !strcmp(szMsg, "PING")) {
- CopyData.dwData=0;
- CopyData.lpData="PONG";
- CopyData.cbData=5;
- SendMessage(g_hWnd, WM_COPYDATA, (WPARAM)hSkypeWnd, (LPARAM)&CopyData);
- return 0;
- }
-
- if (UseSockets && ClientSocket==INVALID_SOCKET) return -1;
- if (!MsgQ_Add(&SkypeSendQueue, szMsg) || !ReleaseSemaphore(SkypeMsgToSend, 1, NULL))
- return -1;
- return 0;
-}
-
-/* SkypeSend
- *
- * Purpose: Sends the specified message to the Skype API.
- * If it fails, try to reconnect zu the Skype API
- * Params: use like sprintf without first param (dest. buffer)
- * Returns: 0 - Success
- * -1 - Failure
- */
-int SkypeSend(char *szFmt, ...) {
- char *pNewBuf;
- va_list ap;
- size_t iLen;
-
- // 0.0.0.17+ - Build message-String from supplied parameter list
- // so the user doesn't have to care about memory allocation any more.
- // 0.0.0.47+ - No more restrictions apply to the format string.
- // The temporary buffer remains allocated during the session and gets
- // dynamically expanded when needed. This makes sense, as this function
- // is used very often and therefore it is faster to not allocate
- // memory on every send.
- if (!m_szSendBuf && !(m_szSendBuf=malloc(m_iBufSize=512))) return -1;
- do
- {
- va_start(ap, szFmt);
- iLen = _vsnprintf(m_szSendBuf, m_iBufSize, szFmt, ap);
- va_end(ap);
- if (iLen == -1)
- {
- if (!(pNewBuf = (char*)realloc (m_szSendBuf, m_iBufSize*2)))
- {
- iLen = strlen (m_szSendBuf);
- break;
- }
- m_szSendBuf = pNewBuf;
- m_iBufSize*=2;
- }
- } while (iLen == -1);
-
- return __sendMsg(m_szSendBuf);
-}
-
-/* SkypeRcvTime
- *
- * Purpose: Wait, until either the message "what" is received or maxwait-Time has passed
- * or there was an error and return it
- * Params : what - Wait for this string-part at the beginning of a received string
- * If the first character of the string is NULL, the rest after the NULL
- * character will be searched in the entire received message-string.
- * You can tokenize the string by using NULL characters.
- * You HAVE TO end the string with a extra \0, otherwise the tokenizer
- * will run amok in memory!
- * st - The message timestamp must be newer or equal to st.
- * Set to 0, if you do not need this and want the first message of this
- * kind in the queue.
- * maxwait - Wait this time before returning, if nothing was received,
- * can be INFINITE
- * Returns: The received message containing "what" or a ERROR-Message or NULL if
- * time is up and nothing was received
- * Warning: Don't forget to free() return value!
- */
-char *SkypeRcvTime(char *what, time_t st, DWORD maxwait) {
- char *msg, *token=NULL;
- struct MsgQueue *ptr;
- int j;
- DWORD dwWaitStat;
- BOOL bChatMsg = FALSE, bIsChatMsg = FALSE;
-
- LOG (("SkypeRcv - Requesting answer: %s", what));
- if (what) bChatMsg = strncmp(what, "CHATMESSAGE", 11)==0;
- do {
- EnterCriticalSection(&SkypeMsgs.cs);
- // First, search for the requested message. On second run, also accept an ERROR
- for (j=0; j<2; j++)
- {
- for (ptr=SkypeMsgs.l.tqh_first; ptr; ptr=ptr->l.tqe_next) {
- if (what && what[0]==0) {
- // Tokenizer syntax active
- token=what+1;
- while (*token) {
- if (!strstr (ptr->message, token)) {
- token=NULL;
- break;
- }
- token+=strlen(token)+1;
- }
- }
-
- //if (j==1) {LOG(("SkypeRcv compare %s (%lu) -- %s (%lu)", ptr->message, ptr->tReceived, what, st));}
- if ((st == 0 || ptr->tReceived >= st) &&
- (what==NULL || token || (what[0] && !strncmp(ptr->message, what, strlen(what))) ||
- (bIsChatMsg = (j==1 && bChatMsg && !strncmp(ptr->message, what+4, strlen(what+4)))) ||
- (j==1 && !strncmp(ptr->message, "ERROR", 5))))
- {
- msg=MsgQ_RemoveMsg(&SkypeMsgs, ptr);
- LOG(("<SkypeRcv: %s", msg));
- if (bIsChatMsg) {
- msg=realloc(msg, strlen(msg)+5);
- memmove (msg+4, msg, strlen(msg)+1);
- memcpy (msg, "CHAT", 4);
-
- // This may be a sign that protocol negotiation failed, so we can try to send
- // our supported protocol version again, just in case... (Skype API bug?)
- //SkypeSend(SKYPE_PROTO);
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- return msg;
- }
- }
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- InterlockedIncrement ((long *)&receivers); //receivers++;
- dwWaitStat = WaitForSingleObject(SkypeMsgReceived, maxwait);
- if (receivers>1) InterlockedDecrement ((long *)&receivers); // receivers--;
- if (receivers>1) {LOG (("SkypeRcv: %d receivers still waiting", receivers));}
-
- } while(dwWaitStat == WAIT_OBJECT_0 && !MirandaShuttingDown);
- InterlockedDecrement ((long *)&receivers);
- LOG(("<SkypeRcv: (empty)"));
- return NULL;
-}
-char *SkypeRcv(char *what, DWORD maxwait) {
- return SkypeRcvTime(what, 0, maxwait);
-}
-
-char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait) {
- char *msg, msgid[32]={0}, *pMsg, *pCurMsg;
- struct MsgQueue *ptr;
- int iLenWhat = strlen(what);
- DWORD dwWaitStat;
- BOOL bIsError, bProcess;
-
- LOG (("SkypeRcvMsg - Requesting answer: %s ", what));
- do {
- EnterCriticalSection(&SkypeMsgs.cs);
- ptr=SkypeMsgs.l.tqh_first;
- while(ptr) {
- //LOG (("SkypeRcvMsg - msg: %s -- %s", ptr->message, what));
- pCurMsg = ptr->message;
- bIsError = FALSE;
- if (*what && !strncmp(pCurMsg, what, iLenWhat)) {
- // Now we received a MESSAGE with an identifier. So this one is definitely for us
- // However the status can be SENDING instead of SENT and next message with this number
- // isn't using the ID anymore, so we have to save the ID as new identifier for message recognition
- pCurMsg+=iLenWhat;
- if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' ')))
- strncpy (msgid, pCurMsg, pMsg-pCurMsg);
- else if (strncmp (pCurMsg, "ERROR", 5) == 0) bIsError = TRUE;
- }
-
- if ((*msgid && strncmp (pCurMsg, msgid, strlen(msgid)) == 0) ||
- (!*what && ptr->tReceived >= st &&
- (strncmp(pCurMsg, "MESSAGE", 7) == 0 || strncmp(pCurMsg, "CHATMESSAGE", 11) == 0 )
- ) || bIsError ||
- (ptr->tReceived >= st && ptr->tReceived <=st+1 &&
- (bIsError=(strncmp(pCurMsg, "ERROR 26", 8)==0 || strncmp(pCurMsg, "ERROR 43", 8)==0))
- ) )
- {
- bProcess = bIsError;
- if (!bIsError) {
- if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' '))) {
- pMsg++;
- if (strncmp (pMsg, "STATUS ", 7) == 0) {
- pMsg+=7;
- if (strcmp (pMsg, "SENDING") == 0 &&
- DBGetContactSettingWord(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
- // Remove dat shit
- struct MsgQueue *ptr_=ptr->l.tqe_next;
-
- free(MsgQ_RemoveMsg(&SkypeMsgs, ptr));
- ptr=ptr_;
- continue;
- }
- bProcess = (strcmp (pMsg, "SENT") == 0 || strcmp (pMsg, "QUEUED") == 0 ||
- strcmp (pMsg, "FAILED") == 0 || strcmp (pMsg, "IGNORED") == 0 ||
- strcmp (pMsg, "SENDING") == 0);
- }
- }
- }
- if (bProcess) {
- msg=MsgQ_RemoveMsg(&SkypeMsgs, ptr);
- LOG(("<SkypeRcv: %s", msg));
- LeaveCriticalSection(&SkypeMsgs.cs);
- return msg;
- }
- }
- ptr=ptr->l.tqe_next;
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- InterlockedIncrement ((long *)&receivers); //receivers++;
- dwWaitStat = WaitForSingleObject(SkypeMsgReceived, maxwait);
- if (receivers>1) InterlockedDecrement ((long *)&receivers); // receivers--;
- if (receivers>1) {LOG (("SkypeRcvMsg: %d receivers still waiting", receivers));}
-
- } while(dwWaitStat == WAIT_OBJECT_0 && !MirandaShuttingDown);
- InterlockedDecrement ((long *)&receivers);
- LOG(("<SkypeRcvMsg: (empty)"));
- return NULL;
-}
-
-/*
- Introduced in 0.0.0.17
-
- Issues a GET szWhat szWho szProperty and waits until the answer is received
- Returns the answer or NULL on failure
- BEWARE: Don't forget to free() return value!
-
- For example: SkypeGet("USER", dbv.pszVal, "FULLNAME");
-*/
-static char *__SkypeGet(char *szID, char *szWhat, char *szWho, char *szProperty) {
- char *str, *ptr;
- size_t len, len_id;
- time_t st = 0;
-
- st = *szID?0:SkypeTime(NULL);
- str=(char *)_alloca((len=strlen(szWhat)+strlen(szWho)+strlen(szProperty)+(*szWho?2:1)+(len_id=strlen(szID)))+5);
- sprintf(str, "%sGET %s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty);
- if (__sendMsg(str)) return NULL;
- if (*szProperty) len++;
- if (*szID) {
- sprintf(str, "%s%s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty);
- ptr = SkypeRcvTime(str, st, INFINITE);
- } else ptr = SkypeRcvTime(str+4, st, INFINITE);
- if (ptr && strncmp (ptr+len_id, "ERROR", 5)) memmove(ptr, ptr+len, strlen(ptr)-len+1);
- LOG(("SkypeGet - Request %s -> Answer %s", str, ptr));
- return ptr;
-}
-
-char *SkypeGetID(char *szWhat, char *szWho, char *szProperty) {
- char szID[16]={0};
- static DWORD dwId = 0;
-
- if (protocol>=4 || bIsImoproxy) sprintf (szID, "#G%d ", dwId++);
- return __SkypeGet (szID, szWhat, szWho, szProperty);
-}
-
-char *SkypeGet(char *szWhat, char *szWho, char *szProperty) {
- return __SkypeGet ("", szWhat, szWho, szProperty);
-}
-
-#ifdef _UNICODE
-WCHAR *SkypeGetW(char *szWhat, WCHAR *szWho, char *szProperty) {
- char *ptszWho = (char*)make_utf8_string(szWho);
- char *pRet = SkypeGet (szWhat, ptszWho, szProperty);
- free (ptszWho);
- if (pRet) {
- WCHAR *ptr = make_unicode_string((const unsigned char*)pRet);
- free (pRet);
- return ptr;
- }
- return NULL;
-}
-#endif
-
-char *SkypeGetErr(char *szWhat, char *szWho, char *szProperty) {
- char *ret = SkypeGet(szWhat, szWho, szProperty);
- if (ret && !strncmp(ret, "ERROR", 5)) {
- free (ret);
- return NULL;
- }
- return ret;
-}
-
-#ifdef _UNICODE
-WCHAR *SkypeGetErrW(char *szWhat, TCHAR *szWho, char *szProperty) {
- WCHAR *ret = SkypeGetW(szWhat, szWho, szProperty);
- if (ret && !_tcsncmp(ret, _T("ERROR"), 5)) {
- free (ret);
- return NULL;
- }
- return ret;
-}
-#endif
-
-
-/* SkypeGetProfile
- *
- * Issues a SET PROFILE szProperty szValue and waits until the answer is received
- * Returns the answer or NULL on failure
- * BEWARE: Don't forget to free() return value!
- *
- * For example: SkypeGetProfile("FULLNAME", "Tweety");
-*/
-char *SkypeGetProfile(char *szProperty) {
- return SkypeGet ("PROFILE", "", szProperty);
-}
-
-/* SkypeSetProfile
- *
- *
-*/
-int SkypeSetProfile(char *szProperty, char *szValue) {
- return SkypeSend("SET PROFILE %s %s", szProperty, szValue);
-}
-
-/* SkypeMsgCollectGarbage
- *
- * Purpose: Runs the garbage collector on the Skype Message-Queue to throw out old
- * messages which may unnecessarily eat up memory.
- * Params : age - Time in seconds. Messages older than this value will be
- * thrown out.
- * Returns: 0 - No messages were thrown out
- * >0 - n messages were thrown out
- */
-int SkypeMsgCollectGarbage(time_t age) {
- return MsgQ_CollectGarbage(&SkypeMsgs, age);
-}
-
-
-/* SkypeCall
- *
- * Purpose: Give a Skype call to the given User in wParam
- * or hangs up existing call
- * (hangUp is moved over to SkypeCallHangup)
- * Params : wParam - Handle to the User to be called
- * lParam - Can be NULL
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- char *msg=0;
- int res;
-
- if (!DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- res = -1; // no direct return, because dbv needs to be freed
- } else {
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
- msg=(char *)malloc(strlen(dbv.pszVal)+6);
- strcpy(msg, "CALL ");
- strcat(msg, dbv.pszVal);
- res=SkypeSend(msg);
- }
- DBFreeVariant(&dbv);
- free(msg);
- return res;
-}
-
-/* SkypeCallHangup
- *
- * Prupose: Hangs up the existing call to the given User
- * in wParam.
- *
- * Params : wParam - Handle to the User to be called
- * lParam - Can be NULL
- *
- * Returns: 0 - Success
- * -1 - Failure
- *
- */
-INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- char *msg=0;
- int res = -1;
-
- if (!DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- msg=(char *)malloc(strlen(dbv.pszVal)+21);
- sprintf(msg, "SET %s STATUS FINISHED", dbv.pszVal);
- //sprintf(msg, "ALTER CALL %s HANGUP", dbv.pszVal);
- res=SkypeSend(msg);
-#if _DEBUG
- DBDeleteContactSetting((HANDLE)wParam, SKYPE_PROTONAME, "CallId");
-#endif
- //} else {
- // if (DBGetContactSetting((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
- // msg=(char *)malloc(strlen(dbv.pszVal)+6);
- // strcpy(msg, "CALL ");
- // strcat(msg, dbv.pszVal);
- // res=SkypeSend(msg);
- }
- DBFreeVariant(&dbv);
- free(msg);
- return res;
-}
-
-/* FixNumber
- *
- * Purpose: Eliminates all non-numeric chars from the given phonenumber
- * Params : p - Pointer to the buffer with the number
- */
-static void FixNumber(char *p) {
- unsigned int i;
-
- for (i=0;i<=strlen(p);i++)
- if ((p[i]<'0' || p[i]>'9'))
- if (p[i]) {
- memmove(p+i, p+i+1, strlen(p+i));
- i--;
- } else break;
-}
-
-
-/* DialDlgProc
- *
- * Purpose: Dialog procedure for the Dial-Dialog
- */
-static BOOL CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static HANDLE hContact;
- static unsigned int entries=0;
- BOOL TempAdded=FALSE;
- char number[64], *msg, *ptr=NULL;
-
- switch (uMsg){
- case WM_INITDIALOG:
- hContact=(HANDLE)lParam;
- Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "DIALdlg");
- TranslateDialogDefault(hwndDlg);
-
- if (lParam) {
- DBVARIANT dbv;
- BOOL bDialNow=TRUE;
-
- if (!DBGetContactSetting(hContact,"UserInfo","MyPhone1",&dbv)) {
- int j;
- char idstr[16];
-
- // Multiple phone numbers, select one
- bDialNow=FALSE;
- DBFreeVariant(&dbv);
- for(j=0;;j++) {
- sprintf(idstr,"MyPhone%d",j);
- if(DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break;
- FixNumber(dbv.pszVal+1); // Leave + alone
- SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- }
- if (DBGetContactSettingString(hContact,SKYPE_PROTONAME,"SkypeOutNr",&dbv)) {
- DBGetContactSettingString(hContact,"UserInfo","MyPhone0",&dbv);
- FixNumber(dbv.pszVal+1);
- }
- SetDlgItemTextA(hwndDlg, IDC_NUMBER, dbv.pszVal);
- DBFreeVariant(&dbv);
- if (bDialNow) PostMessage(hwndDlg, WM_COMMAND, IDDIAL, 0);
- } else {
- DBVARIANT dbv;
- char number[64];
-
- for (entries=0;entries<MAX_ENTRIES;entries++) {
- sprintf(number, "LastNumber%d", entries);
- if (!DBGetContactSettingTString(NULL, SKYPE_PROTONAME, number, &dbv)) {
- SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_ADDSTRING,0,(LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else break ;
- }
- }
- SetFocus(GetDlgItem(hwndDlg, IDC_NUMBER));
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDDIAL:
- EnableWindow(GetDlgItem(hwndDlg, IDDIAL), FALSE);
- GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, sizeof(number));
- if (!strncmp(number, "00", 2)) {
- memmove(number, number+1, sizeof(number)-1);
- number[0]='+';
- number[sizeof(number)]=0;
- }
- if (!hContact) {
- if (!(hContact=add_contact(number, PALF_TEMPORARY))) {
- DestroyWindow(hwndDlg);
- break;
- }
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBWriteContactSettingWord(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT"));
- if (SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_FINDSTRING,0,(LPARAM)number)==CB_ERR) {
- int i;
- char buf[64];
- DBVARIANT dbv;
-
- if (entries>MAX_ENTRIES) entries=MAX_ENTRIES;
- for (i=entries;i>0;i--) {
- sprintf(buf, "LastNumber%d", i-1);
- if (!DBGetContactSettingString(NULL, SKYPE_PROTONAME, buf, &dbv)) {
- sprintf(buf, "LastNumber%d", i);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, buf, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else break;
- }
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "LastNumber0", number);
- }
- TempAdded=TRUE;
- }
- if (!DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "SkypeOutNr", number)) {
- msg=(char *)malloc(strlen(number)+6);
- strcpy(msg, "CALL ");
- strcat(msg, number);
- if (SkypeSend(msg) || (ptr=SkypeRcv("ERROR", 500))) {
- DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "SkypeOutNr");
- if (ptr) {
- OUTPUTA(ptr);
- free(ptr);
- }
- if (TempAdded) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- }
- free(msg);
- }
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
- break;
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "DIALdlg");
- if (httbButton) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)httbButton, TTBST_RELEASED);
- break;
- }
- return FALSE;
-}
-
-/* CallstatDlgProc
- *
- * Purpose: Dialog procedure for the CallStatus Dialog
- */
-static BOOL CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static int selected;
- static DBVARIANT dbv, dbv2={0};
-
- switch (uMsg){
- case WM_INITDIALOG:
- {
- HANDLE hContact;
- char *szProto;
-
- if (!DBGetContactSettingString((HANDLE)lParam, SKYPE_PROTONAME, "CallId", &dbv)) {
-
- // Check, if another call is in progress
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact!=(HANDLE)lParam &&
- DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0 &&
- !DBGetContactSettingString(hContact, SKYPE_PROTONAME, "CallId", &dbv2))
- {
- if (DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "OnHold", 0)) {
- DBFreeVariant(&dbv2);
- continue;
- } else break;
- }
- }
-
- if (dbv2.pszVal)
- {
- char buf[256], buf2[256];
- char *szOtherCaller=(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
-
- Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "CALLSTATdlg");
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_COMMAND, IDC_JOIN, 0);
-
- GetWindowTextA(hwndDlg, buf, sizeof(buf));
- _snprintf(buf2, sizeof(buf), buf, CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lParam,0));
- SetWindowTextA(hwndDlg, buf2);
-
- GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, sizeof(buf));
- _snprintf(buf2, sizeof(buf), buf, szOtherCaller);
- SetDlgItemTextA(hwndDlg, IDC_JOIN, buf2);
-
- GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, sizeof(buf));
- _snprintf(buf2, sizeof(buf), buf, szOtherCaller);
- SetDlgItemTextA(hwndDlg, IDC_HOLD, buf2);
-
- return TRUE;
- }
-
- // No other call in progress, no need for this Dlg., just answer the call
- SkypeSend("SET %s STATUS INPROGRESS", dbv.pszVal);
- testfor ("ERROR", 200);
- DBFreeVariant(&dbv);
- }
- DestroyWindow(hwndDlg);
- break;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_JOIN:
- case IDC_HOLD:
- case IDC_HANGUP:
- CheckRadioButton(hwndDlg, IDC_JOIN, IDC_HANGUP, (selected=LOWORD(wParam)));
- break;
- case IDOK:
- {
- char *szIdCall2;
-
- switch (selected) {
- case IDC_JOIN:
- if (szIdCall2=strchr(dbv2.pszVal, ' '))
- SkypeSend("SET %s JOIN_CONFERENCE%s", dbv.pszVal, szIdCall2);
- break;
- case IDC_HOLD:
- SkypeSend("SET %s STATUS ONHOLD", dbv2.pszVal);
- SkypeSend("SET %s STATUS INPROGRESS", dbv.pszVal);
- break;
- case IDC_HANGUP:
- SkypeSend("SET %s STATUS FINISHED", dbv.pszVal);
- break;
- }
-
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
- DestroyWindow(hwndDlg);
- break;
- }
- }
- break;
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "CALLSTATdlg");
- break;
- }
- return FALSE;
-}
-
-
-/* SkypeOutCallErrorCheck
- *
- * Purpose: Checks, if an error has occured after call and
- * if so, hangs up the call
- * This procedure is a seperate thread to not block the core
- * while waiting for "ERROR"
- * Params : szCallId - ID of the call
- */
-void SkypeOutCallErrorCheck(char *szCallId) {
- if (testfor("ERROR", 500)) EndCallThread(szCallId);
-}
-
-/* SkypeOutCall
- *
- * Purpose: Give a SkypeOut call to the given User in wParam
- * or hangs up existing call
- * The user's record is searched for Phone-number entries.
- * If there is more than 1 entry, the Dial-Dialog is shown
- * Params : wParam - Handle to the User to be called
- * If NULL, the dial-dialog is shown
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- int res = -1;
-
- if (wParam && !DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- res=SkypeSend("SET %s STATUS FINISHED", dbv.pszVal);
- pthread_create(( pThreadFunc )SkypeOutCallErrorCheck, _strdup(dbv.pszVal));
- DBFreeVariant(&dbv);
- } else if (!CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIAL), NULL, DialDlgProc, (LPARAM)wParam)) return -1;
- return res;
-}
-
-/* SkypeHoldCall
- *
- * Purpose: Put the call to the User given in wParam on Hold or Resumes it
- * Params : wParam - Handle to the User
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeHoldCall(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- int retval;
-
- LOG(("SkypeHoldCall started"));
- if (!wParam || DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv))
- return -1;
- retval = SkypeSend ("SET %s STATUS %s", dbv.pszVal,
- DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "OnHold", 0)?"INPROGRESS":"ONHOLD");
- DBFreeVariant(&dbv);
- return retval;
-}
-
-/* SkypeAnswerCall
- *
- * Purpose: Answer a Skype-call when a user double-clicks on
- * The incoming-call-Symbol. Works for both, Skype and SkypeOut-calls
- * Params : wParam - Not used
- * lParam - CLISTEVENT*
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeAnswerCall(WPARAM wParam, LPARAM lParam) {
-
- LOG(("SkypeAnswerCall started"));
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CALLSTAT), NULL, CallstatDlgProc, (LPARAM)((CLISTEVENT*)lParam)->hContact);
- return 0;
-}
-/* SkypeSetNick
- *
- * Purpose: Set Full Name in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)Nick text
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Nick = NULL;
-
- if (wParam & SMNN_UNICODE)
- {
- DBWriteContactSettingWString(0, SKYPE_PROTONAME, "Nick", (WCHAR*)lParam);
- if (AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS &&
- !(Nick = (char*)make_utf8_string((WCHAR*)lParam))) return -1;
- }
- else
- {
- DBWriteContactSettingString(0, SKYPE_PROTONAME, "Nick", (char*)lParam);
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS &&
- utf8_encode((const char *)lParam, &Nick) == -1 ) return -1;
- }
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE FULLNAME %s", Nick);
- if (Nick) free (Nick);
-
- return retval;
-
-}
-/* SkypeSetAwayMessage
- *
- * Purpose: Set Mood message in profile
- * Params : wParam=status mode
- * lParam=(LPARAM)(const char*)message text
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Mood = NULL;
-
- if (!lParam) lParam=(LPARAM)"";
- if(utf8_encode((const char *)lParam, &Mood) == -1 ) return -1;
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "MoodText", (const char *)lParam);
-
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE MOOD_TEXT %s", Mood);
- free (Mood);
-
- return retval;
-}
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Mood = NULL;
-
- if (!lParam) lParam=(LPARAM)"";
- if (!(Mood = (char*)make_utf8_string((WCHAR*)lParam))) return -1;
- DBWriteContactSettingWString(NULL, SKYPE_PROTONAME, "MoodText", (WCHAR*)lParam);
-
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE MOOD_TEXT %s", Mood);
- free (Mood);
-
- return retval;
-}
-
-/* SkypeSetAvatar
- *
- * Purpose: Set user avatar in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)filename
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam) {
- char *filename = (char *) lParam, *ext;
- char AvatarFile[MAX_PATH+1], OldAvatarFile[1024];
- char *ptr = NULL;
- int ret;
- char command[500];
- DBVARIANT dbv = {0};
- BOOL hasOldAvatar = (DBGetContactSettingString(NULL, SKYPE_PROTONAME, "AvatarFile", &dbv) == 0 && dbv.type == DBVT_ASCIIZ);
- size_t len;
-
- if (AttachStatus != SKYPECONTROLAPI_ATTACH_SUCCESS)
- return -3;
-
- if (filename == NULL)
- return -1;
- len = strlen(filename);
- if (len < 4)
- return -1;
-
- ext = &filename[len-4];
- if (_stricmp(ext, ".jpg")==0 || _stricmp(ext-1, ".jpeg")==0)
- ext = "jpg";
- else if (_stricmp(ext, ".png")==0)
- ext = "png";
- else
- return -2;
-
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- mir_snprintf(AvatarFile, sizeof(AvatarFile), "%s\\%s avatar.%s", AvatarFile, SKYPE_PROTONAME, ext);
-
- // Backup old file
- if (hasOldAvatar)
- {
- strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
- OldAvatarFile[sizeof(OldAvatarFile)-5] = '\0';
- strcat(OldAvatarFile, "_old");
- DeleteFileA(OldAvatarFile);
- if (!MoveFileA(dbv.pszVal, OldAvatarFile))
- {
- DBFreeVariant(&dbv);
- return -3;
- }
- }
-
- // Copy new file
- if (!CopyFileA(filename, AvatarFile, FALSE))
- {
- if (hasOldAvatar)
- {
- MoveFileA(OldAvatarFile, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- return -3;
- }
-
- // Try to set with skype
- mir_snprintf(command, sizeof(command), "SET AVATAR 1 %s", AvatarFile);
- if (SkypeSend(command) || (ptr = SkypeRcv(command+4, INFINITE)) == NULL || !strncmp(ptr, "ERROR", 5))
- {
- DeleteFileA(AvatarFile);
-
- if (hasOldAvatar)
- MoveFileA(OldAvatarFile, dbv.pszVal);
-
- ret = -4;
- }
- else
- {
- if (hasOldAvatar)
- DeleteFileA(OldAvatarFile);
-
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "AvatarFile", AvatarFile);
-
- ret = 0;
- }
-
- if (ptr != NULL)
- free(ptr);
-
- if (hasOldAvatar)
- DBFreeVariant(&dbv);
-
- return ret;
-}
-
-
-/* SkypeSendFile
- *
- * Purpose: Opens the Skype-dialog to send a file
- * Params : wParam - Handle to the User
- * lParam - Not used
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- int retval;
-
- if (!wParam || DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
- retval=SkypeSend("OPEN FILETRANSFER %s", dbv.pszVal);
- DBFreeVariant(&dbv);
- return retval;
-}
-
-/* SkypeChatCreate
- *
- * Purpose: Creates a groupchat with the user
- * Params : wParam - Handle to the User
- * lParam - Not used
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- HANDLE hContact=(HANDLE)wParam;
- char *ptr, *ptr2;
-
- if (!hContact || DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
- // Flush old messages
- while (testfor("\0CHAT \0 STATUS \0", 0));
- if (SkypeSend("CHAT CREATE %s", dbv.pszVal) || !(ptr=SkypeRcv ("\0CHAT \0 STATUS \0", INFINITE)))
- {
- DBFreeVariant(&dbv);
- return -1;
- }
- DBFreeVariant(&dbv);
- if (ptr2=strstr (ptr, "STATUS")) {
- *(ptr2-1)=0;
- ChatStart (ptr+5, FALSE);
- }
- free(ptr);
- return 0;
-}
-
-/* SkypeAdduserDlg
- *
- * Purpose: Show Skype's Add user Dialog
- */
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam) {
- SkypeSend("OPEN ADDAFRIEND");
- return 0;
-}
-
-/* SkypeFlush
- *
- * Purpose: Flush the Skype Message-List
- */
-void SkypeFlush(void) {
- char *ptr;
-
- while ((ptr=SkypeRcv(NULL, 0))!=NULL) free(ptr);
-}
-
-/* SkypeStatusToMiranda
- *
- * Purpose: Converts the specified Skype-Status mode to the corresponding Miranda-Status mode
- * Params : s - Skype Status
- * Returns: The correct Status
- * 0 - Nothing found
- */
-int SkypeStatusToMiranda(char *s) {
- int i;
- if (!strcmp("SKYPEOUT", s)) return DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE);
- for(i=0; status_codes[i].szStat; i++)
- if (!strcmp(status_codes[i].szStat, s))
- return status_codes[i].id;
- return 0;
-}
-
-/* MirandaStatusToSkype
- *
- * Purpose: Converts the specified Miranda-Status mode to the corresponding Skype-Status mode
- * Params : id - Miranda Status
- * Returns: The correct Status
- * NULL - Nothing found
- */
-char *MirandaStatusToSkype(int id) {
- int i;
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0)) {
- switch (id)
- {
- case ID_STATUS_NA: return "AWAY";
- case ID_STATUS_FREECHAT: return "ONLINE";
- }
- }
- for(i=0; status_codes[i].szStat; i++)
- if (status_codes[i].id==id)
- return status_codes[i].szStat;
- return NULL;
-}
-
-/* GetSkypeErrorMsg
- *
- * Purpose: Get a human-readable Error-Message for the supplied Skype Error-Message
- * Params : str - Skype Error-Message string
- * Returns: Human-readable Error Message or NULL, if nothing was found
- * Warning: Don't forget to free() return value
- */
-char *GetSkypeErrorMsg(char *str) {
- char *pos, *reason, *msg;
-
- LOG (("GetSkypeErrorMsg received error: %s", str));
- if (!strncmp(str, "ERROR", 5)) {
- reason=_strdup(str);
- return reason;
- }
- if ((pos=strstr(str, "FAILURE")) ) {
- switch(atoi(pos+14)) {
- case MISC_ERROR: msg="Misc. Error"; break;
- case USER_NOT_FOUND: msg="User does not exist, check username"; break;
- case USER_NOT_ONLINE: msg="Trying to send IM to an user, who is not online"; break;
- case USER_BLOCKED: msg="IM blocked by recipient"; break;
- case TYPE_UNSUPPORTED: msg="Type unsupported"; break;
- case SENDER_NOT_FRIEND: msg="Sending IM message to user, who has not added you to friendslist and has chosen 'only people in my friendslist can start IM'"; break;
- case SENDER_NOT_AUTHORIZED: msg="Sending IM message to user, who has not authorized you and has chosen 'only people whom I have authorized can start IM'"; break;
- default: msg="Unknown error";
- }
- reason=(char *)malloc(strlen(pos)+strlen(msg)+3);
- sprintf (reason, "%s: %s", pos, msg);
- return reason;
- }
- return NULL;
-}
-
-/* testfor
- *
- * Purpose: Wait, until the given Message-Fragment is received from Skype within
- * the given amount of time
- * Params : see SkypeRcv
- * Returns: TRUE - Message was received within the given amount of time
- * FALSE- nope, sorry
- */
-BOOL testfor(char *what, DWORD maxwait) {
- char *res;
-
- if ((res=SkypeRcv(what, maxwait))==NULL) return FALSE;
- free(res);
- return TRUE;
-}
-
-char SendSkypeproxyCommand(char command) {
- int length=0;
- char reply=0;
- BOOL res;
-
- res = send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR
- || send(ClientSocket, (char *)&command, sizeof(command), 0)==SOCKET_ERROR
- || recv(ClientSocket, (char *)&reply, sizeof(reply), 0)==SOCKET_ERROR;
- if (res)
- return -1;
- else
- return reply;
-}
-
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : path - Path to the Skype application
- * iStart - Need to start skype for status change.
- * 1 = Normal start if Skype not running
- * 2 = Forced startp code execution no matter what
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-int ConnectToSkypeAPI(char *path, int iStart) {
- static int iRet = -1; // last request result
- static volatile long newRequest = TRUE;
-
- InterlockedExchange(&newRequest, TRUE); // place new request
- EnterCriticalSection(&ConnectMutex); // Prevent reentrance
- if (iRet == -1 || newRequest)
- {
- iRet = _ConnectToSkypeAPI(path, iStart);
- InterlockedExchange(&newRequest, FALSE); // every thread which is waiting for connect mutex will get our result as well.. but subsequent calls will set this value to true and call _Connect again
- }
- LeaveCriticalSection(&ConnectMutex);
- return iRet;
-}
-
-void TranslateMirandaRelativePathToAbsolute(LPCSTR cszPath, LPSTR szAbsolutePath, BOOL fQuoteSpaces) {
- *szAbsolutePath = 0;
- CallService (MS_UTILS_PATHTOABSOLUTE, (WPARAM)(*cszPath ? cszPath : ".\\"), (LPARAM)szAbsolutePath);
- if(fQuoteSpaces && strchr((LPCSTR)szAbsolutePath, ' ')){
- memmove (szAbsolutePath+1, szAbsolutePath, strlen(szAbsolutePath)+1);
- *szAbsolutePath='"';
- strcat (szAbsolutePath, "\"");
- }
-
- TRACEA(szAbsolutePath);
-}
-
-static int my_spawnv(const char *cmdname, const char *const *argv, PROCESS_INFORMATION *pi)
-{
- int i, iLen=0;
- char *CommandLine;
- STARTUPINFOA si={0};
- BOOL bRet;
-
- memset (pi, 0, sizeof(PROCESS_INFORMATION));
- for (i=0; argv[i]; i++) iLen+=strlen(argv[i])+1;
- if (!(CommandLine = calloc(1, iLen))) return -1;
- for (i=0; argv[i]; i++) {
- if (i) strcat (CommandLine, " ");
- strcat (CommandLine, argv[i]);
- }
- si.cb = sizeof(si);
-
- bRet = CreateProcessA( cmdname,CommandLine,NULL,NULL,FALSE,0,NULL,NULL,&si,pi);
- free(CommandLine);
- if (!bRet) return -1;
- return (DWORD)pi->hProcess;
-}
-
-static int _ConnectToSkypeAPI(char *path, int iStart) {
- BOOL SkypeLaunched=FALSE;
- BOOL UseCustomCommand = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- int counter=0, i, j, maxattempts=DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "ConnectionAttempts", 10);
- char *args[7], *pFree = NULL;
- char *SkypeOptions[]={"/notray", "/nosplash", "/minimized", "/removable", "/datapath:", "/secondary"};
- const int SkypeDefaults[]={0, 1, 1, 0, 0};
-
- char szAbsolutePath[MAX_PATH];
-
- LOG(("ConnectToSkypeAPI started."));
- if (UseSockets)
- {
- SOCKADDR_IN service;
- DBVARIANT dbv;
- long inet;
- struct hostent *hp;
-
- LOG(("ConnectToSkypeAPI: Connecting to Skype2socket socket..."));
- if ((ClientSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET) return -1;
-
- if (!DBGetContactSettingString(NULL, SKYPE_PROTONAME, "Host", &dbv)) {
- if ((inet=inet_addr(dbv.pszVal))==-1) {
- if (hp=gethostbyname(dbv.pszVal))
- memcpy(&inet, hp->h_addr, sizeof(inet));
- else {
- OUTPUT(_T("Cannot resolve host!"));
- DBFreeVariant(&dbv);
- return -1;
- }
- }
- DBFreeVariant(&dbv);
- } else {
- OUTPUT(_T("Cannot find valid host to connect to."));
- return -1;
- }
-
- service.sin_family = AF_INET;
- service.sin_addr.s_addr = inet;
- service.sin_port = htons((unsigned short)DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "Port", 1401));
-
- if ( connect( ClientSocket, (SOCKADDR*) &service, sizeof(service) ) == SOCKET_ERROR) return -1;
-
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "RequiresPassword", 0) && !DBGetContactSettingString(NULL, SKYPE_PROTONAME, "Password", &dbv))
- {
- char reply=0;
-
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
- if ((reply=SendSkypeproxyCommand(AUTHENTICATE))==-1)
- {
- DBFreeVariant(&dbv);
- return -1;
- }
- if (!reply) {
- OUTPUT(_T("Authentication is not supported/needed for this Skypeproxy server. It will be disabled."));
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "RequiresPassword", 0);
- } else {
- unsigned int length=(unsigned int)strlen(dbv.pszVal);
- BOOL res;
- res = send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR
- || send(ClientSocket, dbv.pszVal, length, 0)==SOCKET_ERROR
- || recv(ClientSocket, (char *)&reply, sizeof(reply), 0)==SOCKET_ERROR;
- if (res)
- {
- DBFreeVariant(&dbv);
- return -1;
- }
- if (!reply)
- {
- OUTPUT(_T("Authentication failed for this server, connection was not successful. Verify that your password is correct!"));
- DBFreeVariant(&dbv);
- return -1;
- }
- }
- DBFreeVariant(&dbv);
- }
- else
- {
- char reply=0;
-
- if ((reply=SendSkypeproxyCommand(CAPABILITIES))==-1) return -1;
- if (reply&USE_AUTHENTICATION) {
- OUTPUT(_T("The server you specified requires authentication, but you have not supplied a password for it. Check the Skype plugin settings and try again."));
- return -1;
- }
- }
-
-
- if (!rcvThreadRunning)
- if(_beginthread(( pThreadFunc )rcvThread, 0, NULL)==-1) return -1;
-
- AttachStatus=SKYPECONTROLAPI_ATTACH_SUCCESS;
- return 0;
- }
-
- if (pszProxyCallout)
- {
- if (SkypeSend("SET USERSTATUS ONLINE")==-1)
- {
- AttachStatus=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE;
- return -1;
- }
- for ( ;; ) {
- char *ptr = SkypeRcv ("CONNSTATUS", INFINITE);
- if (strcmp (ptr+11, "CONNECTING"))
- {
- free (ptr);
- break;
- }
- free (ptr);
- }
-
- AttachStatus=SKYPECONTROLAPI_ATTACH_SUCCESS;
- return 0;
- }
-
- do
- {
- int retval;
- /* To initiate communication, Client should broadcast windows message
- ('SkypeControlAPIDiscover') to all windows in the system, specifying its own
- window handle in wParam parameter.
- */
- if (iStart != 2 || counter)
- {
- LOG(("ConnectToSkypeAPI sending discover message.. hWnd=%08X", (long)g_hWnd));
- retval=SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- LOG(("ConnectToSkypeAPI sent discover message returning %d", retval));
- }
-
- /* In response, Skype responds with
- message 'SkypeControlAPIAttach' to the handle specified, and indicates
- connection status
- SkypeReady is set if there is an answer by Skype other than API_AVAILABLE.
- If there is no answer after 3 seconds, launch Skype as it's propably
- not running.
- */
- if (iStart == 2 || (WaitForSingleObject(SkypeReady, 3000)==WAIT_TIMEOUT && AttachStatus!=SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION))
- {
- if (iStart != 2 && g_hWnd==NULL)
- {
- LOG(("ConnectToSkypeAPI: hWnd of SkypeDispatchWindow not yet set.."));
- continue;
- }
- if ((iStart == 2 || !SkypeLaunched) && (path || UseCustomCommand))
- {
- static PROCESS_INFORMATION pi={0};
- DWORD dwExitStatus = 0;
-
- if ((!pi.hProcess || !GetExitCodeProcess(pi.hProcess, &dwExitStatus) || dwExitStatus != STILL_ACTIVE) &&
- (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) || iStart))
- {
- LOG(("ConnectToSkypeAPI Starting Skype, as it's not running"));
-
- j=1;
- for (i=0; i<sizeof(SkypeOptions)/sizeof(SkypeOptions[0]); i++)
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, SkypeOptions[i]+1, SkypeDefaults[i])) {
- DBVARIANT dbv;
-
- switch (i)
- {
- case 4:
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"datapath",&dbv))
- {
- int paramSize;
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, TRUE);
- paramSize = strlen(SkypeOptions[i]) + strlen(szAbsolutePath);
- pFree = args[j] = malloc(paramSize + 1);
- sprintf(args[j],"%s%s",SkypeOptions[i],szAbsolutePath);
- DBFreeVariant(&dbv);
- }
- break;
- case 2:
- args[j++]="/legacylogin";
- default:
- args[j]=SkypeOptions[i];
- break;
- }
- LOG(("Using Skype parameter: %s", args[j]));
- //MessageBox(NULL,"Using Skype parameter: ",args[j],0);
- j++;
- }
- args[j]=NULL;
-
- if(UseCustomCommand)
- {
- DBVARIANT dbv;
-
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, FALSE);
- args[0] = (LPSTR)szAbsolutePath;
- LOG(("ConnectToSkypeAPI: Launch skype using command line"));
- if (!*szAbsolutePath || my_spawnv(szAbsolutePath, args, &pi) == -1) {
- LOG(("ConnectToSkypeAPI: Failed to launch skype!"));
- } else {
- WaitForInputIdle((HANDLE)pi.hProcess, 5000);
- setUserNamePassword(pi.dwProcessId);
- }
- DBFreeVariant(&dbv);
- }
- }
- else
- {
- args[0]=path;
- LOG(("ConnectToSkypeAPI: Launch skype"));
- /*for(int i=0;i<j;i++)
- {
- if(args[i] != NULL)
- LOG("ConnectToSkypeAPI", args[i]);
- }*/
-
- // if there is no skype installed and no custom command line, then exit .. else it crashes
- if (args[0] == NULL || strlen(args[0])==0)
- {
- return -1;
- }
- if (my_spawnv(path, args, &pi) != -1) {
- WaitForInputIdle((HANDLE)pi.hProcess, 5000);
- setUserNamePassword(pi.dwProcessId);
- }
- }
- if (pFree) free(pFree);
- }
- ResetEvent(SkypeReady);
- SkypeLaunched=TRUE;
- LOG(("ConnectToSkypeAPI: Skype process started."));
- // Skype launching iniciated, keep sending Discover messages until it responds.
- continue;
- }
- else
- {
- LOG(("ConnectToSkypeAPI: Check if Skype was launchable.."));
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) && !(path || UseCustomCommand)) return -1;
- LOG(("Trying to attach: #%d", counter));
- counter++;
- if (counter>=maxattempts && AttachStatus==-1)
- {
- int oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- OUTPUT(_T("ERROR: Skype not running / too old / working!"));
- return -1;
- }
- }
- }
- LOG(("Attachstatus %d", AttachStatus));
- } while (AttachStatus==SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE || AttachStatus==SKYPECONTROLAPI_ATTACH_API_AVAILABLE || AttachStatus==-1);
-
- while (AttachStatus==SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION) Sleep(1000);
- LOG(("Attachstatus %d", AttachStatus));
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_SUCCESS) {
- int oldstatus;
-
- switch(AttachStatus) {
- case SKYPECONTROLAPI_ATTACH_REFUSED:
- OUTPUT(_T("Skype refused the connection :("));
- break;
- case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
- OUTPUT(_T("The Skype API is not available"));
- break;
- default:
- LOG(("ERROR: AttachStatus: %d", AttachStatus));
- OUTPUT(_T("Wheee, Skype won't let me use the API. :("));
- }
- oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- return -1;
- }
-
- return 0;
-}
-
-/* CloseSkypeAPI
- * Purpose: Closes existing api connection
- * Params: path - Path to the Skype application; could be NULL when using proxy
- * Returns: always 0
- */
-int CloseSkypeAPI(char *skypePath)
-{
- char szAbsolutePath[MAX_PATH];
-
- logoff_contacts(TRUE);
- if (UseSockets)
- {
- if (ClientSocket != INVALID_SOCKET)
- {
- closesocket(ClientSocket);
- ClientSocket = INVALID_SOCKET;
- }
- }
- else {
- if (!pszProxyCallout)
- {
- if (AttachStatus!=-1)
- {
- // it was crashing when the skype-network-proxy is used (imo2sproxy for imo.im) and skype-path is empty
- // now, with the "UseSockets" check and the skypePath[0] != 0 check its fixed
- if (skypePath != NULL && skypePath[0] != 0) {
- TranslateMirandaRelativePathToAbsolute(skypePath, szAbsolutePath, FALSE);
- _spawnl(_P_NOWAIT, szAbsolutePath, szAbsolutePath, "/SHUTDOWN", NULL);
- }
- }
- }
- }
- SkypeInitialized=FALSE;
- ResetEvent(SkypeReady);
- AttachStatus=-1;
- if (g_hWnd) KillTimer (g_hWnd, 1);
- return 0;
-}
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : path - Path to the Skype application
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-//int __connectAPI(char *path) {
-// int retval;
-//
-// EnterCriticalSection(&ConnectMutex);
-// if (AttachStatus!=-1) {
-// LeaveCriticalSection(&ConnectMutex);
-// return -1;
-// }
-// InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
-// ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_OFFLINE, SkypeStatus);
-// retval=__connectAPI(path);
-// if (retval==-1) {
-// logoff_contacts();
-// InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
-// ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_CONNECTING, SkypeStatus);
-// }
-// LeaveCriticalSection(&ConnectMutex);
-// return retval;
-//}
diff --git a/protocols/Skype/skypeapi.h b/protocols/Skype/skypeapi.h
deleted file mode 100644
index fa4f5139a1..0000000000
--- a/protocols/Skype/skypeapi.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Skype API defines
-#define SKYPECONTROLAPI_ATTACH_SUCCESS 0
-#define SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION 1
-#define SKYPECONTROLAPI_ATTACH_REFUSED 2
-#define SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE 3
-#define SKYPECONTROLAPI_ATTACH_API_AVAILABLE 0x8001
-
-#define MISC_ERROR 1
-#define USER_NOT_FOUND 2
-#define USER_NOT_ONLINE 3
-#define USER_BLOCKED 4
-#define TYPE_UNSUPPORTED 5
-#define SENDER_NOT_FRIEND 6
-#define SENDER_NOT_AUTHORIZED 7
-
-#define MAX_ENTRIES 128 // Max. 128 number-Entries in Dial-dlg.
-
-typedef struct {
- int id;
- char *szStat;
-} status_map;
-
-// Prototypes
-int SkypeMsgInit(void);
-int SkypeMsgAdd(char *msg);
-void SkypeMsgCleanup(void);
-char *SkypeMsgGet(void);
-int SkypeSend(char*, ...);
-char *SkypeRcv(char *what, DWORD maxwait);
-char *SkypeRcvTime(char *what, time_t st, DWORD maxwait);
-char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait);
-INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeHup(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeHoldCall(WPARAM wParam, LPARAM lParam);
-void SkypeFlush(void);
-int SkypeStatusToMiranda(char *s);
-char *MirandaStatusToSkype(int id);
-char *GetSkypeErrorMsg(char *str);
-BOOL testfor(char *what, DWORD maxwait);
-int ConnectToSkypeAPI(char *path, BOOL bStart);
-int CloseSkypeAPI(char *skypePath);
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAnswerCall(WPARAM wParam, LPARAM lParam);
-int SkypeMsgCollectGarbage(time_t age);
-INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam);
-int SkypeSetProfile(char *szProperty, char *szValue);
-char *SkypeGet(char *szWhat, char *szWho, char *szProperty);
-char *SkypeGetID(char *szWhat, char *szWho, char *szProperty);
-char *SkypeGetErr(char *szWhat, char *szWho, char *szProperty);
-#ifdef _UNICODE
-WCHAR *SkypeGetW(char *szWhat, WCHAR *szWho, char *szProperty);
-WCHAR *SkypeGetErrW(char *szWhat, TCHAR *szWho, char *szProperty);
-#define SkypeGetT SkypeGetW
-#define SkypeGetErrT SkypeGetErrW
-#else
-#define SkypeGetT SkypeGet
-#define SkypeGetErrT SkypeGetErr
-#endif
-char *SkypeGetProfile(char *szProperty);
-void SetUserNamePassword();
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeReceivedAPIMessage(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Skype/skypeopt.c b/protocols/Skype/skypeopt.c
deleted file mode 100644
index 2dfc4faef5..0000000000
--- a/protocols/Skype/skypeopt.c
+++ /dev/null
@@ -1,969 +0,0 @@
-#include "skype.h"
-#include "skypeopt.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "skypeprofile.h"
-#if(WINVER >= 0x0500)
-#include "uxtheme.h"
-#define HAVE_UXTHEMES
-#endif
-
-#ifdef SKYPE_AUTO_DETECTION
-#include "ezxml/ezxml.c"
-#endif
-
-#ifdef UNICODE
-#include "utf8.h"
-#endif
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-// VC6 SDK defines
-#ifndef BIF_SHAREABLE
-#define BIF_SHAREABLE 0x8000 // sharable resources displayed (remote shares, requires BIF_USENEWUI)
-#endif
-#ifndef BIF_NEWDIALOGSTYLE
-#define BIF_NEWDIALOGSTYLE 0x0040 // Use the new dialog layout with the ability to resize
-#endif // Caller needs to call OleInitialize() before using this API
-#ifndef BIF_NONEWFOLDERBUTTON
-#define BIF_NONEWFOLDERBUTTON 0x0200 // Do not add the "New Folder" button to the dialog. Only applicable with BIF_NEWDIALOGSTYLE.
-#endif
-
-
-extern HINSTANCE hInst;
-extern PLUGININFO pluginInfo;
-extern char protocol, g_szProtoName[];
-extern BOOL SkypeInitialized, bProtocolSet, bIsImoproxy;
-extern DWORD mirandaVersion;
-
-BOOL showPopup, showPopupErr, popupWindowColor, popupWindowColorErr;
-unsigned int popupBackColor, popupBackColorErr;
-unsigned int popupTextColor, popupTextColorErr;
-int popupTimeSec, popupTimeSecErr;
-POPUPDATAT InCallPopup;
-POPUPDATAT ErrorPopup;
-
-static SkypeProfile myProfile;
-static HBITMAP hAvatar = NULL;
-
-extern BOOL PopupServiceExists;
-extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD);
-
-int RegisterOptions(WPARAM wParam, LPARAM lParam) {
- OPTIONSDIALOGPAGE odp;
-
- UNREFERENCED_PARAMETER(lParam);
-
- ZeroMemory(&odp, sizeof(odp));
- odp.cbSize = sizeof(odp);
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.pszGroup = "Network";
- odp.pszTitle = SKYPE_PROTONAME;
- odp.pfnDlgProc = OptionsDlgProc;
- odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
-
- if(PopupServiceExists)
- {
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP);
- odp.pszGroup = "Popups";
- odp.pfnDlgProc = OptPopupDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
- }
-
- return 0;
-}
-
-INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static RECT r;
-
- switch ( msg )
- {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwnd );
- // Message Popup
- popupTimeSec = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
- popupTextColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColor", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColor", FALSE);
- showPopup = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "showPopup", TRUE);
- // ERROR Message Popup
- popupTimeSecErr = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSecErr", 4);
- popupTextColorErr = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColorErr", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColorErr = DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColorErr", GetSysColor(COLOR_BTNFACE));
- popupWindowColorErr = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColorErr", FALSE);
- showPopupErr = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE);
-
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORS),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIME),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEW),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORSERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIMEERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEWERR),showPopupErr);
- CheckDlgButton(hwnd, IDC_POPUPINCOMING, (WPARAM) showPopup);
- CheckDlgButton(hwnd, IDC_USEWINCOLORS, (WPARAM) popupWindowColor);
- CheckDlgButton(hwnd, IDC_POPUPERROR, (WPARAM) showPopupErr);
- CheckDlgButton(hwnd, IDC_USEWINCOLORSERR, (WPARAM) popupWindowColorErr);
- SendDlgItemMessage(hwnd, IDC_POPUPTIME, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt(hwnd, IDC_POPUPTIME, popupTimeSec,FALSE);
- SendDlgItemMessage(hwnd, IDC_POPUPTIMEERR, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt(hwnd, IDC_POPUPTIMEERR, popupTimeSecErr,FALSE);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLOR, CPM_SETCOLOUR,0, popupBackColor);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLOR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_BTNFACE));
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLOR, CPM_SETCOLOUR,0, popupTextColor);
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLOR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT));
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLORERR, CPM_SETCOLOUR,0, popupBackColorErr);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLORERR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_BTNFACE));
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLORERR, CPM_SETCOLOUR,0, popupTextColorErr);
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLORERR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT));
-
-
- return TRUE;
- break;
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColor", popupBackColor);
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColor", popupTextColor);
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSec", popupTimeSec);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColor", (BYTE)popupWindowColor);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "showPopup", (BYTE)showPopup);
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupBackColorErr", popupBackColorErr);
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupTextColorErr", popupTextColorErr);
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "popupTimeSecErr", popupTimeSecErr);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "popupWindowColorErr", (BYTE)popupWindowColorErr);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "showPopupErr", (BYTE)showPopupErr);
- break;
- }
- }
- break;
-
-
-
- case WM_COMMAND:
- switch( LOWORD( wParam ))
- {
- case IDC_PREVIEW:
- {
- HANDLE hContact;
- TCHAR * lpzContactName;
-
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR);
- InCallPopup.lchContact = hContact;
- InCallPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- InCallPopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- InCallPopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- InCallPopup.iSeconds = popupTimeSec;
- InCallPopup.PluginData = (void *)1;
-
- lstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"));
-
- lstrcpy(InCallPopup.lptzContactName, lpzContactName);
-
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&InCallPopup,0);
-
-
- break;
- }
- case IDC_PREVIEWERR:
- ErrorPopup.lchContact = NULL;
- ErrorPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- ErrorPopup.colorBack = ! popupWindowColorErr ? popupBackColorErr : GetSysColor(COLOR_BTNFACE);
- ErrorPopup.colorText = ! popupWindowColorErr ? popupTextColorErr : GetSysColor(COLOR_WINDOWTEXT);
- ErrorPopup.iSeconds = popupTimeSecErr;
- ErrorPopup.PluginData = (void *)1;
-
- lstrcpy(ErrorPopup.lptzText, TranslateT("Preview Error Message"));
-
- lstrcpy(ErrorPopup.lptzContactName, _T("Error Message"));
-
-
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&ErrorPopup,0);
-
- break;
-
- case IDC_POPUPTIME:
- case IDC_POPUPTIMEERR:
- {
- BOOL Translated;
- popupTimeSec = GetDlgItemInt(hwnd,IDC_POPUPTIME,&Translated,FALSE);
- popupTimeSecErr = GetDlgItemInt(hwnd,IDC_POPUPTIMEERR,&Translated,FALSE);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- }
- case IDC_POPUPTEXTCOLOR:
- case IDC_POPUPBACKCOLOR:
- case IDC_POPUPTEXTCOLORERR:
- case IDC_POPUPBACKCOLORERR:
- popupBackColor = SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLOR,CPM_GETCOLOUR,0,0);
- popupTextColor = SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLOR,CPM_GETCOLOUR,0,0);
- popupBackColorErr = SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLORERR,CPM_GETCOLOUR,0,0);
- popupTextColorErr = SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLORERR,CPM_GETCOLOUR,0,0);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_USEWINCOLORS:
- popupWindowColor = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORS)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR), showPopup && ! popupWindowColor);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_POPUPINCOMING:
- showPopup = (IsDlgButtonChecked(hwnd,IDC_POPUPINCOMING)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORS),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIME),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEW),showPopup);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_USEWINCOLORSERR:
- popupWindowColorErr = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORSERR)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR), showPopupErr && ! popupWindowColorErr);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_POPUPERROR:
- showPopupErr = (IsDlgButtonChecked(hwnd,IDC_POPUPERROR)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORSERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIMEERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEWERR),showPopupErr);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- }
-
- break;
-
- case WM_DESTROY:
- break;
- }
-
- return 0;
-}
-
-INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static int iInit = TRUE;
-
- UNREFERENCED_PARAMETER(wParam);
-
- switch(msg)
- {
- case WM_INITDIALOG:
- {
- TCITEM tci;
- RECT rcClient;
- GetClientRect(hwnd, &rcClient);
-
- iInit = TRUE;
- tci.mask = TCIF_PARAM|TCIF_TEXT;
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_DEFAULT), hwnd, OptionsDefaultDlgProc);
- tci.pszText = TranslateT("Skype default");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_ADVANCED),hwnd,OptionsAdvancedDlgProc);
- tci.pszText = TranslateT("Skype advanced");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 1, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_PROXY),hwnd,OptionsProxyDlgProc);
- tci.pszText = TranslateT("Skype proxy");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 2, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- iInit = FALSE;
- return FALSE;
- }
-
- case PSM_CHANGED: // used so tabs dont have to call SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
- if(!iInit)
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- TCITEM tci;
- int i,count;
- tci.mask = TCIF_PARAM;
- count = TabCtrl_GetItemCount(GetDlgItem(hwnd,IDC_OPTIONSTAB));
- for (i=0;i<count;i++)
- {
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),i,&tci);
- SendMessage((HWND)tci.lParam,WM_NOTIFY,0,lParam);
- }
- }
- break;
- }
- break;
- case IDC_OPTIONSTAB:
- switch (((LPNMHDR)lParam)->code)
- {
- case TCN_SELCHANGING:
- {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),TabCtrl_GetCurSel(GetDlgItem(hwnd,IDC_OPTIONSTAB)),&tci);
- ShowWindow((HWND)tci.lParam,SW_HIDE);
- }
- break;
- case TCN_SELCHANGE:
- {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),TabCtrl_GetCurSel(GetDlgItem(hwnd,IDC_OPTIONSTAB)),&tci);
- ShowWindow((HWND)tci.lParam,SW_SHOW);
- }
- break;
- }
- break;
-
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- const int Skype2SocketControls[]={ IDC_STATIC_HOST, IDC_HOST, IDC_STATIC_PORT, IDC_PORT, IDC_REQPASS, IDC_PASSWORD, IDC_STATIC_RESTART };
- static BOOL initDlg=FALSE;
- DBVARIANT dbv;
- int i;
-
- switch (uMsg){
- case WM_INITDIALOG:
- initDlg=TRUE;
- TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingString(NULL, SKYPE_PROTONAME, "Host", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_HOST, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_HOST, _T("localhost"));
- SendDlgItemMessage(hwndDlg, IDC_PORT, EM_SETLIMITTEXT, 5, 0L);
- SetDlgItemInt(hwndDlg, IDC_PORT, DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "Port", 1401), FALSE);
- CheckDlgButton(hwndDlg, IDC_REQPASS, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "RequiresPassword", 0));
- CheckDlgButton(hwndDlg, IDC_USES2S, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0));
- if (!DBGetContactSettingString(NULL, SKYPE_PROTONAME, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- SendMessage(hwndDlg, WM_COMMAND, IDC_USES2S, 0);
- SendMessage(hwndDlg, WM_COMMAND, IDC_REQPASS, 0);
- initDlg=FALSE;
- return TRUE;
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- {
- char buf[1024];
- GetDlgItemTextA(hwndDlg, IDC_HOST, buf, sizeof(buf));
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "Host", buf);
- DBWriteContactSettingWord(NULL, SKYPE_PROTONAME, "Port", (unsigned short)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "RequiresPassword", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REQPASS), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UseSkype2Socket", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_USES2S), BM_GETCHECK,0,0)));
- ZeroMemory(buf, sizeof(buf));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, sizeof(buf));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(buf), (LPARAM)buf);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "Password", buf);
- return TRUE;
- }
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDC_USES2S:
- for (i=0; i<sizeof(Skype2SocketControls)/sizeof(Skype2SocketControls[0]); i++) EnableWindow(GetDlgItem(hwndDlg, Skype2SocketControls[i]), SendMessage(GetDlgItem(hwndDlg, LOWORD(wParam)), BM_GETCHECK,0,0));
- if (SendMessage(GetDlgItem(hwndDlg, LOWORD(wParam)), BM_GETCHECK,0,0)) SendMessage(hwndDlg, WM_COMMAND, IDC_REQPASS, 0);
- break;
- case IDC_REQPASS:
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), SendMessage(GetDlgItem(hwndDlg, LOWORD(wParam)), BM_GETCHECK,0,0));
- break;
-
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static BOOL initDlg=FALSE;
- static int statusModes[]={ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_AWAY,ID_STATUS_NA,ID_STATUS_OCCUPIED,ID_STATUS_DND,ID_STATUS_FREECHAT,ID_STATUS_INVISIBLE,ID_STATUS_OUTTOLUNCH,ID_STATUS_ONTHEPHONE};
- int i, j;
-
- switch (uMsg){
- case WM_INITDIALOG:
- initDlg=TRUE;
-
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEMENU, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "EnableMenu", 1));
- CheckDlgButton(hwndDlg, IDC_NOERRORS, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressErrors", 0));
- CheckDlgButton(hwndDlg, IDC_KEEPSTATE, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "KeepState", 0));
- CheckDlgButton(hwndDlg, IDC_TIMEZONE, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0));
- CheckDlgButton(hwndDlg, IDC_IGNTZ, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "IgnoreTimeZones", 0));
- CheckDlgButton(hwndDlg, IDC_SHOWDEFAULTAVATAR, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0));
- CheckDlgButton(hwndDlg, IDC_SUPPRESSCALLSUMMARYMESSAGE, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1));
- CheckDlgButton(hwndDlg, IDC_NOSKYPE3STATS, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0));
- CheckDlgButton(hwndDlg, IDC_SHOWFULLNAME, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowFullname", 1));
-
- if (ServiceExists(MS_GC_NEWSESSION) && (!bProtocolSet || protocol>=5)) {
- CheckDlgButton(hwndDlg, IDC_GROUPCHAT, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0));
- CheckDlgButton(hwndDlg, IDC_GROUPCHATREAD, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0));
- } else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_GROUPCHAT), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_GROUPCHATREAD), FALSE);
- }
-
-#ifdef USEPOPUP
- if (ServiceExists(MS_POPUP_ADDPOPUP))
- CheckDlgButton(hwndDlg, IDC_USEPOPUP, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UsePopup", 0));
- else
-#endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_USEPOPUP), FALSE);
-
- j=DBGetContactSettingDword(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE);
- for(i=0;i<sizeof(statusModes)/sizeof(statusModes[0]);i++) {
- int k;
-
- k=SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_ADDSTRING,0,(LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,statusModes[i],GCMDF_TCHAR));
- SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETITEMDATA,k,statusModes[i]);
- if (statusModes[i]==j) SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETCURSEL,i,0);
- }
- initDlg=FALSE;
- return TRUE;
-
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "EnableMenu", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_ENABLEMENU), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UsePopup", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_USEPOPUP), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UseGroupchat", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_GROUPCHAT), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "MarkGroupchatRead", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_GROUPCHATREAD), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "SuppressErrors", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_NOERRORS), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "KeepState", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_KEEPSTATE), BM_GETCHECK,0,0)));
- DBWriteContactSettingDword(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_GETCURSEL,0,0),0));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UseTimeZonePatch", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_TIMEZONE), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "IgnoreTimeZones", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_IGNTZ), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SHOWDEFAULTAVATAR), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SUPPRESSCALLSUMMARYMESSAGE), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "NoSkype3Stats", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_NOSKYPE3STATS), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "ShowFullname", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SHOWFULLNAME), BM_GETCHECK,0,0)));
- return TRUE;
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDC_CLEANUP:
- pthread_create(( pThreadFunc )CleanupNicknames, NULL);
- break;
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
-{
- UNREFERENCED_PARAMETER(lParam);
-
- switch (uMsg)
- {
- case BFFM_INITIALIZED:
- {
- // Set initial directory.
-#ifdef UNICODE
- wchar_t* wszInitFolder = make_unicode_string((const unsigned char*)lpData);
- SendMessage(hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)wszInitFolder);
- free(wszInitFolder);
-#else
- SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lpData);
-#endif
- break;
- }
- }
- return 0;
-}
-
-INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static BOOL initDlg=FALSE;
- static int skypeLaunchControls[]={IDC_NOSPLASH,IDC_MINIMIZED,IDC_NOTRAY,IDC_REMOVEABLE,IDC_SECONDARY,IDC_DATAPATHO,IDC_CUSTOMCOMMAND,IDC_STATIC_PATHINFO};
-
- switch (uMsg){
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- BOOL startSkype;
- int i;
-
- initDlg=TRUE;
- TranslateDialogDefault(hwndDlg);
-
- startSkype=DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1);
-
- CheckDlgButton(hwndDlg, IDC_STARTSKYPE, (BYTE)startSkype);
- CheckDlgButton(hwndDlg, IDC_NOSPLASH, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "nosplash", 1));
- CheckDlgButton(hwndDlg, IDC_MINIMIZED, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "minimized", 1));
- CheckDlgButton(hwndDlg, IDC_NOTRAY, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "notray", 0));
- CheckDlgButton(hwndDlg, IDC_REMOVEABLE, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "removable", 0));
- CheckDlgButton(hwndDlg, IDC_SECONDARY, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "secondary", 0));
- CheckDlgButton(hwndDlg, IDC_DATAPATHO, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "datapath:", 0));
- CheckDlgButton(hwndDlg, IDC_SHUTDOWN, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "Shutdown", 0));
- CheckDlgButton(hwndDlg, IDC_UNLOADOFFLINE, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0));
-
- CheckDlgButton(hwndDlg, IDC_CUSTOMCOMMAND, (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0));
- SendDlgItemMessage(hwndDlg, IDC_COMMANDLINE, EM_SETLIMITTEXT, MAX_PATH-1, 0L);
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_COMMANDLINE), dbv.pszVal);
- DBFreeVariant(&dbv);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_DATAPATH, EM_SETLIMITTEXT, MAX_PATH-1, 0L);
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"datapath",&dbv))
- {
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_DATAPATH), dbv.pszVal);
- DBFreeVariant(&dbv);
- }
-
- for(i=0; i < sizeof(skypeLaunchControls)/sizeof(skypeLaunchControls[0]); i++)
- EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
-
- // LoginUserName
- if(!DBGetContactSettingWString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv))
- {
- SetWindowTextW(GetDlgItem(hwndDlg, IDC_USERNAME), dbv.pwszVal);
- DBFreeVariant(&dbv);
- }
-
- // LoginPassword
- if(!DBGetContactSettingWString(NULL,SKYPE_PROTONAME,"LoginPassword",&dbv))
- {
- SetWindowTextW(GetDlgItem(hwndDlg, IDC_PASSWORD), dbv.pwszVal);
- DBFreeVariant(&dbv);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_CONNATTEMPTS, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt (hwndDlg, IDC_CONNATTEMPTS, DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "ConnectionAttempts", 10), FALSE);
- SendMessage(hwndDlg, WM_COMMAND, IDC_STARTSKYPE, 0);
- initDlg=FALSE;
- return TRUE;
- }
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- {
- char text[500];
- WCHAR wtext[500];
- char szRelativePath[MAX_PATH];
-
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "StartSkype", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_STARTSKYPE), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "nosplash", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_NOSPLASH), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "minimized", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_MINIMIZED), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "notray", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_NOTRAY), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "Shutdown", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SHUTDOWN), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UnloadOnOffline", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_UNLOADOFFLINE), BM_GETCHECK,0,0)));
- DBWriteContactSettingWord (NULL, SKYPE_PROTONAME, "ConnectionAttempts", (unsigned short)GetDlgItemInt(hwndDlg, IDC_CONNATTEMPTS, NULL, FALSE));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UseCustomCommand", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "datapath:", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "removable", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REMOVEABLE), BM_GETCHECK,0,0)));
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SECONDARY), BM_GETCHECK,0,0)));
-
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,sizeof(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
- CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath);
-
- GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,sizeof(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
- CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "datapath", szRelativePath);
-
- // LoginUserName
- GetDlgItemTextW(hwndDlg,IDC_USERNAME,wtext,sizeof(wtext)/sizeof(WCHAR));
- DBWriteContactSettingWString(NULL, SKYPE_PROTONAME, "LoginUserName", wtext);
-
- // LoginPassword
- GetDlgItemTextW(hwndDlg,IDC_PASSWORD,wtext,sizeof(wtext)/sizeof(WCHAR));
- DBWriteContactSettingWString(NULL, SKYPE_PROTONAME, "LoginPassword", wtext);
-
- return TRUE;
- }
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- BOOL startSkype;
- int i;
- case IDC_STARTSKYPE:
- startSkype=SendMessage(GetDlgItem(hwndDlg, IDC_STARTSKYPE), BM_GETCHECK,0,0);
-
- for(i=0; i < sizeof(skypeLaunchControls)/sizeof(skypeLaunchControls[0]); i++)
- EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), startSkype && SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
- break;
- case IDC_CLEANUP:
- pthread_create(( pThreadFunc )CleanupNicknames, NULL);
- break;
- case IDC_DATAPATHO:
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), SendMessage(GetDlgItem(hwndDlg, IDC_DATAPATHO), BM_GETCHECK,0,0));
- break;
- case IDC_CUSTOMCOMMAND:
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), SendMessage(GetDlgItem(hwndDlg, IDC_CUSTOMCOMMAND), BM_GETCHECK,0,0));
- break;
- case IDC_BROWSECMDL:
- {
- OPENFILENAMEA ofn={0};
- BOOL gofnResult;
- char szFileName[MAX_PATH];
- char szAbsolutePath[MAX_PATH];
-
- ofn.lStructSize=sizeof(ofn);
- ofn.hwndOwner=hwndDlg;
- ofn.lpstrFilter="Executable files (*.exe)\0*.exe\0All files (*.*)\0*.*\0";
- ofn.nMaxFile=sizeof(szFileName);
- ofn.lpstrDefExt="exe";
- ofn.lpstrFile=szFileName;
- ofn.Flags=OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING;
-
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,sizeof(szFileName));
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- strcpy (szFileName, szAbsolutePath);
-
- if (!(gofnResult = GetOpenFileNameA(&ofn)) && CommDlgExtendedError() == FNERR_INVALIDFILENAME){
- strcpy(szFileName, ".\\Skype.exe");
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- strcpy (szFileName, szAbsolutePath);
- gofnResult = GetOpenFileNameA(&ofn);
- }
-
- if(gofnResult)
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_COMMANDLINE), szFileName);
-
- break;
- }
- case IDC_BROWSEDP:
- {
- BROWSEINFOA bi={0};
- LPITEMIDLIST pidl;
- char szFileName[MAX_PATH];
- char szAbsolutePath[MAX_PATH];
-
- GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, MAX_PATH);
-
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- bi.hwndOwner = hwndDlg;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_SHAREABLE | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)szAbsolutePath;
-
- if ( (pidl = SHBrowseForFolderA (&bi)) ) {
- if (SHGetPathFromIDListA (pidl, szFileName))
- SetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName);
- CoTaskMemFree (pidl);
- }
- break;
- }
-
-#ifdef SKYPE_AUTO_DETECTION
- case IDC_AUTODETECTION:
- DoAutoDetect(hwndDlg);
- break;
-#endif
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// OnDetailsInit - initializes user info dialog pages.
-
-int OnDetailsInit( WPARAM wParam, LPARAM lParam )
-{
- OPTIONSDIALOGPAGE odp = {0};
- HANDLE hContact = ( HANDLE )lParam;
-
- odp.cbSize = sizeof(odp);
- odp.hIcon = NULL;
- odp.hInstance = hInst;
-
- if ( hContact == NULL ) {
-
- char szTitle[256];
-
- if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 7, 0, 27) && !bIsImoproxy)
- {
- mir_snprintf( szTitle, sizeof( szTitle ), "%s %s", SKYPE_PROTONAME, Translate( "Avatar" ));
-
- odp.pfnDlgProc = AvatarDlgProc;
- odp.position = 1900000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETAVATAR);
- odp.pszTitle = szTitle;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
- }
-
- mir_snprintf( szTitle, sizeof( szTitle ), "%s %s", SKYPE_PROTONAME, Translate( "Details" ));
-
- odp.pfnDlgProc = DetailsDlgProc;
- odp.position = 1900000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETDETAILS);
- odp.pszTitle = szTitle;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
- }
-
- return 0;
-}
-
-/*AvatarDlgProc
-*
-* For setting the skype avatar
-*
-*/
-INT_PTR CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static RECT r;
-
- UNREFERENCED_PARAMETER(lParam);
-
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
-
- hAvatar = NULL;
- if(ServiceExists(MS_AV_GETMYAVATAR)){
- struct avatarCacheEntry *ace = (struct avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0,(LPARAM) SKYPE_PROTONAME);
- if (ace!=NULL) {
- hAvatar = ( HBITMAP )CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )ace->szFilename);
- if ( hAvatar != NULL )
- SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar );
- }
- }
-
-
-
- return TRUE;
-
- case WM_COMMAND:
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
- case IDC_SETAVATAR:
- {
- char szFileName[ MAX_PATH ];
- if ( EnterBitmapFileName( szFileName ) != ERROR_SUCCESS )
- return FALSE;
-
- hAvatar = ( HBITMAP )CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )szFileName);
- if ( hAvatar != NULL ){
- SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar );
- CallService(SKYPE_SETAVATAR, 0, ( LPARAM )szFileName);
- }
- break;
- }
- case IDC_DELETEAVATAR:
- if ( hAvatar != NULL ) {
- DeleteObject( hAvatar );
- hAvatar = NULL;
- CallService(SKYPE_SETAVATAR, 0, 0);
- }
- DBDeleteContactSetting( NULL, SKYPE_PROTONAME, "AvatarFile" );
- InvalidateRect( hwndDlg, NULL, TRUE );
- break;
- } }
- break;
-
- case WM_DESTROY:
- if ( hAvatar != NULL )
- DeleteObject( hAvatar );
- break;
- }
-
- return 0;
-}
-
-/*DetailsDlgProc
-*
-* For setting the skype infos
-*
-*/
-INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static int sexM = 0,sexF = 0, sex;
-
- UNREFERENCED_PARAMETER(lParam);
-
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
-
- ZeroMemory (&myProfile, sizeof(myProfile));
- SkypeProfile_Load(&myProfile);
- if(SkypeInitialized)
- SkypeProfile_LoadFromSkype(&myProfile);
-
- SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)_T(""));
- sexM = SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)TranslateT("MALE"));
- sexF = SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)TranslateT("FEMALE"));
-
- switch(myProfile.Sex) {
- case 0x4D: SendDlgItemMessage(hwndDlg,IDC_SEX,CB_SETCURSEL, sexM, 0); break;
- case 0x46: SendDlgItemMessage(hwndDlg,IDC_SEX,CB_SETCURSEL, sexF, 0); break;
- }
-
- SetDlgItemText(hwndDlg, IDC_FULLNAME, myProfile.FullName);
- SetDlgItemTextA(hwndDlg, IDC_HOMEPAGE, myProfile.HomePage);
- SetDlgItemTextA(hwndDlg, IDC_HOMEPHONE, myProfile.HomePhone);
- SetDlgItemTextA(hwndDlg, IDC_OFFICEPHONE, myProfile.OfficePhone);
- SetDlgItemText(hwndDlg, IDC_CITY, myProfile.City);
- SetDlgItemText(hwndDlg, IDC_PROVINCE, myProfile.Province);
- DateTime_SetSystemtime (GetDlgItem (hwndDlg, IDC_BIRTHDAY), GDT_VALID, &myProfile.Birthday);
- return TRUE;
-
- case WM_COMMAND:
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
- case IDC_SAVEDETAILS:
- GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,sizeof(myProfile.FullName)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,sizeof(myProfile.HomePage)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,sizeof(myProfile.HomePhone)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,sizeof(myProfile.OfficePhone)/sizeof(TCHAR));
- GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,sizeof(myProfile.City)/sizeof(TCHAR));
- GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,sizeof(myProfile.Province)/sizeof(TCHAR));
- sex = SendMessage(GetDlgItem(hwndDlg,IDC_SEX),CB_GETCURSEL,0,0);
-
- myProfile.Sex = 0;
- if(sex == sexF) myProfile.Sex = 0x46; else
- if(sex == sexM) myProfile.Sex = 0x4D;
- DateTime_GetSystemtime (GetDlgItem (hwndDlg, IDC_BIRTHDAY), &myProfile.Birthday);
-
- SkypeProfile_Save(&myProfile);
- if(SkypeInitialized)
- SkypeProfile_SaveToSkype(&myProfile);
- break;
- }
- }
- break;
-
- case WM_DESTROY:
- if ( hAvatar != NULL )
- DeleteObject( hAvatar );
- break;
- }
-
- return 0;
-}
-
-#ifdef SKYPE_AUTO_DETECTION
-/**
- * DoAutoDetect
- * @param dlg The default option dialog handle
- */
-void DoAutoDetect(HWND dlg)
-{
- char basePath[MAX_PATH];
- char fileName[MAX_PATH];
- char tmpUser[255];
- ezxml_t f1, acc;
-
- if (FAILED(SHGetFolderPath(dlg,CSIDL_APPDATA,NULL,0,basePath)))
- {
- OUTPUT("Error in retrieving appdata path!");
- return;
- }
-
- strcat(basePath,"\\Skype\\");
- sprintf (fileName, "%s\\shared.xml", basePath);
-
- if (f1 = ezxml_parse_file(fileName))
- {
- if (acc = ezxml_get(f1, "Lib", 0, "Account", 0, "Default", -1))
- {
- if (GetWindowTextA(GetDlgItem(dlg,IDC_USERNAME),tmpUser,sizeof(tmpUser)))
- SetWindowTextA(GetDlgItem(dlg,IDC_USERNAME),acc->txt);
- /* Can't find this stuff in current Skype verions??
- sprintf (fileName, "%s\\%s\\config.xml", basePath, acc->txt);
- if ((acc = ezxml_get(f1, "UI", 0, "Messages", 0, "OpenWindowInCompactMode", -1)) && *acc->txt!='0')
- {
- ezxml_set_txt (acc, "0");
- // ezXML doesn't supprot saving yet
- }
- */
- }
- ezxml_free(f1);
- }
- else
- {
- OUTPUT("Failed to open skypes configuration files!");
- return;
- }
-}
-#endif
diff --git a/protocols/Skype/skypeopt.h b/protocols/Skype/skypeopt.h
deleted file mode 100644
index 23aa7a5212..0000000000
--- a/protocols/Skype/skypeopt.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * RegisterOptions
- *
- * This function tells Miranda to add the configuration section of this plugin in
- * the Options-dialog.
- */
-int RegisterOptions(WPARAM wParam, LPARAM lParam);
-/*
- * OptionsDlgProc
- *
- * This callback function is called, when the options dialog in Miranda is shown
- * The function contains all necessary stuff to process the options in the dialog
- * and store them in the database, when changed, and fill out the settings-dialog
- * correctly according to the current settings
- */
-INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptPopupDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-/*
-* Procedure to call when the option page is asked
-*
-*/
-int OnDetailsInit( WPARAM wParam, LPARAM lParam );
-
-/*
-* Dialog to change avatar in user details.
-*
-*
-*/
-INT_PTR CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-/*
-* Dialog to change infos in user details.
-*
-*
-*/
-INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-/*
- * Helper functions
- *
- */
-void DoAutoDetect(HWND dlg);
-
-; \ No newline at end of file
diff --git a/protocols/Skype/skypeprofile.c b/protocols/Skype/skypeprofile.c
deleted file mode 100644
index 3bf3c0b955..0000000000
--- a/protocols/Skype/skypeprofile.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-#include "skypeprofile.h"
-#include "skypeapi.h"
-#include "utf8.h"
-
-extern char g_szProtoName[];
-
-void SkypeProfile_Save(SkypeProfile *pstProf)
-{
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "Gender", pstProf->Sex);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "HomePhone", pstProf->HomePhone);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "OfficePhone", pstProf->OfficePhone);
- DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "HomePage", pstProf->HomePage);
- DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "Nick", pstProf->FullName);
- DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "City", pstProf->City);
- DBWriteContactSettingTString(NULL, SKYPE_PROTONAME, "Province", pstProf->Province);
- DBWriteContactSettingWord(NULL, SKYPE_PROTONAME, "BirthYear", (WORD)pstProf->Birthday.wYear);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "BirthMonth", (BYTE)pstProf->Birthday.wMonth);
- DBWriteContactSettingByte(NULL, SKYPE_PROTONAME, "BirthDay", (BYTE)pstProf->Birthday.wDay);
-}
-
-void SkypeProfile_Load(SkypeProfile *pstProf)
-{
- DBVARIANT dbv;
-
- pstProf->Sex = (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "Gender", 0);
- pstProf->Birthday.wYear = (WORD)DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "BirthYear", 1900);
- pstProf->Birthday.wMonth = (WORD)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "BirthMonth", 01);
- pstProf->Birthday.wDay = (WORD)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "BirthDay", 01);
- if(!DBGetContactSettingTString(NULL,SKYPE_PROTONAME,"Nick",&dbv))
- {
- _tcsncpy (pstProf->FullName, dbv.ptszVal, sizeof(pstProf->FullName)/sizeof(TCHAR));
- DBFreeVariant(&dbv);
- }
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"HomePage",&dbv))
- {
- strncpy (pstProf->HomePage, dbv.pszVal, sizeof(pstProf->HomePage));
- DBFreeVariant(&dbv);
- }
- if(!DBGetContactSettingTString(NULL,SKYPE_PROTONAME,"Province",&dbv))
- {
- _tcsncpy (pstProf->Province, dbv.ptszVal, sizeof(pstProf->Province)/sizeof(TCHAR));
- DBFreeVariant(&dbv);
- }
- if(!DBGetContactSettingTString(NULL,SKYPE_PROTONAME,"City",&dbv))
- {
- _tcsncpy (pstProf->City, dbv.ptszVal, sizeof(pstProf->City)/sizeof(TCHAR));
- DBFreeVariant(&dbv);
- }
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"OfficePhone",&dbv))
- {
- strncpy (pstProf->OfficePhone, dbv.pszVal, sizeof(pstProf->OfficePhone));
- DBFreeVariant(&dbv);
- }
- if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"HomePhone",&dbv))
- {
- strncpy (pstProf->HomePhone, dbv.pszVal, sizeof(pstProf->HomePhone));
- DBFreeVariant(&dbv);
- }
-}
-
-static void LoadSaveSkype(SkypeProfile *pstProf, BOOL bSet)
-{
-#pragma warning (push)
-#pragma warning (disable: 4204) // nonstandard extension used : non-constant aggregate initializer
-#define ENTRY(x,y) {x, pstProf->y, sizeof(pstProf->y)/sizeof(pstProf->y[0]), sizeof(pstProf->y[0])}
- const struct {
- char *pszSetting;
- LPVOID lpDest;
- int iSize;
- char cType;
- } astSettings[] = {
- ENTRY("FULLNAME", FullName),
- ENTRY("PHONE_HOME", HomePhone),
- ENTRY("PHONE_OFFICE", OfficePhone),
- ENTRY("HOMEPAGE", HomePage),
- ENTRY("CITY", City),
- ENTRY("PROVINCE", Province)
- };
-#pragma warning (pop)
-#undef ENTRY
- char *ptr;
- int i;
-
- if (bSet) {
- char *pBuf, szBirthday[16];
- for (i=0; i<sizeof(astSettings)/sizeof(astSettings[0]); i++) {
- if ((astSettings[i].cType == sizeof(char) && utf8_encode((const char*)astSettings[i].lpDest, &pBuf) != -1) ||
- (astSettings[i].cType == sizeof(WCHAR) && (pBuf = (char*)make_utf8_string((const WCHAR*)astSettings[i].lpDest)))) {
- SkypeSetProfile (astSettings[i].pszSetting, pBuf);
- free (pBuf);
- }
- }
- switch (pstProf->Sex)
- {
- case 0x4D: SkypeSetProfile ("SEX", "MALE"); break;
- case 0x46: SkypeSetProfile ("SEX", "FEMALE"); break;
- }
- sprintf (szBirthday, "%04d%02d%02d", pstProf->Birthday.wYear, pstProf->Birthday.wMonth, pstProf->Birthday.wDay);
- SkypeSetProfile ("BIRTHDAY", szBirthday);
- } else {
- for (i=0; i<sizeof(astSettings)/sizeof(astSettings[0]); i++) {
- if (ptr=SkypeGetProfile(astSettings[i].pszSetting)) {
- if (astSettings[i].cType == sizeof(char)) {
- char *pBuf;
- if (utf8_decode (ptr, &pBuf) != -1) {
- strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
- free (pBuf);
- }
- } else {
- WCHAR *pBuf;
- if (pBuf = make_unicode_string((const unsigned char*)ptr)) {
- wcsncpy ((WCHAR*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
- free (pBuf);
- }
- }
- free (ptr);
- }
- }
- if (ptr=SkypeGetProfile("SEX"))
- {
- if (!_stricmp(ptr, "MALE")) pstProf->Sex=0x4D; else
- if (!_stricmp(ptr, "FEMALE")) pstProf->Sex=0x46;
- free (ptr);
- }
- if (ptr=SkypeGetProfile("BIRTHDAY"))
- {
- if (*ptr != '0')
- sscanf(ptr, "%04hd%02hd%02hd", &pstProf->Birthday.wYear, &pstProf->Birthday.wMonth,
- &pstProf->Birthday.wDay);
- free(ptr);
- }
- }
-}
-
-void SkypeProfile_LoadFromSkype(SkypeProfile *pstProf)
-{
- LoadSaveSkype (pstProf, FALSE);
-}
-
-void SkypeProfile_SaveToSkype(SkypeProfile *pstProf)
-{
- LoadSaveSkype (pstProf, TRUE);
-} \ No newline at end of file
diff --git a/protocols/Skype/skypeprofile.h b/protocols/Skype/skypeprofile.h
deleted file mode 100644
index 60531128d1..0000000000
--- a/protocols/Skype/skypeprofile.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// System includes
-#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include "resource.h"
-#include "skype.h"
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-// Miranda database access
-#include "../../include/newpluginapi.h"
-#include "../../include/m_database.h"
-#pragma warning (pop)
-
-typedef struct
-{
- TCHAR FullName[256];
- char HomePhone[256];
- char OfficePhone[256];
- char HomePage[256];
- TCHAR City[256];
- TCHAR Province[256];
- BYTE Sex;
- SYSTEMTIME Birthday;
-} SkypeProfile;
-
-void SkypeProfile_Load(SkypeProfile *pstProf);
-void SkypeProfile_Save(SkypeProfile *pstProf);
-void SkypeProfile_Free(SkypeProfile *pstProf);
-void SkypeProfile_LoadFromSkype(SkypeProfile *pstProf);
-void SkypeProfile_SaveToSkype(SkypeProfile *pstProf);
diff --git a/protocols/Skype/skypeproxy.h b/protocols/Skype/skypeproxy.h
deleted file mode 100644
index 8e1490803e..0000000000
--- a/protocols/Skype/skypeproxy.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Commands for command mode of Skype proxy */
-
-#define AUTHENTICATE 0x01
-#define CAPABILITIES 0x02
-
-/* Capabilities flags of Skypeproxy */
-#define USE_AUTHENTICATION 0x01 \ No newline at end of file
diff --git a/protocols/Skype/skypeproxy/skypeproxy.c b/protocols/Skype/skypeproxy/skypeproxy.c
deleted file mode 100644
index fff9c1b916..0000000000
--- a/protocols/Skype/skypeproxy/skypeproxy.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
-
-Purpose
-=======
-This program opens a connection on a local TCP/IP port and sends/
-receives Skype-API calls on it so that you can remote-control
-Skype over a network.
-Note, that there are currently NO SECURITY mechanisms, so don't
-use this over an untrusted network!
-
-Author
-======
-This program was written by leecher in 2005 (mailto:leecher@dose.0wnz.at)
-Please give feedback at http://forum.skype.com/viewtopic.php?t=16187
-
-Protocol
-========
-Basic protocol structure
-------------------------
-Sender and receiver have the same protocol:
-
- [(UINT)Length of message][(char[])Message]
-
-The Length is so that you can malloc() enough space for the data buffer
-to receive the next message.
-
-A special case is, if the [Length of message] is 0. In this case the
-client tells the server that he wants to switch to command mode.
-
-Command mode
-------------
-The server expects
-
- [(char)Command]
-
-next. Currently the following commands are supported:
-
- CAPABILITIES - returns the Server's capabilities
- AUTHENTICATE - Starts the authentification process
-
-CAPABILITIES
-------------
-The server returns
-
- [(char)Capabilities]
-
-where this currently can be the following:
-
- USE_AUTHENTICATION - The server supports and requires authentication
-
-AUTHENTICATE
-------------
-The server returns
-
- [(char)0x01]
-
-if authentication is supported AND needed (skypeproxy started with -k switch) or
-
- [(char)0x00]
-
-if this is not the case.
-If 0x01 was returned the server next expects a normal message
-(see "Basic protocol structure) containing the password.
-If the authentication was successful, the server replies with
-
- [(char)0x01]
-
-otherwise with
-
- [(char)0x00]
-
-PLEASE NOTE THAT THE AUTHENTICATION CURRENTLY IS PLAIN TEXT. SO DON'T
-USE THIS PROGRAM OVER AN UNTRUSTED NETWORK, OTHERWISE THERE MAY BE THE
-POSSIBILITY THAT SOMEONE SNIFFS YOUR PASSWORD!
-
-Code example
-------------
-
-SOCKET MySocket;
-
-int SendPacket(char *szSkypeMessage) {
- unsigned int length=strlen(szSkypeMsg);
-
- if (send(MySocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR ||
- send(MySocket, szSkypeMsg, length, 0)==SOCKET_ERROR)
- return -1;
- return 0;
-}
-
-// don't forget to free() the return value on my Heap!!
-char *ReceivePacket(void) {
- unsigned int lenght, received;
- char *buf;
-
- if ((received=recv(MySocket, (char *)&length, sizeof(length), 0))==SOCKET_ERROR ||
- received==0)
- return NULL;
- if (!(buf=calloc(1, length+1))) return NULL;
- if (recv(MySocket, buf, length, 0)==SOCKET_ERROR) {
- free(buf);
- return NULL;
- }
- return buf;
-}
-
-
-License
-=======
-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.
-
-History
-========
-V1.0alpha - First preview release
-V1.0 - Implemented killing & restarting Skype process when it dies
- - BUGFIX: SendMessage() is a blocking call, if Skype hangs our app hangs too -> Fixed
- - Added command line parsing.
- - Renamed from Skype2Socket to skypeproxy
- - Added authentication feature.
-*/
-
-#include <stdio.h>
-#include <process.h>
-#include <windows.h>
-#include <signal.h>
-#include "skypeproxy.h"
-
-UINT ControlAPIAttach, ControlAPIDiscover;
-HWND hSkypeWnd=NULL, hWnd;
-HANDLE SkypeReady, ServerThreadBye;
-LONG AttachStatus=-1;
-int exitcode=EXIT_SUCCESS;
-char skype_path[MAX_PATH], *password=NULL;
-BYTE WatchDog=1;
-BOOL WatchDogRunning=FALSE, Authenticated=FALSE;
-SOCKET ListenSocket, AcceptSocket;
-
-
-void bail_out(int i) {
- OUTPUT("Got termination signal, bailing out.");
- if (i==1) exitcode=EXIT_FAILURE;
- PostMessage(hWnd, WM_QUIT, 0, 0);
-}
-
-BOOL CALLBACK TerminateAppEnum( HWND hwnd, LPARAM lParam ) {
- DWORD dwID ;
-
- GetWindowThreadProcessId(hwnd, &dwID) ;
- if(dwID == (DWORD)lParam)
- PostMessage(hwnd, WM_CLOSE, 0, 0) ; // May you be so kind to quit, please?
-
- return TRUE ;
-}
-
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : ForceRestart - Kill Skype if it's running before restarting
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-void ConnectToSkypeAPI(void *ForceRestart) {
- BOOL SkypeLaunched=FALSE;
- int counter=0, i, j;
- char *args[5];
- char *SkypeOptions[]={"/notray", "/nosplash", "/minimized"};
- char *szFuncName="ConnectToSkypeAPI";
-
- ResetEvent(SkypeReady);
- AttachStatus=-1;
- if ((BOOL)ForceRestart) {
- HANDLE hProc;
- DWORD dwPID=0;
-
- if (!hSkypeWnd) {
- OUTPUT("I can't kill Skype, as I don't even have its window handle!");
- return;
- }
- GetWindowThreadProcessId(hSkypeWnd, &dwPID);
- LOG(("%s: Shutting down Skype as it was not behaving the way it should...", szFuncName));
- if (hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID)) {
-
- // Try to shutdown Skype the nice way by asking it to close
- EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM) dwPID);
-
- if(WaitForSingleObject(hProc, 10000)!=WAIT_OBJECT_0) {
- // Try it the hard way by killing it
- LOG(("%s: I tried it the nice way, but you were not listening! Now DIIIIEEE!", szFuncName));
- if (!TerminateProcess(hProc,0)) {
- OUTPUT("Argh, process refused to die, it's too mighty for me, I've given up");
- CloseHandle(hProc);
- return;
- }
- LOG(("%s: Process killed! >:)", szFuncName));
- }
- CloseHandle(hProc);
- }
- }
- do {
- /* To initiate communication, Client should broadcast windows message
- ('SkypeControlAPIDiscover') to all windows in the system, specifying its own
- window handle in wParam parameter.
- */
- LOG(("%s: Sending discover message..", szFuncName));
- SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- LOG(("%s: Discover message sent, waiting for Skype to become ready..", szFuncName));
-
- /* In response, Skype responds with
- message 'SkypeControlAPIAttach' to the handle specified, and indicates
- connection status
- SkypeReady is set if there is an answer by Skype other than API_AVAILABLE.
- If there is no answer after 3 seconds, launch Skype as it's propably
- not running.
- */
- if (WaitForSingleObject(SkypeReady, 3000)==WAIT_TIMEOUT &&
- AttachStatus!=SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION)
- {
- if (hWnd==NULL) {
- LOG(("%s: hWnd of SkypeDispatchWindow not yet set..", szFuncName));
- continue;
- }
- if (!SkypeLaunched && skype_path) {
- LOG(("%s: Starting Skype, as it's not running", szFuncName));
- args[0]=skype_path;
- j=1;
- for (i=0; i<3; i++) {
- args[j]=SkypeOptions[i];
- LOG(("%s: Using Skype parameter: ", szFuncName, args[j]));
- j++;
- }
- args[j]=NULL;
- _spawnv(_P_NOWAIT, skype_path, args);
- ResetEvent(SkypeReady);
- SkypeLaunched=TRUE;
- LOG(("%s: Skype process started.", szFuncName));
- // Skype launching iniciated, keep sending Discover messages until it responds.
- continue;
- } else {
- LOG(("%s: Check if Skype was launchable..", szFuncName));
- if (!skype_path) {
- OUTPUT("There was no correct path for Skype application");
- bail_out(1);
- return;
- }
- LOG("%s: Trying to attach: #%d", szFuncName, counter));
- counter++;
- if (counter==5) {
- OUTPUT("ERROR: Skype not running / too old / working!");
- bail_out(1);
- return;
- }
- }
- }
- LOG(("%s: Attachstatus %d", szFuncName, AttachStatus));
- } while (AttachStatus==SKYPECONTROLAPI_ATTACH_API_AVAILABLE || AttachStatus==-1);
-
- while (AttachStatus==SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION) Sleep(1000);
- LOG(("%s: Attachstatus %d", szFuncName, AttachStatus));
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_SUCCESS) {
- switch(AttachStatus) {
- case SKYPECONTROLAPI_ATTACH_REFUSED:
- OUTPUT("Skype refused the connection :(");
- break;
- case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
- OUTPUT("The Skype API is not available");
- break;
- default:
- LOG(("%s: ERROR: AttachStatus: %d", szFuncName, AttachStatus));
- OUTPUT("Wheee, Skype won't let me use the API. :(");
- }
- bail_out(1);
- return;
- }
- OUTPUT("Attached to Skype successfully.");
- if (!WatchDogRunning)
- if (_beginthread(WatchDogTimer, 0, NULL)==-1) {
- OUTPUT("Cannot start Watchdog.");
- bail_out(1);
- }
- return;
-}
-
-void SkypeSend(char *szMsg) {
- COPYDATASTRUCT CopyData;
- int count=0;
-
- if (!hSkypeWnd) {
- LOG(("SkypeSend: DAMN! No Skype window handle! :("));
- return;
- }
- if (strcmp(szMsg, "PING")) {LOG(("> %s", szMsg));}
- CopyData.dwData=0;
- CopyData.lpData=szMsg;
- CopyData.cbData=strlen(szMsg)+1;
- while (!SendMessageTimeout(hSkypeWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&CopyData, SMTO_ABORTIFHUNG, 3000, NULL)) {
- count++;
- LOG(("SkypeSend: failed, try #%d", count));
- if (count==5) {
- OUTPUT("Sending message to Skype failed too often.");
- OUTPUT("Skype may have died unexpectedly, I will try to restart it.");
- ConnectToSkypeAPI((void *)TRUE);
- OUTPUT("Restart complete. Trying to deliver message one more time.");
- if (!SendMessageTimeout(hSkypeWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&CopyData, SMTO_ABORTIFHUNG, 3000, NULL)) {
- OUTPUT("It still failed. Skype seems to be completely f*cked up. I've given up. Bye..");
- bail_out(1);
- break;
- } else {
- OUTPUT("Now it worked! :)");
- break;
- }
- }
- Sleep(1000);
- }
-}
-
-void ServerThread(char *dummy) {
- unsigned int length, received;
- char *buf, command, reply;
-
- LOG(("ServerThread started"));
- AcceptSocket=INVALID_SOCKET;
- while( AcceptSocket == INVALID_SOCKET) {
- if ((AcceptSocket = accept( ListenSocket, NULL, NULL ))==INVALID_SOCKET) {
- LOG(("ServerThread: Byebye..."));
- SetEvent(ServerThreadBye);
- bail_out(1);
- return;
- }
- OUTPUT("Connection by client");
- while(1) {
- if ((received=recv(AcceptSocket, (char *)&length, sizeof(length), 0))==SOCKET_ERROR ||
- received==0)
- {
- OUTPUT("Connection was closed by client. See ya soon! :)");
- break;
- }
- // Command mode
- if (length==0) {
- reply=0;
- if (recv(AcceptSocket, (char *)&command, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
-#ifdef USE_AUTHENTICATION
- if (command==AUTHENTICATE)
- if (password) reply=0x01; // Ok, go ahead
- else command=0;
-#endif
- if (command==CAPABILITIES)
- reply=password?USE_AUTHENTICATION:0;
-
- if (send(AcceptSocket, (char *)&reply, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
- continue;
- }
- // Normal Skype API-call
- if (!(buf=calloc(1, length+1))) {
- OUTPUT("Out of memory error while allocating buffer space.");
- break;
- }
- if (recv(AcceptSocket, buf, length, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- free(buf);
- break;
- }
- switch (command) {
-#ifdef USE_AUTHENTICATION
- case 0x01: // Compare hash
- if (password && !strcmp(password, buf)) Authenticated=TRUE;
- else Authenticated=FALSE;
- if (Authenticated) {
- OUTPUT("User authenticated succesfully.");
- reply=1;
- } else {
- OUTPUT("User authentication failed!! (Intruder?)");
- reply=0;
- }
- if (send(AcceptSocket, (char *)&reply, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
- command=0;
- break;
-#endif
- default:
-#ifdef USE_AUTHENTICATION
- if (password && !Authenticated) break;
-#endif
- SkypeSend(buf);
- }
- command=0;
- free(buf);
- }
- AcceptSocket=INVALID_SOCKET;
-#ifdef USE_AUTHENTICATION
- Authenticated=FALSE;
-#endif
- }
-}
-
-
-void WatchDogTimer(char *dummy) {
- LOG(("WatchDogTimer started"));
- WatchDogRunning=TRUE;
- while (1) {
- Sleep(PING_INTERVAL);
- if (!WatchDog) {
- OUTPUT("Ouch.. It seems that Skype has died unexpectedly. Trying to restart.");
- ConnectToSkypeAPI((void *)TRUE);
- }
- WatchDog=0;
- SkypeSend("PING");
- }
-}
-
-LONG APIENTRY WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
-{
- PCOPYDATASTRUCT CopyData;
- char *szSkypeMsg=NULL;
-
- switch (message)
- {
- case WM_COPYDATA:
-// LOG("WM_COPYDATA", "start");
- if(hSkypeWnd==(HWND)wParam) {
- CopyData=(PCOPYDATASTRUCT)lParam;
- szSkypeMsg=strdup(CopyData->lpData);
- ReplyMessage(1);
- if (!strcmp(szSkypeMsg, "PONG")) {
- WatchDog=1;
- break;
- } // Hide PING-PONG
- LOG(("< %s", szSkypeMsg));
- if (!strcmp(szSkypeMsg, "USERSTATUS LOGGEDOUT")) {
- OUTPUT("Skype shut down gracefully. I'll leave too, bye.. :)");
- bail_out(1);
- }
-#ifdef USE_AUTHENTICATION
- if (password && !Authenticated) break;
-#endif
- if (AcceptSocket!=INVALID_SOCKET) {
- unsigned int length=strlen(szSkypeMsg);
-
- if (send(AcceptSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR ||
- send(AcceptSocket, szSkypeMsg, length, 0)==SOCKET_ERROR)
- OUTPUT("Cannot send to client :(");
- }
- }
- break;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- default:
- if(message==ControlAPIAttach) {
- // Skype responds with Attach to the discover-message
- AttachStatus=lParam;
- if (AttachStatus==SKYPECONTROLAPI_ATTACH_SUCCESS)
- hSkypeWnd=(HWND)wParam; // Skype gave us the communication window handle
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_API_AVAILABLE)
- SetEvent(SkypeReady);
- break;
- }
- return (DefWindowProc(hWnd, message, wParam, lParam));
- }
-// LOG("WM_COPYDATA", "exit");
- if (szSkypeMsg) free(szSkypeMsg);
- return 1;
-}
-
-
-void TellError(DWORD err) {
- LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
- MessageBox( NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );
- LocalFree( lpMsgBuf );
- return;
-}
-
-int main(int argc, char *argv[]) {
- DWORD Buffsize;
- HKEY MyKey;
- BOOL SkypeInstalled=TRUE;
- MSG Message;
- WNDCLASS WndClass;
- SOCKADDR_IN service;
- WSADATA wsaData;
- int ExitCode=STILL_ACTIVE;
- unsigned short BindPort=1401;
- char BindIP[16]="0.0.0.0";
-
- printf("Skypeproxy V1.0, by leecher 2005 <leecher@dose.0wnz.at>\n\n");
-
- if (argc>1) {
- int i;
-
- if (!stricmp(argv[1], "-h") || !stricmp(argv[1], "--help") || !stricmp(argv[1], "/?")) {
- printf("Usage: %s [-i BindIP] [-p BindPort]", argv[0]);
-#ifdef USE_AUTHENTICATION
- printf(" [-k Password]");
-#endif
- printf("\n\n");
- return EXIT_SUCCESS;
- }
- for (i=0;i<argc;i++) {
- if (!stricmp(argv[i], "-i") && argc>i+1)
- strncpy(BindIP, argv[i+1], sizeof(BindIP));
- if (!stricmp(argv[i], "-p") && argc>i+1)
- if (!(BindPort=atoi(argv[i+1]))) {
- OUTPUT("ERROR: Cannot convert port to int. bye..");
- return EXIT_FAILURE;
- }
-#ifdef USE_AUTHENTICATION
- if (!stricmp(argv[i], "-k") && argc>i+1)
- password=strdup(argv[i+1]);
-#endif
- }
- }
-
- if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Skype\\Phone", 0, KEY_READ, &MyKey)!=ERROR_SUCCESS ||
- RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Skype\\Phone", 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
- SkypeInstalled=FALSE;
- Buffsize=sizeof(skype_path);
- if (SkypeInstalled==FALSE ||
- RegQueryValueEx(MyKey, "SkypePath", NULL, NULL, skype_path, &Buffsize)!=ERROR_SUCCESS) {
- OUTPUT("Skype was not found on this machine :(");
- RegCloseKey(MyKey);
- skype_path[0]=0;
- return EXIT_FAILURE;
- }
- RegCloseKey(MyKey);
-
- if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
- OUTPUT("Error at loading windows sockets.");
- return EXIT_FAILURE;
- }
-
- if ((ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- printf("* Error at creating socket(): Error %d", WSAGetLastError());
- return EXIT_FAILURE;
- }
-
- service.sin_family = AF_INET;
- service.sin_addr.s_addr = inet_addr(BindIP);
- service.sin_port = htons(BindPort);
-
- printf("* Binding to interface %s, Port %d..", BindIP, BindPort);
- if (bind( ListenSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR ||
- listen( ListenSocket, 1 ) == SOCKET_ERROR)
- {
- OUTPUT("Failed.");
- closesocket(ListenSocket);
- return EXIT_FAILURE;
- }
- printf("OK\n");
-
-
- if (!(ControlAPIAttach=RegisterWindowMessage("SkypeControlAPIAttach")) ||
- !(ControlAPIDiscover=RegisterWindowMessage("SkypeControlAPIDiscover"))) {
- OUTPUT("Cannot register Windows message.");
- closesocket(ListenSocket);
- return EXIT_FAILURE;
- }
-
- // Create window class
- hSkypeWnd=NULL;
- WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
- WndClass.lpfnWndProc = (WNDPROC)WndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = NULL;
- WndClass.hIcon = NULL;
- WndClass.hCursor = NULL;
- WndClass.hbrBackground = NULL;
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = "SkypeApiDispatchWindow";
- RegisterClass(&WndClass);
- // Do not check the retval of RegisterClass, because on non-unicode
- // win98 it will fail, as it is a stub that returns false() there
-
- // Create main window
- hWnd=CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,
- "SkypeApiDispatchWindow", "", WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, (HINSTANCE)WndClass.hInstance, 0);
-
- if (!hWnd) {
- OUTPUT("Cannot create window.");
- TellError(GetLastError());
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- return EXIT_FAILURE;
- }
- ShowWindow(hWnd, 0);
- UpdateWindow(hWnd);
-
- if (!(SkypeReady=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
- !(ServerThreadBye=CreateEvent(NULL, TRUE, FALSE, NULL))) {
- OUTPUT("Unable to create Mutex!");
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- return EXIT_FAILURE;
- }
-
- if (_beginthread(ConnectToSkypeAPI, 0, (void *)FALSE)==-1 ||
- _beginthread(ServerThread, 0, NULL)==-1) {
- OUTPUT("Cannot create thread. Bye..");
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- CloseHandle(SkypeReady);
- return EXIT_FAILURE;
- }
-
- signal(SIGINT, &bail_out);
- LOG(("Startup: Messagepump started.\nPress CTRL+C to terminate\n"));
-
- while (GetMessage(&Message, hWnd, 0, 0))
- {
- TranslateMessage(&Message);
- DispatchMessage(&Message);
- }
-
- LOG(("Shutdown: Messagepump stopped"));
-
- if (password) free(password);
- if (AcceptSocket != INVALID_SOCKET) closesocket(AcceptSocket);
- closesocket(ListenSocket);
- LOG(("Shutdown: Waiting for serverthread to quit..."));
- if (WaitForSingleObject(ServerThreadBye, 3000)==WAIT_TIMEOUT)
- {OUTPUT("Serverthread didn't terminate correctly, shutting down anyway...");}
- else
- {LOG(("ServerThread terminated"));}
- CloseHandle(WndClass.hInstance);
- CloseHandle(SkypeReady);
- return exitcode;
-} \ No newline at end of file
diff --git a/protocols/Skype/skypeproxy/skypeproxy.h b/protocols/Skype/skypeproxy/skypeproxy.h
deleted file mode 100644
index 8ce122990b..0000000000
--- a/protocols/Skype/skypeproxy/skypeproxy.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*** Skype API ***/
-//Messages
-#define SKYPECONTROLAPI_ATTACH_SUCCESS 0
-#define SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION 1
-#define SKYPECONTROLAPI_ATTACH_REFUSED 2
-#define SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE 3
-#define SKYPECONTROLAPI_ATTACH_API_AVAILABLE 0x8001
-
-// Errors
-#define MISC_ERROR 1
-#define USER_NOT_FOUND 2
-#define USER_NOT_ONLINE 3
-#define USER_BLOCKED 4
-#define TYPE_UNSUPPORTED 5
-#define SENDER_NOT_FRIEND 6
-#define SENDER_NOT_AUTHORIZED 7
-
-
-/*** Debugging macros ***/
-#define OUTPUT(a) printf("* %s\n", a);
-#define LOG(a, b) printf("- %s: %s\n", a, b);
-#define LOGL(a, b) printf("- %s: %d\n", a, b);
-
-/*** Program settings ***/
-#define PING_INTERVAL 10000 // Ping every 10000 msec to see if Skype is still available
-#define USE_AUTHENTICATION 0x01 // Program supports authentication -> Comment to disable!
-
-/*** Commands ***/
-#define AUTHENTICATE 0x01
-#define CAPABILITIES 0x02
-
-/*** Sockets ***/
-#pragma comment(lib, "ws2_32")
-
-/*** Prototypes ***/
-void WatchDogTimer(char *); \ No newline at end of file
diff --git a/protocols/Skype/skypesvc.c b/protocols/Skype/skypesvc.c
deleted file mode 100644
index c6d02e6d3a..0000000000
--- a/protocols/Skype/skypesvc.c
+++ /dev/null
@@ -1,188 +0,0 @@
-#define __SKYPESVC_C__
-#include "skype.h"
-#include "skypesvc.h"
-#include "skypeapi.h"
-#include "skypeopt.h"
-#include "contacts.h"
-#include "m_toptoolbar.h"
-
-// Exports
-SKYPE_SVCNAMES g_svcNames;
-
-//From skype.c
-extern char protocol, g_szProtoName[];
-extern HINSTANCE hInst;
-extern DWORD mirandaVersion;
-static HANDLE m_hPrebuildCMenu=NULL, m_hStatusHookContact=NULL, m_hContactDeleted=NULL,
- m_hHookModulesLoaded=NULL, m_hHookOkToExit=NULL, m_hOptHook=NULL, m_hHookMirandaExit=NULL,
- m_hTTBModuleLoadedHook = NULL, m_hHookOnUserInfoInit = NULL;
-
-void CreateProtoService(const char* szService, MIRANDASERVICE svc)
-{
- char str[MAXMODULELABELLENGTH];
- _snprintf(str, sizeof(str), "%s%s", SKYPE_PROTONAME, szService);
- CreateServiceFunction(str, svc);
-}
-
-#define CreateServiceName(srvce) _snprintf (g_svcNames.##srvce, sizeof(g_svcNames.##srvce), "%s/"#srvce, SKYPE_PROTONAME);
-
-void CreateServices(void)
-{
- CreateServiceName(ChatNew);
- CreateServiceName(SetAvatar);
- CreateServiceName(SendFile);
- CreateServiceName(HoldCall);
- CreateServiceName(AnswerCall);
- CreateServiceName(ImportHistory);
- CreateServiceName(AddUser);
- CreateServiceName(SkypeOutCallUser);
- CreateServiceName(CallHangupUser);
- CreateServiceName(CallUser);
-
- CreateServiceFunction(SKYPE_CALL, SkypeCall);
- CreateServiceFunction(SKYPE_CALLHANGUP, SkypeCallHangup);
- CreateServiceFunction(SKYPEOUT_CALL, SkypeOutCall);
- CreateServiceFunction(SKYPE_HOLDCALL, SkypeHoldCall);
- CreateServiceFunction(SKYPE_ADDUSER, SkypeAdduserDlg);
- CreateServiceFunction(SKYPE_IMPORTHISTORY, ImportHistory);
- CreateServiceFunction(SKYPE_ANSWERCALL, SkypeAnswerCall);
- CreateServiceFunction(SKYPE_SENDFILE, SkypeSendFile);
- CreateServiceFunction(SKYPE_SETAVATAR, SkypeSetAvatar);
-
- CreateProtoService(PS_GETCAPS, SkypeGetCaps);
- CreateProtoService(PS_GETNAME, SkypeGetName);
- CreateProtoService(PS_LOADICON, SkypeLoadIcon);
- CreateProtoService(PS_SETSTATUS, SkypeSetStatus);
- CreateProtoService(PS_GETSTATUS, SkypeGetStatus);
- CreateProtoService(PS_ADDTOLIST, SkypeAddToList);
- CreateProtoService(PS_ADDTOLISTBYEVENT, SkypeAddToListByEvent);
- CreateProtoService(PS_BASICSEARCH, SkypeBasicSearch);
-
- CreateProtoService(PSS_GETINFO, SkypeGetInfo);
- CreateProtoService(PSS_MESSAGE, SkypeSendMessage);
- CreateProtoService(PSR_MESSAGE, SkypeRecvMessage);
- CreateProtoService(PSS_USERISTYPING, SkypeUserIsTyping);
- CreateProtoService(PSS_AUTHREQUEST, SkypeSendAuthRequest);
- CreateProtoService(PSR_AUTH, SkypeRecvAuth);
- CreateProtoService(PS_AUTHALLOW, SkypeAuthAllow);
- CreateProtoService(PS_AUTHDENY, SkypeAuthDeny);
-
- CreateProtoService(PS_GETAVATARINFO, SkypeGetAvatarInfo);
- CreateProtoService(PS_GETAVATARCAPS, SkypeGetAvatarCaps);
- CreateProtoService(PS_GETMYAVATAR, SkypeGetAvatar);
- CreateProtoService(PS_SETMYAVATAR, SkypeSetAvatar);
-
- CreateProtoService(PS_SETAWAYMSG, SkypeSetAwayMessage);
- CreateProtoService(PS_SETAWAYMSGW, SkypeSetAwayMessageW);
- CreateProtoService(PSS_GETAWAYMSG, SkypeGetAwayMessage);
- CreateProtoService(PS_SETMYNICKNAME, SkypeSetNick);
-
- CreateProtoService(PSS_SKYPEAPIMSG, SkypeReceivedAPIMessage);
- CreateProtoService(SKYPE_REGPROXY, SkypeRegisterProxy);
-}
-
-void HookEvents(void)
-{
- m_hPrebuildCMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
-
- //HookEvent(ME_CLIST_DOUBLECLICKED, ClistDblClick);
- m_hOptHook = HookEvent(ME_OPT_INITIALISE, RegisterOptions);
- m_hStatusHookContact = HookEvent(ME_DB_CONTACT_ADDED,HookContactAdded);
- m_hContactDeleted = HookEvent( ME_DB_CONTACT_DELETED, HookContactDeleted );
- m_hHookModulesLoaded = HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- m_hHookMirandaExit = HookEvent(ME_SYSTEM_OKTOEXIT, MirandaExit);
- m_hHookOkToExit = HookEvent(ME_SYSTEM_PRESHUTDOWN, OkToExit);
-}
-
-void HookEventsLoaded(void)
-{
- // We cannot check for the TTB-service before this event gets fired... :-/
- m_hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButton);
- m_hHookOnUserInfoInit = HookEvent( ME_USERINFO_INITIALISE, OnDetailsInit );
-}
-
-void UnhookEvents(void)
-{
- UnhookEvent(m_hOptHook);
- UnhookEvent(m_hTTBModuleLoadedHook);
- UnhookEvent(m_hHookOnUserInfoInit);
- UnhookEvent(m_hStatusHookContact);
- UnhookEvent(m_hContactDeleted);
- UnhookEvent(m_hHookModulesLoaded);
- UnhookEvent(m_hPrebuildCMenu);
- UnhookEvent(m_hHookOkToExit);
- UnhookEvent(m_hHookMirandaExit);
- //UnhookEvent(ClistDblClick);
-}
-
-INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM lParam) {
- int ret = 0;
-
- UNREFERENCED_PARAMETER(lParam);
-
- switch (wParam) {
- case PFLAGNUM_1:
- ret = PF1_BASICSEARCH | PF1_IM | PF1_MODEMSG; // | PF1_AUTHREQ;
- if (protocol>=5) ret |= PF1_ADDSEARCHRES;
- break;
-
- case PFLAGNUM_2:
- ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_INVISIBLE | PF2_HEAVYDND;
-#ifdef MAPDND
- ret |= PF2_LIGHTDND | PF2_HEAVYDND;
-#endif
- if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0))
- ret |= PF2_LONGAWAY | PF2_FREECHAT;
- break;
-
- case PFLAGNUM_3:
- ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE | PF2_IDLE;
- break;
-
- case PFLAGNUM_4:
- ret = PF4_FORCEAUTH | PF4_FORCEADDED | PF4_AVATARS | PF4_SUPPORTTYPING /* Not really, but libgaim compat. */;
- if (mirandaVersion >= 0x070000) ret |= PF4_IMSENDUTF;
- break;
- case PFLAG_UNIQUEIDTEXT:
- ret = (INT_PTR) "NAME";
- break;
- case PFLAG_UNIQUEIDSETTING:
- ret = (INT_PTR) SKYPE_NAME;
- break;
- }
- return ret;
-
-}
-
-INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam)
-{
- if (lParam)
- {
- strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
- return 0; // Success
- }
- return 1; // Failure
-}
-
-
-INT_PTR SkypeLoadIcon(WPARAM wParam,LPARAM lParam)
-{
- UINT id;
-
- UNREFERENCED_PARAMETER(lParam);
-
- switch(wParam&0xFFFF) {
- case PLI_PROTOCOL: id=IDI_SKYPE; 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);
-}
-
-INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam)
-{ DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv)){
- lstrcpynA((char*)wParam, dbv.pszVal, (int)lParam);
- DBFreeVariant(&dbv);
- }
- return 0;
-}
diff --git a/protocols/Skype/skypesvc.h b/protocols/Skype/skypesvc.h
deleted file mode 100644
index 74c8cd37bf..0000000000
--- a/protocols/Skype/skypesvc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include "resource.h"
-
-void CreateProtoService(const char* szService, MIRANDASERVICE svc);
-void HookEvents(void);
-void HookEventsLoaded(void);
-void UnhookEvents(void);
-void CreateServices(void);
-INT_PTR SkypeLoadIcon(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM lParam);
-/* SkypeGetAvatar
- *
- * Purpose: Return the avatar file name
- * Params : wParam=0
- * lParam=0
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam); \ No newline at end of file
diff --git a/protocols/Skype/utf8.c b/protocols/Skype/utf8.c
deleted file mode 100644
index 8ae746e871..0000000000
--- a/protocols/Skype/utf8.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Harris <peter.harris@hummingbird.com>
- * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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
- */
-
-/*
- * Convert a string between UTF-8 and the locale's charset.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "utf8.h"
-
-#ifdef _WIN32
-
- /* Thanks to Peter Harris <peter.harris@hummingbird.com> for this win32
- * code.
- */
-
-#include <stdio.h>
-#include <windows.h>
-
-unsigned char *make_utf8_string(const wchar_t *unicode)
-{
- int size = 0, index = 0, out_index = 0;
- unsigned char *out;
- unsigned short c;
-
- /* first calculate the size of the target string */
- c = unicode[index++];
- while(c) {
- if(c < 0x0080) {
- size += 1;
- } else if(c < 0x0800) {
- size += 2;
- } else {
- size += 3;
- }
- c = unicode[index++];
- }
-
- out = (unsigned char *) malloc(size + 1);
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = unicode[index++];
- while(c)
- {
- if(c < 0x080) {
- out[out_index++] = (unsigned char)c;
- } else if(c < 0x800) {
- #pragma warning (suppress: 4244) // conversion from 'int' to 'unsigned char', possible loss of data
- out[out_index++] = 0xc0 | (c >> 6);
- out[out_index++] = 0x80 | (c & 0x3f);
- } else {
- out[out_index++] = 0xe0 | (c >> 12);
- out[out_index++] = 0x80 | ((c >> 6) & 0x3f);
- out[out_index++] = 0x80 | (c & 0x3f);
- }
- c = unicode[index++];
- }
- out[out_index] = 0x00;
-
- return out;
-}
-
-wchar_t *make_unicode_string(const unsigned char *utf8)
-{
- int size = 0, index = 0, out_index = 0;
- wchar_t *out;
- unsigned char c;
-
- /* first calculate the size of the target string */
- c = utf8[index++];
- while(c) {
- if((c & 0x80) == 0) {
- index += 0;
- } else if((c & 0xe0) == 0xe0) {
- index += 2;
- } else {
- index += 1;
- }
- size += 1;
- c = utf8[index++];
- }
-
- out = (wchar_t *) malloc((size + 1) * sizeof(wchar_t));
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = utf8[index++];
- while(c)
- {
- if((c & 0x80) == 0) {
- out[out_index++] = c;
- } else if((c & 0xe0) == 0xe0) {
- out[out_index] = (c & 0x1F) << 12;
- c = utf8[index++];
- out[out_index] |= (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- } else {
- out[out_index] = (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- }
- c = utf8[index++];
- }
- out[out_index] = 0;
-
- return out;
-}
-
-int utf8_encode(const char *from, char **to)
-{
- wchar_t *unicode;
- int wchars, err;
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, strlen(from), NULL, 0);
-
- if(wchars == 0)
- {
-// fprintf(stderr, "Unicode translation error %d\n"), GetLastError();
- return -1;
- }
-
- unicode = (wchar_t *) calloc(wchars + 1, sizeof(unsigned short));
- if(unicode == NULL)
- {
-// fprintf(stderr, "Out of memory processing string to UTF8\n");
- return -1;
- }
-
- err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, strlen(from), unicode, wchars);
- if(err != wchars)
- {
- free(unicode);
-// fprintf(stderr, "Unicode translation error %d\n"), GetLastError();
- return -1;
- }
-
- /* On NT-based windows systems, we could use WideCharToMultiByte(), but
- * MS doesn't actually have a consistent API across win32.
- */
- *to = (char *) make_utf8_string(unicode);
-
- free(unicode);
- return 0;
-}
-
-int utf8_decode(const char *from, char **to)
-{
- wchar_t *unicode;
- int chars, err;
-// LPCPINFO lpCPInfo;
-
- /* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but
- * MS doesn't actually have a consistent API across win32.
- */
- unicode = make_unicode_string( (const unsigned char *)from);
- if(unicode == NULL)
- {
- fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n");
- return -1;
- }
-
- //if(GetCPInfo(CP_ACP,lpCPInfo))
- {
-
- chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
- }
- /*else
- {
- chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
- }*/
-
- if(chars == 0)
- {
- fprintf(stderr, "Unicode translation error %ld\n", GetLastError());
- free(unicode);
- return -1;
- }
-
- *to = (char *) calloc(chars + 1, sizeof(unsigned char));
- if(*to == NULL)
- {
- fprintf(stderr, "Out of memory processing string to local charset\n");
- free(unicode);
- return -1;
- }
-
- //err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, -1, *to, chars, NULL, NULL);
- err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, *to, chars, NULL, NULL);
- if(err != chars)
- {
- fprintf(stderr, "Unicode translation error %ld\n", GetLastError());
- free(unicode);
- free(*to);
- *to = NULL;
- return -1;
- }
-
- free(unicode);
- return 0;
-}
-
-#ifndef _UNICODE
-char *make_tchar_string(const unsigned char *utf8) {
- char *ret;
- if (utf8_decode((const char*)utf8, &ret)==-1) return NULL;
- return ret;
-}
-#endif
-
-#else /* End win32. Rest is for real operating systems */
-
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-int iconvert(const char *fromcode, const char *tocode,
- const char *from, size_t fromlen,
- char **to, size_t *tolen);
-
-static char *current_charset = "BIG-5"; /* means "US-ASCII" */
-
-void convert_set_charset(const char *charset)
-{
-
- if (!charset)
- charset = getenv("CHARSET");
-
-#ifdef HAVE_LANGINFO_CODESET
- if (!charset)
- charset = nl_langinfo(CODESET);
-#endif
-
- free(current_charset);
- current_charset = 0;
- if (charset && *charset)
- current_charset = _strdup(charset);
-}
-
-static int convert_buffer(const char *fromcode, const char *tocode,
- const char *from, size_t fromlen,
- char **to, size_t *tolen)
-{
- int ret = -1;
-
-#ifdef HAVE_ICONV
- ret = iconvert(fromcode, tocode, from, fromlen, to, tolen);
- if (ret != -1)
- return ret;
-#endif
-
-#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */
- ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen);
- if (ret != -1)
- return ret;
-#endif
-
- return ret;
-}
-
-static int convert_string(const char *fromcode, const char *tocode,
- const char *from, char **to, char replace)
-{
- int ret;
- size_t fromlen;
- char *s;
-
- fromlen = lstrlen(from);
- ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0);
- if (ret == -2)
- return -1;
- if (ret != -1)
- return ret;
-
- s = malloc(fromlen + 1);
- if (!s)
- return -1;
- lstrcpy(s, from);
- *to = s;
- for (; *s; s++)
- if (*s & ~0x7f)
- *s = replace;
- return 3;
-}
-
-int utf8_encode(const char *from, char **to)
-{
- char *charset;
-
- if (!current_charset)
- convert_set_charset(0);
- charset = current_charset ? current_charset : "US-ASCII";
- return convert_string(charset, "UTF-8", from, to, '#');
-}
-
-int utf8_decode(const char *from, char **to)
-{
- char *charset;
-
- if(*from == 0) {
- *to = malloc(1);
- **to = 0;
- return 1;
- }
-
- if (!current_charset)
- convert_set_charset(0);
- charset = current_charset ? current_charset : "US-ASCII";
- return convert_string("UTF-8", charset, from, to, '?');
-}
-
-#endif
diff --git a/protocols/Skype/utf8.h b/protocols/Skype/utf8.h
deleted file mode 100644
index 70c533deca..0000000000
--- a/protocols/Skype/utf8.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Convert a string between UTF-8 and the locale's charset.
- * Invalid bytes are replaced by '#', and characters that are
- * not available in the target encoding are replaced by '?'.
- *
- * If the locale's charset is not set explicitly then it is
- * obtained using nl_langinfo(CODESET), where available, the
- * environment variable CHARSET, or assumed to be US-ASCII.
- *
- * Return value of conversion functions:
- *
- * -1 : memory allocation failed
- * 0 : data was converted exactly
- * 1 : valid data was converted approximately (using '?')
- * 2 : input was invalid (but still converted, using '#')
- * 3 : unknown encoding (but still converted, using '?')
- */
-
-#ifndef __UTF8_H
-#define __UTF8_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void convert_set_charset(const char *charset);
-
-int utf8_encode(const char *from, char **to);
-int utf8_decode(const char *from, char **to);
-wchar_t *make_unicode_string(const unsigned char *utf8);
-unsigned char *make_utf8_string(const wchar_t *unicode);
-#ifdef _UNICODE
-#define make_tchar_string make_unicode_string
-// Helpers for strings that only can contain 7bit chars to not make unneccessary memory allocation
-#define make_nonutf_tchar_string(x) make_tchar_string(x)
-#define free_nonutf_tchar_string(x) if(x) free(x);
-#else
-char *make_tchar_string(const unsigned char *utf8);
-#define make_nonutf_tchar_string(x) (char*)x
-#define free_nonutf_tchar_string(x)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UTF8_H */
diff --git a/protocols/Skype/util.c b/protocols/Skype/util.c
deleted file mode 100644
index ce5ad9c756..0000000000
--- a/protocols/Skype/util.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdlib.h>
-
-char * __cdecl strtok_r (
- char * string,
- const char * control,
- char **nextoken
- )
-{
- unsigned char *str;
- const unsigned char *ctrl = (const unsigned char*)control;
-
- unsigned char map[32];
- int count;
-
- /* Clear control map */
- for (count = 0; count < 32; count++)
- map[count] = 0;
-
- /* Set bits in delimiter table */
- do {
- map[*ctrl >> 3] |= (1 << (*ctrl & 7));
- } while (*ctrl++);
-
- /* Initialize str. If string is NULL, set str to the saved
- * pointer (i.e., continue breaking tokens out of the string
- * from the last strtok call) */
- if (string)
- str = (unsigned char*)string;
- else
- str = (unsigned char*)(*nextoken);
-
- /* Find beginning of token (skip over leading delimiters). Note that
- * there is no token iff this loop sets str to point to the terminal
- * null (*str == '\0') */
- while ( (map[*str >> 3] & (1 << (*str & 7))) && *str )
- str++;
-
- string = (char*)str;
-
- /* Find the end of the token. If it is not the end of the string,
- * put a null there. */
- for ( ; *str ; str++ )
- if ( map[*str >> 3] & (1 << (*str & 7)) ) {
- *str++ = '\0';
- break;
- }
-
- /* Update nextoken (or the corresponding field in the per-thread data
- * structure */
- *nextoken = (char*)str;
-
- /* Determine if a token has been found. */
- if ( string == (char*)str )
- return NULL;
- else
- return string;
-}
diff --git a/protocols/Skype/util.h b/protocols/Skype/util.h
deleted file mode 100644
index 181f5d1878..0000000000
--- a/protocols/Skype/util.h
+++ /dev/null
@@ -1,7 +0,0 @@
-char * __cdecl strtok_r (
- char * string,
- const char * control,
- char **nextoken
- );
-
-void TranslateMirandaRelativePathToAbsolute(LPCSTR cszPath, LPSTR szAbsolutePath, BOOL fQuoteSpaces);
diff --git a/protocols/Skype/voiceservice.c b/protocols/Skype/voiceservice.c
deleted file mode 100644
index b13ac097c1..0000000000
--- a/protocols/Skype/voiceservice.c
+++ /dev/null
@@ -1,156 +0,0 @@
-#include "skype.h"
-#include "skypeapi.h"
-#include "skypesvc.h"
-#include "voiceservice.h"
-#include "sdk/m_voiceservice.h"
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include "../../include/m_utils.h"
-#pragma warning (pop)
-
-HANDLE hVoiceNotify = NULL;
-BOOL has_voice_service = FALSE;
-
-extern char g_szProtoName[];
-
-
-BOOL HasVoiceService()
-{
- return has_voice_service;
-}
-
-void NofifyVoiceService(HANDLE hContact, char *callId, int state)
-{
- VOICE_CALL vc = {0};
- vc.cbSize = sizeof(vc);
- vc.szModule = SKYPE_PROTONAME;
- vc.id = callId;
- vc.flags = VOICE_CALL_CONTACT;
- vc.state = state;
- vc.hContact = hContact;
- NotifyEventHooks(hVoiceNotify, (WPARAM) &vc, 0);
-}
-
-static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam)
-{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- return VOICE_SUPPORTED | VOICE_CALL_CONTACT | VOICE_CAN_HOLD;
-}
-
-static HANDLE FindContactByCallId(char *callId)
-{
- HANDLE hContact;
- int iCmpRes;
- for (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- hContact != NULL;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- {
- char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
-
- DBVARIANT dbv;
- if (szProto != NULL
- && !strcmp(szProto, SKYPE_PROTONAME)
- && DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0
- && !DBGetContactSettingString(hContact, SKYPE_PROTONAME, "CallId", &dbv))
- {
- iCmpRes = strcmp(callId, dbv.pszVal);
- DBFreeVariant(&dbv);
- if (iCmpRes == 0) return hContact;
- }
- }
-
- return NULL;
-}
-
-static INT_PTR VoiceCall(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
-
- SkypeSend("CALL %s", dbv.pszVal);
- DBFreeVariant (&dbv);
-
- return 0;
-}
-
-static INT_PTR VoiceAnswer(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS INPROGRESS", callId);
- testfor("ERROR", 200);
-
- return 0;
-}
-
-static INT_PTR VoiceDrop(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS FINISHED", callId);
-
- return 0;
-}
-
-static INT_PTR VoiceHold(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS ONHOLD", callId);
-
- return 0;
-}
-
-void VoiceServiceInit()
-{
- // leecher, 26.03.2011: Did this ever work in the old versions??
- char szEvent[MAXMODULELABELLENGTH];
-
- _snprintf (szEvent, sizeof(szEvent), "%s%s", SKYPE_PROTONAME, PE_VOICE_CALL_STATE);
- hVoiceNotify = CreateHookableEvent( szEvent );
- CreateProtoService( PS_VOICE_GETINFO, VoiceGetInfo );
- CreateProtoService( PS_VOICE_CALL, VoiceCall );
- CreateProtoService( PS_VOICE_ANSWERCALL, VoiceAnswer );
- CreateProtoService( PS_VOICE_DROPCALL, VoiceDrop );
- CreateProtoService( PS_VOICE_HOLDCALL, VoiceHold );
-}
-
-void VoiceServiceExit()
-{
- DestroyHookableEvent(hVoiceNotify);
-}
-
-void VoiceServiceModulesLoaded()
-{
- has_voice_service = ServiceExists(MS_VOICESERVICE_REGISTER);
-} \ No newline at end of file
diff --git a/protocols/Skype/voiceservice.h b/protocols/Skype/voiceservice.h
deleted file mode 100644
index bbb333ec4b..0000000000
--- a/protocols/Skype/voiceservice.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _VOICESERVICE_H_
-#define _VOICESERVICE_H_
-
-#pragma warning (push)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-#include "sdk/m_voice.h"
-#pragma warning (pop)
-
-BOOL HasVoiceService();
-void VoiceServiceInit();
-void VoiceServiceExit();
-void VoiceServiceModulesLoaded();
-void NofifyVoiceService(HANDLE hContact, char *callId, int state) ;
-
-
-
-#endif // _VOICESERVICE_H_
-
diff --git a/protocols/Tlen/codec/gsm.h b/protocols/Tlen/codec/gsm.h
deleted file mode 100644
index fba1bcb1ac..0000000000
--- a/protocols/Tlen/codec/gsm.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-#include <windows.h>
-
-#define P_MAX 8 /* order p of LPC analysis, typically 8..14 */
-
-typedef struct {
- int LARpp[2][8]; /* LAR coefficients for previous and current frame */
- int j; /* current frame index in LARpp[j][] */
- int qLARs[8]; /* quantized LARs for current frame */
- int u[8]; /* used by short term analysis filter */
- int v[9]; /* used by short term synthesis filter */
- int subframe; /* subframe index (0..3)*/
- short dp0[ 280 ]; /* previous short-term filter output/prediction, used by long term analysis*/
- int e[160]; /* errors (residuals) */
- int nrp; /* long term synthesis */
- int Nc[4], bc[4]; /* long-term lag and gain for current frame */
- int Mc[4]; /* RPE grid index (0..3) */
- int xMaxc[4]; /* RPE maximum error quantized and encoded (mantissa + exp) */
- int xMc[52]; /* quantized residuals (errors) 4 * 13 */
-
- int z1; /* preprocessing.c, Offset_com. */
- int z2; /* Offset_com. */
- int mp; /* Preemphasis */
- int msr; /* decoder.c, Postprocessing */
-
- unsigned char gsmFrame[33];
-}gsm_state;
-
-extern gsm_state * gsm_create() ;
-extern void gsm_release(gsm_state *ptr);
-extern void gsm_encode(gsm_state *state, short *in);
-extern void gsm_decode(gsm_state *state, short *out);
-
-extern void gsm_preprocessing( gsm_state *state, short *in, short *out);
-extern void shortTermAnalysis(gsm_state *state, short *in);
-extern void longTermAnalysis(gsm_state *state, short *in);
-extern void encodeRPE(gsm_state *state);
-extern void decodeRPE(gsm_state *state);
-extern void longTermSynthesis(gsm_state *state);
-extern void shortTermSynthesis(gsm_state *state, short *in, short *out);
-extern void gsm_postprocessing( gsm_state *state, short *in, short *out);
diff --git a/protocols/Tlen/codec/gsm_codec.c b/protocols/Tlen/codec/gsm_codec.c
deleted file mode 100644
index 1d0a08a41e..0000000000
--- a/protocols/Tlen/codec/gsm_codec.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-
-#include "gsm.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define GSM_MAGIC 0xD
-
-gsm_state * gsm_create()
-{
- gsm_state * state = (gsm_state *)malloc(sizeof(gsm_state));
- memset(state, 0, sizeof(gsm_state));
- state->nrp = 40;
- return state;
-}
-
-void gsm_release(gsm_state *ptr)
-{
- free(ptr);
-}
-
-void gsm_encode(gsm_state *state, short *in)
-{ int i, j;
- unsigned char *c = state->gsmFrame;
- short temp_in[160];
-
- gsm_preprocessing(state, in, temp_in);
- shortTermAnalysis(state, temp_in);
- for (i = 0; i < 4; i++) {
- state->subframe = i;
- longTermAnalysis(state, temp_in + 40 * i);
- encodeRPE(state);
- for (j = 0; j < 40; j++) {
- int ii = (int) state->dp0[120 + i * 40 + j] + state->e[i * 40 + j];
- if (ii<-32768) ii = -32768;
- else if (ii>32767) ii=32767;
- state->dp0[120 + i * 40 + j] = ii;
- }
- }
- memcpy(state->dp0, state->dp0 + 160, 120 * sizeof(short));
- state->j ^= 1;
- *c++ = ((GSM_MAGIC & 0xF) << 4)
- | ((state->qLARs[0] >> 2) & 0xF);
- *c++ = ((state->qLARs[0] & 0x3) << 6)
- | (state->qLARs[1] & 0x3F);
- *c++ = ((state->qLARs[2] & 0x1F) << 3)
- | ((state->qLARs[3] >> 2) & 0x7);
- *c++ = ((state->qLARs[3] & 0x3) << 6)
- | ((state->qLARs[4] & 0xF) << 2)
- | ((state->qLARs[5] >> 2) & 0x3);
- *c++ = ((state->qLARs[5] & 0x3) << 6)
- | ((state->qLARs[6] & 0x7) << 3)
- | (state->qLARs[7] & 0x7);
- *c++ = ((state->Nc[0] & 0x7F) << 1)
- | ((state->bc[0] >> 1) & 0x1);
- *c++ = ((state->bc[0] & 0x1) << 7)
- | ((state->Mc[0] & 0x3) << 5)
- | ((state->xMaxc[0] >> 1) & 0x1F);
- *c++ = ((state->xMaxc[0] & 0x1) << 7)
- | ((state->xMc[0] & 0x7) << 4)
- | ((state->xMc[1] & 0x7) << 1)
- | ((state->xMc[2] >> 2) & 0x1);
- *c++ = ((state->xMc[2] & 0x3) << 6)
- | ((state->xMc[3] & 0x7) << 3)
- | (state->xMc[4] & 0x7);
- *c++ = ((state->xMc[5] & 0x7) << 5)
- | ((state->xMc[6] & 0x7) << 2)
- | ((state->xMc[7] >> 1) & 0x3);
- *c++ = ((state->xMc[7] & 0x1) << 7)
- | ((state->xMc[8] & 0x7) << 4)
- | ((state->xMc[9] & 0x7) << 1)
- | ((state->xMc[10] >> 2) & 0x1);
- *c++ = ((state->xMc[10] & 0x3) << 6)
- | ((state->xMc[11] & 0x7) << 3)
- | (state->xMc[12] & 0x7);
- *c++ = ((state->Nc[1] & 0x7F) << 1)
- | ((state->bc[1] >> 1) & 0x1);
- *c++ = ((state->bc[1] & 0x1) << 7)
- | ((state->Mc[1] & 0x3) << 5)
- | ((state->xMaxc[1] >> 1) & 0x1F);
- *c++ = ((state->xMaxc[1] & 0x1) << 7)
- | ((state->xMc[13] & 0x7) << 4)
- | ((state->xMc[14] & 0x7) << 1)
- | ((state->xMc[15] >> 2) & 0x1);
- *c++ = ((state->xMc[15] & 0x3) << 6)
- | ((state->xMc[16] & 0x7) << 3)
- | (state->xMc[17] & 0x7);
- *c++ = ((state->xMc[18] & 0x7) << 5)
- | ((state->xMc[19] & 0x7) << 2)
- | ((state->xMc[20] >> 1) & 0x3);
- *c++ = ((state->xMc[20] & 0x1) << 7)
- | ((state->xMc[21] & 0x7) << 4)
- | ((state->xMc[22] & 0x7) << 1)
- | ((state->xMc[23] >> 2) & 0x1);
- *c++ = ((state->xMc[23] & 0x3) << 6)
- | ((state->xMc[24] & 0x7) << 3)
- | (state->xMc[25] & 0x7);
- *c++ = ((state->Nc[2] & 0x7F) << 1)
- | ((state->bc[2] >> 1) & 0x1);
- *c++ = ((state->bc[2] & 0x1) << 7)
- | ((state->Mc[2] & 0x3) << 5)
- | ((state->xMaxc[2] >> 1) & 0x1F);
- *c++ = ((state->xMaxc[2] & 0x1) << 7)
- | ((state->xMc[26] & 0x7) << 4)
- | ((state->xMc[27] & 0x7) << 1)
- | ((state->xMc[28] >> 2) & 0x1);
- *c++ = ((state->xMc[28] & 0x3) << 6)
- | ((state->xMc[29] & 0x7) << 3)
- | (state->xMc[30] & 0x7);
- *c++ = ((state->xMc[31] & 0x7) << 5)
- | ((state->xMc[32] & 0x7) << 2)
- | ((state->xMc[33] >> 1) & 0x3);
- *c++ = ((state->xMc[33] & 0x1) << 7)
- | ((state->xMc[34] & 0x7) << 4)
- | ((state->xMc[35] & 0x7) << 1)
- | ((state->xMc[36] >> 2) & 0x1);
- *c++ = ((state->xMc[36] & 0x3) << 6)
- | ((state->xMc[37] & 0x7) << 3)
- | (state->xMc[38] & 0x7);
- *c++ = ((state->Nc[3] & 0x7F) << 1)
- | ((state->bc[3] >> 1) & 0x1);
- *c++ = ((state->bc[3] & 0x1) << 7)
- | ((state->Mc[3] & 0x3) << 5)
- | ((state->xMaxc[3] >> 1) & 0x1F);
- *c++ = ((state->xMaxc[3] & 0x1) << 7)
- | ((state->xMc[39] & 0x7) << 4)
- | ((state->xMc[40] & 0x7) << 1)
- | ((state->xMc[41] >> 2) & 0x1);
- *c++ = ((state->xMc[41] & 0x3) << 6)
- | ((state->xMc[42] & 0x7) << 3)
- | (state->xMc[43] & 0x7);
- *c++ = ((state->xMc[44] & 0x7) << 5)
- | ((state->xMc[45] & 0x7) << 2)
- | ((state->xMc[46] >> 1) & 0x3);
- *c++ = ((state->xMc[46] & 0x1) << 7)
- | ((state->xMc[47] & 0x7) << 4)
- | ((state->xMc[48] & 0x7) << 1)
- | ((state->xMc[49] >> 2) & 0x1);
- *c++ = ((state->xMc[49] & 0x3) << 6)
- | ((state->xMc[50] & 0x7) << 3)
- | (state->xMc[51] & 0x7);
-}
-
-void gsm_decode(gsm_state *state, short *out)
-{
- int i;
- unsigned char *c = state->gsmFrame;
-
- if (((*c >> 4) & 0x0F) != GSM_MAGIC) return ;
- state->qLARs[0] = (*c++ & 0xF) << 2;
- state->qLARs[0] |= (*c >> 6) & 0x3;
- state->qLARs[1] = *c++ & 0x3F;
- state->qLARs[2] = (*c >> 3) & 0x1F;
- state->qLARs[3] = (*c++ & 0x7) << 2;
- state->qLARs[3] |= (*c >> 6) & 0x3;
- state->qLARs[4] = (*c >> 2) & 0xF;
- state->qLARs[5] = (*c++ & 0x3) << 2;
- state->qLARs[5] |= (*c >> 6) & 0x3;
- state->qLARs[6] = (*c >> 3) & 0x7;
- state->qLARs[7] = *c++ & 0x7;
- state->Nc[0] = (*c >> 1) & 0x7F;
- state->bc[0] = (*c++ & 0x1) << 1;
- state->bc[0] |= (*c >> 7) & 0x1;
- state->Mc[0] = (*c >> 5) & 0x3;
- state->xMaxc[0] = (*c++ & 0x1F) << 1;
- state->xMaxc[0] |= (*c >> 7) & 0x1;
- state->xMc[0] = (*c >> 4) & 0x7;
- state->xMc[1] = (*c >> 1) & 0x7;
- state->xMc[2] = (*c++ & 0x1) << 2;
- state->xMc[2] |= (*c >> 6) & 0x3;
- state->xMc[3] = (*c >> 3) & 0x7;
- state->xMc[4] = *c++ & 0x7;
- state->xMc[5] = (*c >> 5) & 0x7;
- state->xMc[6] = (*c >> 2) & 0x7;
- state->xMc[7] = (*c++ & 0x3) << 1;
- state->xMc[7] |= (*c >> 7) & 0x1;
- state->xMc[8] = (*c >> 4) & 0x7;
- state->xMc[9] = (*c >> 1) & 0x7;
- state->xMc[10] = (*c++ & 0x1) << 2;
- state->xMc[10] |= (*c >> 6) & 0x3;
- state->xMc[11] = (*c >> 3) & 0x7;
- state->xMc[12] = *c++ & 0x7;
- state->Nc[1] = (*c >> 1) & 0x7F;
- state->bc[1] = (*c++ & 0x1) << 1;
- state->bc[1] |= (*c >> 7) & 0x1;
- state->Mc[1] = (*c >> 5) & 0x3;
- state->xMaxc[1] = (*c++ & 0x1F) << 1;
- state->xMaxc[1] |= (*c >> 7) & 0x1;
- state->xMc[13] = (*c >> 4) & 0x7;
- state->xMc[14] = (*c >> 1) & 0x7;
- state->xMc[15] = (*c++ & 0x1) << 2;
- state->xMc[15] |= (*c >> 6) & 0x3;
- state->xMc[16] = (*c >> 3) & 0x7;
- state->xMc[17] = *c++ & 0x7;
- state->xMc[18] = (*c >> 5) & 0x7;
- state->xMc[19] = (*c >> 2) & 0x7;
- state->xMc[20] = (*c++ & 0x3) << 1;
- state->xMc[20] |= (*c >> 7) & 0x1;
- state->xMc[21] = (*c >> 4) & 0x7;
- state->xMc[22] = (*c >> 1) & 0x7;
- state->xMc[23] = (*c++ & 0x1) << 2;
- state->xMc[23] |= (*c >> 6) & 0x3;
- state->xMc[24] = (*c >> 3) & 0x7;
- state->xMc[25] = *c++ & 0x7;
- state->Nc[2] = (*c >> 1) & 0x7F;
- state->bc[2] = (*c++ & 0x1) << 1;
- state->bc[2] |= (*c >> 7) & 0x1;
- state->Mc[2] = (*c >> 5) & 0x3;
- state->xMaxc[2] = (*c++ & 0x1F) << 1;
- state->xMaxc[2] |= (*c >> 7) & 0x1;
- state->xMc[26] = (*c >> 4) & 0x7;
- state->xMc[27] = (*c >> 1) & 0x7;
- state->xMc[28] = (*c++ & 0x1) << 2;
- state->xMc[28] |= (*c >> 6) & 0x3;
- state->xMc[29] = (*c >> 3) & 0x7;
- state->xMc[30] = *c++ & 0x7;
- state->xMc[31] = (*c >> 5) & 0x7;
- state->xMc[32] = (*c >> 2) & 0x7;
- state->xMc[33] = (*c++ & 0x3) << 1;
- state->xMc[33] |= (*c >> 7) & 0x1;
- state->xMc[34] = (*c >> 4) & 0x7;
- state->xMc[35] = (*c >> 1) & 0x7;
- state->xMc[36] = (*c++ & 0x1) << 2;
- state->xMc[36] |= (*c >> 6) & 0x3;
- state->xMc[37] = (*c >> 3) & 0x7;
- state->xMc[38] = *c++ & 0x7;
- state->Nc[3] = (*c >> 1) & 0x7F;
- state->bc[3] = (*c++ & 0x1) << 1;
- state->bc[3] |= (*c >> 7) & 0x1;
- state->Mc[3] = (*c >> 5) & 0x3;
- state->xMaxc[3] = (*c++ & 0x1F) << 1;
- state->xMaxc[3] |= (*c >> 7) & 0x1;
- state->xMc[39] = (*c >> 4) & 0x7;
- state->xMc[40] = (*c >> 1) & 0x7;
- state->xMc[41] = (*c++ & 0x1) << 2;
- state->xMc[41] |= (*c >> 6) & 0x3;
- state->xMc[42] = (*c >> 3) & 0x7;
- state->xMc[43] = *c++ & 0x7;
- state->xMc[44] = (*c >> 5) & 0x7;
- state->xMc[45] = (*c >> 2) & 0x7;
- state->xMc[46] = (*c++ & 0x3) << 1;
- state->xMc[46] |= (*c >> 7) & 0x1;
- state->xMc[47] = (*c >> 4) & 0x7;
- state->xMc[48] = (*c >> 1) & 0x7;
- state->xMc[49] = (*c++ & 0x1) << 2;
- state->xMc[49] |= (*c >> 6) & 0x3;
- state->xMc[50] = (*c >> 3) & 0x7;
- state->xMc[51] = *c & 0x7;
-
- for (i = 0; i < 4; i++) {
- state->subframe = i;
- decodeRPE(state);
- longTermSynthesis(state);
- }
- memcpy(state->dp0, state->dp0 + 160, 120 * sizeof(short));
- shortTermSynthesis(state, &state->dp0[120], out);
- gsm_postprocessing(state, out, out);
- state->j ^= 1;
-}
diff --git a/protocols/Tlen/codec/gsm_long.c b/protocols/Tlen/codec/gsm_long.c
deleted file mode 100644
index 7d9148061c..0000000000
--- a/protocols/Tlen/codec/gsm_long.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-#include "gsm.h"
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-
-/* Decision levels */
-const static int gsm_DLB[4] = { 6554, 16384, 26214, 32767 };
-/* Quantization levels */
-const static int gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
-
-/*
- * Long term parameters calculation - lag (Nc) and gain (bc).
- */
-static void longTermLTPCalculation(gsm_state *state, short *in, short *in_1)
-{
- int k, lambda;
- int Nc, bc;
- float in_1_float_base[120], * in_1_float = in_1_float_base + 120;
- float in_float[40];
- float L_result, L_max, L_power;
-
- for (k = -120; k < 0; k++) in_1_float[k] = (float)in_1[k];
- for (k = 0; k < 40; k++) in_float[k] = (float)in[k];
-
- /* Search for the maximum cross-correlation and coding of the LTP lag */
-
- L_max = 0;
- Nc = 40; /* index for the maximum cross-correlation */
-
- for (lambda = 40; lambda < 121; lambda++) {
- for (L_result = 0, L_power = 0, k = 0; k < 40; k++) {
- L_result += in_float[k] * in_1_float[k - lambda];
-// L_power += in_1_float[k - lambda] * in_1_float[k - lambda];
- }
-// L_result = L_result / L_power;
- if (L_result > L_max) {
- Nc = lambda;
- L_max = L_result;
- }
- }
- state->Nc[state->subframe] = Nc;
- if (L_max <= 0.) {
- state->bc[state->subframe] = 0;
- return;
- }
- /* Compute the power of the reconstructed short term residual signal dp[..] */
- in_1_float -= Nc;
- L_power = 0;
- for (k = 0; k < 40; k++) {
- float f = in_1_float[k];
- L_power += f * f;
- }
- if (L_max >= L_power) { //1.0
- state->bc[state->subframe] = 3;
- return;
- }
- /* Coding of the LTP gain
- * Table gsm_DLB must be used to obtain the level DLB[i] for the
- * quantization of the LTP gain b to get the coded version bc.
- */
-// lambda = L_max * 32768.;
- lambda = (int)(L_max * 32768. / L_power);
- for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
- state->bc[state->subframe] = bc;
-}
-
-/*
- * Here we decode the bc parameter and compute samples of the estimate out[0..39].
- * The decoding of bc needs the gsm_QLB table.
- * The long term residual signal e[0..39] is then calculated to be fed to the
- * RPE encoding section.
- */
-static void longTermAnalysisFilter(int Nc, int bc, short *in, short *in_1, short *out, int *e)
-{
- int gain, k, l;
- gain = gsm_QLB[bc];
- for (k = 0; k < 40; k++) {
- l = (gain * (int)in_1[k - Nc] + 16384) >> 15;
- if (l < -32768) l = -32768;
- else if (l > 32767) l = 32767;
- out[k] = l;
- e[k] = in[k] - l;
- }
-}
-
-/*
- * This procedure uses the bcr and Ncr parameter to realize the
- * long term synthesis filtering. The decoding of bcr needs table gsm_QLB.
- */
-static void longTermSynthesisFilter(gsm_state * state, int Ncr, int bcr, int *e, short *out)
-{
- int k;
- int brp, Nr;
-
- /* Check the limits of Nr. */
- Nr = Ncr < 40 || Ncr > 120 ? state->nrp : Ncr;
- state->nrp = Nr;
- /* Decoding of the LTP gain bcr */
- brp = gsm_QLB[ bcr ];
-
- /* Computation of the reconstructed short term residual
- * signal drp[0..39]
- */
- for (k = 0; k < 40; k++) {
- int temp = (brp * (int)out[ k-Nr ] + 16384) >> 15;
- out[k] = e[k] + temp;
- }
-}
-
-/*
- * This procedure performs long term analysis.
- */
-void longTermAnalysis(gsm_state *state, short *in)
-{
- short *in_1 = state->dp0 + 120 + state->subframe * 40;
- short *out = state->dp0 + 120 + state->subframe * 40;
- int *e = state->e + state->subframe * 40;
-/*
-
- int i;
- printf("Long-term in: \n");
- for (i=0;i<40;i++) {
- printf("%7d ", in[i]);
- }
- printf("\n");
- */
- longTermLTPCalculation(state, in, in_1);
- /* printf("Nc: %d, bc: %d \n", state->Nc[state->subframe], state->bc[state->subframe]);
- */
- longTermAnalysisFilter(state->Nc[state->subframe], state->bc[state->subframe], in, in_1, out, e);
-/*
- printf("Long-term out: \n");
- for (i=0;i<40;i++) {
- printf("%7d ", out[i]);
- }
- printf("\n");
- */
-}
-
-/*
- * This procedure performs long term synthesis.
- */
-void longTermSynthesis(gsm_state *state)
-{
- int Nc = state->Nc[state->subframe];
- int bc = state->bc[state->subframe];
- int *e = state->e + state->subframe * 40;
- short *out = state->dp0 + 120 + state->subframe * 40;
- //int i;
- longTermSynthesisFilter(state, Nc, bc, e, out);
- /*
- printf("Long-term reconstructed: \n");
- for (i=0;i<160;i++) {
- printf("%7d ", state->dp0[i]);
- }
- printf("\n");
- */
-}
diff --git a/protocols/Tlen/codec/gsm_lpc.c b/protocols/Tlen/codec/gsm_lpc.c
deleted file mode 100644
index 519612baff..0000000000
--- a/protocols/Tlen/codec/gsm_lpc.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-
-/* LPC- and Reflection Coefficients
- * The next two functions calculate linear prediction coefficients
- * and/or the related reflection coefficients from the first P_MAX+1
- * values of the autocorrelation function.
- */
-#include "gsm.h" /* for P_MAX */
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* Compute the autocorrelation
- * ,--,
- * ac(l) = > x(i) * x(i-l) for all i
- * `--'
- * for lags l between 0 and lag-1, and x(i) == 0 for i < 0 or i >= n
- * @param n: number of samples
- * @param lax: max lag (order)
- * @param in: [0...n-1] samples x
- * @param out: [0...lag-1] autocorrelation
- */
-static void autocorrelation(int n, float const *x, int lag, float *ac)
-{
- float d;
- int i, j;
- for (j = 0; j < lag; j++) {
- for (i = j, d = 0; i < n; i++) d += x[i] * x[i-j];
- ac[j] = d;
- }
- d = (float)fabs(ac[0]);
- if (d != 0) {
- for (j = 0; j < lag; j++) ac[j] /= d;
- }
-}
-
-/* The Levinson-Durbin algorithm was invented by N. Levinson in 1947
- * and modified by J. Durbin in 1959.
- * @param in: [0...p] autocorrelation values
- * @param out: [0...p-1] reflection coefficients
- * @param lpc: [0...p-1] LPC coefficients
- * @return minimum mean square error
- */
-/*
-static float levinson_durbin (float const *ac, float *ref, float *lpc)
-{
- int i, j;
- float r, error = ac[0];
-
- if (ac[0] == 0) {
- for (i = 0; i < P_MAX; i++) ref[i] = 0;
- return 0;
- }
-
- for (i = 0; i < P_MAX; i++) {
-
- r = -ac[i + 1];
- for (j = 0; j < i; j++) r -= lpc[j] * ac[i - j];
- ref[i] = r /= error;
-
- // Update LPC coefficients and total error.
- lpc[i] = r;
- for (j = 0; j < i / 2; j++) {
- float tmp = lpc[j];
- lpc[j] = r * lpc[i - 1 - j];
- lpc[i - 1 - j] += r * tmp;
- }
- if (i % 2) lpc[j] += lpc[j] * r;
-
- error *= 1 - r * r;
- }
- return error;
-}
-*/
-/* I. Schur's recursion from 1917 is related to the Levinson-Durbin method,
- * but faster on parallel architectures; where Levinson-Durbin would take time
- * proportional to p * log(p), Schur only requires time proportional to p. The
- * GSM coder uses an integer version of the Schur recursion.
- * @param in: [0...p] autocorrelation values
- * @param out: [0...p-1] reflection coefficients
- * @return the minimum mean square error
- */
-static float schur(float const *ac, float *ref)
-{
- int i, m;
- float error=ac[0], r, G[2][P_MAX];
-
- if (ac[0] == 0.0) {
- for (i = 0; i < P_MAX; i++) ref[i] = 0;
- return 0;
- }
-
- /* Initialize the rows of the generator matrix G to ac[1...p]. */
- for (i = 0; i < P_MAX; i++) G[0][i] = G[1][i] = ac[i + 1];
-
- for (i = 0;;) {
- /* Calculate this iteration's reflection coefficient and error. */
- ref[i] = r = -G[1][0] / error;
- error += G[1][0] * r;
-
- if (++i >= P_MAX) return error;
-
- /* Update the generator matrix. Unlike Levinson-Durbin's summing of
- * reflection coefficients, this loop could be executed in parallel
- * by p processors in constant time.
- */
- for (m = 0; m < P_MAX - i; m++) {
- G[1][m] = G[1][m + 1] + r * G[0][m];
- G[0][m] = G[1][m + 1] * r + G[0][m];
- }
- }
-}
-
-
- /* 0..7 IN/OUT */
-static void rToLAR(int *r)
-/*
- * The following scaling for r[..] and LAR[..] has been used:
- *
- * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
- * LAR[..] = integer( real_LAR[..] * 16384 );
- * with -1.625 <= real_LAR <= 1.625
- */
-{
- int temp;
- int i;
-
- /* Computation of the LAR[0..7] from the r[0..7]
- */
- for (i = 0; i < 8; i++) {
- temp = abs(r[i]); //GSM_ABS(temp);
- if (temp < 22118) {
- temp >>= 1;
- } else if (temp < 31130) {
- temp -= 11059;
- } else {
- temp -= 26112;
- temp <<= 2;
- }
- r[i] = r[i] < 0 ? -temp : temp;
- }
-}
-
-static void quantizeLARs(int *LARs, int *qLARs)
-{ int qA[]={20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036};
- int qB[]={0, 0, 2048, -2560, 94, -1792, -341, -1144};
- int qMin[]={-32, -32, -16, -16, -8, -8, -4, -4};
- int qMax[]={31, 31, 15, 15, 7, 7, 3, 3};
- int i;
- for (i = 0; i < 8; i++) {
- int temp;
- temp = (((LARs[i] * qA[i]) >> 15) + qB[i] + 256) >> 9;
- if (temp < qMin[i]) temp = 0;
- else if (temp > qMax[i]) temp = qMax[i] - qMin[i];
- else temp = temp - qMin[i];
- qLARs[i] = temp;
- }
-}
-
-void lpcAnalysis(gsm_state *state, short *in)
-{ float error;
- float samples[160];
- float ac[9];
- float ref[8];
- int i;
- int * qLARs = state->qLARs;
- for (i = 0; i < 160; i++) {
- samples[i] = in[i];
- }
- autocorrelation(160, samples, 9, ac);
- error=schur(ac, ref);
- /*
- printf("reff: ");
- for (i=0;i<8;i++) {
- printf("%5.5f ", ref[i]);//((float)i_lpc[i])/32768.0f);
- }
- printf("\n");
- */
- for (i = 0; i < 8; i++) {
- qLARs[i] = (int) (32768 * ref[i]);
- }
- rToLAR(qLARs);
- quantizeLARs(qLARs, qLARs);
-}
diff --git a/protocols/Tlen/codec/gsm_preprocess.c b/protocols/Tlen/codec/gsm_preprocess.c
deleted file mode 100644
index b3d11bb7b1..0000000000
--- a/protocols/Tlen/codec/gsm_preprocess.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-#include "gsm.h"
-#include <stdio.h>
-
-/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
- *
- * After A-law to linear conversion (or directly from the
- * Ato D converter) the following scaling is assumed for
- * input to the RPE-LTP algorithm:
- *
- *
- * Where S is the sign bit, v a valid bit, and * a "don't care" bit.
- * The original signal is called sop[..]
- *
- */
-
-
-void gsm_preprocessing( gsm_state *state, short *in, short *out)
-{
- int z1 = state->z1;
- int z2 = state->z2;
- int mp = state->mp;
- int so, s1;
- int msp, lsp;
-
- int k = 160;
-
- while (k--) {
- /* Downscaling of the input signal
- * in: 0.1.....................12
- * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
- * out: 0.1................... 12
- * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
- */
- so = (*in >> 3) << 2;
- in++;
- /* 4.2.2 Offset compensation
- *
- * This part implements a high-pass filter and requires extended
- * arithmetic precision for the recursive part of this filter.
- * The input of this procedure is the array so[0...159] and the
- * output the array sof[ 0...159 ].
- */
- /* Compute the non-recursive part
- */
- s1 = (so - z1) << 15;
- z1 = so;
- msp = z2 >> 15;
- lsp = z2 - (msp << 15);
- s1 += ((lsp * 32735) + 16384) >> 15;
- z2 = msp * 32735 + s1;
- /* 4.2.3 Preemphasis
- */
- msp = (-28180 * mp + 16384) >> 15;
- mp = (z2 + 16384) >> 15;
- *out++ = mp + msp;
- }
- state->z1 = z1;
- state->z2 = z2;
- state->mp = mp;
-/*
- printf("preprocessed: \n");
- for (k=0;k<160;k++) {
- printf("%7d ", out[k]);//((float)i_lpc[i])/32768.0f);
- }
- printf("\n");
- */
-}
-
-void gsm_postprocessing( gsm_state *state, short *in, short *out)
-{
- int k;
- int msr = state->msr;
- for (k = 160; k--; in++, out++) {
- msr = *in + ((msr * 28180 + 16384) >>15); /* Deemphasis */
- *out = (msr + msr ) & 0xFFF8; /* Truncation & Upscaling */
- }
- state->msr = msr;
-}
diff --git a/protocols/Tlen/codec/gsm_rpe.c b/protocols/Tlen/codec/gsm_rpe.c
deleted file mode 100644
index ad7234e606..0000000000
--- a/protocols/Tlen/codec/gsm_rpe.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-#include "gsm.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-static const int gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
-static const int gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
-static const int gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
-/*
- * The coefficients of the weighting filter are stored in the gsm_H table.
- * The following scaling is used:
- *
- * gsm_H[0..10] = integer( real_H[ 0..10] * 8192 );
- */
-static void weightingFilter (int *e, int *x)
-{
- int L_result;
- int k, i;
- for (k = 0; k < 40; k++) {
- L_result = 4096;
- for (i = 0; i < 11; i++) {
- int ix = i + k;
- if (ix>4 && ix<45) L_result += e[ix - 5] * gsm_H[i];
- }
- L_result >>= 13;
- x[k] = (L_result < -32768 ? -32768 : (L_result > 32767 ? 32767 : L_result));
- }
-}
-
-/*
- * The signal x[0..39] is used to select the RPE grid which is
- * represented by Mc.
- */
-static void gridSelection( int *x, int *xM, int *Mc_out)
-{
- int m, i;
- int L_result, L_temp;
- int EM, Mc;
-
- EM = 0;
- Mc = 0;
-
- for (m = 0; m < 4; m++) {
- L_result = 0;
- for (i = 0; i < 13; i++) {
- int temp = x[m + 3*i] >> 2;
- L_temp = temp * temp << 1;
- L_result += L_temp;
- }
- if (L_result > EM) {
- Mc = m;
- EM = L_result;
- }
- }
- /* Down-sampling by a factor 3 to get the selected xM[0..12]
- * RPE sequence.
- */
- for (i = 0; i < 13; i ++) xM[i] = x[Mc + 3*i];
- *Mc_out = Mc;
-}
-
-/*
- * This procedure computes the reconstructed long term residual signal
- * ep[0..39] for the LTP analysis filter. The inputs are the Mc
- * which is the grid position selection and the xMp[0..12] decoded
- * RPE samples which are upsampled by a factor of 3 by inserting zero
- * values.
- */
-static void gridPositioning (int Mc, int *xMp, int *ep)
-{
- int i, k;
- for (k = 0; k < 40; k++) ep[k] = 0;
- for (i = 0; i < 13; i++) {
- ep[ Mc + (3*i) ] = xMp[i];
- }
-}
-
-static void APCMXmaxcToExpMant (int xmaxc, int *exp_out, int *mant_out )
-{
- int exp, mant;
- /* Compute exponent and mantissa of the decoded version of xmaxc
- */
- exp = 0;
- if (xmaxc > 15) exp = (xmaxc >> 3) - 1;
- mant = xmaxc - (exp << 3);
-
- if (mant == 0) {
- exp = -4;
- mant = 7;
- }
- else {
- while (mant < 8) {
- mant = mant << 1 | 1;
- exp--;
- }
- mant -= 8;
- }
-
- *exp_out = exp;
- *mant_out = mant;
-}
-
-static void APCMQuantization (int *xM, int *xMc, int *mant_out, int *exp_out, int *xmaxc_out)
-{
- int i, itest;
- int xmax, xmaxc, temp, temp1, temp2;
- int exp, mant;
-
-
- /* Find the maximum absolute value xmax of xM[0..12].
- */
-
- xmax = 0;
- for (i = 0; i < 13; i++) {
- temp = abs(xM[i]);
- if (temp > xmax) xmax = temp;
- }
- if (xmax > 32767) xmax = 32767;
- /* Qantizing and coding of xmax to get xmaxc.
- */
-
- exp = 0;
- temp = xmax >> 9;
- itest = 0;
-
- for (i = 0; i < 6; i++) {
- if (temp != 0) exp++;
- temp = temp >> 1;
- }
-
- temp = exp + 5;
-
- xmaxc = (xmax >> temp) + (exp << 3);
-
- /* Quantizing and coding of the xM[0..12] RPE sequence
- * to get the xMc[0..12]
- */
- APCMXmaxcToExpMant( xmaxc, &exp, &mant );
-
- /* This computation uses the fact that the decoded version of xmaxc
- * can be calculated by using the exponent and the mantissa part of
- * xmaxc (logarithmic table).
- * So, this method avoids any division and uses only a scaling
- * of the RPE samples by a function of the exponent. A direct
- * multiplication by the inverse of the mantissa (NRFAC[0..7]
- * found in table 4.5) gives the 3 bit coded version xMc[0..12]
- * of the RPE samples.
- */
-
- /* Direct computation of xMc[0..12] using table 4.5
- */
- temp = (mant|8)<<(5+exp);
- temp1 = 6 - exp;
- temp2 = gsm_NRFAC[ mant ];
- for (i = 0; i < 13; i++) {
- xMc[i] = ((xM[i] << temp1) * temp2 >> 27) + 4;
- }
-
- /* NOTE: This equation is used to make all the xMc[i] positive.
- */
-
- *mant_out = mant;
- *exp_out = exp;
- *xmaxc_out = xmaxc;
-}
-
-static void APCMDequantization (int *xMc, int mant, int exp, int *xMp)
-{
- int i, temp1, temp2, temp3;
- temp1 = gsm_FAC[ mant ];
- temp2 = 6 - exp;
- if (temp2 <= 0) {
- temp3 = 1 >> (1 - temp2);
- } else {
- temp3 = 1 << (temp2 - 1);
- }
- for (i = 0; i < 13; i++) {
- xMp[i] = ((((((xMc[i]<<1)-7)<<12)*temp1+16384)>>15)+temp3)>>temp2;
- }
-}
-
-void encodeRPE(gsm_state *state)
-{ int x[40];
- int xM[13], xMp[13];
- int mant, exp;
- int *Mc = state->Mc + state->subframe;
- int *xMaxc = state->xMaxc + state->subframe;
- int *xMc = state->xMc + state->subframe * 13;
- int *e = state->e + state->subframe * 40;
- //int i;
- /*
- printf("RPE in: \n");
- for (i=0;i<40;i++) {
- printf("%7d ", e[i]);
- }
- printf("\n");
- */
- weightingFilter(e, x);
- /*
- printf("RPE weighting filter: \n");
- for (i=0;i<40;i++) {
- printf("%7d ", x[i]);
- }
- printf("\n");
- */
- gridSelection(x, xM, Mc);
- APCMQuantization(xM, xMc, &mant, &exp, xMaxc);
- /* printf("RPE Mc(grid #)=%d xmaxc=%d mant=%d exp=%d \n", *Mc, *xMaxc, mant, exp); */
- APCMDequantization(xMc, mant, exp, xMp);
- gridPositioning(*Mc, xMp, e);
-}
-
-void decodeRPE(gsm_state *state)
-{
- int exp, mant;
- int xMp[ 13 ];
- int *xMc = state->xMc + state->subframe * 13;
- int *e = state->e + state->subframe * 40;
-
- APCMXmaxcToExpMant(state->xMaxc[state->subframe], &exp, &mant);
- APCMDequantization(xMc, mant, exp, xMp);
- gridPositioning(state->Mc[state->subframe], xMp, e);
-}
diff --git a/protocols/Tlen/codec/gsm_short.c b/protocols/Tlen/codec/gsm_short.c
deleted file mode 100644
index c461484639..0000000000
--- a/protocols/Tlen/codec/gsm_short.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-This program is based on GSM 06.10 source code developed by
-Jutta Degener and Carsten Bormann,
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-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.
-
-*/
-#include "gsm.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-extern void lpcAnalysis(gsm_state *state, short *in);
-
-/*
- * Dequantize LAR coefficients
- */
-static void dequantizeLARs(int *qLARs, int *LARs)
-{
- int dqA[]={13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708};
- int dqB[]={0, 0, 2048, -2560, 94, -1792, -341, -1144};
- int dqMin[]={-32, -32, -16, -16, -8, -8, -4, -4};
- int i;
- for (i = 0; i < 8; i++) {
- int temp;
- temp = ((((qLARs[i] + dqMin[i]) << 10) - (dqB[i] << 1)) * dqA[i] + 16384) >> 15;
- LARs[i] = temp + temp;
- }
-}
-/*
- * Interpolate LAR coefficients (samples 0..12)
- */
-static void interpolateLARs_0_12 (int *LARpp_j_1, int *LARpp_j, int *LARp)
-{ int i;
- for (i = 0; i < 8; i++) {
- LARp[i] = (LARpp_j_1[i] >> 1) + (LARpp_j_1[i] >> 2) + (LARpp_j[i] >> 2);
- }
-}
-/*
- * Interpolate LAR coefficients (samples 13..26)
- */
-static void interpolateLARs_13_26 (int *LARpp_j_1, int *LARpp_j, int *LARp)
-{ int i;
- for (i = 0; i < 8; i++) {
- LARp[i] = (LARpp_j_1[i] >> 1) + (LARpp_j[i] >> 1);
- }
-}
-/*
- * Interpolate LAR coefficients (samples 27..39)
- */
-static void interpolateLARs_27_39 (int *LARpp_j_1, int *LARpp_j, int *LARp)
-{ int i;
- for (i = 0; i < 8; i++) {
- LARp[i] = (LARpp_j[i] >> 1) + (LARpp_j_1[i] >> 2) + (LARpp_j[i] >> 2);
- }
-}
-/*
- * Interpolate LAR coefficients (samples 40..159)
- */
-static void interpolateLARs_40_159 (int *LARpp_j_1, int *LARpp_j, int *LARp)
-{ int i;
- for (i = 0; i < 8; i++) {
- LARp[i] = LARpp_j[i];
- }
-}
-/*
- * Convert LAR coefficients to reflection coefficients
- */
-static void LARToR( int * LARp)
-{
- int i;
- int temp;
- for (i = 0; i < 8; i++) {
- temp = abs(LARp[i]);
- if (temp < 11059) temp <<= 1;
- else if (temp < 20070) temp += 11059;
- else temp = (temp >> 2) + 26112;
- LARp[i] = LARp[i] < 0 ? -temp : temp;
- }
-}
-
-/*
- * This procedure computes the short term residual signal d[..] to be fed
- * to the RPE-LTP loop from the s[..] signal and from the local rp[..]
- * array (quantized reflection coefficients). As the call of this
- * procedure can be done in many ways (see the interpolation of the LAR
- * coefficient), it is assumed that the computation begins with index
- * k_start (for arrays d[..] and s[..]) and stops with index k_end
- * (k_start and k_end are defined in 4.2.9.1). This procedure also
- * needs to keep the array u[0..7] in memory for each call.
- */
-static void shortTermAnalysisFilter (gsm_state * state, int * rp, int len, short * in)
-{
- int * u = state->u;
- int i;
- int di, ui, sav, rpi;
- for (; len--; in++) {
- di = sav = *in;
- for (i = 0; i < 8; i++) {
- ui = u[i];
- rpi = rp[i];
- u[i] = sav;
- sav = ui + ((rpi * di + 16384) >> 15);
- di = di + ((rpi * ui + 16384) >> 15);
- }
- *in = di;
- }
-}
-
-static void shortTermSynthesisFilter(gsm_state * state, int * rrp, int len, short * in, short *out)
-{
- int * v = state->v;
- int i;
- int sri;
- for (; len--; in++, out++) {
- sri = *in;
- for (i = 8; i--;) {
- sri -= (rrp[i] * v[i] + 16384) >> 15;
- if (sri < -32768) sri = -32768;
- else if (sri > 32767) sri = 32767;
- v[i+1] = v[i] + ((rrp[i] * sri + 16384) >> 15);
- if (v[i+1] < -32768) v[i+1] = -32768;
- else if (v[i+1] > 32767) v[i+1] = 32767;
- }
- *out = v[0] = sri;
- }
-}
-
-void shortTermAnalysis(gsm_state *state, short *in)
-{
- int * qLARs = state->qLARs;
- int * LARpp_j = state->LARpp[state->j];
- int * LARpp_j_1 = state->LARpp[state->j ^1];
- int LARp[8];
-// int i;
-
- lpcAnalysis(state, in);//i_samples);
-/*
- printf("short term in: \n");
- for (i=0;i<160;i++) {
- printf("%7d ", in[i]);//((float)i_lpc[i])/32768.0f);
- }
- printf("\n");
- */
- dequantizeLARs(qLARs, LARpp_j);
- interpolateLARs_0_12(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermAnalysisFilter(state, LARp, 13, in);
- interpolateLARs_13_26(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermAnalysisFilter(state, LARp, 14, in+13);
- interpolateLARs_27_39(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermAnalysisFilter(state, LARp, 13, in+27);
- interpolateLARs_40_159(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermAnalysisFilter(state, LARp, 120, in+40);
- /*
- printf("short-term residuals: \n");
- for (i=0;i<160;i++) {
- printf("%7d ", in[i]);//((float)i_lpc[i])/32768.0f);
- }
- printf("\n");
- */
-}
-
-void shortTermSynthesis(gsm_state *state, short *in, short *out)
-{
- int * qLARs = state->qLARs;
- int * LARpp_j = state->LARpp[state->j];
- int * LARpp_j_1 = state->LARpp[state->j ^1];
- int LARp[8];
-// int i;
-
- dequantizeLARs(qLARs, LARpp_j);
- interpolateLARs_0_12(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermSynthesisFilter(state, LARp, 13, in, out);
- interpolateLARs_13_26(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermSynthesisFilter(state, LARp, 14, in+13, out+13);
- interpolateLARs_27_39(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermSynthesisFilter(state, LARp, 13, in+27, out+27);
- interpolateLARs_40_159(LARpp_j_1, LARpp_j, LARp);
- LARToR(LARp);
- shortTermSynthesisFilter(state, LARp, 120, in+40, out+40);
- /*
- printf("samples[reconstructed]: \n");
- for (i=0;i<160;i++) {
- printf("%7d ", out[i]);
- }
- */
-}
diff --git a/protocols/Tlen/commons.h b/protocols/Tlen/commons.h
deleted file mode 100644
index af5a9bbcd7..0000000000
--- a/protocols/Tlen/commons.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _TLENCOMMONS_INC
-#define _TLENCOMMONS_INC
-
-
-#define TLENMUCC_MAJOR_VERSION 2
-#define TLENMUCC_MINOR_VERSION 0
-#define TLENMUCC_RELEASE_NUM 5
-#define TLENMUCC_BUILD_NUM 0
-#define TLENMUCC_VERSION_STRING "2.0.5.0"
-
-
-
-//consts for tlen.dll
-#define TLEN_MAJOR_VERSION TLENMUCC_MAJOR_VERSION
-#define TLEN_MINOR_VERSION TLENMUCC_MINOR_VERSION
-#define TLEN_RELEASE_NUM TLENMUCC_RELEASE_NUM
-#define TLEN_BUILD_NUM TLENMUCC_BUILD_NUM
-
-#define TLEN_FILEVERSION_STRING TLEN_MAJOR_VERSION,TLEN_MINOR_VERSION,TLEN_RELEASE_NUM,TLEN_BUILD_NUM
-#define TLEN_VERSION_STRING TLENMUCC_VERSION_STRING
-
-//consts for tlen_czaty.dll
-#define MUCC_MAJOR_VERSION TLENMUCC_MAJOR_VERSION
-#define MUCC_MINOR_VERSION TLENMUCC_MINOR_VERSION
-#define MUCC_RELEASE_NUM TLENMUCC_RELEASE_NUM
-#define MUCC_BUILD_NUM TLENMUCC_BUILD_NUM
-
-#define MUCC_FILEVERSION_STRING MUCC_MAJOR_VERSION,MUCC_MINOR_VERSION,MUCC_RELEASE_NUM,MUCC_BUILD_NUM
-#define MUCC_VERSION_STRING TLENMUCC_VERSION_STRING
-
-
-#endif //ifndef _TLENCOMMONS_INC
diff --git a/protocols/Tlen/crypto/aes.c b/protocols/Tlen/crypto/aes.c
deleted file mode 100644
index 7bccdf93a1..0000000000
--- a/protocols/Tlen/crypto/aes.c
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*
- * FIPS-197 compliant AES implementation
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-/*
- * The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
- *
- * http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
- * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
- */
-
-#include "polarssl/config.h"
-
-#if defined(POLARSSL_AES_C)
-
-#include "polarssl/aes.h"
-#include "polarssl/padlock.h"
-
-/*
- * 32-bit integer manipulation macros (little endian)
- */
-#ifndef GET_ULONG_LE
-#define GET_ULONG_LE(n,b,i) \
-{ \
- (n) = ( (unsigned long) (b)[(i) ] ) \
- | ( (unsigned long) (b)[(i) + 1] << 8 ) \
- | ( (unsigned long) (b)[(i) + 2] << 16 ) \
- | ( (unsigned long) (b)[(i) + 3] << 24 ); \
-}
-#endif
-
-#ifndef PUT_ULONG_LE
-#define PUT_ULONG_LE(n,b,i) \
-{ \
- (b)[(i) ] = (unsigned char) ( (n) ); \
- (b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
- (b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
- (b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
-}
-#endif
-
-#if defined(POLARSSL_AES_ROM_TABLES)
-/*
- * Forward S-box
- */
-static const unsigned char FSb[256] =
-{
- 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
- 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
- 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
- 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
- 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC,
- 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
- 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A,
- 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
- 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
- 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
- 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B,
- 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
- 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85,
- 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
- 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
- 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
- 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17,
- 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
- 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88,
- 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
- 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
- 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
- 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9,
- 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
- 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6,
- 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
- 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
- 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
- 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94,
- 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
- 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
- 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
-};
-
-/*
- * Forward tables
- */
-#define FT \
-\
- V(A5,63,63,C6), V(84,7C,7C,F8), V(99,77,77,EE), V(8D,7B,7B,F6), \
- V(0D,F2,F2,FF), V(BD,6B,6B,D6), V(B1,6F,6F,DE), V(54,C5,C5,91), \
- V(50,30,30,60), V(03,01,01,02), V(A9,67,67,CE), V(7D,2B,2B,56), \
- V(19,FE,FE,E7), V(62,D7,D7,B5), V(E6,AB,AB,4D), V(9A,76,76,EC), \
- V(45,CA,CA,8F), V(9D,82,82,1F), V(40,C9,C9,89), V(87,7D,7D,FA), \
- V(15,FA,FA,EF), V(EB,59,59,B2), V(C9,47,47,8E), V(0B,F0,F0,FB), \
- V(EC,AD,AD,41), V(67,D4,D4,B3), V(FD,A2,A2,5F), V(EA,AF,AF,45), \
- V(BF,9C,9C,23), V(F7,A4,A4,53), V(96,72,72,E4), V(5B,C0,C0,9B), \
- V(C2,B7,B7,75), V(1C,FD,FD,E1), V(AE,93,93,3D), V(6A,26,26,4C), \
- V(5A,36,36,6C), V(41,3F,3F,7E), V(02,F7,F7,F5), V(4F,CC,CC,83), \
- V(5C,34,34,68), V(F4,A5,A5,51), V(34,E5,E5,D1), V(08,F1,F1,F9), \
- V(93,71,71,E2), V(73,D8,D8,AB), V(53,31,31,62), V(3F,15,15,2A), \
- V(0C,04,04,08), V(52,C7,C7,95), V(65,23,23,46), V(5E,C3,C3,9D), \
- V(28,18,18,30), V(A1,96,96,37), V(0F,05,05,0A), V(B5,9A,9A,2F), \
- V(09,07,07,0E), V(36,12,12,24), V(9B,80,80,1B), V(3D,E2,E2,DF), \
- V(26,EB,EB,CD), V(69,27,27,4E), V(CD,B2,B2,7F), V(9F,75,75,EA), \
- V(1B,09,09,12), V(9E,83,83,1D), V(74,2C,2C,58), V(2E,1A,1A,34), \
- V(2D,1B,1B,36), V(B2,6E,6E,DC), V(EE,5A,5A,B4), V(FB,A0,A0,5B), \
- V(F6,52,52,A4), V(4D,3B,3B,76), V(61,D6,D6,B7), V(CE,B3,B3,7D), \
- V(7B,29,29,52), V(3E,E3,E3,DD), V(71,2F,2F,5E), V(97,84,84,13), \
- V(F5,53,53,A6), V(68,D1,D1,B9), V(00,00,00,00), V(2C,ED,ED,C1), \
- V(60,20,20,40), V(1F,FC,FC,E3), V(C8,B1,B1,79), V(ED,5B,5B,B6), \
- V(BE,6A,6A,D4), V(46,CB,CB,8D), V(D9,BE,BE,67), V(4B,39,39,72), \
- V(DE,4A,4A,94), V(D4,4C,4C,98), V(E8,58,58,B0), V(4A,CF,CF,85), \
- V(6B,D0,D0,BB), V(2A,EF,EF,C5), V(E5,AA,AA,4F), V(16,FB,FB,ED), \
- V(C5,43,43,86), V(D7,4D,4D,9A), V(55,33,33,66), V(94,85,85,11), \
- V(CF,45,45,8A), V(10,F9,F9,E9), V(06,02,02,04), V(81,7F,7F,FE), \
- V(F0,50,50,A0), V(44,3C,3C,78), V(BA,9F,9F,25), V(E3,A8,A8,4B), \
- V(F3,51,51,A2), V(FE,A3,A3,5D), V(C0,40,40,80), V(8A,8F,8F,05), \
- V(AD,92,92,3F), V(BC,9D,9D,21), V(48,38,38,70), V(04,F5,F5,F1), \
- V(DF,BC,BC,63), V(C1,B6,B6,77), V(75,DA,DA,AF), V(63,21,21,42), \
- V(30,10,10,20), V(1A,FF,FF,E5), V(0E,F3,F3,FD), V(6D,D2,D2,BF), \
- V(4C,CD,CD,81), V(14,0C,0C,18), V(35,13,13,26), V(2F,EC,EC,C3), \
- V(E1,5F,5F,BE), V(A2,97,97,35), V(CC,44,44,88), V(39,17,17,2E), \
- V(57,C4,C4,93), V(F2,A7,A7,55), V(82,7E,7E,FC), V(47,3D,3D,7A), \
- V(AC,64,64,C8), V(E7,5D,5D,BA), V(2B,19,19,32), V(95,73,73,E6), \
- V(A0,60,60,C0), V(98,81,81,19), V(D1,4F,4F,9E), V(7F,DC,DC,A3), \
- V(66,22,22,44), V(7E,2A,2A,54), V(AB,90,90,3B), V(83,88,88,0B), \
- V(CA,46,46,8C), V(29,EE,EE,C7), V(D3,B8,B8,6B), V(3C,14,14,28), \
- V(79,DE,DE,A7), V(E2,5E,5E,BC), V(1D,0B,0B,16), V(76,DB,DB,AD), \
- V(3B,E0,E0,DB), V(56,32,32,64), V(4E,3A,3A,74), V(1E,0A,0A,14), \
- V(DB,49,49,92), V(0A,06,06,0C), V(6C,24,24,48), V(E4,5C,5C,B8), \
- V(5D,C2,C2,9F), V(6E,D3,D3,BD), V(EF,AC,AC,43), V(A6,62,62,C4), \
- V(A8,91,91,39), V(A4,95,95,31), V(37,E4,E4,D3), V(8B,79,79,F2), \
- V(32,E7,E7,D5), V(43,C8,C8,8B), V(59,37,37,6E), V(B7,6D,6D,DA), \
- V(8C,8D,8D,01), V(64,D5,D5,B1), V(D2,4E,4E,9C), V(E0,A9,A9,49), \
- V(B4,6C,6C,D8), V(FA,56,56,AC), V(07,F4,F4,F3), V(25,EA,EA,CF), \
- V(AF,65,65,CA), V(8E,7A,7A,F4), V(E9,AE,AE,47), V(18,08,08,10), \
- V(D5,BA,BA,6F), V(88,78,78,F0), V(6F,25,25,4A), V(72,2E,2E,5C), \
- V(24,1C,1C,38), V(F1,A6,A6,57), V(C7,B4,B4,73), V(51,C6,C6,97), \
- V(23,E8,E8,CB), V(7C,DD,DD,A1), V(9C,74,74,E8), V(21,1F,1F,3E), \
- V(DD,4B,4B,96), V(DC,BD,BD,61), V(86,8B,8B,0D), V(85,8A,8A,0F), \
- V(90,70,70,E0), V(42,3E,3E,7C), V(C4,B5,B5,71), V(AA,66,66,CC), \
- V(D8,48,48,90), V(05,03,03,06), V(01,F6,F6,F7), V(12,0E,0E,1C), \
- V(A3,61,61,C2), V(5F,35,35,6A), V(F9,57,57,AE), V(D0,B9,B9,69), \
- V(91,86,86,17), V(58,C1,C1,99), V(27,1D,1D,3A), V(B9,9E,9E,27), \
- V(38,E1,E1,D9), V(13,F8,F8,EB), V(B3,98,98,2B), V(33,11,11,22), \
- V(BB,69,69,D2), V(70,D9,D9,A9), V(89,8E,8E,07), V(A7,94,94,33), \
- V(B6,9B,9B,2D), V(22,1E,1E,3C), V(92,87,87,15), V(20,E9,E9,C9), \
- V(49,CE,CE,87), V(FF,55,55,AA), V(78,28,28,50), V(7A,DF,DF,A5), \
- V(8F,8C,8C,03), V(F8,A1,A1,59), V(80,89,89,09), V(17,0D,0D,1A), \
- V(DA,BF,BF,65), V(31,E6,E6,D7), V(C6,42,42,84), V(B8,68,68,D0), \
- V(C3,41,41,82), V(B0,99,99,29), V(77,2D,2D,5A), V(11,0F,0F,1E), \
- V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C)
-
-#define V(a,b,c,d) 0x##a##b##c##d
-static const unsigned long FT0[256] = { FT };
-#undef V
-
-#define V(a,b,c,d) 0x##b##c##d##a
-static const unsigned long FT1[256] = { FT };
-#undef V
-
-#define V(a,b,c,d) 0x##c##d##a##b
-static const unsigned long FT2[256] = { FT };
-#undef V
-
-#define V(a,b,c,d) 0x##d##a##b##c
-static const unsigned long FT3[256] = { FT };
-#undef V
-
-#undef FT
-
-/*
- * Reverse S-box
- */
-static const unsigned char RSb[256] =
-{
- 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38,
- 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
- 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87,
- 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
- 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D,
- 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
- 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2,
- 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
- 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16,
- 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
- 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA,
- 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
- 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A,
- 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
- 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02,
- 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
- 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA,
- 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
- 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85,
- 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
- 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89,
- 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
- 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20,
- 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
- 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31,
- 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
- 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
- 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
- 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0,
- 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
- 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26,
- 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
-};
-
-/*
- * Reverse tables
- */
-#define RT \
-\
- V(50,A7,F4,51), V(53,65,41,7E), V(C3,A4,17,1A), V(96,5E,27,3A), \
- V(CB,6B,AB,3B), V(F1,45,9D,1F), V(AB,58,FA,AC), V(93,03,E3,4B), \
- V(55,FA,30,20), V(F6,6D,76,AD), V(91,76,CC,88), V(25,4C,02,F5), \
- V(FC,D7,E5,4F), V(D7,CB,2A,C5), V(80,44,35,26), V(8F,A3,62,B5), \
- V(49,5A,B1,DE), V(67,1B,BA,25), V(98,0E,EA,45), V(E1,C0,FE,5D), \
- V(02,75,2F,C3), V(12,F0,4C,81), V(A3,97,46,8D), V(C6,F9,D3,6B), \
- V(E7,5F,8F,03), V(95,9C,92,15), V(EB,7A,6D,BF), V(DA,59,52,95), \
- V(2D,83,BE,D4), V(D3,21,74,58), V(29,69,E0,49), V(44,C8,C9,8E), \
- V(6A,89,C2,75), V(78,79,8E,F4), V(6B,3E,58,99), V(DD,71,B9,27), \
- V(B6,4F,E1,BE), V(17,AD,88,F0), V(66,AC,20,C9), V(B4,3A,CE,7D), \
- V(18,4A,DF,63), V(82,31,1A,E5), V(60,33,51,97), V(45,7F,53,62), \
- V(E0,77,64,B1), V(84,AE,6B,BB), V(1C,A0,81,FE), V(94,2B,08,F9), \
- V(58,68,48,70), V(19,FD,45,8F), V(87,6C,DE,94), V(B7,F8,7B,52), \
- V(23,D3,73,AB), V(E2,02,4B,72), V(57,8F,1F,E3), V(2A,AB,55,66), \
- V(07,28,EB,B2), V(03,C2,B5,2F), V(9A,7B,C5,86), V(A5,08,37,D3), \
- V(F2,87,28,30), V(B2,A5,BF,23), V(BA,6A,03,02), V(5C,82,16,ED), \
- V(2B,1C,CF,8A), V(92,B4,79,A7), V(F0,F2,07,F3), V(A1,E2,69,4E), \
- V(CD,F4,DA,65), V(D5,BE,05,06), V(1F,62,34,D1), V(8A,FE,A6,C4), \
- V(9D,53,2E,34), V(A0,55,F3,A2), V(32,E1,8A,05), V(75,EB,F6,A4), \
- V(39,EC,83,0B), V(AA,EF,60,40), V(06,9F,71,5E), V(51,10,6E,BD), \
- V(F9,8A,21,3E), V(3D,06,DD,96), V(AE,05,3E,DD), V(46,BD,E6,4D), \
- V(B5,8D,54,91), V(05,5D,C4,71), V(6F,D4,06,04), V(FF,15,50,60), \
- V(24,FB,98,19), V(97,E9,BD,D6), V(CC,43,40,89), V(77,9E,D9,67), \
- V(BD,42,E8,B0), V(88,8B,89,07), V(38,5B,19,E7), V(DB,EE,C8,79), \
- V(47,0A,7C,A1), V(E9,0F,42,7C), V(C9,1E,84,F8), V(00,00,00,00), \
- V(83,86,80,09), V(48,ED,2B,32), V(AC,70,11,1E), V(4E,72,5A,6C), \
- V(FB,FF,0E,FD), V(56,38,85,0F), V(1E,D5,AE,3D), V(27,39,2D,36), \
- V(64,D9,0F,0A), V(21,A6,5C,68), V(D1,54,5B,9B), V(3A,2E,36,24), \
- V(B1,67,0A,0C), V(0F,E7,57,93), V(D2,96,EE,B4), V(9E,91,9B,1B), \
- V(4F,C5,C0,80), V(A2,20,DC,61), V(69,4B,77,5A), V(16,1A,12,1C), \
- V(0A,BA,93,E2), V(E5,2A,A0,C0), V(43,E0,22,3C), V(1D,17,1B,12), \
- V(0B,0D,09,0E), V(AD,C7,8B,F2), V(B9,A8,B6,2D), V(C8,A9,1E,14), \
- V(85,19,F1,57), V(4C,07,75,AF), V(BB,DD,99,EE), V(FD,60,7F,A3), \
- V(9F,26,01,F7), V(BC,F5,72,5C), V(C5,3B,66,44), V(34,7E,FB,5B), \
- V(76,29,43,8B), V(DC,C6,23,CB), V(68,FC,ED,B6), V(63,F1,E4,B8), \
- V(CA,DC,31,D7), V(10,85,63,42), V(40,22,97,13), V(20,11,C6,84), \
- V(7D,24,4A,85), V(F8,3D,BB,D2), V(11,32,F9,AE), V(6D,A1,29,C7), \
- V(4B,2F,9E,1D), V(F3,30,B2,DC), V(EC,52,86,0D), V(D0,E3,C1,77), \
- V(6C,16,B3,2B), V(99,B9,70,A9), V(FA,48,94,11), V(22,64,E9,47), \
- V(C4,8C,FC,A8), V(1A,3F,F0,A0), V(D8,2C,7D,56), V(EF,90,33,22), \
- V(C7,4E,49,87), V(C1,D1,38,D9), V(FE,A2,CA,8C), V(36,0B,D4,98), \
- V(CF,81,F5,A6), V(28,DE,7A,A5), V(26,8E,B7,DA), V(A4,BF,AD,3F), \
- V(E4,9D,3A,2C), V(0D,92,78,50), V(9B,CC,5F,6A), V(62,46,7E,54), \
- V(C2,13,8D,F6), V(E8,B8,D8,90), V(5E,F7,39,2E), V(F5,AF,C3,82), \
- V(BE,80,5D,9F), V(7C,93,D0,69), V(A9,2D,D5,6F), V(B3,12,25,CF), \
- V(3B,99,AC,C8), V(A7,7D,18,10), V(6E,63,9C,E8), V(7B,BB,3B,DB), \
- V(09,78,26,CD), V(F4,18,59,6E), V(01,B7,9A,EC), V(A8,9A,4F,83), \
- V(65,6E,95,E6), V(7E,E6,FF,AA), V(08,CF,BC,21), V(E6,E8,15,EF), \
- V(D9,9B,E7,BA), V(CE,36,6F,4A), V(D4,09,9F,EA), V(D6,7C,B0,29), \
- V(AF,B2,A4,31), V(31,23,3F,2A), V(30,94,A5,C6), V(C0,66,A2,35), \
- V(37,BC,4E,74), V(A6,CA,82,FC), V(B0,D0,90,E0), V(15,D8,A7,33), \
- V(4A,98,04,F1), V(F7,DA,EC,41), V(0E,50,CD,7F), V(2F,F6,91,17), \
- V(8D,D6,4D,76), V(4D,B0,EF,43), V(54,4D,AA,CC), V(DF,04,96,E4), \
- V(E3,B5,D1,9E), V(1B,88,6A,4C), V(B8,1F,2C,C1), V(7F,51,65,46), \
- V(04,EA,5E,9D), V(5D,35,8C,01), V(73,74,87,FA), V(2E,41,0B,FB), \
- V(5A,1D,67,B3), V(52,D2,DB,92), V(33,56,10,E9), V(13,47,D6,6D), \
- V(8C,61,D7,9A), V(7A,0C,A1,37), V(8E,14,F8,59), V(89,3C,13,EB), \
- V(EE,27,A9,CE), V(35,C9,61,B7), V(ED,E5,1C,E1), V(3C,B1,47,7A), \
- V(59,DF,D2,9C), V(3F,73,F2,55), V(79,CE,14,18), V(BF,37,C7,73), \
- V(EA,CD,F7,53), V(5B,AA,FD,5F), V(14,6F,3D,DF), V(86,DB,44,78), \
- V(81,F3,AF,CA), V(3E,C4,68,B9), V(2C,34,24,38), V(5F,40,A3,C2), \
- V(72,C3,1D,16), V(0C,25,E2,BC), V(8B,49,3C,28), V(41,95,0D,FF), \
- V(71,01,A8,39), V(DE,B3,0C,08), V(9C,E4,B4,D8), V(90,C1,56,64), \
- V(61,84,CB,7B), V(70,B6,32,D5), V(74,5C,6C,48), V(42,57,B8,D0)
-
-#define V(a,b,c,d) 0x##a##b##c##d
-static const unsigned long RT0[256] = { RT };
-#undef V
-
-#define V(a,b,c,d) 0x##b##c##d##a
-static const unsigned long RT1[256] = { RT };
-#undef V
-
-#define V(a,b,c,d) 0x##c##d##a##b
-static const unsigned long RT2[256] = { RT };
-#undef V
-
-#define V(a,b,c,d) 0x##d##a##b##c
-static const unsigned long RT3[256] = { RT };
-#undef V
-
-#undef RT
-
-/*
- * Round constants
- */
-static const unsigned long RCON[10] =
-{
- 0x00000001, 0x00000002, 0x00000004, 0x00000008,
- 0x00000010, 0x00000020, 0x00000040, 0x00000080,
- 0x0000001B, 0x00000036
-};
-
-#else
-
-/*
- * Forward S-box & tables
- */
-static unsigned char FSb[256];
-static unsigned long FT0[256];
-static unsigned long FT1[256];
-static unsigned long FT2[256];
-static unsigned long FT3[256];
-
-/*
- * Reverse S-box & tables
- */
-static unsigned char RSb[256];
-static unsigned long RT0[256];
-static unsigned long RT1[256];
-static unsigned long RT2[256];
-static unsigned long RT3[256];
-
-/*
- * Round constants
- */
-static unsigned long RCON[10];
-
-/*
- * Tables generation code
- */
-#define ROTL8(x) ( ( x << 8 ) & 0xFFFFFFFF ) | ( x >> 24 )
-#define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) )
-#define MUL(x,y) ( ( x && y ) ? pow[(log[x]+log[y]) % 255] : 0 )
-
-static int aes_init_done = 0;
-
-static void aes_gen_tables( void )
-{
- int i, x, y, z;
- int pow[256];
- int log[256];
-
- /*
- * compute pow and log tables over GF(2^8)
- */
- for( i = 0, x = 1; i < 256; i++ )
- {
- pow[i] = x;
- log[x] = i;
- x = ( x ^ XTIME( x ) ) & 0xFF;
- }
-
- /*
- * calculate the round constants
- */
- for( i = 0, x = 1; i < 10; i++ )
- {
- RCON[i] = (unsigned long) x;
- x = XTIME( x ) & 0xFF;
- }
-
- /*
- * generate the forward and reverse S-boxes
- */
- FSb[0x00] = 0x63;
- RSb[0x63] = 0x00;
-
- for( i = 1; i < 256; i++ )
- {
- x = pow[255 - log[i]];
-
- y = x; y = ( (y << 1) | (y >> 7) ) & 0xFF;
- x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
- x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
- x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
- x ^= y ^ 0x63;
-
- FSb[i] = (unsigned char) x;
- RSb[x] = (unsigned char) i;
- }
-
- /*
- * generate the forward and reverse tables
- */
- for( i = 0; i < 256; i++ )
- {
- x = FSb[i];
- y = XTIME( x ) & 0xFF;
- z = ( y ^ x ) & 0xFF;
-
- FT0[i] = ( (unsigned long) y ) ^
- ( (unsigned long) x << 8 ) ^
- ( (unsigned long) x << 16 ) ^
- ( (unsigned long) z << 24 );
-
- FT1[i] = ROTL8( FT0[i] );
- FT2[i] = ROTL8( FT1[i] );
- FT3[i] = ROTL8( FT2[i] );
-
- x = RSb[i];
-
- RT0[i] = ( (unsigned long) MUL( 0x0E, x ) ) ^
- ( (unsigned long) MUL( 0x09, x ) << 8 ) ^
- ( (unsigned long) MUL( 0x0D, x ) << 16 ) ^
- ( (unsigned long) MUL( 0x0B, x ) << 24 );
-
- RT1[i] = ROTL8( RT0[i] );
- RT2[i] = ROTL8( RT1[i] );
- RT3[i] = ROTL8( RT2[i] );
- }
-}
-
-#endif
-
-/*
- * AES key schedule (encryption)
- */
-int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize )
-{
- unsigned int i;
- unsigned long *RK;
-
-#if !defined(POLARSSL_AES_ROM_TABLES)
- if( aes_init_done == 0 )
- {
- aes_gen_tables();
- aes_init_done = 1;
- }
-#endif
-
- switch( keysize )
- {
- case 128: ctx->nr = 10; break;
- case 192: ctx->nr = 12; break;
- case 256: ctx->nr = 14; break;
- default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
- }
-
-#if defined(PADLOCK_ALIGN16)
- ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
-#else
- ctx->rk = RK = ctx->buf;
-#endif
-
- for( i = 0; i < (keysize >> 5); i++ )
- {
- GET_ULONG_LE( RK[i], key, i << 2 );
- }
-
- switch( ctx->nr )
- {
- case 10:
-
- for( i = 0; i < 10; i++, RK += 4 )
- {
- RK[4] = RK[0] ^ RCON[i] ^
- ( (unsigned long) FSb[ ( RK[3] >> 8 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( RK[3] >> 16 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( RK[3] >> 24 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( RK[3] ) & 0xFF ] << 24 );
-
- RK[5] = RK[1] ^ RK[4];
- RK[6] = RK[2] ^ RK[5];
- RK[7] = RK[3] ^ RK[6];
- }
- break;
-
- case 12:
-
- for( i = 0; i < 8; i++, RK += 6 )
- {
- RK[6] = RK[0] ^ RCON[i] ^
- ( (unsigned long) FSb[ ( RK[5] >> 8 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( RK[5] >> 16 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( RK[5] >> 24 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( RK[5] ) & 0xFF ] << 24 );
-
- RK[7] = RK[1] ^ RK[6];
- RK[8] = RK[2] ^ RK[7];
- RK[9] = RK[3] ^ RK[8];
- RK[10] = RK[4] ^ RK[9];
- RK[11] = RK[5] ^ RK[10];
- }
- break;
-
- case 14:
-
- for( i = 0; i < 7; i++, RK += 8 )
- {
- RK[8] = RK[0] ^ RCON[i] ^
- ( (unsigned long) FSb[ ( RK[7] >> 8 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( RK[7] >> 16 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( RK[7] >> 24 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( RK[7] ) & 0xFF ] << 24 );
-
- RK[9] = RK[1] ^ RK[8];
- RK[10] = RK[2] ^ RK[9];
- RK[11] = RK[3] ^ RK[10];
-
- RK[12] = RK[4] ^
- ( (unsigned long) FSb[ ( RK[11] ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( RK[11] >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( RK[11] >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( RK[11] >> 24 ) & 0xFF ] << 24 );
-
- RK[13] = RK[5] ^ RK[12];
- RK[14] = RK[6] ^ RK[13];
- RK[15] = RK[7] ^ RK[14];
- }
- break;
-
- default:
-
- break;
- }
-
- return( 0 );
-}
-
-/*
- * AES key schedule (decryption)
- */
-int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize )
-{
- int i, j;
- aes_context cty;
- unsigned long *RK;
- unsigned long *SK;
- int ret;
-
- switch( keysize )
- {
- case 128: ctx->nr = 10; break;
- case 192: ctx->nr = 12; break;
- case 256: ctx->nr = 14; break;
- default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
- }
-
-#if defined(PADLOCK_ALIGN16)
- ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
-#else
- ctx->rk = RK = ctx->buf;
-#endif
-
- ret = aes_setkey_enc( &cty, key, keysize );
- if( ret != 0 )
- return( ret );
-
- SK = cty.rk + cty.nr * 4;
-
- *RK++ = *SK++;
- *RK++ = *SK++;
- *RK++ = *SK++;
- *RK++ = *SK++;
-
- for( i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8 )
- {
- for( j = 0; j < 4; j++, SK++ )
- {
- *RK++ = RT0[ FSb[ ( *SK ) & 0xFF ] ] ^
- RT1[ FSb[ ( *SK >> 8 ) & 0xFF ] ] ^
- RT2[ FSb[ ( *SK >> 16 ) & 0xFF ] ] ^
- RT3[ FSb[ ( *SK >> 24 ) & 0xFF ] ];
- }
- }
-
- *RK++ = *SK++;
- *RK++ = *SK++;
- *RK++ = *SK++;
- *RK++ = *SK++;
-
- memset( &cty, 0, sizeof( aes_context ) );
-
- return( 0 );
-}
-
-#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
-{ \
- X0 = *RK++ ^ FT0[ ( Y0 ) & 0xFF ] ^ \
- FT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
- FT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
- FT3[ ( Y3 >> 24 ) & 0xFF ]; \
- \
- X1 = *RK++ ^ FT0[ ( Y1 ) & 0xFF ] ^ \
- FT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
- FT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
- FT3[ ( Y0 >> 24 ) & 0xFF ]; \
- \
- X2 = *RK++ ^ FT0[ ( Y2 ) & 0xFF ] ^ \
- FT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
- FT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
- FT3[ ( Y1 >> 24 ) & 0xFF ]; \
- \
- X3 = *RK++ ^ FT0[ ( Y3 ) & 0xFF ] ^ \
- FT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
- FT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
- FT3[ ( Y2 >> 24 ) & 0xFF ]; \
-}
-
-#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
-{ \
- X0 = *RK++ ^ RT0[ ( Y0 ) & 0xFF ] ^ \
- RT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
- RT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
- RT3[ ( Y1 >> 24 ) & 0xFF ]; \
- \
- X1 = *RK++ ^ RT0[ ( Y1 ) & 0xFF ] ^ \
- RT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
- RT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
- RT3[ ( Y2 >> 24 ) & 0xFF ]; \
- \
- X2 = *RK++ ^ RT0[ ( Y2 ) & 0xFF ] ^ \
- RT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
- RT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
- RT3[ ( Y3 >> 24 ) & 0xFF ]; \
- \
- X3 = *RK++ ^ RT0[ ( Y3 ) & 0xFF ] ^ \
- RT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
- RT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
- RT3[ ( Y0 >> 24 ) & 0xFF ]; \
-}
-
-/*
- * AES-ECB block encryption/decryption
- */
-int aes_crypt_ecb( aes_context *ctx,
- int mode,
- const unsigned char input[16],
- unsigned char output[16] )
-{
- int i;
- unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
-
-#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
- if( padlock_supports( PADLOCK_ACE ) )
- {
- if( padlock_xcryptecb( ctx, mode, input, output ) == 0 )
- return( 0 );
-
- // If padlock data misaligned, we just fall back to
- // unaccelerated mode
- //
- }
-#endif
-
- RK = ctx->rk;
-
- GET_ULONG_LE( X0, input, 0 ); X0 ^= *RK++;
- GET_ULONG_LE( X1, input, 4 ); X1 ^= *RK++;
- GET_ULONG_LE( X2, input, 8 ); X2 ^= *RK++;
- GET_ULONG_LE( X3, input, 12 ); X3 ^= *RK++;
-
- if( mode == AES_DECRYPT )
- {
- for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
- {
- AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
- AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
- }
-
- AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
-
- X0 = *RK++ ^ \
- ( (unsigned long) RSb[ ( Y0 ) & 0xFF ] ) ^
- ( (unsigned long) RSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) RSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) RSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
-
- X1 = *RK++ ^ \
- ( (unsigned long) RSb[ ( Y1 ) & 0xFF ] ) ^
- ( (unsigned long) RSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) RSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) RSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
-
- X2 = *RK++ ^ \
- ( (unsigned long) RSb[ ( Y2 ) & 0xFF ] ) ^
- ( (unsigned long) RSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) RSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) RSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
-
- X3 = *RK++ ^ \
- ( (unsigned long) RSb[ ( Y3 ) & 0xFF ] ) ^
- ( (unsigned long) RSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) RSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) RSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
- }
- else /* AES_ENCRYPT */
- {
- for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
- {
- AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
- AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
- }
-
- AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
-
- X0 = *RK++ ^ \
- ( (unsigned long) FSb[ ( Y0 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
-
- X1 = *RK++ ^ \
- ( (unsigned long) FSb[ ( Y1 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
-
- X2 = *RK++ ^ \
- ( (unsigned long) FSb[ ( Y2 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
-
- X3 = *RK++ ^ \
- ( (unsigned long) FSb[ ( Y3 ) & 0xFF ] ) ^
- ( (unsigned long) FSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
- ( (unsigned long) FSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
- ( (unsigned long) FSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
- }
-
- PUT_ULONG_LE( X0, output, 0 );
- PUT_ULONG_LE( X1, output, 4 );
- PUT_ULONG_LE( X2, output, 8 );
- PUT_ULONG_LE( X3, output, 12 );
-
- return( 0 );
-}
-
-/*
- * AES-CBC buffer encryption/decryption
- */
-int aes_crypt_cbc( aes_context *ctx,
- int mode,
- size_t length,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output )
-{
- int i;
- unsigned char temp[16];
-
- if( length % 16 )
- return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH );
-
-#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
- if( padlock_supports( PADLOCK_ACE ) )
- {
- if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 )
- return( 0 );
-
- // If padlock data misaligned, we just fall back to
- // unaccelerated mode
- //
- }
-#endif
-
- if( mode == AES_DECRYPT )
- {
- while( length > 0 )
- {
- memcpy( temp, input, 16 );
- aes_crypt_ecb( ctx, mode, input, output );
-
- for( i = 0; i < 16; i++ )
- output[i] = (unsigned char)( output[i] ^ iv[i] );
-
- memcpy( iv, temp, 16 );
-
- input += 16;
- output += 16;
- length -= 16;
- }
- }
- else
- {
- while( length > 0 )
- {
- for( i = 0; i < 16; i++ )
- output[i] = (unsigned char)( input[i] ^ iv[i] );
-
- aes_crypt_ecb( ctx, mode, output, output );
- memcpy( iv, output, 16 );
-
- input += 16;
- output += 16;
- length -= 16;
- }
- }
-
- return( 0 );
-}
-
-#if defined(POLARSSL_CIPHER_MODE_CFB)
-/*
- * AES-CFB128 buffer encryption/decryption
- */
-int aes_crypt_cfb128( aes_context *ctx,
- int mode,
- size_t length,
- size_t *iv_off,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output )
-{
- int c;
- size_t n = *iv_off;
-
- if( mode == AES_DECRYPT )
- {
- while( length-- )
- {
- if( n == 0 )
- aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv );
-
- c = *input++;
- *output++ = (unsigned char)( c ^ iv[n] );
- iv[n] = (unsigned char) c;
-
- n = (n + 1) & 0x0F;
- }
- }
- else
- {
- while( length-- )
- {
- if( n == 0 )
- aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv );
-
- iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ );
-
- n = (n + 1) & 0x0F;
- }
- }
-
- *iv_off = n;
-
- return( 0 );
-}
-#endif /*POLARSSL_CIPHER_MODE_CFB */
-
-#if defined(POLARSSL_CIPHER_MODE_CTR)
-/*
- * AES-CTR buffer encryption/decryption
- */
-int aes_crypt_ctr( aes_context *ctx,
- size_t length,
- size_t *nc_off,
- unsigned char nonce_counter[16],
- unsigned char stream_block[16],
- const unsigned char *input,
- unsigned char *output )
-{
- int c, i, cb;
- size_t n = *nc_off;
-
- while( length-- )
- {
- if( n == 0 ) {
- aes_crypt_ecb( ctx, AES_ENCRYPT, nonce_counter, stream_block );
-
- i = 15;
- do {
- nonce_counter[i]++;
- cb = nonce_counter[i] == 0;
- } while( i-- && cb );
-
- }
- c = *input++;
- *output++ = (unsigned char)( c ^ stream_block[n] );
-
- n = (n + 1) & 0x0F;
- }
-
- *nc_off = n;
-
- return( 0 );
-}
-#endif /* POLARSSL_CIPHER_MODE_CTR */
-
-#if defined(POLARSSL_SELF_TEST)
-
-#include <stdio.h>
-
-/*
- * AES test vectors from:
- *
- * http://csrc.nist.gov/archive/aes/rijndael/rijndael-vals.zip
- */
-static const unsigned char aes_test_ecb_dec[3][16] =
-{
- { 0x44, 0x41, 0x6A, 0xC2, 0xD1, 0xF5, 0x3C, 0x58,
- 0x33, 0x03, 0x91, 0x7E, 0x6B, 0xE9, 0xEB, 0xE0 },
- { 0x48, 0xE3, 0x1E, 0x9E, 0x25, 0x67, 0x18, 0xF2,
- 0x92, 0x29, 0x31, 0x9C, 0x19, 0xF1, 0x5B, 0xA4 },
- { 0x05, 0x8C, 0xCF, 0xFD, 0xBB, 0xCB, 0x38, 0x2D,
- 0x1F, 0x6F, 0x56, 0x58, 0x5D, 0x8A, 0x4A, 0xDE }
-};
-
-static const unsigned char aes_test_ecb_enc[3][16] =
-{
- { 0xC3, 0x4C, 0x05, 0x2C, 0xC0, 0xDA, 0x8D, 0x73,
- 0x45, 0x1A, 0xFE, 0x5F, 0x03, 0xBE, 0x29, 0x7F },
- { 0xF3, 0xF6, 0x75, 0x2A, 0xE8, 0xD7, 0x83, 0x11,
- 0x38, 0xF0, 0x41, 0x56, 0x06, 0x31, 0xB1, 0x14 },
- { 0x8B, 0x79, 0xEE, 0xCC, 0x93, 0xA0, 0xEE, 0x5D,
- 0xFF, 0x30, 0xB4, 0xEA, 0x21, 0x63, 0x6D, 0xA4 }
-};
-
-static const unsigned char aes_test_cbc_dec[3][16] =
-{
- { 0xFA, 0xCA, 0x37, 0xE0, 0xB0, 0xC8, 0x53, 0x73,
- 0xDF, 0x70, 0x6E, 0x73, 0xF7, 0xC9, 0xAF, 0x86 },
- { 0x5D, 0xF6, 0x78, 0xDD, 0x17, 0xBA, 0x4E, 0x75,
- 0xB6, 0x17, 0x68, 0xC6, 0xAD, 0xEF, 0x7C, 0x7B },
- { 0x48, 0x04, 0xE1, 0x81, 0x8F, 0xE6, 0x29, 0x75,
- 0x19, 0xA3, 0xE8, 0x8C, 0x57, 0x31, 0x04, 0x13 }
-};
-
-static const unsigned char aes_test_cbc_enc[3][16] =
-{
- { 0x8A, 0x05, 0xFC, 0x5E, 0x09, 0x5A, 0xF4, 0x84,
- 0x8A, 0x08, 0xD3, 0x28, 0xD3, 0x68, 0x8E, 0x3D },
- { 0x7B, 0xD9, 0x66, 0xD5, 0x3A, 0xD8, 0xC1, 0xBB,
- 0x85, 0xD2, 0xAD, 0xFA, 0xE8, 0x7B, 0xB1, 0x04 },
- { 0xFE, 0x3C, 0x53, 0x65, 0x3E, 0x2F, 0x45, 0xB5,
- 0x6F, 0xCD, 0x88, 0xB2, 0xCC, 0x89, 0x8F, 0xF0 }
-};
-
-#if defined(POLARSSL_CIPHER_MODE_CFB)
-/*
- * AES-CFB128 test vectors from:
- *
- * http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
- */
-static const unsigned char aes_test_cfb128_key[3][32] =
-{
- { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
- 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C },
- { 0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52,
- 0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5,
- 0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B },
- { 0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
- 0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
- 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
- 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4 }
-};
-
-static const unsigned char aes_test_cfb128_iv[16] =
-{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
-};
-
-static const unsigned char aes_test_cfb128_pt[64] =
-{
- 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
- 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
- 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
- 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
- 0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
- 0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
- 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
- 0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10
-};
-
-static const unsigned char aes_test_cfb128_ct[3][64] =
-{
- { 0x3B, 0x3F, 0xD9, 0x2E, 0xB7, 0x2D, 0xAD, 0x20,
- 0x33, 0x34, 0x49, 0xF8, 0xE8, 0x3C, 0xFB, 0x4A,
- 0xC8, 0xA6, 0x45, 0x37, 0xA0, 0xB3, 0xA9, 0x3F,
- 0xCD, 0xE3, 0xCD, 0xAD, 0x9F, 0x1C, 0xE5, 0x8B,
- 0x26, 0x75, 0x1F, 0x67, 0xA3, 0xCB, 0xB1, 0x40,
- 0xB1, 0x80, 0x8C, 0xF1, 0x87, 0xA4, 0xF4, 0xDF,
- 0xC0, 0x4B, 0x05, 0x35, 0x7C, 0x5D, 0x1C, 0x0E,
- 0xEA, 0xC4, 0xC6, 0x6F, 0x9F, 0xF7, 0xF2, 0xE6 },
- { 0xCD, 0xC8, 0x0D, 0x6F, 0xDD, 0xF1, 0x8C, 0xAB,
- 0x34, 0xC2, 0x59, 0x09, 0xC9, 0x9A, 0x41, 0x74,
- 0x67, 0xCE, 0x7F, 0x7F, 0x81, 0x17, 0x36, 0x21,
- 0x96, 0x1A, 0x2B, 0x70, 0x17, 0x1D, 0x3D, 0x7A,
- 0x2E, 0x1E, 0x8A, 0x1D, 0xD5, 0x9B, 0x88, 0xB1,
- 0xC8, 0xE6, 0x0F, 0xED, 0x1E, 0xFA, 0xC4, 0xC9,
- 0xC0, 0x5F, 0x9F, 0x9C, 0xA9, 0x83, 0x4F, 0xA0,
- 0x42, 0xAE, 0x8F, 0xBA, 0x58, 0x4B, 0x09, 0xFF },
- { 0xDC, 0x7E, 0x84, 0xBF, 0xDA, 0x79, 0x16, 0x4B,
- 0x7E, 0xCD, 0x84, 0x86, 0x98, 0x5D, 0x38, 0x60,
- 0x39, 0xFF, 0xED, 0x14, 0x3B, 0x28, 0xB1, 0xC8,
- 0x32, 0x11, 0x3C, 0x63, 0x31, 0xE5, 0x40, 0x7B,
- 0xDF, 0x10, 0x13, 0x24, 0x15, 0xE5, 0x4B, 0x92,
- 0xA1, 0x3E, 0xD0, 0xA8, 0x26, 0x7A, 0xE2, 0xF9,
- 0x75, 0xA3, 0x85, 0x74, 0x1A, 0xB9, 0xCE, 0xF8,
- 0x20, 0x31, 0x62, 0x3D, 0x55, 0xB1, 0xE4, 0x71 }
-};
-#endif /* POLARSSL_CIPHER_MODE_CFB */
-
-#if defined(POLARSSL_CIPHER_MODE_CTR)
-/*
- * AES-CTR test vectors from:
- *
- * http://www.faqs.org/rfcs/rfc3686.html
- */
-
-static const unsigned char aes_test_ctr_key[3][16] =
-{
- { 0xAE, 0x68, 0x52, 0xF8, 0x12, 0x10, 0x67, 0xCC,
- 0x4B, 0xF7, 0xA5, 0x76, 0x55, 0x77, 0xF3, 0x9E },
- { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7,
- 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63 },
- { 0x76, 0x91, 0xBE, 0x03, 0x5E, 0x50, 0x20, 0xA8,
- 0xAC, 0x6E, 0x61, 0x85, 0x29, 0xF9, 0xA0, 0xDC }
-};
-
-static const unsigned char aes_test_ctr_nonce_counter[3][16] =
-{
- { 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
- { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59,
- 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 },
- { 0x00, 0xE0, 0x01, 0x7B, 0x27, 0x77, 0x7F, 0x3F,
- 0x4A, 0x17, 0x86, 0xF0, 0x00, 0x00, 0x00, 0x01 }
-};
-
-static const unsigned char aes_test_ctr_pt[3][48] =
-{
- { 0x53, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x20, 0x62,
- 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x6D, 0x73, 0x67 },
-
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
-
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23 }
-};
-
-static const unsigned char aes_test_ctr_ct[3][48] =
-{
- { 0xE4, 0x09, 0x5D, 0x4F, 0xB7, 0xA7, 0xB3, 0x79,
- 0x2D, 0x61, 0x75, 0xA3, 0x26, 0x13, 0x11, 0xB8 },
- { 0x51, 0x04, 0xA1, 0x06, 0x16, 0x8A, 0x72, 0xD9,
- 0x79, 0x0D, 0x41, 0xEE, 0x8E, 0xDA, 0xD3, 0x88,
- 0xEB, 0x2E, 0x1E, 0xFC, 0x46, 0xDA, 0x57, 0xC8,
- 0xFC, 0xE6, 0x30, 0xDF, 0x91, 0x41, 0xBE, 0x28 },
- { 0xC1, 0xCF, 0x48, 0xA8, 0x9F, 0x2F, 0xFD, 0xD9,
- 0xCF, 0x46, 0x52, 0xE9, 0xEF, 0xDB, 0x72, 0xD7,
- 0x45, 0x40, 0xA4, 0x2B, 0xDE, 0x6D, 0x78, 0x36,
- 0xD5, 0x9A, 0x5C, 0xEA, 0xAE, 0xF3, 0x10, 0x53,
- 0x25, 0xB2, 0x07, 0x2F }
-};
-
-static const int aes_test_ctr_len[3] =
- { 16, 32, 36 };
-#endif /* POLARSSL_CIPHER_MODE_CTR */
-
-/*
- * Checkup routine
- */
-int aes_self_test( int verbose )
-{
- int i, j, u, v;
- unsigned char key[32];
- unsigned char buf[64];
- unsigned char prv[16];
- unsigned char iv[16];
-#if defined(POLARSSL_CIPHER_MODE_CTR) || defined(POLARSSL_CIPHER_MODE_CFB)
- size_t offset;
-#endif
-#if defined(POLARSSL_CIPHER_MODE_CTR)
- int len;
- unsigned char nonce_counter[16];
- unsigned char stream_block[16];
-#endif
- aes_context ctx;
-
- memset( key, 0, 32 );
-
- /*
- * ECB mode
- */
- for( i = 0; i < 6; i++ )
- {
- u = i >> 1;
- v = i & 1;
-
- if( verbose != 0 )
- printf( " AES-ECB-%3d (%s): ", 128 + u * 64,
- ( v == AES_DECRYPT ) ? "dec" : "enc" );
-
- memset( buf, 0, 16 );
-
- if( v == AES_DECRYPT )
- {
- aes_setkey_dec( &ctx, key, 128 + u * 64 );
-
- for( j = 0; j < 10000; j++ )
- aes_crypt_ecb( &ctx, v, buf, buf );
-
- if( memcmp( buf, aes_test_ecb_dec[u], 16 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
- else
- {
- aes_setkey_enc( &ctx, key, 128 + u * 64 );
-
- for( j = 0; j < 10000; j++ )
- aes_crypt_ecb( &ctx, v, buf, buf );
-
- if( memcmp( buf, aes_test_ecb_enc[u], 16 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
- }
-
- if( verbose != 0 )
- printf( "\n" );
-
- /*
- * CBC mode
- */
- for( i = 0; i < 6; i++ )
- {
- u = i >> 1;
- v = i & 1;
-
- if( verbose != 0 )
- printf( " AES-CBC-%3d (%s): ", 128 + u * 64,
- ( v == AES_DECRYPT ) ? "dec" : "enc" );
-
- memset( iv , 0, 16 );
- memset( prv, 0, 16 );
- memset( buf, 0, 16 );
-
- if( v == AES_DECRYPT )
- {
- aes_setkey_dec( &ctx, key, 128 + u * 64 );
-
- for( j = 0; j < 10000; j++ )
- aes_crypt_cbc( &ctx, v, 16, iv, buf, buf );
-
- if( memcmp( buf, aes_test_cbc_dec[u], 16 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
- else
- {
- aes_setkey_enc( &ctx, key, 128 + u * 64 );
-
- for( j = 0; j < 10000; j++ )
- {
- unsigned char tmp[16];
-
- aes_crypt_cbc( &ctx, v, 16, iv, buf, buf );
-
- memcpy( tmp, prv, 16 );
- memcpy( prv, buf, 16 );
- memcpy( buf, tmp, 16 );
- }
-
- if( memcmp( prv, aes_test_cbc_enc[u], 16 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
- }
-
- if( verbose != 0 )
- printf( "\n" );
-
-#if defined(POLARSSL_CIPHER_MODE_CFB)
- /*
- * CFB128 mode
- */
- for( i = 0; i < 6; i++ )
- {
- u = i >> 1;
- v = i & 1;
-
- if( verbose != 0 )
- printf( " AES-CFB128-%3d (%s): ", 128 + u * 64,
- ( v == AES_DECRYPT ) ? "dec" : "enc" );
-
- memcpy( iv, aes_test_cfb128_iv, 16 );
- memcpy( key, aes_test_cfb128_key[u], 16 + u * 8 );
-
- offset = 0;
- aes_setkey_enc( &ctx, key, 128 + u * 64 );
-
- if( v == AES_DECRYPT )
- {
- memcpy( buf, aes_test_cfb128_ct[u], 64 );
- aes_crypt_cfb128( &ctx, v, 64, &offset, iv, buf, buf );
-
- if( memcmp( buf, aes_test_cfb128_pt, 64 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
- else
- {
- memcpy( buf, aes_test_cfb128_pt, 64 );
- aes_crypt_cfb128( &ctx, v, 64, &offset, iv, buf, buf );
-
- if( memcmp( buf, aes_test_cfb128_ct[u], 64 ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
- }
-
- if( verbose != 0 )
- printf( "\n" );
-#endif /* POLARSSL_CIPHER_MODE_CFB */
-
-#if defined(POLARSSL_CIPHER_MODE_CTR)
- /*
- * CTR mode
- */
- for( i = 0; i < 6; i++ )
- {
- u = i >> 1;
- v = i & 1;
-
- if( verbose != 0 )
- printf( " AES-CTR-128 (%s): ",
- ( v == AES_DECRYPT ) ? "dec" : "enc" );
-
- memcpy( nonce_counter, aes_test_ctr_nonce_counter[u], 16 );
- memcpy( key, aes_test_ctr_key[u], 16 );
-
- offset = 0;
- aes_setkey_enc( &ctx, key, 128 );
-
- if( v == AES_DECRYPT )
- {
- len = aes_test_ctr_len[u];
- memcpy( buf, aes_test_ctr_ct[u], len );
-
- aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
-
- if( memcmp( buf, aes_test_ctr_pt[u], len ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
- else
- {
- len = aes_test_ctr_len[u];
- memcpy( buf, aes_test_ctr_pt[u], len );
-
- aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
-
- if( memcmp( buf, aes_test_ctr_ct[u], len ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
- }
-
- if( verbose != 0 )
- printf( "\n" );
-#endif /* POLARSSL_CIPHER_MODE_CTR */
-
- return( 0 );
-}
-
-#endif
-
-#endif
diff --git a/protocols/Tlen/crypto/bignum.c b/protocols/Tlen/crypto/bignum.c
deleted file mode 100644
index eabfbfe6f9..0000000000
--- a/protocols/Tlen/crypto/bignum.c
+++ /dev/null
@@ -1,2097 +0,0 @@
-/*
- * Multi-precision integer library
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-/*
- * This MPI implementation is based on:
- *
- * http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
- * http://www.stillhq.com/extracted/gnupg-api/mpi/
- * http://math.libtomcrypt.com/files/tommath.pdf
- */
-
-#include "polarssl/config.h"
-
-#if defined(POLARSSL_BIGNUM_C)
-
-#include "polarssl/bignum.h"
-#include "polarssl/bn_mul.h"
-
-#include <stdlib.h>
-
-#define ciL (sizeof(t_uint)) /* chars in limb */
-#define biL (ciL << 3) /* bits in limb */
-#define biH (ciL << 2) /* half limb size */
-
-/*
- * Convert between bits/chars and number of limbs
- */
-#define BITS_TO_LIMBS(i) (((i) + biL - 1) / biL)
-#define CHARS_TO_LIMBS(i) (((i) + ciL - 1) / ciL)
-
-/*
- * Initialize one MPI
- */
-void mpi_init( mpi *X )
-{
- if( X == NULL )
- return;
-
- X->s = 1;
- X->n = 0;
- X->p = NULL;
-}
-
-/*
- * Unallocate one MPI
- */
-void mpi_free( mpi *X )
-{
- if( X == NULL )
- return;
-
- if( X->p != NULL )
- {
- memset( X->p, 0, X->n * ciL );
- free( X->p );
- }
-
- X->s = 1;
- X->n = 0;
- X->p = NULL;
-}
-
-/*
- * Enlarge to the specified number of limbs
- */
-int mpi_grow( mpi *X, size_t nblimbs )
-{
- t_uint *p;
-
- if( nblimbs > POLARSSL_MPI_MAX_LIMBS )
- return( 1 );
-
- if( X->n < nblimbs )
- {
- if( ( p = (t_uint *) malloc( nblimbs * ciL ) ) == NULL )
- return( 1 );
-
- memset( p, 0, nblimbs * ciL );
-
- if( X->p != NULL )
- {
- memcpy( p, X->p, X->n * ciL );
- memset( X->p, 0, X->n * ciL );
- free( X->p );
- }
-
- X->n = nblimbs;
- X->p = p;
- }
-
- return( 0 );
-}
-
-/*
- * Copy the contents of Y into X
- */
-int mpi_copy( mpi *X, const mpi *Y )
-{
- int ret;
- size_t i;
-
- if( X == Y )
- return( 0 );
-
- for( i = Y->n - 1; i > 0; i-- )
- if( Y->p[i] != 0 )
- break;
- i++;
-
- X->s = Y->s;
-
- MPI_CHK( mpi_grow( X, i ) );
-
- memset( X->p, 0, X->n * ciL );
- memcpy( X->p, Y->p, i * ciL );
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Swap the contents of X and Y
- */
-void mpi_swap( mpi *X, mpi *Y )
-{
- mpi T;
-
- memcpy( &T, X, sizeof( mpi ) );
- memcpy( X, Y, sizeof( mpi ) );
- memcpy( Y, &T, sizeof( mpi ) );
-}
-
-/*
- * Set value from integer
- */
-int mpi_lset( mpi *X, t_sint z )
-{
- int ret;
-
- MPI_CHK( mpi_grow( X, 1 ) );
- memset( X->p, 0, X->n * ciL );
-
- X->p[0] = ( z < 0 ) ? -z : z;
- X->s = ( z < 0 ) ? -1 : 1;
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Get a specific bit
- */
-int mpi_get_bit( mpi *X, size_t pos )
-{
- if( X->n * biL <= pos )
- return( 0 );
-
- return ( X->p[pos / biL] >> ( pos % biL ) ) & 0x01;
-}
-
-/*
- * Set a bit to a specific value of 0 or 1
- */
-int mpi_set_bit( mpi *X, size_t pos, unsigned char val )
-{
- int ret = 0;
- size_t off = pos / biL;
- size_t idx = pos % biL;
-
- if( val != 0 && val != 1 )
- return POLARSSL_ERR_MPI_BAD_INPUT_DATA;
-
- if( X->n * biL <= pos )
- {
- if( val == 0 )
- return ( 0 );
-
- MPI_CHK( mpi_grow( X, off + 1 ) );
- }
-
- X->p[off] = ( X->p[off] & ~( 0x01 << idx ) ) | ( val << idx );
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Return the number of least significant bits
- */
-size_t mpi_lsb( const mpi *X )
-{
- size_t i, j, count = 0;
-
- for( i = 0; i < X->n; i++ )
- for( j = 0; j < biL; j++, count++ )
- if( ( ( X->p[i] >> j ) & 1 ) != 0 )
- return( count );
-
- return( 0 );
-}
-
-/*
- * Return the number of most significant bits
- */
-size_t mpi_msb( const mpi *X )
-{
- size_t i, j;
-
- for( i = X->n - 1; i > 0; i-- )
- if( X->p[i] != 0 )
- break;
-
- for( j = biL; j > 0; j-- )
- if( ( ( X->p[i] >> ( j - 1 ) ) & 1 ) != 0 )
- break;
-
- return( ( i * biL ) + j );
-}
-
-/*
- * Return the total size in bytes
- */
-size_t mpi_size( const mpi *X )
-{
- return( ( mpi_msb( X ) + 7 ) >> 3 );
-}
-
-/*
- * Convert an ASCII character to digit value
- */
-static int mpi_get_digit( t_uint *d, int radix, char c )
-{
- *d = 255;
-
- if( c >= 0x30 && c <= 0x39 ) *d = c - 0x30;
- if( c >= 0x41 && c <= 0x46 ) *d = c - 0x37;
- if( c >= 0x61 && c <= 0x66 ) *d = c - 0x57;
-
- if( *d >= (t_uint) radix )
- return( POLARSSL_ERR_MPI_INVALID_CHARACTER );
-
- return( 0 );
-}
-
-/*
- * Import from an ASCII string
- */
-int mpi_read_string( mpi *X, int radix, const char *s )
-{
- int ret;
- size_t i, j, slen, n;
- t_uint d;
- mpi T;
-
- if( radix < 2 || radix > 16 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- mpi_init( &T );
-
- slen = strlen( s );
-
- if( radix == 16 )
- {
- n = BITS_TO_LIMBS( slen << 2 );
-
- MPI_CHK( mpi_grow( X, n ) );
- MPI_CHK( mpi_lset( X, 0 ) );
-
- for( i = slen, j = 0; i > 0; i--, j++ )
- {
- if( i == 1 && s[i - 1] == '-' )
- {
- X->s = -1;
- break;
- }
-
- MPI_CHK( mpi_get_digit( &d, radix, s[i - 1] ) );
- X->p[j / (2 * ciL)] |= d << ( (j % (2 * ciL)) << 2 );
- }
- }
- else
- {
- MPI_CHK( mpi_lset( X, 0 ) );
-
- for( i = 0; i < slen; i++ )
- {
- if( i == 0 && s[i] == '-' )
- {
- X->s = -1;
- continue;
- }
-
- MPI_CHK( mpi_get_digit( &d, radix, s[i] ) );
- MPI_CHK( mpi_mul_int( &T, X, radix ) );
-
- if( X->s == 1 )
- {
- MPI_CHK( mpi_add_int( X, &T, d ) );
- }
- else
- {
- MPI_CHK( mpi_sub_int( X, &T, d ) );
- }
- }
- }
-
-cleanup:
-
- mpi_free( &T );
-
- return( ret );
-}
-
-/*
- * Helper to write the digits high-order first
- */
-static int mpi_write_hlp( mpi *X, int radix, char **p )
-{
- int ret;
- t_uint r;
-
- if( radix < 2 || radix > 16 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- MPI_CHK( mpi_mod_int( &r, X, radix ) );
- MPI_CHK( mpi_div_int( X, NULL, X, radix ) );
-
- if( mpi_cmp_int( X, 0 ) != 0 )
- MPI_CHK( mpi_write_hlp( X, radix, p ) );
-
- if( r < 10 )
- *(*p)++ = (char)( r + 0x30 );
- else
- *(*p)++ = (char)( r + 0x37 );
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Export into an ASCII string
- */
-int mpi_write_string( const mpi *X, int radix, char *s, size_t *slen )
-{
- int ret = 0;
- size_t n;
- char *p;
- mpi T;
-
- if( radix < 2 || radix > 16 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- n = mpi_msb( X );
- if( radix >= 4 ) n >>= 1;
- if( radix >= 16 ) n >>= 1;
- n += 3;
-
- if( *slen < n )
- {
- *slen = n;
- return( POLARSSL_ERR_MPI_BUFFER_TOO_SMALL );
- }
-
- p = s;
- mpi_init( &T );
-
- if( X->s == -1 )
- *p++ = '-';
-
- if( radix == 16 )
- {
- int c;
- size_t i, j, k;
-
- for( i = X->n, k = 0; i > 0; i-- )
- {
- for( j = ciL; j > 0; j-- )
- {
- c = ( X->p[i - 1] >> ( ( j - 1 ) << 3) ) & 0xFF;
-
- if( c == 0 && k == 0 && ( i + j + 3 ) != 0 )
- continue;
-
- p += sprintf( p, "%02X", c );
- k = 1;
- }
- }
- }
- else
- {
- MPI_CHK( mpi_copy( &T, X ) );
-
- if( T.s == -1 )
- T.s = 1;
-
- MPI_CHK( mpi_write_hlp( &T, radix, &p ) );
- }
-
- *p++ = '\0';
- *slen = p - s;
-
-cleanup:
-
- mpi_free( &T );
-
- return( ret );
-}
-
-#if defined(POLARSSL_FS_IO)
-/*
- * Read X from an opened file
- */
-int mpi_read_file( mpi *X, int radix, FILE *fin )
-{
- t_uint d;
- size_t slen;
- char *p;
- char s[1024];
-
- memset( s, 0, sizeof( s ) );
- if( fgets( s, sizeof( s ) - 1, fin ) == NULL )
- return( POLARSSL_ERR_MPI_FILE_IO_ERROR );
-
- slen = strlen( s );
- if( s[slen - 1] == '\n' ) { slen--; s[slen] = '\0'; }
- if( s[slen - 1] == '\r' ) { slen--; s[slen] = '\0'; }
-
- p = s + slen;
- while( --p >= s )
- if( mpi_get_digit( &d, radix, *p ) != 0 )
- break;
-
- return( mpi_read_string( X, radix, p + 1 ) );
-}
-
-/*
- * Write X into an opened file (or stdout if fout == NULL)
- */
-int mpi_write_file( const char *p, const mpi *X, int radix, FILE *fout )
-{
- int ret;
- size_t n, slen, plen;
- char s[2048];
-
- n = sizeof( s );
- memset( s, 0, n );
- n -= 2;
-
- MPI_CHK( mpi_write_string( X, radix, s, (size_t *) &n ) );
-
- if( p == NULL ) p = "";
-
- plen = strlen( p );
- slen = strlen( s );
- s[slen++] = '\r';
- s[slen++] = '\n';
-
- if( fout != NULL )
- {
- if( fwrite( p, 1, plen, fout ) != plen ||
- fwrite( s, 1, slen, fout ) != slen )
- return( POLARSSL_ERR_MPI_FILE_IO_ERROR );
- }
- else
- printf( "%s%s", p, s );
-
-cleanup:
-
- return( ret );
-}
-#endif /* POLARSSL_FS_IO */
-
-/*
- * Import X from unsigned binary data, big endian
- */
-int mpi_read_binary( mpi *X, const unsigned char *buf, size_t buflen )
-{
- int ret;
- size_t i, j, n;
-
- for( n = 0; n < buflen; n++ )
- if( buf[n] != 0 )
- break;
-
- MPI_CHK( mpi_grow( X, CHARS_TO_LIMBS( buflen - n ) ) );
- MPI_CHK( mpi_lset( X, 0 ) );
-
- for( i = buflen, j = 0; i > n; i--, j++ )
- X->p[j / ciL] |= ((t_uint) buf[i - 1]) << ((j % ciL) << 3);
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Export X into unsigned binary data, big endian
- */
-int mpi_write_binary( const mpi *X, unsigned char *buf, size_t buflen )
-{
- size_t i, j, n;
-
- n = mpi_size( X );
-
- if( buflen < n )
- return( POLARSSL_ERR_MPI_BUFFER_TOO_SMALL );
-
- memset( buf, 0, buflen );
-
- for( i = buflen - 1, j = 0; n > 0; i--, j++, n-- )
- buf[i] = (unsigned char)( X->p[j / ciL] >> ((j % ciL) << 3) );
-
- return( 0 );
-}
-
-/*
- * Left-shift: X <<= count
- */
-int mpi_shift_l( mpi *X, size_t count )
-{
- int ret;
- size_t i, v0, t1;
- t_uint r0 = 0, r1;
-
- v0 = count / (biL );
- t1 = count & (biL - 1);
-
- i = mpi_msb( X ) + count;
-
- if( X->n * biL < i )
- MPI_CHK( mpi_grow( X, BITS_TO_LIMBS( i ) ) );
-
- ret = 0;
-
- /*
- * shift by count / limb_size
- */
- if( v0 > 0 )
- {
- for( i = X->n; i > v0; i-- )
- X->p[i - 1] = X->p[i - v0 - 1];
-
- for( ; i > 0; i-- )
- X->p[i - 1] = 0;
- }
-
- /*
- * shift by count % limb_size
- */
- if( t1 > 0 )
- {
- for( i = v0; i < X->n; i++ )
- {
- r1 = X->p[i] >> (biL - t1);
- X->p[i] <<= t1;
- X->p[i] |= r0;
- r0 = r1;
- }
- }
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Right-shift: X >>= count
- */
-int mpi_shift_r( mpi *X, size_t count )
-{
- size_t i, v0, v1;
- t_uint r0 = 0, r1;
-
- v0 = count / biL;
- v1 = count & (biL - 1);
-
- /*
- * shift by count / limb_size
- */
- if( v0 > 0 )
- {
- for( i = 0; i < X->n - v0; i++ )
- X->p[i] = X->p[i + v0];
-
- for( ; i < X->n; i++ )
- X->p[i] = 0;
- }
-
- /*
- * shift by count % limb_size
- */
- if( v1 > 0 )
- {
- for( i = X->n; i > 0; i-- )
- {
- r1 = X->p[i - 1] << (biL - v1);
- X->p[i - 1] >>= v1;
- X->p[i - 1] |= r0;
- r0 = r1;
- }
- }
-
- return( 0 );
-}
-
-/*
- * Compare unsigned values
- */
-int mpi_cmp_abs( const mpi *X, const mpi *Y )
-{
- size_t i, j;
-
- for( i = X->n; i > 0; i-- )
- if( X->p[i - 1] != 0 )
- break;
-
- for( j = Y->n; j > 0; j-- )
- if( Y->p[j - 1] != 0 )
- break;
-
- if( i == 0 && j == 0 )
- return( 0 );
-
- if( i > j ) return( 1 );
- if( j > i ) return( -1 );
-
- for( ; i > 0; i-- )
- {
- if( X->p[i - 1] > Y->p[i - 1] ) return( 1 );
- if( X->p[i - 1] < Y->p[i - 1] ) return( -1 );
- }
-
- return( 0 );
-}
-
-/*
- * Compare signed values
- */
-int mpi_cmp_mpi( const mpi *X, const mpi *Y )
-{
- size_t i, j;
-
- for( i = X->n; i > 0; i-- )
- if( X->p[i - 1] != 0 )
- break;
-
- for( j = Y->n; j > 0; j-- )
- if( Y->p[j - 1] != 0 )
- break;
-
- if( i == 0 && j == 0 )
- return( 0 );
-
- if( i > j ) return( X->s );
- if( j > i ) return( -X->s );
-
- if( X->s > 0 && Y->s < 0 ) return( 1 );
- if( Y->s > 0 && X->s < 0 ) return( -1 );
-
- for( ; i > 0; i-- )
- {
- if( X->p[i - 1] > Y->p[i - 1] ) return( X->s );
- if( X->p[i - 1] < Y->p[i - 1] ) return( -X->s );
- }
-
- return( 0 );
-}
-
-/*
- * Compare signed values
- */
-int mpi_cmp_int( const mpi *X, t_sint z )
-{
- mpi Y;
- t_uint p[1];
-
- *p = ( z < 0 ) ? -z : z;
- Y.s = ( z < 0 ) ? -1 : 1;
- Y.n = 1;
- Y.p = p;
-
- return( mpi_cmp_mpi( X, &Y ) );
-}
-
-/*
- * Unsigned addition: X = |A| + |B| (HAC 14.7)
- */
-int mpi_add_abs( mpi *X, const mpi *A, const mpi *B )
-{
- int ret;
- size_t i, j;
- t_uint *o, *p, c;
-
- if( X == B )
- {
- const mpi *T = A; A = X; B = T;
- }
-
- if( X != A )
- MPI_CHK( mpi_copy( X, A ) );
-
- /*
- * X should always be positive as a result of unsigned additions.
- */
- X->s = 1;
-
- for( j = B->n; j > 0; j-- )
- if( B->p[j - 1] != 0 )
- break;
-
- MPI_CHK( mpi_grow( X, j ) );
-
- o = B->p; p = X->p; c = 0;
-
- for( i = 0; i < j; i++, o++, p++ )
- {
- *p += c; c = ( *p < c );
- *p += *o; c += ( *p < *o );
- }
-
- while( c != 0 )
- {
- if( i >= X->n )
- {
- MPI_CHK( mpi_grow( X, i + 1 ) );
- p = X->p + i;
- }
-
- *p += c; c = ( *p < c ); i++;
- }
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Helper for mpi substraction
- */
-static void mpi_sub_hlp( size_t n, t_uint *s, t_uint *d )
-{
- size_t i;
- t_uint c, z;
-
- for( i = c = 0; i < n; i++, s++, d++ )
- {
- z = ( *d < c ); *d -= c;
- c = ( *d < *s ) + z; *d -= *s;
- }
-
- while( c != 0 )
- {
- z = ( *d < c ); *d -= c;
- c = z; i++; d++;
- }
-}
-
-/*
- * Unsigned substraction: X = |A| - |B| (HAC 14.9)
- */
-int mpi_sub_abs( mpi *X, const mpi *A, const mpi *B )
-{
- mpi TB;
- int ret;
- size_t n;
-
- if( mpi_cmp_abs( A, B ) < 0 )
- return( POLARSSL_ERR_MPI_NEGATIVE_VALUE );
-
- mpi_init( &TB );
-
- if( X == B )
- {
- MPI_CHK( mpi_copy( &TB, B ) );
- B = &TB;
- }
-
- if( X != A )
- MPI_CHK( mpi_copy( X, A ) );
-
- /*
- * X should always be positive as a result of unsigned substractions.
- */
- X->s = 1;
-
- ret = 0;
-
- for( n = B->n; n > 0; n-- )
- if( B->p[n - 1] != 0 )
- break;
-
- mpi_sub_hlp( n, B->p, X->p );
-
-cleanup:
-
- mpi_free( &TB );
-
- return( ret );
-}
-
-/*
- * Signed addition: X = A + B
- */
-int mpi_add_mpi( mpi *X, const mpi *A, const mpi *B )
-{
- int ret, s = A->s;
-
- if( A->s * B->s < 0 )
- {
- if( mpi_cmp_abs( A, B ) >= 0 )
- {
- MPI_CHK( mpi_sub_abs( X, A, B ) );
- X->s = s;
- }
- else
- {
- MPI_CHK( mpi_sub_abs( X, B, A ) );
- X->s = -s;
- }
- }
- else
- {
- MPI_CHK( mpi_add_abs( X, A, B ) );
- X->s = s;
- }
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Signed substraction: X = A - B
- */
-int mpi_sub_mpi( mpi *X, const mpi *A, const mpi *B )
-{
- int ret, s = A->s;
-
- if( A->s * B->s > 0 )
- {
- if( mpi_cmp_abs( A, B ) >= 0 )
- {
- MPI_CHK( mpi_sub_abs( X, A, B ) );
- X->s = s;
- }
- else
- {
- MPI_CHK( mpi_sub_abs( X, B, A ) );
- X->s = -s;
- }
- }
- else
- {
- MPI_CHK( mpi_add_abs( X, A, B ) );
- X->s = s;
- }
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Signed addition: X = A + b
- */
-int mpi_add_int( mpi *X, const mpi *A, t_sint b )
-{
- mpi _B;
- t_uint p[1];
-
- p[0] = ( b < 0 ) ? -b : b;
- _B.s = ( b < 0 ) ? -1 : 1;
- _B.n = 1;
- _B.p = p;
-
- return( mpi_add_mpi( X, A, &_B ) );
-}
-
-/*
- * Signed substraction: X = A - b
- */
-int mpi_sub_int( mpi *X, const mpi *A, t_sint b )
-{
- mpi _B;
- t_uint p[1];
-
- p[0] = ( b < 0 ) ? -b : b;
- _B.s = ( b < 0 ) ? -1 : 1;
- _B.n = 1;
- _B.p = p;
-
- return( mpi_sub_mpi( X, A, &_B ) );
-}
-
-/*
- * Helper for mpi multiplication
- */
-static void mpi_mul_hlp( size_t i, t_uint *s, t_uint *d, t_uint b )
-{
- t_uint c = 0, t = 0;
-
-#if defined(MULADDC_HUIT)
- for( ; i >= 8; i -= 8 )
- {
- MULADDC_INIT
- MULADDC_HUIT
- MULADDC_STOP
- }
-
- for( ; i > 0; i-- )
- {
- MULADDC_INIT
- MULADDC_CORE
- MULADDC_STOP
- }
-#else
- for( ; i >= 16; i -= 16 )
- {
- MULADDC_INIT
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
-
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_STOP
- }
-
- for( ; i >= 8; i -= 8 )
- {
- MULADDC_INIT
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
-
- MULADDC_CORE MULADDC_CORE
- MULADDC_CORE MULADDC_CORE
- MULADDC_STOP
- }
-
- for( ; i > 0; i-- )
- {
- MULADDC_INIT
- MULADDC_CORE
- MULADDC_STOP
- }
-#endif
-
- t++;
-
- do {
- *d += c; c = ( *d < c ); d++;
- }
- while( c != 0 );
-}
-
-/*
- * Baseline multiplication: X = A * B (HAC 14.12)
- */
-int mpi_mul_mpi( mpi *X, const mpi *A, const mpi *B )
-{
- int ret;
- size_t i, j;
- mpi TA, TB;
-
- mpi_init( &TA ); mpi_init( &TB );
-
- if( X == A ) { MPI_CHK( mpi_copy( &TA, A ) ); A = &TA; }
- if( X == B ) { MPI_CHK( mpi_copy( &TB, B ) ); B = &TB; }
-
- for( i = A->n; i > 0; i-- )
- if( A->p[i - 1] != 0 )
- break;
-
- for( j = B->n; j > 0; j-- )
- if( B->p[j - 1] != 0 )
- break;
-
- MPI_CHK( mpi_grow( X, i + j ) );
- MPI_CHK( mpi_lset( X, 0 ) );
-
- for( i++; j > 0; j-- )
- mpi_mul_hlp( i - 1, A->p, X->p + j - 1, B->p[j - 1] );
-
- X->s = A->s * B->s;
-
-cleanup:
-
- mpi_free( &TB ); mpi_free( &TA );
-
- return( ret );
-}
-
-/*
- * Baseline multiplication: X = A * b
- */
-int mpi_mul_int( mpi *X, const mpi *A, t_sint b )
-{
- mpi _B;
- t_uint p[1];
-
- _B.s = 1;
- _B.n = 1;
- _B.p = p;
- p[0] = b;
-
- return( mpi_mul_mpi( X, A, &_B ) );
-}
-
-/*
- * Division by mpi: A = Q * B + R (HAC 14.20)
- */
-int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
-{
- int ret;
- size_t i, n, t, k;
- mpi X, Y, Z, T1, T2;
-
- if( mpi_cmp_int( B, 0 ) == 0 )
- return( POLARSSL_ERR_MPI_DIVISION_BY_ZERO );
-
- mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z );
- mpi_init( &T1 ); mpi_init( &T2 );
-
- if( mpi_cmp_abs( A, B ) < 0 )
- {
- if( Q != NULL ) MPI_CHK( mpi_lset( Q, 0 ) );
- if( R != NULL ) MPI_CHK( mpi_copy( R, A ) );
- return( 0 );
- }
-
- MPI_CHK( mpi_copy( &X, A ) );
- MPI_CHK( mpi_copy( &Y, B ) );
- X.s = Y.s = 1;
-
- MPI_CHK( mpi_grow( &Z, A->n + 2 ) );
- MPI_CHK( mpi_lset( &Z, 0 ) );
- MPI_CHK( mpi_grow( &T1, 2 ) );
- MPI_CHK( mpi_grow( &T2, 3 ) );
-
- k = mpi_msb( &Y ) % biL;
- if( k < biL - 1 )
- {
- k = biL - 1 - k;
- MPI_CHK( mpi_shift_l( &X, k ) );
- MPI_CHK( mpi_shift_l( &Y, k ) );
- }
- else k = 0;
-
- n = X.n - 1;
- t = Y.n - 1;
- mpi_shift_l( &Y, biL * (n - t) );
-
- while( mpi_cmp_mpi( &X, &Y ) >= 0 )
- {
- Z.p[n - t]++;
- mpi_sub_mpi( &X, &X, &Y );
- }
- mpi_shift_r( &Y, biL * (n - t) );
-
- for( i = n; i > t ; i-- )
- {
- if( X.p[i] >= Y.p[t] )
- Z.p[i - t - 1] = ~0;
- else
- {
-#if defined(POLARSSL_HAVE_LONGLONG)
- t_dbl r;
-
- r = (t_dbl) X.p[i] << biL;
- r |= (t_dbl) X.p[i - 1];
- r /= Y.p[t];
- if( r > ((t_dbl) 1 << biL) - 1)
- r = ((t_dbl) 1 << biL) - 1;
-
- Z.p[i - t - 1] = (t_uint) r;
-#else
- /*
- * __udiv_qrnnd_c, from gmp/longlong.h
- */
- t_uint q0, q1, r0, r1;
- t_uint d0, d1, d, m;
-
- d = Y.p[t];
- d0 = ( d << biH ) >> biH;
- d1 = ( d >> biH );
-
- q1 = X.p[i] / d1;
- r1 = X.p[i] - d1 * q1;
- r1 <<= biH;
- r1 |= ( X.p[i - 1] >> biH );
-
- m = q1 * d0;
- if( r1 < m )
- {
- q1--, r1 += d;
- while( r1 >= d && r1 < m )
- q1--, r1 += d;
- }
- r1 -= m;
-
- q0 = r1 / d1;
- r0 = r1 - d1 * q0;
- r0 <<= biH;
- r0 |= ( X.p[i - 1] << biH ) >> biH;
-
- m = q0 * d0;
- if( r0 < m )
- {
- q0--, r0 += d;
- while( r0 >= d && r0 < m )
- q0--, r0 += d;
- }
- r0 -= m;
-
- Z.p[i - t - 1] = ( q1 << biH ) | q0;
-#endif
- }
-
- Z.p[i - t - 1]++;
- do
- {
- Z.p[i - t - 1]--;
-
- MPI_CHK( mpi_lset( &T1, 0 ) );
- T1.p[0] = (t < 1) ? 0 : Y.p[t - 1];
- T1.p[1] = Y.p[t];
- MPI_CHK( mpi_mul_int( &T1, &T1, Z.p[i - t - 1] ) );
-
- MPI_CHK( mpi_lset( &T2, 0 ) );
- T2.p[0] = (i < 2) ? 0 : X.p[i - 2];
- T2.p[1] = (i < 1) ? 0 : X.p[i - 1];
- T2.p[2] = X.p[i];
- }
- while( mpi_cmp_mpi( &T1, &T2 ) > 0 );
-
- MPI_CHK( mpi_mul_int( &T1, &Y, Z.p[i - t - 1] ) );
- MPI_CHK( mpi_shift_l( &T1, biL * (i - t - 1) ) );
- MPI_CHK( mpi_sub_mpi( &X, &X, &T1 ) );
-
- if( mpi_cmp_int( &X, 0 ) < 0 )
- {
- MPI_CHK( mpi_copy( &T1, &Y ) );
- MPI_CHK( mpi_shift_l( &T1, biL * (i - t - 1) ) );
- MPI_CHK( mpi_add_mpi( &X, &X, &T1 ) );
- Z.p[i - t - 1]--;
- }
- }
-
- if( Q != NULL )
- {
- mpi_copy( Q, &Z );
- Q->s = A->s * B->s;
- }
-
- if( R != NULL )
- {
- mpi_shift_r( &X, k );
- mpi_copy( R, &X );
-
- R->s = A->s;
- if( mpi_cmp_int( R, 0 ) == 0 )
- R->s = 1;
- }
-
-cleanup:
-
- mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z );
- mpi_free( &T1 ); mpi_free( &T2 );
-
- return( ret );
-}
-
-/*
- * Division by int: A = Q * b + R
- *
- * Returns 0 if successful
- * 1 if memory allocation failed
- * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
- */
-int mpi_div_int( mpi *Q, mpi *R, const mpi *A, t_sint b )
-{
- mpi _B;
- t_uint p[1];
-
- p[0] = ( b < 0 ) ? -b : b;
- _B.s = ( b < 0 ) ? -1 : 1;
- _B.n = 1;
- _B.p = p;
-
- return( mpi_div_mpi( Q, R, A, &_B ) );
-}
-
-/*
- * Modulo: R = A mod B
- */
-int mpi_mod_mpi( mpi *R, const mpi *A, const mpi *B )
-{
- int ret;
-
- if( mpi_cmp_int( B, 0 ) < 0 )
- return POLARSSL_ERR_MPI_NEGATIVE_VALUE;
-
- MPI_CHK( mpi_div_mpi( NULL, R, A, B ) );
-
- while( mpi_cmp_int( R, 0 ) < 0 )
- MPI_CHK( mpi_add_mpi( R, R, B ) );
-
- while( mpi_cmp_mpi( R, B ) >= 0 )
- MPI_CHK( mpi_sub_mpi( R, R, B ) );
-
-cleanup:
-
- return( ret );
-}
-
-/*
- * Modulo: r = A mod b
- */
-int mpi_mod_int( t_uint *r, const mpi *A, t_sint b )
-{
- size_t i;
- t_uint x, y, z;
-
- if( b == 0 )
- return( POLARSSL_ERR_MPI_DIVISION_BY_ZERO );
-
- if( b < 0 )
- return POLARSSL_ERR_MPI_NEGATIVE_VALUE;
-
- /*
- * handle trivial cases
- */
- if( b == 1 )
- {
- *r = 0;
- return( 0 );
- }
-
- if( b == 2 )
- {
- *r = A->p[0] & 1;
- return( 0 );
- }
-
- /*
- * general case
- */
- for( i = A->n, y = 0; i > 0; i-- )
- {
- x = A->p[i - 1];
- y = ( y << biH ) | ( x >> biH );
- z = y / b;
- y -= z * b;
-
- x <<= biH;
- y = ( y << biH ) | ( x >> biH );
- z = y / b;
- y -= z * b;
- }
-
- /*
- * If A is negative, then the current y represents a negative value.
- * Flipping it to the positive side.
- */
- if( A->s < 0 && y != 0 )
- y = b - y;
-
- *r = y;
-
- return( 0 );
-}
-
-/*
- * Fast Montgomery initialization (thanks to Tom St Denis)
- */
-static void mpi_montg_init( t_uint *mm, const mpi *N )
-{
- t_uint x, m0 = N->p[0];
-
- x = m0;
- x += ( ( m0 + 2 ) & 4 ) << 1;
- x *= ( 2 - ( m0 * x ) );
-
- if( biL >= 16 ) x *= ( 2 - ( m0 * x ) );
- if( biL >= 32 ) x *= ( 2 - ( m0 * x ) );
- if( biL >= 64 ) x *= ( 2 - ( m0 * x ) );
-
- *mm = ~x + 1;
-}
-
-/*
- * Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36)
- */
-static void mpi_montmul( mpi *A, const mpi *B, const mpi *N, t_uint mm, const mpi *T )
-{
- size_t i, n, m;
- t_uint u0, u1, *d;
-
- memset( T->p, 0, T->n * ciL );
-
- d = T->p;
- n = N->n;
- m = ( B->n < n ) ? B->n : n;
-
- for( i = 0; i < n; i++ )
- {
- /*
- * T = (T + u0*B + u1*N) / 2^biL
- */
- u0 = A->p[i];
- u1 = ( d[0] + u0 * B->p[0] ) * mm;
-
- mpi_mul_hlp( m, B->p, d, u0 );
- mpi_mul_hlp( n, N->p, d, u1 );
-
- *d++ = u0; d[n + 1] = 0;
- }
-
- memcpy( A->p, d, (n + 1) * ciL );
-
- if( mpi_cmp_abs( A, N ) >= 0 )
- mpi_sub_hlp( n, N->p, A->p );
- else
- /* prevent timing attacks */
- mpi_sub_hlp( n, A->p, T->p );
-}
-
-/*
- * Montgomery reduction: A = A * R^-1 mod N
- */
-static void mpi_montred( mpi *A, const mpi *N, t_uint mm, const mpi *T )
-{
- t_uint z = 1;
- mpi U;
-
- U.n = U.s = z;
- U.p = &z;
-
- mpi_montmul( A, &U, N, mm, T );
-}
-
-/*
- * Sliding-window exponentiation: X = A^E mod N (HAC 14.85)
- */
-int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
-{
- int ret;
- size_t wbits, wsize, one = 1;
- size_t i, j, nblimbs;
- size_t bufsize, nbits;
- t_uint ei, mm, state;
- mpi RR, T, W[64];
-
- if( mpi_cmp_int( N, 0 ) < 0 || ( N->p[0] & 1 ) == 0 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- /*
- * Init temps and window size
- */
- mpi_montg_init( &mm, N );
- mpi_init( &RR ); mpi_init( &T );
- memset( W, 0, sizeof( W ) );
-
- i = mpi_msb( E );
-
- wsize = ( i > 671 ) ? 6 : ( i > 239 ) ? 5 :
- ( i > 79 ) ? 4 : ( i > 23 ) ? 3 : 1;
-
- j = N->n + 1;
- MPI_CHK( mpi_grow( X, j ) );
- MPI_CHK( mpi_grow( &W[1], j ) );
- MPI_CHK( mpi_grow( &T, j * 2 ) );
-
- /*
- * If 1st call, pre-compute R^2 mod N
- */
- if( _RR == NULL || _RR->p == NULL )
- {
- MPI_CHK( mpi_lset( &RR, 1 ) );
- MPI_CHK( mpi_shift_l( &RR, N->n * 2 * biL ) );
- MPI_CHK( mpi_mod_mpi( &RR, &RR, N ) );
-
- if( _RR != NULL )
- memcpy( _RR, &RR, sizeof( mpi ) );
- }
- else
- memcpy( &RR, _RR, sizeof( mpi ) );
-
- /*
- * W[1] = A * R^2 * R^-1 mod N = A * R mod N
- */
- if( mpi_cmp_mpi( A, N ) >= 0 )
- mpi_mod_mpi( &W[1], A, N );
- else mpi_copy( &W[1], A );
-
- mpi_montmul( &W[1], &RR, N, mm, &T );
-
- /*
- * X = R^2 * R^-1 mod N = R mod N
- */
- MPI_CHK( mpi_copy( X, &RR ) );
- mpi_montred( X, N, mm, &T );
-
- if( wsize > 1 )
- {
- /*
- * W[1 << (wsize - 1)] = W[1] ^ (wsize - 1)
- */
- j = one << (wsize - 1);
-
- MPI_CHK( mpi_grow( &W[j], N->n + 1 ) );
- MPI_CHK( mpi_copy( &W[j], &W[1] ) );
-
- for( i = 0; i < wsize - 1; i++ )
- mpi_montmul( &W[j], &W[j], N, mm, &T );
-
- /*
- * W[i] = W[i - 1] * W[1]
- */
- for( i = j + 1; i < (one << wsize); i++ )
- {
- MPI_CHK( mpi_grow( &W[i], N->n + 1 ) );
- MPI_CHK( mpi_copy( &W[i], &W[i - 1] ) );
-
- mpi_montmul( &W[i], &W[1], N, mm, &T );
- }
- }
-
- nblimbs = E->n;
- bufsize = 0;
- nbits = 0;
- wbits = 0;
- state = 0;
-
- while( 1 )
- {
- if( bufsize == 0 )
- {
- if( nblimbs-- == 0 )
- break;
-
- bufsize = sizeof( t_uint ) << 3;
- }
-
- bufsize--;
-
- ei = (E->p[nblimbs] >> bufsize) & 1;
-
- /*
- * skip leading 0s
- */
- if( ei == 0 && state == 0 )
- continue;
-
- if( ei == 0 && state == 1 )
- {
- /*
- * out of window, square X
- */
- mpi_montmul( X, X, N, mm, &T );
- continue;
- }
-
- /*
- * add ei to current window
- */
- state = 2;
-
- nbits++;
- wbits |= (ei << (wsize - nbits));
-
- if( nbits == wsize )
- {
- /*
- * X = X^wsize R^-1 mod N
- */
- for( i = 0; i < wsize; i++ )
- mpi_montmul( X, X, N, mm, &T );
-
- /*
- * X = X * W[wbits] R^-1 mod N
- */
- mpi_montmul( X, &W[wbits], N, mm, &T );
-
- state--;
- nbits = 0;
- wbits = 0;
- }
- }
-
- /*
- * process the remaining bits
- */
- for( i = 0; i < nbits; i++ )
- {
- mpi_montmul( X, X, N, mm, &T );
-
- wbits <<= 1;
-
- if( (wbits & (one << wsize)) != 0 )
- mpi_montmul( X, &W[1], N, mm, &T );
- }
-
- /*
- * X = A^E * R * R^-1 mod N = A^E mod N
- */
- mpi_montred( X, N, mm, &T );
-
-cleanup:
-
- for( i = (one << (wsize - 1)); i < (one << wsize); i++ )
- mpi_free( &W[i] );
-
- mpi_free( &W[1] ); mpi_free( &T );
-
- if( _RR == NULL )
- mpi_free( &RR );
-
- return( ret );
-}
-
-/*
- * Greatest common divisor: G = gcd(A, B) (HAC 14.54)
- */
-int mpi_gcd( mpi *G, const mpi *A, const mpi *B )
-{
- int ret;
- size_t lz, lzt;
- mpi TG, TA, TB;
-
- mpi_init( &TG ); mpi_init( &TA ); mpi_init( &TB );
-
- MPI_CHK( mpi_copy( &TA, A ) );
- MPI_CHK( mpi_copy( &TB, B ) );
-
- lz = mpi_lsb( &TA );
- lzt = mpi_lsb( &TB );
-
- if ( lzt < lz )
- lz = lzt;
-
- MPI_CHK( mpi_shift_r( &TA, lz ) );
- MPI_CHK( mpi_shift_r( &TB, lz ) );
-
- TA.s = TB.s = 1;
-
- while( mpi_cmp_int( &TA, 0 ) != 0 )
- {
- MPI_CHK( mpi_shift_r( &TA, mpi_lsb( &TA ) ) );
- MPI_CHK( mpi_shift_r( &TB, mpi_lsb( &TB ) ) );
-
- if( mpi_cmp_mpi( &TA, &TB ) >= 0 )
- {
- MPI_CHK( mpi_sub_abs( &TA, &TA, &TB ) );
- MPI_CHK( mpi_shift_r( &TA, 1 ) );
- }
- else
- {
- MPI_CHK( mpi_sub_abs( &TB, &TB, &TA ) );
- MPI_CHK( mpi_shift_r( &TB, 1 ) );
- }
- }
-
- MPI_CHK( mpi_shift_l( &TB, lz ) );
- MPI_CHK( mpi_copy( G, &TB ) );
-
-cleanup:
-
- mpi_free( &TG ); mpi_free( &TA ); mpi_free( &TB );
-
- return( ret );
-}
-
-int mpi_fill_random( mpi *X, size_t size, int (*f_rng)(void *), void *p_rng )
-{
- int ret;
- size_t k;
- unsigned char *p;
-
- MPI_CHK( mpi_grow( X, size ) );
- MPI_CHK( mpi_lset( X, 0 ) );
-
- p = (unsigned char *) X->p;
- for( k = 0; k < X->n * ciL; k++ )
- *p++ = (unsigned char) f_rng( p_rng );
-
-cleanup:
- return( ret );
-}
-
-#if defined(POLARSSL_GENPRIME)
-
-/*
- * Modular inverse: X = A^-1 mod N (HAC 14.61 / 14.64)
- */
-int mpi_inv_mod( mpi *X, const mpi *A, const mpi *N )
-{
- int ret;
- mpi G, TA, TU, U1, U2, TB, TV, V1, V2;
-
- if( mpi_cmp_int( N, 0 ) <= 0 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- mpi_init( &TA ); mpi_init( &TU ); mpi_init( &U1 ); mpi_init( &U2 );
- mpi_init( &G ); mpi_init( &TB ); mpi_init( &TV );
- mpi_init( &V1 ); mpi_init( &V2 );
-
- MPI_CHK( mpi_gcd( &G, A, N ) );
-
- if( mpi_cmp_int( &G, 1 ) != 0 )
- {
- ret = POLARSSL_ERR_MPI_NOT_ACCEPTABLE;
- goto cleanup;
- }
-
- MPI_CHK( mpi_mod_mpi( &TA, A, N ) );
- MPI_CHK( mpi_copy( &TU, &TA ) );
- MPI_CHK( mpi_copy( &TB, N ) );
- MPI_CHK( mpi_copy( &TV, N ) );
-
- MPI_CHK( mpi_lset( &U1, 1 ) );
- MPI_CHK( mpi_lset( &U2, 0 ) );
- MPI_CHK( mpi_lset( &V1, 0 ) );
- MPI_CHK( mpi_lset( &V2, 1 ) );
-
- do
- {
- while( ( TU.p[0] & 1 ) == 0 )
- {
- MPI_CHK( mpi_shift_r( &TU, 1 ) );
-
- if( ( U1.p[0] & 1 ) != 0 || ( U2.p[0] & 1 ) != 0 )
- {
- MPI_CHK( mpi_add_mpi( &U1, &U1, &TB ) );
- MPI_CHK( mpi_sub_mpi( &U2, &U2, &TA ) );
- }
-
- MPI_CHK( mpi_shift_r( &U1, 1 ) );
- MPI_CHK( mpi_shift_r( &U2, 1 ) );
- }
-
- while( ( TV.p[0] & 1 ) == 0 )
- {
- MPI_CHK( mpi_shift_r( &TV, 1 ) );
-
- if( ( V1.p[0] & 1 ) != 0 || ( V2.p[0] & 1 ) != 0 )
- {
- MPI_CHK( mpi_add_mpi( &V1, &V1, &TB ) );
- MPI_CHK( mpi_sub_mpi( &V2, &V2, &TA ) );
- }
-
- MPI_CHK( mpi_shift_r( &V1, 1 ) );
- MPI_CHK( mpi_shift_r( &V2, 1 ) );
- }
-
- if( mpi_cmp_mpi( &TU, &TV ) >= 0 )
- {
- MPI_CHK( mpi_sub_mpi( &TU, &TU, &TV ) );
- MPI_CHK( mpi_sub_mpi( &U1, &U1, &V1 ) );
- MPI_CHK( mpi_sub_mpi( &U2, &U2, &V2 ) );
- }
- else
- {
- MPI_CHK( mpi_sub_mpi( &TV, &TV, &TU ) );
- MPI_CHK( mpi_sub_mpi( &V1, &V1, &U1 ) );
- MPI_CHK( mpi_sub_mpi( &V2, &V2, &U2 ) );
- }
- }
- while( mpi_cmp_int( &TU, 0 ) != 0 );
-
- while( mpi_cmp_int( &V1, 0 ) < 0 )
- MPI_CHK( mpi_add_mpi( &V1, &V1, N ) );
-
- while( mpi_cmp_mpi( &V1, N ) >= 0 )
- MPI_CHK( mpi_sub_mpi( &V1, &V1, N ) );
-
- MPI_CHK( mpi_copy( X, &V1 ) );
-
-cleanup:
-
- mpi_free( &TA ); mpi_free( &TU ); mpi_free( &U1 ); mpi_free( &U2 );
- mpi_free( &G ); mpi_free( &TB ); mpi_free( &TV );
- mpi_free( &V1 ); mpi_free( &V2 );
-
- return( ret );
-}
-
-static const int small_prime[] =
-{
- 3, 5, 7, 11, 13, 17, 19, 23,
- 29, 31, 37, 41, 43, 47, 53, 59,
- 61, 67, 71, 73, 79, 83, 89, 97,
- 101, 103, 107, 109, 113, 127, 131, 137,
- 139, 149, 151, 157, 163, 167, 173, 179,
- 181, 191, 193, 197, 199, 211, 223, 227,
- 229, 233, 239, 241, 251, 257, 263, 269,
- 271, 277, 281, 283, 293, 307, 311, 313,
- 317, 331, 337, 347, 349, 353, 359, 367,
- 373, 379, 383, 389, 397, 401, 409, 419,
- 421, 431, 433, 439, 443, 449, 457, 461,
- 463, 467, 479, 487, 491, 499, 503, 509,
- 521, 523, 541, 547, 557, 563, 569, 571,
- 577, 587, 593, 599, 601, 607, 613, 617,
- 619, 631, 641, 643, 647, 653, 659, 661,
- 673, 677, 683, 691, 701, 709, 719, 727,
- 733, 739, 743, 751, 757, 761, 769, 773,
- 787, 797, 809, 811, 821, 823, 827, 829,
- 839, 853, 857, 859, 863, 877, 881, 883,
- 887, 907, 911, 919, 929, 937, 941, 947,
- 953, 967, 971, 977, 983, 991, 997, -103
-};
-
-/*
- * Miller-Rabin primality test (HAC 4.24)
- */
-int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
-{
- int ret, xs;
- size_t i, j, n, s;
- mpi W, R, T, A, RR;
-
- if( mpi_cmp_int( X, 0 ) == 0 ||
- mpi_cmp_int( X, 1 ) == 0 )
- return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
-
- if( mpi_cmp_int( X, 2 ) == 0 )
- return( 0 );
-
- mpi_init( &W ); mpi_init( &R ); mpi_init( &T ); mpi_init( &A );
- mpi_init( &RR );
-
- xs = X->s; X->s = 1;
-
- /*
- * test trivial factors first
- */
- if( ( X->p[0] & 1 ) == 0 )
- return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
-
- for( i = 0; small_prime[i] > 0; i++ )
- {
- t_uint r;
-
- if( mpi_cmp_int( X, small_prime[i] ) <= 0 )
- return( 0 );
-
- MPI_CHK( mpi_mod_int( &r, X, small_prime[i] ) );
-
- if( r == 0 )
- return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
- }
-
- /*
- * W = |X| - 1
- * R = W >> lsb( W )
- */
- MPI_CHK( mpi_sub_int( &W, X, 1 ) );
- s = mpi_lsb( &W );
- MPI_CHK( mpi_copy( &R, &W ) );
- MPI_CHK( mpi_shift_r( &R, s ) );
-
- i = mpi_msb( X );
- /*
- * HAC, table 4.4
- */
- n = ( ( i >= 1300 ) ? 2 : ( i >= 850 ) ? 3 :
- ( i >= 650 ) ? 4 : ( i >= 350 ) ? 8 :
- ( i >= 250 ) ? 12 : ( i >= 150 ) ? 18 : 27 );
-
- for( i = 0; i < n; i++ )
- {
- /*
- * pick a random A, 1 < A < |X| - 1
- */
- mpi_fill_random( &A, X->n, f_rng, p_rng );
-
- if( mpi_cmp_mpi( &A, &W ) >= 0 )
- {
- j = mpi_msb( &A ) - mpi_msb( &W );
- MPI_CHK( mpi_shift_r( &A, j + 1 ) );
- }
- A.p[0] |= 3;
-
- /*
- * A = A^R mod |X|
- */
- MPI_CHK( mpi_exp_mod( &A, &A, &R, X, &RR ) );
-
- if( mpi_cmp_mpi( &A, &W ) == 0 ||
- mpi_cmp_int( &A, 1 ) == 0 )
- continue;
-
- j = 1;
- while( j < s && mpi_cmp_mpi( &A, &W ) != 0 )
- {
- /*
- * A = A * A mod |X|
- */
- MPI_CHK( mpi_mul_mpi( &T, &A, &A ) );
- MPI_CHK( mpi_mod_mpi( &A, &T, X ) );
-
- if( mpi_cmp_int( &A, 1 ) == 0 )
- break;
-
- j++;
- }
-
- /*
- * not prime if A != |X| - 1 or A == 1
- */
- if( mpi_cmp_mpi( &A, &W ) != 0 ||
- mpi_cmp_int( &A, 1 ) == 0 )
- {
- ret = POLARSSL_ERR_MPI_NOT_ACCEPTABLE;
- break;
- }
- }
-
-cleanup:
-
- X->s = xs;
-
- mpi_free( &W ); mpi_free( &R ); mpi_free( &T ); mpi_free( &A );
- mpi_free( &RR );
-
- return( ret );
-}
-
-/*
- * Prime number generation
- */
-int mpi_gen_prime( mpi *X, size_t nbits, int dh_flag,
- int (*f_rng)(void *), void *p_rng )
-{
- int ret;
- size_t k, n;
- mpi Y;
-
- if( nbits < 3 || nbits > 4096 )
- return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
-
- mpi_init( &Y );
-
- n = BITS_TO_LIMBS( nbits );
-
- mpi_fill_random( X, n, f_rng, p_rng );
-
- k = mpi_msb( X );
- if( k < nbits ) MPI_CHK( mpi_shift_l( X, nbits - k ) );
- if( k > nbits ) MPI_CHK( mpi_shift_r( X, k - nbits ) );
-
- X->p[0] |= 3;
-
- if( dh_flag == 0 )
- {
- while( ( ret = mpi_is_prime( X, f_rng, p_rng ) ) != 0 )
- {
- if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
- goto cleanup;
-
- MPI_CHK( mpi_add_int( X, X, 2 ) );
- }
- }
- else
- {
- MPI_CHK( mpi_sub_int( &Y, X, 1 ) );
- MPI_CHK( mpi_shift_r( &Y, 1 ) );
-
- while( 1 )
- {
- if( ( ret = mpi_is_prime( X, f_rng, p_rng ) ) == 0 )
- {
- if( ( ret = mpi_is_prime( &Y, f_rng, p_rng ) ) == 0 )
- break;
-
- if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
- goto cleanup;
- }
-
- if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
- goto cleanup;
-
- MPI_CHK( mpi_add_int( &Y, X, 1 ) );
- MPI_CHK( mpi_add_int( X, X, 2 ) );
- MPI_CHK( mpi_shift_r( &Y, 1 ) );
- }
- }
-
-cleanup:
-
- mpi_free( &Y );
-
- return( ret );
-}
-
-#endif
-
-#if defined(POLARSSL_SELF_TEST)
-
-#define GCD_PAIR_COUNT 3
-
-static const int gcd_pairs[GCD_PAIR_COUNT][3] =
-{
- { 693, 609, 21 },
- { 1764, 868, 28 },
- { 768454923, 542167814, 1 }
-};
-
-/*
- * Checkup routine
- */
-int mpi_self_test( int verbose )
-{
- int ret, i;
- mpi A, E, N, X, Y, U, V;
-
- mpi_init( &A ); mpi_init( &E ); mpi_init( &N ); mpi_init( &X );
- mpi_init( &Y ); mpi_init( &U ); mpi_init( &V );
-
- MPI_CHK( mpi_read_string( &A, 16,
- "EFE021C2645FD1DC586E69184AF4A31E" \
- "D5F53E93B5F123FA41680867BA110131" \
- "944FE7952E2517337780CB0DB80E61AA" \
- "E7C8DDC6C5C6AADEB34EB38A2F40D5E6" ) );
-
- MPI_CHK( mpi_read_string( &E, 16,
- "B2E7EFD37075B9F03FF989C7C5051C20" \
- "34D2A323810251127E7BF8625A4F49A5" \
- "F3E27F4DA8BD59C47D6DAABA4C8127BD" \
- "5B5C25763222FEFCCFC38B832366C29E" ) );
-
- MPI_CHK( mpi_read_string( &N, 16,
- "0066A198186C18C10B2F5ED9B522752A" \
- "9830B69916E535C8F047518A889A43A5" \
- "94B6BED27A168D31D4A52F88925AA8F5" ) );
-
- MPI_CHK( mpi_mul_mpi( &X, &A, &N ) );
-
- MPI_CHK( mpi_read_string( &U, 16,
- "602AB7ECA597A3D6B56FF9829A5E8B85" \
- "9E857EA95A03512E2BAE7391688D264A" \
- "A5663B0341DB9CCFD2C4C5F421FEC814" \
- "8001B72E848A38CAE1C65F78E56ABDEF" \
- "E12D3C039B8A02D6BE593F0BBBDA56F1" \
- "ECF677152EF804370C1A305CAF3B5BF1" \
- "30879B56C61DE584A0F53A2447A51E" ) );
-
- if( verbose != 0 )
- printf( " MPI test #1 (mul_mpi): " );
-
- if( mpi_cmp_mpi( &X, &U ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
-
- MPI_CHK( mpi_div_mpi( &X, &Y, &A, &N ) );
-
- MPI_CHK( mpi_read_string( &U, 16,
- "256567336059E52CAE22925474705F39A94" ) );
-
- MPI_CHK( mpi_read_string( &V, 16,
- "6613F26162223DF488E9CD48CC132C7A" \
- "0AC93C701B001B092E4E5B9F73BCD27B" \
- "9EE50D0657C77F374E903CDFA4C642" ) );
-
- if( verbose != 0 )
- printf( " MPI test #2 (div_mpi): " );
-
- if( mpi_cmp_mpi( &X, &U ) != 0 ||
- mpi_cmp_mpi( &Y, &V ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
-
- MPI_CHK( mpi_exp_mod( &X, &A, &E, &N, NULL ) );
-
- MPI_CHK( mpi_read_string( &U, 16,
- "36E139AEA55215609D2816998ED020BB" \
- "BD96C37890F65171D948E9BC7CBAA4D9" \
- "325D24D6A3C12710F10A09FA08AB87" ) );
-
- if( verbose != 0 )
- printf( " MPI test #3 (exp_mod): " );
-
- if( mpi_cmp_mpi( &X, &U ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
-
-#if defined(POLARSSL_GENPRIME)
- MPI_CHK( mpi_inv_mod( &X, &A, &N ) );
-
- MPI_CHK( mpi_read_string( &U, 16,
- "003A0AAEDD7E784FC07D8F9EC6E3BFD5" \
- "C3DBA76456363A10869622EAC2DD84EC" \
- "C5B8A74DAC4D09E03B5E0BE779F2DF61" ) );
-
- if( verbose != 0 )
- printf( " MPI test #4 (inv_mod): " );
-
- if( mpi_cmp_mpi( &X, &U ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed\n" );
-
- return( 1 );
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
-#endif
-
- if( verbose != 0 )
- printf( " MPI test #5 (simple gcd): " );
-
- for ( i = 0; i < GCD_PAIR_COUNT; i++)
- {
- MPI_CHK( mpi_lset( &X, gcd_pairs[i][0] ) );
- MPI_CHK( mpi_lset( &Y, gcd_pairs[i][1] ) );
-
- MPI_CHK( mpi_gcd( &A, &X, &Y ) );
-
- if( mpi_cmp_int( &A, gcd_pairs[i][2] ) != 0 )
- {
- if( verbose != 0 )
- printf( "failed at %d\n", i );
-
- return( 1 );
- }
- }
-
- if( verbose != 0 )
- printf( "passed\n" );
-
-cleanup:
-
- if( ret != 0 && verbose != 0 )
- printf( "Unexpected error, return code = %08X\n", ret );
-
- mpi_free( &A ); mpi_free( &E ); mpi_free( &N ); mpi_free( &X );
- mpi_free( &Y ); mpi_free( &U ); mpi_free( &V );
-
- if( verbose != 0 )
- printf( "\n" );
-
- return( ret );
-}
-
-#endif
-
-#endif
diff --git a/protocols/Tlen/crypto/padlock.c b/protocols/Tlen/crypto/padlock.c
deleted file mode 100644
index 2e2e4775ff..0000000000
--- a/protocols/Tlen/crypto/padlock.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * VIA PadLock support functions
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-/*
- * This implementation is based on the VIA PadLock Programming Guide:
- *
- * http://www.via.com.tw/en/downloads/whitepapers/initiatives/padlock/
- * programming_guide.pdf
- */
-
-#include "polarssl/config.h"
-
-#if defined(POLARSSL_PADLOCK_C)
-
-#include "polarssl/padlock.h"
-
-#if defined(POLARSSL_HAVE_X86)
-
-/*
- * PadLock detection routine
- */
-int padlock_supports( int feature )
-{
- static int flags = -1;
- int ebx, edx;
-
- if( flags == -1 )
- {
- asm( "movl %%ebx, %0 \n" \
- "movl $0xC0000000, %%eax \n" \
- "cpuid \n" \
- "cmpl $0xC0000001, %%eax \n" \
- "movl $0, %%edx \n" \
- "jb unsupported \n" \
- "movl $0xC0000001, %%eax \n" \
- "cpuid \n" \
- "unsupported: \n" \
- "movl %%edx, %1 \n" \
- "movl %2, %%ebx \n"
- : "=m" (ebx), "=m" (edx)
- : "m" (ebx)
- : "eax", "ecx", "edx" );
-
- flags = edx;
- }
-
- return( flags & feature );
-}
-
-/*
- * PadLock AES-ECB block en(de)cryption
- */
-int padlock_xcryptecb( aes_context *ctx,
- int mode,
- const unsigned char input[16],
- unsigned char output[16] )
-{
- int ebx;
- unsigned long *rk;
- unsigned long *blk;
- unsigned long *ctrl;
- unsigned char buf[256];
-
- rk = ctx->rk;
- blk = PADLOCK_ALIGN16( buf );
- memcpy( blk, input, 16 );
-
- ctrl = blk + 4;
- *ctrl = 0x80 | ctx->nr | ( ( ctx->nr + ( mode^1 ) - 10 ) << 9 );
-
- asm( "pushfl; popfl \n" \
- "movl %%ebx, %0 \n" \
- "movl $1, %%ecx \n" \
- "movl %2, %%edx \n" \
- "movl %3, %%ebx \n" \
- "movl %4, %%esi \n" \
- "movl %4, %%edi \n" \
- ".byte 0xf3,0x0f,0xa7,0xc8\n" \
- "movl %1, %%ebx \n"
- : "=m" (ebx)
- : "m" (ebx), "m" (ctrl), "m" (rk), "m" (blk)
- : "ecx", "edx", "esi", "edi" );
-
- memcpy( output, blk, 16 );
-
- return( 0 );
-}
-
-/*
- * PadLock AES-CBC buffer en(de)cryption
- */
-int padlock_xcryptcbc( aes_context *ctx,
- int mode,
- size_t length,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output )
-{
- int ebx;
- size_t count;
- unsigned long *rk;
- unsigned long *iw;
- unsigned long *ctrl;
- unsigned char buf[256];
-
- if( ( (long) input & 15 ) != 0 ||
- ( (long) output & 15 ) != 0 )
- return( POLARSSL_ERR_PADLOCK_DATA_MISALIGNED );
-
- rk = ctx->rk;
- iw = PADLOCK_ALIGN16( buf );
- memcpy( iw, iv, 16 );
-
- ctrl = iw + 4;
- *ctrl = 0x80 | ctx->nr | ( ( ctx->nr + (mode^1) - 10 ) << 9 );
-
- count = (length + 15) >> 4;
-
- asm( "pushfl; popfl \n" \
- "movl %%ebx, %0 \n" \
- "movl %2, %%ecx \n" \
- "movl %3, %%edx \n" \
- "movl %4, %%ebx \n" \
- "movl %5, %%esi \n" \
- "movl %6, %%edi \n" \
- "movl %7, %%eax \n" \
- ".byte 0xf3,0x0f,0xa7,0xd0\n" \
- "movl %1, %%ebx \n"
- : "=m" (ebx)
- : "m" (ebx), "m" (count), "m" (ctrl),
- "m" (rk), "m" (input), "m" (output), "m" (iw)
- : "eax", "ecx", "edx", "esi", "edi" );
-
- memcpy( iv, iw, 16 );
-
- return( 0 );
-}
-
-#endif
-
-#endif
diff --git a/protocols/Tlen/crypto/polarssl/aes.h b/protocols/Tlen/crypto/polarssl/aes.h
deleted file mode 100644
index efc13daf5b..0000000000
--- a/protocols/Tlen/crypto/polarssl/aes.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * \file aes.h
- *
- * \brief AES block cipher
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef POLARSSL_AES_H
-#define POLARSSL_AES_H
-
-#include <string.h>
-
-#define AES_ENCRYPT 1
-#define AES_DECRYPT 0
-
-#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */
-#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */
-
-/**
- * \brief AES context structure
- */
-typedef struct
-{
- int nr; /*!< number of rounds */
- unsigned long *rk; /*!< AES round keys */
- unsigned long buf[68]; /*!< unaligned data */
-}
-aes_context;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief AES key schedule (encryption)
- *
- * \param ctx AES context to be initialized
- * \param key encryption key
- * \param keysize must be 128, 192 or 256
- *
- * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
- */
-int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize );
-
-/**
- * \brief AES key schedule (decryption)
- *
- * \param ctx AES context to be initialized
- * \param key decryption key
- * \param keysize must be 128, 192 or 256
- *
- * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
- */
-int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize );
-
-/**
- * \brief AES-ECB block encryption/decryption
- *
- * \param ctx AES context
- * \param mode AES_ENCRYPT or AES_DECRYPT
- * \param input 16-byte input block
- * \param output 16-byte output block
- *
- * \return 0 if successful
- */
-int aes_crypt_ecb( aes_context *ctx,
- int mode,
- const unsigned char input[16],
- unsigned char output[16] );
-
-/**
- * \brief AES-CBC buffer encryption/decryption
- * Length should be a multiple of the block
- * size (16 bytes)
- *
- * \param ctx AES context
- * \param mode AES_ENCRYPT or AES_DECRYPT
- * \param length length of the input data
- * \param iv initialization vector (updated after use)
- * \param input buffer holding the input data
- * \param output buffer holding the output data
- *
- * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
- */
-int aes_crypt_cbc( aes_context *ctx,
- int mode,
- size_t length,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output );
-
-/**
- * \brief AES-CFB128 buffer encryption/decryption.
- *
- * \param ctx AES context
- * \param mode AES_ENCRYPT or AES_DECRYPT
- * \param length length of the input data
- * \param iv_off offset in IV (updated after use)
- * \param iv initialization vector (updated after use)
- * \param input buffer holding the input data
- * \param output buffer holding the output data
- *
- * \return 0 if successful
- */
-int aes_crypt_cfb128( aes_context *ctx,
- int mode,
- size_t length,
- size_t *iv_off,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output );
-
-/*
- * \brief AES-CTR buffer encryption/decryption
- *
- * Warning: You have to keep the maximum use of your counter in mind!
- *
- * \param length The length of the data
- * \param nc_off The offset in the current stream_block (for resuming
- * within current cipher stream). The offset pointer to
- * should be 0 at the start of a stream.
- * \param nonce_counter The 128-bit nonce and counter.
- * \param stream_block The saved stream-block for resuming. Is overwritten
- * by the function.
- * \param input The input data stream
- * \param output The output data stream
- *
- * \return 0 if successful
- */
-int aes_crypt_ctr( aes_context *ctx,
- size_t length,
- size_t *nc_off,
- unsigned char nonce_counter[16],
- unsigned char stream_block[16],
- const unsigned char *input,
- unsigned char *output );
-/**
- * \brief Checkup routine
- *
- * \return 0 if successful, or 1 if the test failed
- */
-int aes_self_test( int verbose );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* aes.h */
diff --git a/protocols/Tlen/crypto/polarssl/bignum.h b/protocols/Tlen/crypto/polarssl/bignum.h
deleted file mode 100644
index 7938406708..0000000000
--- a/protocols/Tlen/crypto/polarssl/bignum.h
+++ /dev/null
@@ -1,587 +0,0 @@
-/**
- * \file bignum.h
- *
- * \brief Multi-precision integer library
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef POLARSSL_BIGNUM_H
-#define POLARSSL_BIGNUM_H
-
-#include <stdio.h>
-#include <string.h>
-
-#define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002 /**< An error occurred while reading from or writing to a file. */
-#define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004 /**< Bad input parameters to function. */
-#define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006 /**< There is an invalid character in the digit string. */
-#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008 /**< The output buffer is too small to write too. */
-#define POLARSSL_ERR_MPI_NEGATIVE_VALUE -0x000A /**< The input arguments are negative or result in illegal output. */
-#define POLARSSL_ERR_MPI_DIVISION_BY_ZERO -0x000C /**< The input argument for division is zero, which is not allowed. */
-#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E /**< The input arguments are not acceptable. */
-
-#define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup
-
-/*
- * Maximum size MPIs are allowed to grow to in number of limbs.
- */
-#define POLARSSL_MPI_MAX_LIMBS 10000
-
-/*
- * Define the base integer type, architecture-wise
- */
-#if defined(POLARSSL_HAVE_INT8)
-typedef signed char t_sint;
-typedef unsigned char t_uint;
-typedef unsigned short t_udbl;
-#else
-#if defined(POLARSSL_HAVE_INT16)
-typedef signed short t_sint;
-typedef unsigned short t_uint;
-typedef unsigned long t_udbl;
-#else
- typedef signed long t_sint;
- typedef unsigned long t_uint;
- #if defined(_MSC_VER) && defined(_M_IX86)
- typedef unsigned __int64 t_udbl;
- #else
- #if defined(__amd64__) || defined(__x86_64__) || \
- defined(__ppc64__) || defined(__powerpc64__) || \
- defined(__ia64__) || defined(__alpha__)
- typedef unsigned int t_udbl __attribute__((mode(TI)));
- #else
- #if defined(POLARSSL_HAVE_LONGLONG)
- typedef unsigned long long t_udbl;
- #endif
- #endif
- #endif
-#endif
-#endif
-
-/**
- * \brief MPI structure
- */
-typedef struct
-{
- int s; /*!< integer sign */
- size_t n; /*!< total # of limbs */
- t_uint *p; /*!< pointer to limbs */
-}
-mpi;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Initialize one MPI
- *
- * \param X One MPI to initialize.
- */
-void mpi_init( mpi *X );
-
-/**
- * \brief Unallocate one MPI
- *
- * \param X One MPI to unallocate.
- */
-void mpi_free( mpi *X );
-
-/**
- * \brief Enlarge to the specified number of limbs
- *
- * \param X MPI to grow
- * \param nblimbs The target number of limbs
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_grow( mpi *X, size_t nblimbs );
-
-/**
- * \brief Copy the contents of Y into X
- *
- * \param X Destination MPI
- * \param Y Source MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_copy( mpi *X, const mpi *Y );
-
-/**
- * \brief Swap the contents of X and Y
- *
- * \param X First MPI value
- * \param Y Second MPI value
- */
-void mpi_swap( mpi *X, mpi *Y );
-
-/**
- * \brief Set value from integer
- *
- * \param X MPI to set
- * \param z Value to use
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_lset( mpi *X, t_sint z );
-
-/*
- * \brief Get a specific bit from X
- *
- * \param X MPI to use
- * \param pos Zero-based index of the bit in X
- *
- * \return Either a 0 or a 1
- */
-int mpi_get_bit( mpi *X, size_t pos );
-
-/*
- * \brief Set a bit of X to a specific value of 0 or 1
- *
- * \note Will grow X if necessary to set a bit to 1 in a not yet
- * existing limb. Will not grow if bit should be set to 0
- *
- * \param X MPI to use
- * \param pos Zero-based index of the bit in X
- * \param val The value to set the bit to (0 or 1)
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_BAD_INPUT_DATA if val is not 0 or 1
- */
-int mpi_set_bit( mpi *X, size_t pos, unsigned char val );
-
-/**
- * \brief Return the number of least significant bits
- *
- * \param X MPI to use
- */
-size_t mpi_lsb( const mpi *X );
-
-/**
- * \brief Return the number of most significant bits
- *
- * \param X MPI to use
- */
-size_t mpi_msb( const mpi *X );
-
-/**
- * \brief Return the total size in bytes
- *
- * \param X MPI to use
- */
-size_t mpi_size( const mpi *X );
-
-/**
- * \brief Import from an ASCII string
- *
- * \param X Destination MPI
- * \param radix Input numeric base
- * \param s Null-terminated string buffer
- *
- * \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
- */
-int mpi_read_string( mpi *X, int radix, const char *s );
-
-/**
- * \brief Export into an ASCII string
- *
- * \param X Source MPI
- * \param radix Output numeric base
- * \param s String buffer
- * \param slen String buffer size
- *
- * \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code.
- * *slen is always updated to reflect the amount
- * of data that has (or would have) been written.
- *
- * \note Call this function with *slen = 0 to obtain the
- * minimum required buffer size in *slen.
- */
-int mpi_write_string( const mpi *X, int radix, char *s, size_t *slen );
-
-/**
- * \brief Read X from an opened file
- *
- * \param X Destination MPI
- * \param radix Input numeric base
- * \param fin Input file handle
- *
- * \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
- */
-int mpi_read_file( mpi *X, int radix, FILE *fin );
-
-/**
- * \brief Write X into an opened file, or stdout if fout is NULL
- *
- * \param p Prefix, can be NULL
- * \param X Source MPI
- * \param radix Output numeric base
- * \param fout Output file handle (can be NULL)
- *
- * \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
- *
- * \note Set fout == NULL to print X on the console.
- */
-int mpi_write_file( const char *p, const mpi *X, int radix, FILE *fout );
-
-/**
- * \brief Import X from unsigned binary data, big endian
- *
- * \param X Destination MPI
- * \param buf Input buffer
- * \param buflen Input buffer size
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_read_binary( mpi *X, const unsigned char *buf, size_t buflen );
-
-/**
- * \brief Export X into unsigned binary data, big endian
- *
- * \param X Source MPI
- * \param buf Output buffer
- * \param buflen Output buffer size
- *
- * \return 0 if successful,
- * POLARSSL_ERR_MPI_BUFFER_TOO_SMALL if buf isn't large enough
- */
-int mpi_write_binary( const mpi *X, unsigned char *buf, size_t buflen );
-
-/**
- * \brief Left-shift: X <<= count
- *
- * \param X MPI to shift
- * \param count Amount to shift
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_shift_l( mpi *X, size_t count );
-
-/**
- * \brief Right-shift: X >>= count
- *
- * \param X MPI to shift
- * \param count Amount to shift
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_shift_r( mpi *X, size_t count );
-
-/**
- * \brief Compare unsigned values
- *
- * \param X Left-hand MPI
- * \param Y Right-hand MPI
- *
- * \return 1 if |X| is greater than |Y|,
- * -1 if |X| is lesser than |Y| or
- * 0 if |X| is equal to |Y|
- */
-int mpi_cmp_abs( const mpi *X, const mpi *Y );
-
-/**
- * \brief Compare signed values
- *
- * \param X Left-hand MPI
- * \param Y Right-hand MPI
- *
- * \return 1 if X is greater than Y,
- * -1 if X is lesser than Y or
- * 0 if X is equal to Y
- */
-int mpi_cmp_mpi( const mpi *X, const mpi *Y );
-
-/**
- * \brief Compare signed values
- *
- * \param X Left-hand MPI
- * \param z The integer value to compare to
- *
- * \return 1 if X is greater than z,
- * -1 if X is lesser than z or
- * 0 if X is equal to z
- */
-int mpi_cmp_int( const mpi *X, t_sint z );
-
-/**
- * \brief Unsigned addition: X = |A| + |B|
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_add_abs( mpi *X, const mpi *A, const mpi *B );
-
-/**
- * \brief Unsigned substraction: X = |A| - |B|
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * POLARSSL_ERR_MPI_NEGATIVE_VALUE if B is greater than A
- */
-int mpi_sub_abs( mpi *X, const mpi *A, const mpi *B );
-
-/**
- * \brief Signed addition: X = A + B
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_add_mpi( mpi *X, const mpi *A, const mpi *B );
-
-/**
- * \brief Signed substraction: X = A - B
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_sub_mpi( mpi *X, const mpi *A, const mpi *B );
-
-/**
- * \brief Signed addition: X = A + b
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param b The integer value to add
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_add_int( mpi *X, const mpi *A, t_sint b );
-
-/**
- * \brief Signed substraction: X = A - b
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param b The integer value to subtract
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_sub_int( mpi *X, const mpi *A, t_sint b );
-
-/**
- * \brief Baseline multiplication: X = A * B
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_mul_mpi( mpi *X, const mpi *A, const mpi *B );
-
-/**
- * \brief Baseline multiplication: X = A * b
- * Note: b is an unsigned integer type, thus
- * Negative values of b are ignored.
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param b The integer value to multiply with
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_mul_int( mpi *X, const mpi *A, t_sint b );
-
-/**
- * \brief Division by mpi: A = Q * B + R
- *
- * \param Q Destination MPI for the quotient
- * \param R Destination MPI for the rest value
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0
- *
- * \note Either Q or R can be NULL.
- */
-int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B );
-
-/**
- * \brief Division by int: A = Q * b + R
- *
- * \param Q Destination MPI for the quotient
- * \param R Destination MPI for the rest value
- * \param A Left-hand MPI
- * \param b Integer to divide by
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
- *
- * \note Either Q or R can be NULL.
- */
-int mpi_div_int( mpi *Q, mpi *R, const mpi *A, t_sint b );
-
-/**
- * \brief Modulo: R = A mod B
- *
- * \param R Destination MPI for the rest value
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0,
- * POLARSSL_ERR_MPI_NEGATIVE_VALUE if B < 0
- */
-int mpi_mod_mpi( mpi *R, const mpi *A, const mpi *B );
-
-/**
- * \brief Modulo: r = A mod b
- *
- * \param r Destination t_uint
- * \param A Left-hand MPI
- * \param b Integer to divide by
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0,
- * POLARSSL_ERR_MPI_NEGATIVE_VALUE if b < 0
- */
-int mpi_mod_int( t_uint *r, const mpi *A, t_sint b );
-
-/**
- * \brief Sliding-window exponentiation: X = A^E mod N
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param E Exponent MPI
- * \param N Modular MPI
- * \param _RR Speed-up MPI used for recalculations
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even
- *
- * \note _RR is used to avoid re-computing R*R mod N across
- * multiple calls, which speeds up things a bit. It can
- * be set to NULL if the extra performance is unneeded.
- */
-int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR );
-
-/**
- * \brief Fill an MPI X with size bytes of random
- *
- * \param X Destination MPI
- * \param size Size in bytes
- * \param f_rng RNG function
- * \param p_rng RNG parameter
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_fill_random( mpi *X, size_t size, int (*f_rng)(void *), void *p_rng );
-
-/**
- * \brief Greatest common divisor: G = gcd(A, B)
- *
- * \param G Destination MPI
- * \param A Left-hand MPI
- * \param B Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed
- */
-int mpi_gcd( mpi *G, const mpi *A, const mpi *B );
-
-/**
- * \brief Modular inverse: X = A^-1 mod N
- *
- * \param X Destination MPI
- * \param A Left-hand MPI
- * \param N Right-hand MPI
- *
- * \return 0 if successful,
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or nil
- POLARSSL_ERR_MPI_NOT_ACCEPTABLE if A has no inverse mod N
- */
-int mpi_inv_mod( mpi *X, const mpi *A, const mpi *N );
-
-/**
- * \brief Miller-Rabin primality test
- *
- * \param X MPI to check
- * \param f_rng RNG function
- * \param p_rng RNG parameter
- *
- * \return 0 if successful (probably prime),
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_NOT_ACCEPTABLE if X is not prime
- */
-int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng );
-
-/**
- * \brief Prime number generation
- *
- * \param X Destination MPI
- * \param nbits Required size of X in bits ( 3 <= nbits <= 4096 )
- * \param dh_flag If 1, then (X-1)/2 will be prime too
- * \param f_rng RNG function
- * \param p_rng RNG parameter
- *
- * \return 0 if successful (probably prime),
- * 1 if memory allocation failed,
- * POLARSSL_ERR_MPI_BAD_INPUT_DATA if nbits is < 3
- */
-int mpi_gen_prime( mpi *X, size_t nbits, int dh_flag,
- int (*f_rng)(void *), void *p_rng );
-
-/**
- * \brief Checkup routine
- *
- * \return 0 if successful, or 1 if the test failed
- */
-int mpi_self_test( int verbose );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* bignum.h */
diff --git a/protocols/Tlen/crypto/polarssl/bn_mul.h b/protocols/Tlen/crypto/polarssl/bn_mul.h
deleted file mode 100644
index 59a32857cb..0000000000
--- a/protocols/Tlen/crypto/polarssl/bn_mul.h
+++ /dev/null
@@ -1,738 +0,0 @@
-/**
- * \file bn_mul.h
- *
- * \brief Multi-precision integer library
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-/*
- * Multiply source vector [s] with b, add result
- * to destination vector [d] and set carry c.
- *
- * Currently supports:
- *
- * . IA-32 (386+) . AMD64 / EM64T
- * . IA-32 (SSE2) . Motorola 68000
- * . PowerPC, 32-bit . MicroBlaze
- * . PowerPC, 64-bit . TriCore
- * . SPARC v8 . ARM v3+
- * . Alpha . MIPS32
- * . C, longlong . C, generic
- */
-#ifndef POLARSSL_BN_MUL_H
-#define POLARSSL_BN_MUL_H
-
-#include "polarssl/config.h"
-
-#if defined(POLARSSL_HAVE_ASM)
-
-#if defined(__GNUC__)
-#if defined(__i386__)
-
-#define MULADDC_INIT \
- asm( " \
- movl %%ebx, %0; \
- movl %5, %%esi; \
- movl %6, %%edi; \
- movl %7, %%ecx; \
- movl %8, %%ebx; \
- "
-
-#define MULADDC_CORE \
- " \
- lodsl; \
- mull %%ebx; \
- addl %%ecx, %%eax; \
- adcl $0, %%edx; \
- addl (%%edi), %%eax; \
- adcl $0, %%edx; \
- movl %%edx, %%ecx; \
- stosl; \
- "
-
-#if defined(POLARSSL_HAVE_SSE2)
-
-#define MULADDC_HUIT \
- " \
- movd %%ecx, %%mm1; \
- movd %%ebx, %%mm0; \
- movd (%%edi), %%mm3; \
- paddq %%mm3, %%mm1; \
- movd (%%esi), %%mm2; \
- pmuludq %%mm0, %%mm2; \
- movd 4(%%esi), %%mm4; \
- pmuludq %%mm0, %%mm4; \
- movd 8(%%esi), %%mm6; \
- pmuludq %%mm0, %%mm6; \
- movd 12(%%esi), %%mm7; \
- pmuludq %%mm0, %%mm7; \
- paddq %%mm2, %%mm1; \
- movd 4(%%edi), %%mm3; \
- paddq %%mm4, %%mm3; \
- movd 8(%%edi), %%mm5; \
- paddq %%mm6, %%mm5; \
- movd 12(%%edi), %%mm4; \
- paddq %%mm4, %%mm7; \
- movd %%mm1, (%%edi); \
- movd 16(%%esi), %%mm2; \
- pmuludq %%mm0, %%mm2; \
- psrlq $32, %%mm1; \
- movd 20(%%esi), %%mm4; \
- pmuludq %%mm0, %%mm4; \
- paddq %%mm3, %%mm1; \
- movd 24(%%esi), %%mm6; \
- pmuludq %%mm0, %%mm6; \
- movd %%mm1, 4(%%edi); \
- psrlq $32, %%mm1; \
- movd 28(%%esi), %%mm3; \
- pmuludq %%mm0, %%mm3; \
- paddq %%mm5, %%mm1; \
- movd 16(%%edi), %%mm5; \
- paddq %%mm5, %%mm2; \
- movd %%mm1, 8(%%edi); \
- psrlq $32, %%mm1; \
- paddq %%mm7, %%mm1; \
- movd 20(%%edi), %%mm5; \
- paddq %%mm5, %%mm4; \
- movd %%mm1, 12(%%edi); \
- psrlq $32, %%mm1; \
- paddq %%mm2, %%mm1; \
- movd 24(%%edi), %%mm5; \
- paddq %%mm5, %%mm6; \
- movd %%mm1, 16(%%edi); \
- psrlq $32, %%mm1; \
- paddq %%mm4, %%mm1; \
- movd 28(%%edi), %%mm5; \
- paddq %%mm5, %%mm3; \
- movd %%mm1, 20(%%edi); \
- psrlq $32, %%mm1; \
- paddq %%mm6, %%mm1; \
- movd %%mm1, 24(%%edi); \
- psrlq $32, %%mm1; \
- paddq %%mm3, %%mm1; \
- movd %%mm1, 28(%%edi); \
- addl $32, %%edi; \
- addl $32, %%esi; \
- psrlq $32, %%mm1; \
- movd %%mm1, %%ecx; \
- "
-
-#define MULADDC_STOP \
- " \
- emms; \
- movl %4, %%ebx; \
- movl %%ecx, %1; \
- movl %%edi, %2; \
- movl %%esi, %3; \
- " \
- : "=m" (t), "=m" (c), "=m" (d), "=m" (s) \
- : "m" (t), "m" (s), "m" (d), "m" (c), "m" (b) \
- : "eax", "ecx", "edx", "esi", "edi" \
- );
-
-#else
-
-#define MULADDC_STOP \
- " \
- movl %4, %%ebx; \
- movl %%ecx, %1; \
- movl %%edi, %2; \
- movl %%esi, %3; \
- " \
- : "=m" (t), "=m" (c), "=m" (d), "=m" (s) \
- : "m" (t), "m" (s), "m" (d), "m" (c), "m" (b) \
- : "eax", "ecx", "edx", "esi", "edi" \
- );
-#endif /* SSE2 */
-#endif /* i386 */
-
-#if defined(__amd64__) || defined (__x86_64__)
-
-#define MULADDC_INIT \
- asm( "movq %0, %%rsi " :: "m" (s)); \
- asm( "movq %0, %%rdi " :: "m" (d)); \
- asm( "movq %0, %%rcx " :: "m" (c)); \
- asm( "movq %0, %%rbx " :: "m" (b)); \
- asm( "xorq %r8, %r8 " );
-
-#define MULADDC_CORE \
- asm( "movq (%rsi),%rax " ); \
- asm( "mulq %rbx " ); \
- asm( "addq $8, %rsi " ); \
- asm( "addq %rcx, %rax " ); \
- asm( "movq %r8, %rcx " ); \
- asm( "adcq $0, %rdx " ); \
- asm( "nop " ); \
- asm( "addq %rax, (%rdi) " ); \
- asm( "adcq %rdx, %rcx " ); \
- asm( "addq $8, %rdi " );
-
-#define MULADDC_STOP \
- asm( "movq %%rcx, %0 " : "=m" (c)); \
- asm( "movq %%rdi, %0 " : "=m" (d)); \
- asm( "movq %%rsi, %0 " : "=m" (s) :: \
- "rax", "rcx", "rdx", "rbx", "rsi", "rdi", "r8" );
-
-#endif /* AMD64 */
-
-#if defined(__mc68020__) || defined(__mcpu32__)
-
-#define MULADDC_INIT \
- asm( "movl %0, %%a2 " :: "m" (s)); \
- asm( "movl %0, %%a3 " :: "m" (d)); \
- asm( "movl %0, %%d3 " :: "m" (c)); \
- asm( "movl %0, %%d2 " :: "m" (b)); \
- asm( "moveq #0, %d0 " );
-
-#define MULADDC_CORE \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d4:%d1 " ); \
- asm( "addl %d3, %d1 " ); \
- asm( "addxl %d0, %d4 " ); \
- asm( "moveq #0, %d3 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "addxl %d4, %d3 " );
-
-#define MULADDC_STOP \
- asm( "movl %%d3, %0 " : "=m" (c)); \
- asm( "movl %%a3, %0 " : "=m" (d)); \
- asm( "movl %%a2, %0 " : "=m" (s) :: \
- "d0", "d1", "d2", "d3", "d4", "a2", "a3" );
-
-#define MULADDC_HUIT \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d4:%d1 " ); \
- asm( "addxl %d3, %d1 " ); \
- asm( "addxl %d0, %d4 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d3:%d1 " ); \
- asm( "addxl %d4, %d1 " ); \
- asm( "addxl %d0, %d3 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d4:%d1 " ); \
- asm( "addxl %d3, %d1 " ); \
- asm( "addxl %d0, %d4 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d3:%d1 " ); \
- asm( "addxl %d4, %d1 " ); \
- asm( "addxl %d0, %d3 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d4:%d1 " ); \
- asm( "addxl %d3, %d1 " ); \
- asm( "addxl %d0, %d4 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d3:%d1 " ); \
- asm( "addxl %d4, %d1 " ); \
- asm( "addxl %d0, %d3 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d4:%d1 " ); \
- asm( "addxl %d3, %d1 " ); \
- asm( "addxl %d0, %d4 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "movel %a2@+, %d1 " ); \
- asm( "mulul %d2, %d3:%d1 " ); \
- asm( "addxl %d4, %d1 " ); \
- asm( "addxl %d0, %d3 " ); \
- asm( "addl %d1, %a3@+ " ); \
- asm( "addxl %d0, %d3 " );
-
-#endif /* MC68000 */
-
-#if defined(__powerpc__) || defined(__ppc__)
-#if defined(__powerpc64__) || defined(__ppc64__)
-
-#if defined(__MACH__) && defined(__APPLE__)
-
-#define MULADDC_INIT \
- asm( "ld r3, %0 " :: "m" (s)); \
- asm( "ld r4, %0 " :: "m" (d)); \
- asm( "ld r5, %0 " :: "m" (c)); \
- asm( "ld r6, %0 " :: "m" (b)); \
- asm( "addi r3, r3, -8 " ); \
- asm( "addi r4, r4, -8 " ); \
- asm( "addic r5, r5, 0 " );
-
-#define MULADDC_CORE \
- asm( "ldu r7, 8(r3) " ); \
- asm( "mulld r8, r7, r6 " ); \
- asm( "mulhdu r9, r7, r6 " ); \
- asm( "adde r8, r8, r5 " ); \
- asm( "ld r7, 8(r4) " ); \
- asm( "addze r5, r9 " ); \
- asm( "addc r8, r8, r7 " ); \
- asm( "stdu r8, 8(r4) " );
-
-#define MULADDC_STOP \
- asm( "addze r5, r5 " ); \
- asm( "addi r4, r4, 8 " ); \
- asm( "addi r3, r3, 8 " ); \
- asm( "std r5, %0 " : "=m" (c)); \
- asm( "std r4, %0 " : "=m" (d)); \
- asm( "std r3, %0 " : "=m" (s) :: \
- "r3", "r4", "r5", "r6", "r7", "r8", "r9" );
-
-#else
-
-#define MULADDC_INIT \
- asm( "ld %%r3, %0 " :: "m" (s)); \
- asm( "ld %%r4, %0 " :: "m" (d)); \
- asm( "ld %%r5, %0 " :: "m" (c)); \
- asm( "ld %%r6, %0 " :: "m" (b)); \
- asm( "addi %r3, %r3, -8 " ); \
- asm( "addi %r4, %r4, -8 " ); \
- asm( "addic %r5, %r5, 0 " );
-
-#define MULADDC_CORE \
- asm( "ldu %r7, 8(%r3) " ); \
- asm( "mulld %r8, %r7, %r6 " ); \
- asm( "mulhdu %r9, %r7, %r6 " ); \
- asm( "adde %r8, %r8, %r5 " ); \
- asm( "ld %r7, 8(%r4) " ); \
- asm( "addze %r5, %r9 " ); \
- asm( "addc %r8, %r8, %r7 " ); \
- asm( "stdu %r8, 8(%r4) " );
-
-#define MULADDC_STOP \
- asm( "addze %r5, %r5 " ); \
- asm( "addi %r4, %r4, 8 " ); \
- asm( "addi %r3, %r3, 8 " ); \
- asm( "std %%r5, %0 " : "=m" (c)); \
- asm( "std %%r4, %0 " : "=m" (d)); \
- asm( "std %%r3, %0 " : "=m" (s) :: \
- "r3", "r4", "r5", "r6", "r7", "r8", "r9" );
-
-#endif
-
-#else /* PPC32 */
-
-#if defined(__MACH__) && defined(__APPLE__)
-
-#define MULADDC_INIT \
- asm( "lwz r3, %0 " :: "m" (s)); \
- asm( "lwz r4, %0 " :: "m" (d)); \
- asm( "lwz r5, %0 " :: "m" (c)); \
- asm( "lwz r6, %0 " :: "m" (b)); \
- asm( "addi r3, r3, -4 " ); \
- asm( "addi r4, r4, -4 " ); \
- asm( "addic r5, r5, 0 " );
-
-#define MULADDC_CORE \
- asm( "lwzu r7, 4(r3) " ); \
- asm( "mullw r8, r7, r6 " ); \
- asm( "mulhwu r9, r7, r6 " ); \
- asm( "adde r8, r8, r5 " ); \
- asm( "lwz r7, 4(r4) " ); \
- asm( "addze r5, r9 " ); \
- asm( "addc r8, r8, r7 " ); \
- asm( "stwu r8, 4(r4) " );
-
-#define MULADDC_STOP \
- asm( "addze r5, r5 " ); \
- asm( "addi r4, r4, 4 " ); \
- asm( "addi r3, r3, 4 " ); \
- asm( "stw r5, %0 " : "=m" (c)); \
- asm( "stw r4, %0 " : "=m" (d)); \
- asm( "stw r3, %0 " : "=m" (s) :: \
- "r3", "r4", "r5", "r6", "r7", "r8", "r9" );
-
-#else
-
-#define MULADDC_INIT \
- asm( "lwz %%r3, %0 " :: "m" (s)); \
- asm( "lwz %%r4, %0 " :: "m" (d)); \
- asm( "lwz %%r5, %0 " :: "m" (c)); \
- asm( "lwz %%r6, %0 " :: "m" (b)); \
- asm( "addi %r3, %r3, -4 " ); \
- asm( "addi %r4, %r4, -4 " ); \
- asm( "addic %r5, %r5, 0 " );
-
-#define MULADDC_CORE \
- asm( "lwzu %r7, 4(%r3) " ); \
- asm( "mullw %r8, %r7, %r6 " ); \
- asm( "mulhwu %r9, %r7, %r6 " ); \
- asm( "adde %r8, %r8, %r5 " ); \
- asm( "lwz %r7, 4(%r4) " ); \
- asm( "addze %r5, %r9 " ); \
- asm( "addc %r8, %r8, %r7 " ); \
- asm( "stwu %r8, 4(%r4) " );
-
-#define MULADDC_STOP \
- asm( "addze %r5, %r5 " ); \
- asm( "addi %r4, %r4, 4 " ); \
- asm( "addi %r3, %r3, 4 " ); \
- asm( "stw %%r5, %0 " : "=m" (c)); \
- asm( "stw %%r4, %0 " : "=m" (d)); \
- asm( "stw %%r3, %0 " : "=m" (s) :: \
- "r3", "r4", "r5", "r6", "r7", "r8", "r9" );
-
-#endif
-
-#endif /* PPC32 */
-#endif /* PPC64 */
-
-#if defined(__sparc__)
-
-#define MULADDC_INIT \
- asm( "ld %0, %%o0 " :: "m" (s)); \
- asm( "ld %0, %%o1 " :: "m" (d)); \
- asm( "ld %0, %%o2 " :: "m" (c)); \
- asm( "ld %0, %%o3 " :: "m" (b));
-
-#define MULADDC_CORE \
- asm( "ld [%o0], %o4 " ); \
- asm( "inc 4, %o0 " ); \
- asm( "ld [%o1], %o5 " ); \
- asm( "umul %o3, %o4, %o4 " ); \
- asm( "addcc %o4, %o2, %o4 " ); \
- asm( "rd %y, %g1 " ); \
- asm( "addx %g1, 0, %g1 " ); \
- asm( "addcc %o4, %o5, %o4 " ); \
- asm( "st %o4, [%o1] " ); \
- asm( "addx %g1, 0, %o2 " ); \
- asm( "inc 4, %o1 " );
-
-#define MULADDC_STOP \
- asm( "st %%o2, %0 " : "=m" (c)); \
- asm( "st %%o1, %0 " : "=m" (d)); \
- asm( "st %%o0, %0 " : "=m" (s) :: \
- "g1", "o0", "o1", "o2", "o3", "o4", "o5" );
-
-#endif /* SPARCv8 */
-
-#if defined(__microblaze__) || defined(microblaze)
-
-#define MULADDC_INIT \
- asm( "lwi r3, %0 " :: "m" (s)); \
- asm( "lwi r4, %0 " :: "m" (d)); \
- asm( "lwi r5, %0 " :: "m" (c)); \
- asm( "lwi r6, %0 " :: "m" (b)); \
- asm( "andi r7, r6, 0xffff" ); \
- asm( "bsrli r6, r6, 16 " );
-
-#define MULADDC_CORE \
- asm( "lhui r8, r3, 0 " ); \
- asm( "addi r3, r3, 2 " ); \
- asm( "lhui r9, r3, 0 " ); \
- asm( "addi r3, r3, 2 " ); \
- asm( "mul r10, r9, r6 " ); \
- asm( "mul r11, r8, r7 " ); \
- asm( "mul r12, r9, r7 " ); \
- asm( "mul r13, r8, r6 " ); \
- asm( "bsrli r8, r10, 16 " ); \
- asm( "bsrli r9, r11, 16 " ); \
- asm( "add r13, r13, r8 " ); \
- asm( "add r13, r13, r9 " ); \
- asm( "bslli r10, r10, 16 " ); \
- asm( "bslli r11, r11, 16 " ); \
- asm( "add r12, r12, r10 " ); \
- asm( "addc r13, r13, r0 " ); \
- asm( "add r12, r12, r11 " ); \
- asm( "addc r13, r13, r0 " ); \
- asm( "lwi r10, r4, 0 " ); \
- asm( "add r12, r12, r10 " ); \
- asm( "addc r13, r13, r0 " ); \
- asm( "add r12, r12, r5 " ); \
- asm( "addc r5, r13, r0 " ); \
- asm( "swi r12, r4, 0 " ); \
- asm( "addi r4, r4, 4 " );
-
-#define MULADDC_STOP \
- asm( "swi r5, %0 " : "=m" (c)); \
- asm( "swi r4, %0 " : "=m" (d)); \
- asm( "swi r3, %0 " : "=m" (s) :: \
- "r3", "r4" , "r5" , "r6" , "r7" , "r8" , \
- "r9", "r10", "r11", "r12", "r13" );
-
-#endif /* MicroBlaze */
-
-#if defined(__tricore__)
-
-#define MULADDC_INIT \
- asm( "ld.a %%a2, %0 " :: "m" (s)); \
- asm( "ld.a %%a3, %0 " :: "m" (d)); \
- asm( "ld.w %%d4, %0 " :: "m" (c)); \
- asm( "ld.w %%d1, %0 " :: "m" (b)); \
- asm( "xor %d5, %d5 " );
-
-#define MULADDC_CORE \
- asm( "ld.w %d0, [%a2+] " ); \
- asm( "madd.u %e2, %e4, %d0, %d1 " ); \
- asm( "ld.w %d0, [%a3] " ); \
- asm( "addx %d2, %d2, %d0 " ); \
- asm( "addc %d3, %d3, 0 " ); \
- asm( "mov %d4, %d3 " ); \
- asm( "st.w [%a3+], %d2 " );
-
-#define MULADDC_STOP \
- asm( "st.w %0, %%d4 " : "=m" (c)); \
- asm( "st.a %0, %%a3 " : "=m" (d)); \
- asm( "st.a %0, %%a2 " : "=m" (s) :: \
- "d0", "d1", "e2", "d4", "a2", "a3" );
-
-#endif /* TriCore */
-
-#if defined(__arm__)
-
-#define MULADDC_INIT \
- asm( "ldr r0, %0 " :: "m" (s)); \
- asm( "ldr r1, %0 " :: "m" (d)); \
- asm( "ldr r2, %0 " :: "m" (c)); \
- asm( "ldr r3, %0 " :: "m" (b));
-
-#define MULADDC_CORE \
- asm( "ldr r4, [r0], #4 " ); \
- asm( "mov r5, #0 " ); \
- asm( "ldr r6, [r1] " ); \
- asm( "umlal r2, r5, r3, r4 " ); \
- asm( "adds r7, r6, r2 " ); \
- asm( "adc r2, r5, #0 " ); \
- asm( "str r7, [r1], #4 " );
-
-#define MULADDC_STOP \
- asm( "str r2, %0 " : "=m" (c)); \
- asm( "str r1, %0 " : "=m" (d)); \
- asm( "str r0, %0 " : "=m" (s) :: \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7" );
-
-#endif /* ARMv3 */
-
-#if defined(__alpha__)
-
-#define MULADDC_INIT \
- asm( "ldq $1, %0 " :: "m" (s)); \
- asm( "ldq $2, %0 " :: "m" (d)); \
- asm( "ldq $3, %0 " :: "m" (c)); \
- asm( "ldq $4, %0 " :: "m" (b));
-
-#define MULADDC_CORE \
- asm( "ldq $6, 0($1) " ); \
- asm( "addq $1, 8, $1 " ); \
- asm( "mulq $6, $4, $7 " ); \
- asm( "umulh $6, $4, $6 " ); \
- asm( "addq $7, $3, $7 " ); \
- asm( "cmpult $7, $3, $3 " ); \
- asm( "ldq $5, 0($2) " ); \
- asm( "addq $7, $5, $7 " ); \
- asm( "cmpult $7, $5, $5 " ); \
- asm( "stq $7, 0($2) " ); \
- asm( "addq $2, 8, $2 " ); \
- asm( "addq $6, $3, $3 " ); \
- asm( "addq $5, $3, $3 " );
-
-#define MULADDC_STOP \
- asm( "stq $3, %0 " : "=m" (c)); \
- asm( "stq $2, %0 " : "=m" (d)); \
- asm( "stq $1, %0 " : "=m" (s) :: \
- "$1", "$2", "$3", "$4", "$5", "$6", "$7" );
-
-#endif /* Alpha */
-
-#if defined(__mips__)
-
-#define MULADDC_INIT \
- asm( "lw $10, %0 " :: "m" (s)); \
- asm( "lw $11, %0 " :: "m" (d)); \
- asm( "lw $12, %0 " :: "m" (c)); \
- asm( "lw $13, %0 " :: "m" (b));
-
-#define MULADDC_CORE \
- asm( "lw $14, 0($10) " ); \
- asm( "multu $13, $14 " ); \
- asm( "addi $10, $10, 4 " ); \
- asm( "mflo $14 " ); \
- asm( "mfhi $9 " ); \
- asm( "addu $14, $12, $14 " ); \
- asm( "lw $15, 0($11) " ); \
- asm( "sltu $12, $14, $12 " ); \
- asm( "addu $15, $14, $15 " ); \
- asm( "sltu $14, $15, $14 " ); \
- asm( "addu $12, $12, $9 " ); \
- asm( "sw $15, 0($11) " ); \
- asm( "addu $12, $12, $14 " ); \
- asm( "addi $11, $11, 4 " );
-
-#define MULADDC_STOP \
- asm( "sw $12, %0 " : "=m" (c)); \
- asm( "sw $11, %0 " : "=m" (d)); \
- asm( "sw $10, %0 " : "=m" (s) :: \
- "$9", "$10", "$11", "$12", "$13", "$14", "$15" );
-
-#endif /* MIPS */
-#endif /* GNUC */
-
-#if (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
-
-#define MULADDC_INIT \
- __asm mov esi, s \
- __asm mov edi, d \
- __asm mov ecx, c \
- __asm mov ebx, b
-
-#define MULADDC_CORE \
- __asm lodsd \
- __asm mul ebx \
- __asm add eax, ecx \
- __asm adc edx, 0 \
- __asm add eax, [edi] \
- __asm adc edx, 0 \
- __asm mov ecx, edx \
- __asm stosd
-
-#if defined(POLARSSL_HAVE_SSE2)
-
-#define EMIT __asm _emit
-
-#define MULADDC_HUIT \
- EMIT 0x0F EMIT 0x6E EMIT 0xC9 \
- EMIT 0x0F EMIT 0x6E EMIT 0xC3 \
- EMIT 0x0F EMIT 0x6E EMIT 0x1F \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCB \
- EMIT 0x0F EMIT 0x6E EMIT 0x16 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xD0 \
- EMIT 0x0F EMIT 0x6E EMIT 0x66 EMIT 0x04 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xE0 \
- EMIT 0x0F EMIT 0x6E EMIT 0x76 EMIT 0x08 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xF0 \
- EMIT 0x0F EMIT 0x6E EMIT 0x7E EMIT 0x0C \
- EMIT 0x0F EMIT 0xF4 EMIT 0xF8 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCA \
- EMIT 0x0F EMIT 0x6E EMIT 0x5F EMIT 0x04 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xDC \
- EMIT 0x0F EMIT 0x6E EMIT 0x6F EMIT 0x08 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xEE \
- EMIT 0x0F EMIT 0x6E EMIT 0x67 EMIT 0x0C \
- EMIT 0x0F EMIT 0xD4 EMIT 0xFC \
- EMIT 0x0F EMIT 0x7E EMIT 0x0F \
- EMIT 0x0F EMIT 0x6E EMIT 0x56 EMIT 0x10 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xD0 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0x6E EMIT 0x66 EMIT 0x14 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xE0 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCB \
- EMIT 0x0F EMIT 0x6E EMIT 0x76 EMIT 0x18 \
- EMIT 0x0F EMIT 0xF4 EMIT 0xF0 \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x04 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0x6E EMIT 0x5E EMIT 0x1C \
- EMIT 0x0F EMIT 0xF4 EMIT 0xD8 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCD \
- EMIT 0x0F EMIT 0x6E EMIT 0x6F EMIT 0x10 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xD5 \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x08 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCF \
- EMIT 0x0F EMIT 0x6E EMIT 0x6F EMIT 0x14 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xE5 \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x0C \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCA \
- EMIT 0x0F EMIT 0x6E EMIT 0x6F EMIT 0x18 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xF5 \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x10 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCC \
- EMIT 0x0F EMIT 0x6E EMIT 0x6F EMIT 0x1C \
- EMIT 0x0F EMIT 0xD4 EMIT 0xDD \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x14 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCE \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x18 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0xD4 EMIT 0xCB \
- EMIT 0x0F EMIT 0x7E EMIT 0x4F EMIT 0x1C \
- EMIT 0x83 EMIT 0xC7 EMIT 0x20 \
- EMIT 0x83 EMIT 0xC6 EMIT 0x20 \
- EMIT 0x0F EMIT 0x73 EMIT 0xD1 EMIT 0x20 \
- EMIT 0x0F EMIT 0x7E EMIT 0xC9
-
-#define MULADDC_STOP \
- EMIT 0x0F EMIT 0x77 \
- __asm mov c, ecx \
- __asm mov d, edi \
- __asm mov s, esi \
-
-#else
-
-#define MULADDC_STOP \
- __asm mov c, ecx \
- __asm mov d, edi \
- __asm mov s, esi \
-
-#endif /* SSE2 */
-#endif /* MSVC */
-
-#endif /* POLARSSL_HAVE_ASM */
-
-#if !defined(MULADDC_CORE)
-#if defined(POLARSSL_HAVE_LONGLONG)
-
-#define MULADDC_INIT \
-{ \
- t_udbl r; \
- t_uint r0, r1;
-
-#define MULADDC_CORE \
- r = *(s++) * (t_udbl) b; \
- r0 = r; \
- r1 = r >> biL; \
- r0 += c; r1 += (r0 < c); \
- r0 += *d; r1 += (r0 < *d); \
- c = r1; *(d++) = r0;
-
-#define MULADDC_STOP \
-}
-
-#else
-#define MULADDC_INIT \
-{ \
- t_uint s0, s1, b0, b1; \
- t_uint r0, r1, rx, ry; \
- b0 = ( b << biH ) >> biH; \
- b1 = ( b >> biH );
-
-#define MULADDC_CORE \
- s0 = ( *s << biH ) >> biH; \
- s1 = ( *s >> biH ); s++; \
- rx = s0 * b1; r0 = s0 * b0; \
- ry = s1 * b0; r1 = s1 * b1; \
- r1 += ( rx >> biH ); \
- r1 += ( ry >> biH ); \
- rx <<= biH; ry <<= biH; \
- r0 += rx; r1 += (r0 < rx); \
- r0 += ry; r1 += (r0 < ry); \
- r0 += c; r1 += (r0 < c); \
- r0 += *d; r1 += (r0 < *d); \
- c = r1; *(d++) = r0;
-
-#define MULADDC_STOP \
-}
-
-#endif /* C (generic) */
-#endif /* C (longlong) */
-
-#endif /* bn_mul.h */
diff --git a/protocols/Tlen/crypto/polarssl/config.h b/protocols/Tlen/crypto/polarssl/config.h
deleted file mode 100644
index 61500a75ee..0000000000
--- a/protocols/Tlen/crypto/polarssl/config.h
+++ /dev/null
@@ -1,625 +0,0 @@
-/**
- * \file config.h
- *
- * \brief Configuration options (set of defines)
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * This set of compile-time options may be used to enable
- * or disable features selectively, and reduce the global
- * memory footprint.
- */
-#ifndef POLARSSL_CONFIG_H
-#define POLARSSL_CONFIG_H
-
-#ifndef _CRT_SECURE_NO_DEPRECATE
-#define _CRT_SECURE_NO_DEPRECATE 1
-#endif
-
-/**
- * \name SECTION: System support
- *
- * This section sets system specific settings.
- * \{
- */
-
-/**
- * \def POLARSSL_HAVE_INT8
- *
- * The system uses 8-bit wide native integers.
- *
- * Uncomment if native integers are 8-bit wide.
-#define POLARSSL_HAVE_INT8
- */
-
-/**
- * \def POLARSSL_HAVE_INT16
- *
- * The system uses 16-bit wide native integers.
- *
- * Uncomment if native integers are 16-bit wide.
-#define POLARSSL_HAVE_INT16
- */
-
-/**
- * \def POLARSSL_HAVE_LONGLONG
- *
- * The compiler supports the use of long long.
- *
- * Uncomment if the compiler supports long long.
-#define POLARSSL_HAVE_LONGLONG
- */
-
-/**
- * \def POLARSSL_HAVE_ASM
- *
- * The compiler has support for asm()
- *
- * Uncomment to enable the use of assembly code.
- *
- * Requires support for asm() in compiler.
- *
- * Used in:
- * library/timing.c
- * library/padlock.c
- * include/polarssl/bn_mul.h
- *
- */
-#define POLARSSL_HAVE_ASM
-
-/**
- * \def POLARSSL_HAVE_SSE2
- *
- * CPI supports SSE2 instruction set.
- *
- * Uncomment if the CPU supports SSE2 (IA-32 specific).
- *
-#define POLARSSL_HAVE_SSE2
- */
-/* \} name */
-
-/**
- * \name SECTION: PolarSSL feature support
- *
- * This section sets support for features that are or are not needed
- * within the modules that are enabled.
- * \{
- */
-
-/**
- * \def POLARSSL_AES_ROM_TABLES
- *
- * Store the AES tables in ROM.
- *
- * Uncomment this macro to store the AES tables in ROM.
- *
-#define POLARSSL_AES_ROM_TABLES
- */
-
-/**
- * \def POLARSSL_CIPHER_MODE_CFB
- *
- * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
- */
-#define POLARSSL_CIPHER_MODE_CFB
-
-/**
- * \def POLARSSL_CIPHER_MODE_CTR
- *
- * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
- */
-#define POLARSSL_CIPHER_MODE_CTR
-
-/**
- * \def POLARSSL_DEBUG_MSG
- *
- * Requires: POLARSSL_DEBUG_C
- *
- * Enable all SSL/TLS debugging messages.
- */
-#define POLARSSL_DEBUG_MSG
-
-/**
- * \def POLARSSL_GENPRIME
- *
- * Requires: POLARSSL_BIGNUM_C, POLARSSL_RSA_C
- *
- * Enable the RSA prime-number generation code.
- */
-#define POLARSSL_GENPRIME
-
-/**
- * \def POLARSSL_FS_IO
- *
- * Enable functions that use the filesystem.
- */
-#define POLARSSL_FS_IO
-
-/**
- * \def POLARSSL_PKCS1_V21
- *
- * Requires: POLARSSL_MD_C, POLARSSL_RSA_C
- *
- * Enable support for PKCS#1 v2.1 encoding.
- * This enables support for RSAES-OAEP and RSASSA-PSS operations.
- */
-#define POLARSSL_PKCS1_V21
-
-/**
- * \def POLARSSL_RSA_NO_CRT
- *
- * Do not use the Chinese Remainder Theorem for the RSA private operation.
- *
- * Uncomment this macro to disable the use of CRT in RSA.
- *
-#define POLARSSL_RSA_NO_CRT
- */
-
-/**
- * \def POLARSSL_SELF_TEST
- *
- * Enable the checkup functions (*_self_test).
- */
-#define POLARSSL_SELF_TEST
-
-/**
- * \def POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
- *
- * If set, the X509 parser will not break-off when parsing an X509 certificate
- * and encountering an unknown critical extension.
- *
- * Uncomment to prevent an error.
- *
-#define POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
- */
-/* \} name */
-
-/**
- * \name SECTION: PolarSSL modules
- *
- * This section enables or disables entire modules in PolarSSL
- * \{
- */
-
-/**
- * \def POLARSSL_AES_C
- *
- * Enable the AES block cipher.
- *
- * Module: library/aes.c
- * Caller: library/ssl_tls.c
- * library/pem.c
- *
- * This module enables the following ciphersuites:
- * SSL_RSA_AES_128_SHA
- * SSL_RSA_AES_256_SHA
- * SSL_EDH_RSA_AES_256_SHA
- */
-#define POLARSSL_AES_C
-
-/**
- * \def POLARSSL_ARC4_C
- *
- * Enable the ARCFOUR stream cipher.
- *
- * Module: library/arc4.c
- * Caller: library/ssl_tls.c
- *
- * This module enables the following ciphersuites:
- * SSL_RSA_RC4_128_MD5
- * SSL_RSA_RC4_128_SHA
- */
-#define POLARSSL_ARC4_C
-
-/**
- * \def POLARSSL_BASE64_C
- *
- * Enable the Base64 module.
- *
- * Module: library/base64.c
- * Caller: library/pem.c
- *
- * This module is required for PEM support (required by X.509).
- */
-#define POLARSSL_BASE64_C
-
-/**
- * \def POLARSSL_BIGNUM_C
- *
- * Enable the multo-precision integer library.
- *
- * Module: library/bignum.c
- * Caller: library/dhm.c
- * library/rsa.c
- * library/ssl_tls.c
- * library/x509parse.c
- *
- * This module is required for RSA and DHM support.
- */
-#define POLARSSL_BIGNUM_C
-
-/**
- * \def POLARSSL_CAMELLIA_C
- *
- * Enable the Camellia block cipher.
- *
- * Module: library/camellia.c
- * Caller: library/ssl_tls.c
- *
- * This module enabled the following cipher suites:
- * SSL_RSA_CAMELLIA_128_SHA
- * SSL_RSA_CAMELLIA_256_SHA
- * SSL_EDH_RSA_CAMELLIA_256_SHA
- */
-#define POLARSSL_CAMELLIA_C
-
-/**
- * \def POLARSSL_CERTS_C
- *
- * Enable the test certificates.
- *
- * Module: library/certs.c
- * Caller:
- *
- * This module is used for testing (ssl_client/server).
- */
-#define POLARSSL_CERTS_C
-
-/**
- * \def POLARSSL_CIPHER_C
- *
- * Enable the generic cipher layer.
- *
- * Module: library/cipher.c
- * Caller:
- *
- * Uncomment to enable generic cipher wrappers.
- */
-#define POLARSSL_CIPHER_C
-
-/**
- * \def POLARSSL_DEBUG_C
- *
- * Enable the debug functions.
- *
- * Module: library/debug.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- * library/ssl_tls.c
- *
- * This module provides debugging functions.
- */
-#define POLARSSL_DEBUG_C
-
-/**
- * \def POLARSSL_DES_C
- *
- * Enable the DES block cipher.
- *
- * Module: library/des.c
- * Caller: library/ssl_tls.c
- *
- * This module enables the following ciphersuites:
- * SSL_RSA_DES_168_SHA
- * SSL_EDH_RSA_DES_168_SHA
- */
-#define POLARSSL_DES_C
-
-/**
- * \def POLARSSL_DHM_C
- *
- * Enable the Diffie-Hellman-Merkle key exchange.
- *
- * Module: library/dhm.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- *
- * This module enables the following ciphersuites:
- * SSL_EDH_RSA_DES_168_SHA
- * SSL_EDH_RSA_AES_256_SHA
- * SSL_EDH_RSA_CAMELLIA_256_SHA
- */
-#define POLARSSL_DHM_C
-
-/**
- * \def POLARSSL_ERROR_C
- *
- * Enable error code to error string conversion.
- *
- * Module: library/error.c
- * Caller:
- *
- * This module enables err_strerror().
- */
-#define POLARSSL_ERROR_C
-
-/**
- * \def POLARSSL_HAVEGE_C
- *
- * Enable the HAVEGE random generator.
- *
- * Module: library/havege.c
- * Caller:
- *
- * Requires: POLARSSL_TIMING_C
- *
- * This module enables the HAVEGE random number generator.
- */
-#define POLARSSL_HAVEGE_C
-
-/**
- * \def POLARSSL_MD_C
- *
- * Enable the generic message digest layer.
- *
- * Module: library/md.c
- * Caller:
- *
- * Uncomment to enable generic message digest wrappers.
- */
-#define POLARSSL_MD_C
-
-/**
- * \def POLARSSL_MD2_C
- *
- * Enable the MD2 hash algorithm
- *
- * Module: library/md2.c
- * Caller: library/x509parse.c
- *
- * Uncomment to enable support for (rare) MD2-signed X.509 certs.
- *
-#define POLARSSL_MD2_C
- */
-
-/**
- * \def POLARSSL_MD4_C
- *
- * Enable the MD4 hash algorithm
- *
- * Module: library/md4.c
- * Caller: library/x509parse.c
- *
- * Uncomment to enable support for (rare) MD4-signed X.509 certs.
- *
-#define POLARSSL_MD4_C
- */
-
-/**
- * \def POLARSSL_MD5_C
- *
- * Enable the MD5 hash algorithm
- *
- * Module: library/md5.c
- * Caller: library/ssl_tls.c
- * library/x509parse.c
- *
- * This module is required for SSL/TLS and X.509.
- */
-#define POLARSSL_MD5_C
-
-/**
- * \def POLARSSL_NET_C
- *
- * Enable the TCP/IP networking routines.
- *
- * Module: library/net.c
- * Caller:
- *
- * This module provides TCP/IP networking routines.
- */
-#define POLARSSL_NET_C
-
-/**
- * \def POLARSSL_PADLOCK_C
- *
- * Enable VIA Padlock support on x86.
- *
- * Module: library/padlock.c
- * Caller: library/aes.c
- *
- * This modules adds support for the VIA PadLock on x86.
- */
-#define POLARSSL_PADLOCK_C
-
-/**
- * \def POLARSSL_PEM_C
- *
- * Enable PEM decoding
- *
- * Module: library/pem.c
- * Caller: library/x509parse.c
- *
- * Requires: POLARSSL_BASE64_C
- *
- * This modules adds support for decoding PEM files.
- */
-#define POLARSSL_PEM_C
-
-/**
- * \def POLARSSL_PKCS11_C
- *
- * Enable support for PKCS#11 smartcard support.
- *
- * Module: library/ssl_srv.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- *
- * Requires: POLARSSL_SSL_TLS_C
- *
- * This module is required for SSL/TLS PKCS #11 smartcard support.
- * Requires the presence of the PKCS#11 helper library (libpkcs11-helper)
-#define POLARSSL_PKCS11_C
- */
-
-/**
- * \def POLARSSL_RSA_C
- *
- * Enable the RSA public-key cryptosystem.
- *
- * Module: library/rsa.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- * library/ssl_tls.c
- * library/x509.c
- *
- * Requires: POLARSSL_BIGNUM_C
- *
- * This module is required for SSL/TLS and MD5-signed certificates.
- */
-#define POLARSSL_RSA_C
-
-/**
- * \def POLARSSL_SHA1_C
- *
- * Enable the SHA1 cryptographic hash algorithm.
- *
- * Module: library/sha1.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- * library/ssl_tls.c
- * library/x509parse.c
- *
- * This module is required for SSL/TLS and SHA1-signed certificates.
- */
-#define POLARSSL_SHA1_C
-
-/**
- * \def POLARSSL_SHA2_C
- *
- * Enable the SHA-224 and SHA-256 cryptographic hash algorithms.
- *
- * Module: library/sha2.c
- * Caller: library/md_wrap.c
- * library/x509parse.c
- *
- * This module adds support for SHA-224 and SHA-256.
- */
-#define POLARSSL_SHA2_C
-
-/**
- * \def POLARSSL_SHA4_C
- *
- * Enable the SHA-384 and SHA-512 cryptographic hash algorithms.
- *
- * Module: library/sha4.c
- * Caller: library/md_wrap.c
- * library/x509parse.c
- *
- * This module adds support for SHA-384 and SHA-512.
- */
-#define POLARSSL_SHA4_C
-
-/**
- * \def POLARSSL_SSL_CLI_C
- *
- * Enable the SSL/TLS client code.
- *
- * Module: library/ssl_cli.c
- * Caller:
- *
- * Requires: POLARSSL_SSL_TLS_C
- *
- * This module is required for SSL/TLS client support.
- */
-#define POLARSSL_SSL_CLI_C
-
-/*
- * \def POLARSSL_SSL_SRV_C
- *
- * Enable the SSL/TLS server code.
- *
- * Module: library/ssl_srv.c
- * Caller:
- *
- * Requires: POLARSSL_SSL_TLS_C
- *
- * This module is required for SSL/TLS server support.
- */
-#define POLARSSL_SSL_SRV_C
-
-/**
- * \def POLARSSL_SSL_TLS_C
- *
- * Enable the generic SSL/TLS code.
- *
- * Module: library/ssl_tls.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- *
- * Requires: POLARSSL_MD5_C, POLARSSL_SHA1_C, POLARSSL_X509_PARSE_C
- *
- * This module is required for SSL/TLS.
- */
-#define POLARSSL_SSL_TLS_C
-
-/**
- * \def POLARSSL_TIMING_C
- *
- * Enable the portable timing interface.
- *
- * Module: library/timing.c
- * Caller: library/havege.c
- *
- * This module is used by the HAVEGE random number generator.
- */
-#define POLARSSL_TIMING_C
-
-/**
- * \def POLARSSL_VERSION_C
- *
- * Enable run-time version information.
- *
- * Module: library/version.c
- *
- * This module provides run-time version information.
- */
-#define POLARSSL_VERSION_C
-
-/**
- * \def POLARSSL_X509_PARSE_C
- *
- * Enable X.509 certificate parsing.
- *
- * Module: library/x509parse.c
- * Caller: library/ssl_cli.c
- * library/ssl_srv.c
- * library/ssl_tls.c
- *
- * Requires: POLARSSL_BIGNUM_C, POLARSSL_RSA_C
- *
- * This module is required for X.509 certificate parsing.
- */
-#define POLARSSL_X509_PARSE_C
-
-/**
- * \def POLARSSL_XTEA_C
- *
- * Enable the XTEA block cipher.
- *
- * Module: library/xtea.c
- * Caller:
- */
-#define POLARSSL_XTEA_C
-/* \} name */
-
-#endif /* config.h */
diff --git a/protocols/Tlen/crypto/polarssl/padlock.h b/protocols/Tlen/crypto/polarssl/padlock.h
deleted file mode 100644
index 08fbe825c9..0000000000
--- a/protocols/Tlen/crypto/polarssl/padlock.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * \file padlock.h
- *
- * \brief VIA PadLock ACE for HW encryption/decryption supported by some processors
- *
- * Copyright (C) 2006-2010, Brainspark B.V.
- *
- * This file is part of PolarSSL (http://www.polarssl.org)
- * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- * All rights reserved.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef POLARSSL_PADLOCK_H
-#define POLARSSL_PADLOCK_H
-
-#include "polarssl/aes.h"
-
-#define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */
-
-#if defined(POLARSSL_HAVE_ASM) && defined(__GNUC__) && defined(__i386__)
-
-#ifndef POLARSSL_HAVE_X86
-#define POLARSSL_HAVE_X86
-#endif
-
-#define PADLOCK_RNG 0x000C
-#define PADLOCK_ACE 0x00C0
-#define PADLOCK_PHE 0x0C00
-#define PADLOCK_PMM 0x3000
-
-#define PADLOCK_ALIGN16(x) (unsigned long *) (16 + ((long) x & ~15))
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief PadLock detection routine
- *
- * \param The feature to detect
- *
- * \return 1 if CPU has support for the feature, 0 otherwise
- */
-int padlock_supports( int feature );
-
-/**
- * \brief PadLock AES-ECB block en(de)cryption
- *
- * \param ctx AES context
- * \param mode AES_ENCRYPT or AES_DECRYPT
- * \param input 16-byte input block
- * \param output 16-byte output block
- *
- * \return 0 if success, 1 if operation failed
- */
-int padlock_xcryptecb( aes_context *ctx,
- int mode,
- const unsigned char input[16],
- unsigned char output[16] );
-
-/**
- * \brief PadLock AES-CBC buffer en(de)cryption
- *
- * \param ctx AES context
- * \param mode AES_ENCRYPT or AES_DECRYPT
- * \param length length of the input data
- * \param iv initialization vector (updated after use)
- * \param input buffer holding the input data
- * \param output buffer holding the output data
- *
- * \return 0 if success, 1 if operation failed
- */
-int padlock_xcryptcbc( aes_context *ctx,
- int mode,
- size_t length,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HAVE_X86 */
-
-#endif /* padlock.h */
diff --git a/protocols/Tlen/docs/InstallScript.xml b/protocols/Tlen/docs/InstallScript.xml
deleted file mode 100644
index 7d8a8f28fe..0000000000
--- a/protocols/Tlen/docs/InstallScript.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<installscript>
- <info>
- <name>Tlen Protocol</name>
- <author>Santithorn Bunchua</author>
- <version>0.1.0.2</version>
- <type>Plugin</type>
- </info>
-
- <packageinfo>
- <title>Main Files</title>
- <file>tlen.dll</file>
- <file>tlen_czaty.dll</file>
- </packageinfo>
-
- <packageinfo>
- <optional/>
- <title>Documentation</title>
- <file>readme_tlen.txt</file>
- <document/>
- </packageinfo>
-
- <autorun>
- <file>readme_tlen.txt</file>
- <document/>
- </autorun>
-</installscript>
diff --git a/protocols/Tlen/docs/changelog_tlen.txt b/protocols/Tlen/docs/changelog_tlen.txt
deleted file mode 100644
index b2c05c760a..0000000000
--- a/protocols/Tlen/docs/changelog_tlen.txt
+++ /dev/null
@@ -1,269 +0,0 @@
-Version 2.0.5.0
--------
-* Project cleanup
- + change mucc.dll to tlen_czaty.dll
- + compile tlen_czaty in Unicode and x64
-* fix warnings, project files changes
-Version 2.0.4.1
--------
-- fix accounts... dialog
-Version 2.0.4.0
--------
-+ x64 version
-* set timeout to NETLIBOPENCONNECTION (patch by piotrw)
-* fix for display texts at comboboxes in unicode (patch by piotrw)
-* fixes in Find/Add Contacts search (by piotrw, dezeath and wsx22)
-* fix warnings, project files changes (add VS2010)
-Version 2.0.3.2
--------
-* update PolarSSL library to polarssl-1.0.0
-* change compile options to not require microsoft visual studio runtime libs on user system, (100KB larger file but no problems with msvcr90.dll not found on user system)
-Version 2.0.2.0
--------
-* "Leave status message after disconnection", "Send and receive client version information" and "Log alerts as messages" options enabled by default (AL|EN suggestion)
-Version 2.0.1.0
--------
-merge changes from wsx22 mod
-* fix in typing notify message handling
-* fix in logging to server message
-Version 2.0.0.0
--------
-+ Image transfer
-* other bug fixes and improvements
-Version 1.8.0.2
--------
-improved icons handling
-minor fixes on account unloading
-1.8.0.1
--------
-* bugfix: removed ME_SYSTEM_MODULESLOADED hook
-1.8.0.0
--------
-+ support for account manager (requires MIM 0.8)
-* many bugfixes and small improvements
-1.1.0.0
--------
-* avatar support improvements
-1.0.9.2
--------
-* avatar management UI changes
-* user info page changes
-* some clean-up and bugfixes
-* fix for advertisement blocking
-* fix for file transfers
-1.0.9.1
--------
-* avatar management improvements
-1.0.9.0
--------
-+ message encryption
-* improved search (up to 200 results displayed)
-* some avatar-related fixes
-* MIM 0.7 compatibility
-1.0.7.7
--------
-* new icons by Angelika
-1.0.7.6
--------
-+ support for Tlen avatars
-1.0.7.5
--------
-* bugfix: settings changes were not loaded properly
-1.0.7.4
--------
-* p2p connections refactoring
-* UPnP support
-* managed services/hooks
-* support for IcoLib
-* new icons
-* support for Miranda Memory Manager
-1.0.7.3
---------
-* bugfix: offline status message
-1.0.7.2
---------
-! fixed compatibility issues with new versions of IEView (1.0.9.0 or higher)
-+ support for Nudge plugin
-* improved avatar support
-* improved sending/receiving client version info
-1.0.7.1
----------
-* bugfix: sending/receiving client version info
-1.0.7.0
----------
-+ full support for avatars (compatible with tAvatar 0.0.2.1 or higher)
-+ sending and receiving full client version info
-* optimized DB usage
-* code cleanup
-1.0.6.9
----------
-+ experimental client recognition
-+ voice chat notification sound
-* bugfix: offline message timestamp
-* code clean-up
-1.0.6.8
----------
-* bugfix: compatibility with Unicode contact lists
-* bugfix: user login is always converted to lower case
-* bugfix: typing notifications
-* other bugfixes
-1.0.6.7
----------
-+ possibility to send files to offline users
-+ public status visibility settings
-* bugfixes
-1.0.6.6
----------
-* fixed IEView support (text scrolling issue)
-* code cleanup
-1.0.6.5
----------
-+ option to ignore advertisements
-* bugfixes
-1.0.6.4
----------
-+ alert, voice chat and group chat policies
-+ received alerts are logged as messages
-* offline message timestamp improvements (thanks to Atay for the idea)
-* removed obsolete, Jabber-specific code
-* a lot of more or less important bugfixes
-1.0.6.3
----------
-+ group names encoding
-+ log saving in IEView mode
-* simplified option page
-1.0.6.2
----------
-+ support for IEView group chats (IEView 1.0.3.0 or later)
-+ improvements of group chats in RichEdit mode (context menu, better scrolling)
-1.0.6.1
----------
-* bugfix: proper filename encoding
-* options page rearranged
-* code cleanup, other fixes and improvements
-1.0.6.0
----------
-+ group chat window flashing
-+ message icons in tabbed mode
-+ web messages grouped as a single contact
-* offline message timestamp handling fixed (again)
-1.0.5.10 RC2
----------
-+ tabbed mode available in group chat window
-+ saving chat log to file
-+ smiley selection button in group chat window
-+ new shortcuts: ctrl+w (close), ctrl+a (select all)
-+ saving chat fonts setting
-+ new menu items: request and grant authorization
-* several bugfixes in MUCC plugin, better MUCC architecture
-1.0.5.9 RC
----------
-+ voice chat improvements (better sound quality and smarter delay reduction, bugfixes)
-+ separate group for Global Owners in chat user list
-* bugfix: web messages receiving (fix by MoMaT)
-1.0.5.8
----------
-+ playback and recording device selection
-+ sending and receiving alerts (use <alert> to send)
-+ enabling/disabling Always Visible support
-* bugfixes
-1.0.5.7
----------
-+ chat room administration window (user administration and browser)
-+ unban option
-+ dynamic user groups
-+ voice chat p2p connection negotiation
-+ voice chat status display
-+ incoming voice chat invitation dialog
-+ removing contacts from roster on authorization denial
-+ offline status message selection
-* a lot of fixes in group chats interface
-1.0.5.6
----------
-+ voice chats ! (experimental)
-+ chat room administration: destroying room, changing users' roles, kick & ban
-+ MUCC option: send on Enter
-+ status messages of offline contacts (use mToolTip to read them)
-* bugfix: contact name encoding when adding new contact
-* bugfix: offline messages time ('more inteligent' Daylight Saving Time handling)
-* bugfix: closing all file transfers at shutdown
-* other minor fixes
-1.0.5.5
----------
-+ improved file transfer (p2p connection negotiation, error notification)
-+ MUCC options page (fonts, colors, default filters)
-+ chat room events logging (user has joined etc.)
-+ registering and uregistering nick names
-+ creating chat rooms
-+ chat room topic displaying and setting
-+ improved errors handling
-* look & feel improvements
-* bugfix: correct chat room name returned by search
-* bugfix: removing users from contact list groups
-* source code refactoring
-1.0.5.4
----------
-+ group chats error handling
-+ message log formatting options
-+ chat room searching
-+ list of contacts in 'invite to group chat' dialog
-+ Multi-User Conference item in contact menu
-+ some look & feel improvements (better resizing, new icons)
-+ internal history of messages
-* a lot of bugfixes and code improvements
-* code clean-up
-1.0.5.3
----------
-+ full text formatting (font name, font size)
-+ private messaging sessions
-+ displaying user details (administrator/moderator/registered nickname)
-+ displaying chat room details icons (moderated/members only/anonymous nicknames not allowed)
-+ browsing own chat rooms/registered nicknames
-* code clean-up
-* bugfixes
-1.0.5.2
----------
-+ text formatting (bold, italic, underline, text color for now)
-+ chat rooms browsing page by page
-* bugfixes and code clean-up
-1.0.5.1
----------
-+ initial multi-user conferences and chats support
-+ MUCC plugin responsible for chats GUI (manager window (groups/rooms), messanging window, helper dialogs)
-
-2004-09-23 Version 1.0.4.0
- Jabber and Tlen now have separate source trees (Tlen plugin is compliant with GCC now)
- File transfer with forwarding and SOCKS4/5 proxy support
- vCard viewing and editing
- Web messages receiving
- Incoming email notification through the popup plugin and sounds
- User typing notification (patch by Adam Libura)
- Searching users by login
- New user details page
- Invisible status message
- Option to leave offline status message
- Option to show offline users with status message as invisible
- Link to create new account
- Fixed bug: adjust offline message time
- A lot of other fixes and improvements
-
-2003-08-19 Version 0.1.0.2
- Fixed bug: crash when receiving some invisible presence
- Fixed bug: incorrect newline encoding/decoding (tlen uses \r\n while jabber uses \n)
- Fixed bug: User detail text is not decoded
- Use new invisible presence (now conform to Jabber invisible presence)
- Advanced search
- Based on Jabber plugin 0.1.1.2
-
-2003-05-12 Version 0.1.0.1
- Fixed bug: slightly incorrect online presence
- Based on Jabber plugin 0.1.1.0
-
-2003-01-19 Version 0.1.0.0
- Based on Jabber plugin 0.1.0.7
- Tlen basic user info
- Tlen invisible status
- Tlen visible/invisible list
- Option to show invisible users as invisible
- Find/add users using tlen user database
- Rebase DLL to 0x32600000
diff --git a/protocols/Tlen/docs/gpl.txt b/protocols/Tlen/docs/gpl.txt
deleted file mode 100644
index 45645b4b53..0000000000
--- a/protocols/Tlen/docs/gpl.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/protocols/Tlen/docs/gpl_comment.txt b/protocols/Tlen/docs/gpl_comment.txt
deleted file mode 100644
index ecacc17720..0000000000
--- a/protocols/Tlen/docs/gpl_comment.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2012 Santithorn Bunchua, Piotr Piastucki
-
-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.
-
-*/
diff --git a/protocols/Tlen/docs/readme_tlen.txt b/protocols/Tlen/docs/readme_tlen.txt
deleted file mode 100644
index 234e9b098b..0000000000
--- a/protocols/Tlen/docs/readme_tlen.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-Tlen Protocol Plugin for Miranda IM
-===================================
-
-Introduction:
- Tlen is a protocol used by a propritary instant messaging network
- at tlen.pl. It is based on Jabber, and, therefore, this plugin
- is very much based on Jabber protocol plugin for Miranda. All
- necessary helps to create this Tlen plugin are from Adam Strzelecki.
-
-Installation:
- Copy tlen.dll and (optional) tlen_czaty.dll to Miranda's plugins directory.
-
- If you want to have multiple Tlen accounts online at the same time,
- you need to have multiple copies of tlen.dll, each with different name,
- all in Miranda's plugins directory. Note that all configurations for a
- Tlen account (including your contact list) are associated with the
- DLL's name. In addition, it is highly recommended that you do NOT choose
- the name that is in conflict with other plugins or any database categories
- used by Miranda core (use DatabaseViewer or DatabaseEditor to see what
- database categories are already in use).
-
-More information:
- Web: http://mtlen.berlios.de
- E-mail: the_leech@users.berlios.de
-
-Copyright (c) 2002-2012 Santithorn Bunchua (keh@au.edu), Piotr Piastucki
-
-Acknowledgement:
- We would like to thank the following people for their helps and/or comments
- (alphabetically listed):
- Dmitry Balabanov
- Nikola Dachev
- Sam Kothari
- Adam Libura
- Jörgen Persson
- Robert Rainwater
- Adam Strzelecki
- Michal Wojciechowski
- Szymon Tokarz (wsx22)
-
-================================================================
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2012 Santithorn Bunchua, Piotr Piastucki
-
-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.
-
-================================================================
diff --git a/protocols/Tlen/docs/tlen-translation.txt b/protocols/Tlen/docs/tlen-translation.txt
deleted file mode 100644
index 6406f204c7..0000000000
--- a/protocols/Tlen/docs/tlen-translation.txt
+++ /dev/null
@@ -1,153 +0,0 @@
-;***********************************
-;******* Tlen language by raq ******
-
-[Tlen czaty]
-;[Authentication failed for]
-;[Tlen Authentication]
-[Network]
-[Advanced]
-[PopUps]
-[Accept all alerts]
-[Ignore alerts from unauthorized contacts]
-[Ignore all alerts]
-[Always ask me]
-[Accept invitations from authorized contacts]
-[Accept all invitations]
-[Ignore invitations from unauthorized contacts]
-[Ignore all invitation]
-[Always ask me]
-[<Last message>]
-[<Ask me>]
-[Online]
-[Away]
-[NA]
-[DND]
-[Free for chat]
-[Invisible]
-[These changes will take effect the next time you connect to the Tlen network.]
-[Tlen Protocol Option]
-[Forwarding]
-;[SOCKS4]
-;[SOCKS5]
-;[Tlen login]
-[Enter password for]
-[Error: Not enough memory]
-[Error: Cannot connect to the server]
-[The connection requires an OpenSSL library, which is not installed.]
-;[Jabber Connection Error]
-[%s Web Messages]
-[Web message]
-[From]
-;[E-mail]
-[An alert has been received.]
-[Private conference]
-[New mail]
-[Subject]
-;[both]
-[to]
-[from]
-[none]
-;[not on roster]
-[Error]
-[Unknown error message]
-[connection]
-[Incoming mail]
-;[Alert]
-[Multi-User Conference]
-[Tlen Chats...]
-[Voice Chat]
-[Voice chat]
-[Request authorization]
-[Grant authorization]
-[You have been kicked. Reason: %s ]
-[You cannot join this chat room, because you are banned.]
-[Chat room not found.]
-[This is a private chat room and you are not one of the members.]
-[You cannot send any message unless you join this chat room.]
-[Chat room with already created.]
-[Nickname '%s' is already registered.]
-[Nickname already in use, please try another one. Hint: '%s' is free.]
-[You cannot register more than %s nicknames.]
-[You cannot create more than %s chat rooms.]
-[You cannot join more than %s chat rooms.]
-[Anonymous nicknames are not allowed in this chat room.]
-[Unknown error code : %d]
-[Default]
-
-;tlen.rc
-
-[Username:]
-[Create a new account]
-[Password:]
-[Save password]
-[Use SSL]
-[Options]
-[Automatically reconnect after unintentional disconnection]
-[Leave status message after disconnection]
-[Ignore advertisements]
-[Automatically delete contacts not in my roster]
-[Show offline users with status messages as invisible in contact list]
-[Enable avatars]
-[Send and receive version information]
-[Use Nudge plugin]
-[Log alerts as messages]
-[Alert policy]
-[Group chat policy]
-[Voice Chats]
-[Voice chat policy]
-[Recording device:]
-[Playback device:]
-[Expert Options]
-[Login server:]
-[Connection Host:]
-;[Port:]
-[Keep connection alive]
-[Enable Always Visible and Never Visible]
-[File Transfer and Voice Chats]
-[Use proxy for incoming connections]
-[Proxy type:]
-[Proxy server:]
-[Proxy requires authorization]
-[Delay]
-[&From PopUp plugin]
-[&Custom]
-[P&ermanent]
-[Colours]
-[Background]
-[Text]
-[General Options]
-[Preview]
-[Enable incoming mail notification]
-;[OK]
-[Cancel]
-[Nick name:]
-[First name:]
-[Last name:]
-;[E-mail:]
-[Gender:]
-[Year of birth:]
-[City:]
-[School:]
-[Occupation:]
-[Looking for:]
-[Voice chats]
-[Save changes]
-;[Subscription:]
-[Age:]
-[Personal Information]
-;[Status:]
-[Plan:]
-[&Accept]
-[From:]
-[Software:]
-[Version:]
-[System:]
-[The following invitation to join a voice chat is received.]
-[Current Avatar]
-[New Avatar]
-[Public]
-[Browse...]
-[Set]
-[Delete]
-[Note: Image size max. 64x64]
-[Enable encryption]
diff --git a/protocols/Tlen/icos/auth_grant.ico b/protocols/Tlen/icos/auth_grant.ico
deleted file mode 100644
index 8d1ba94308..0000000000
--- a/protocols/Tlen/icos/auth_grant.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/auth_request.ico b/protocols/Tlen/icos/auth_request.ico
deleted file mode 100644
index 116ed47baf..0000000000
--- a/protocols/Tlen/icos/auth_request.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/groupchats.ico b/protocols/Tlen/icos/groupchats.ico
deleted file mode 100644
index ecd2070d20..0000000000
--- a/protocols/Tlen/icos/groupchats.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/image.ico b/protocols/Tlen/icos/image.ico
deleted file mode 100644
index 832b9a8b69..0000000000
--- a/protocols/Tlen/icos/image.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/mail.ico b/protocols/Tlen/icos/mail.ico
deleted file mode 100644
index c5ded81702..0000000000
--- a/protocols/Tlen/icos/mail.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/microphone.ico b/protocols/Tlen/icos/microphone.ico
deleted file mode 100644
index 1edeb90d1f..0000000000
--- a/protocols/Tlen/icos/microphone.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/speaker.ico b/protocols/Tlen/icos/speaker.ico
deleted file mode 100644
index 77545c0598..0000000000
--- a/protocols/Tlen/icos/speaker.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/tlen.ico b/protocols/Tlen/icos/tlen.ico
deleted file mode 100644
index a166dd4c5b..0000000000
--- a/protocols/Tlen/icos/tlen.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/tlenchats.ico b/protocols/Tlen/icos/tlenchats.ico
deleted file mode 100644
index 52ab77ff63..0000000000
--- a/protocols/Tlen/icos/tlenchats.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/icos/voicechat.ico b/protocols/Tlen/icos/voicechat.ico
deleted file mode 100644
index f989d5b212..0000000000
--- a/protocols/Tlen/icos/voicechat.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/jabber.h b/protocols/Tlen/jabber.h
deleted file mode 100644
index fdaabf5e43..0000000000
--- a/protocols/Tlen/jabber.h
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _JABBER_H_
-#define _JABBER_H_
-
-#if defined(UNICODE)
- #ifndef _UNICODE
- #define _UNICODE
- #endif
-#endif
-
-#define MIRANDA_VER 0x0800
-
-#undef _WIN32_WINNT
-#undef _WIN32_IE
-#define _WIN32_WINNT 0x0501
-#define _WIN32_IE 0x0501
-
-#define __try
-#define __except(x) if (0)
-#define __finally
-
-#define _try __try
-#define _except __except
-#define _finally __finally
-
-#ifdef _DEBUG
-#define _CRTDBG_MAP_ALLOC
-#include <stdlib.h>
-#include <crtdbg.h>
-#endif
-#define ENABLE_LOGGING
-
-/*******************************************************************
- * Global compilation flags
- *******************************************************************/
-
-/*******************************************************************
- * Global header files
- *******************************************************************/
-#include <windows.h>
-#include <process.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-#include <limits.h>
-#include <win2k.h>
-
-#include <newpluginapi.h>
-#include <m_system.h>
-#include <m_netlib.h>
-#include <m_protomod.h>
-#include <m_protosvc.h>
-#include <m_protoint.h>
-#include <m_contacts.h>
-#include <m_clist.h>
-#include <m_clui.h>
-#include <m_options.h>
-#include <m_userinfo.h>
-#include <m_database.h>
-#include <m_langpack.h>
-#include <m_utils.h>
-#include <m_message.h>
-#include <m_skin.h>
-#include <m_popup.h>
-#include <m_avatars.h>
-
-#include "jabber_xml.h"
-#include "crypto/polarssl/aes.h"
-#include "crypto/polarssl/bignum.h"
-
-/*******************************************************************
- * Global constants
- *******************************************************************/
-#define TLEN_DEFAULT_PORT 443
-#define JABBER_IQID "mim_"
-#define TLEN_REGISTER "http://reg.tlen.pl/"
-#define TLEN_MAX_SEARCH_RESULTS_PER_PAGE 20
-
-// User-defined message
-#define WM_TLEN_REFRESH (WM_USER + 100)
-// Error code
-#define JABBER_ERROR_REDIRECT 302
-#define JABBER_ERROR_BAD_REQUEST 400
-#define JABBER_ERROR_UNAUTHORIZED 401
-#define JABBER_ERROR_PAYMENT_REQUIRED 402
-#define JABBER_ERROR_FORBIDDEN 403
-#define JABBER_ERROR_NOT_FOUND 404
-#define JABBER_ERROR_NOT_ALLOWED 405
-#define JABBER_ERROR_NOT_ACCEPTABLE 406
-#define JABBER_ERROR_REGISTRATION_REQUIRED 407
-#define JABBER_ERROR_REQUEST_TIMEOUT 408
-#define JABBER_ERROR_CONFLICT 409
-#define JABBER_ERROR_INTERNAL_SERVER_ERROR 500
-#define JABBER_ERROR_NOT_IMPLEMENTED 501
-#define JABBER_ERROR_REMOTE_SERVER_ERROR 502
-#define JABBER_ERROR_SERVICE_UNAVAILABLE 503
-#define JABBER_ERROR_REMOTE_SERVER_TIMEOUT 504
-
-#define TLEN_ALERTS_ACCEPT_ALL 0
-#define TLEN_ALERTS_IGNORE_NIR 1
-#define TLEN_ALERTS_IGNORE_ALL 2
-
-#define TLEN_IMAGES_ACCEPT_ALL 0
-#define TLEN_IMAGES_IGNORE_NIR 1
-#define TLEN_IMAGES_IGNORE_ALL 2
-
-#define TLEN_MUC_ASK 0
-#define TLEN_MUC_ACCEPT_IR 1
-#define TLEN_MUC_ACCEPT_ALL 2
-#define TLEN_MUC_IGNORE_NIR 3
-#define TLEN_MUC_IGNORE_ALL 4
-
-#define IDC_STATIC (-1)
-
-/*******************************************************************
- * Global data structures and data type definitions
- *******************************************************************/
-typedef HANDLE JABBER_SOCKET;
-
-typedef enum {
- LIST_ROSTER, // Roster list
- LIST_CHATROOM, // Groupchat room currently joined
- LIST_FILE, // Current file transfer session
- LIST_INVITATIONS,// Invitations to be sent
- LIST_SEARCH, // Rooms names being searched
- LIST_VOICE,
- LIST_PICTURE
-} JABBER_LIST;
-
-typedef enum {
- IQ_PROC_NONE,
- IQ_PROC_GETSEARCH
-} JABBER_IQ_PROCID;
-
-typedef enum {
- SUB_NONE,
- SUB_TO,
- SUB_FROM,
- SUB_BOTH
-} JABBER_SUBSCRIPTION;
-
-typedef struct {
- char *szOnline;
- char *szAway;
- char *szNa;
- char *szDnd;
- char *szFreechat;
- char *szInvisible;
-} JABBER_MODEMSGS;
-
-typedef struct {
- char mailBase[256];
- char mailMsg[256];
- int mailMsgMthd;
- char mailIndex[256];
- int mailIndexMthd;
- char mailLogin[256];
- int mailLoginMthd;
- char mailCompose[256];
- int mailComposeMthd;
- char avatarGet[256];
- int avatarGetMthd;
- char avatarUpload[256];
- int avatarUploadMthd;
- char avatarRemove[256];
- int avatarRemoveMthd;
-} TlenConfiguration;
-
-typedef struct {
- BOOL useEncryption;
- BOOL reconnect;
- BOOL rosterSync;
- BOOL offlineAsInvisible;
- BOOL leaveOfflineMessage;
- int offlineMessageOption;
- BOOL ignoreAdvertisements;
- int alertPolicy;
- int groupChatPolicy;
- int voiceChatPolicy;
- int imagePolicy;
- BOOL enableAvatars;
- BOOL enableVersion;
- BOOL useNudge;
- BOOL logAlerts;
- BOOL useNewP2P;
- BOOL sendKeepAlive;
- BOOL savePassword;
-} TlenOptions;
-
-struct JABBER_IQ_FUNC_STRUCT;
-struct JABBER_LIST_ITEM_STRUCT;
-struct TLEN_VOICE_CONTROL_STRUCT;
-
-typedef struct {
- PROTO_INTERFACE iface;
- HANDLE hNetlibUser;
- HANDLE hFileNetlibUser;
-
- JABBER_MODEMSGS modeMsgs;
-
- struct ThreadDataStruct *threadData;
- HANDLE hTlenNudge;
- HANDLE hMenuMUC;
- HANDLE hMenuChats;
- HANDLE hMenuInbox;
- HANDLE hMenuContactMUC;
- HANDLE hMenuContactVoice;
- HANDLE hMenuContactGrantAuth;
- HANDLE hMenuContactRequestAuth;
- HANDLE hMenuPicture;
-
- HANDLE* hServices;
- unsigned serviceNum;
- HANDLE* hHooks;
- unsigned hookNum;
-
- int listsCount;
- struct JABBER_LIST_ITEM_STRUCT *lists;
- CRITICAL_SECTION csLists;
-
- int iqCount;
- int iqAlloced;
- struct JABBER_IQ_FUNC_STRUCT *iqList;
- CRITICAL_SECTION csIqList;
-
- CRITICAL_SECTION csSerial;
- unsigned int serial;
- BOOL isOnline;
- BOOL isConnected;
-
- CRITICAL_SECTION modeMsgMutex;
-
- HANDLE hMenuRoot;
-
- char *searchJID;
- int searchID;
- int searchIndex;
- char *searchQuery;
- int searchQueryLen;
-
- CRITICAL_SECTION csSend;
-
- HWND voiceDlgHWND;
- struct TLEN_VOICE_CONTROL_STRUCT *playbackControl;
- struct TLEN_VOICE_CONTROL_STRUCT *recordingControl;
- int framesAvailableForPlayback;
- int availOverrunValue;
-
- TlenOptions tlenOptions;
-} TlenProtocol;
-
-
-typedef struct ThreadDataStruct{
- HANDLE hThread;
- char *streamId;
- char username[128];
- char password[128];
- char server[128];
- char manualHost[128];
- char avatarToken[128];
- char avatarHash[64];
- int avatarFormat;
- WORD port;
- BOOL useEncryption;
-
- JABBER_SOCKET s; //HANDLE from CallService(MS_NETLIB_OPENCONNECTION (jabber_ws.c:68)
- aes_context aes_in_context;
- aes_context aes_out_context;
- unsigned char aes_in_iv[16];
- unsigned char aes_out_iv[16];
-
- BOOL useAES;
- TlenConfiguration tlenConfig;
- TlenProtocol *proto;
-} ThreadData;
-
-
-typedef enum { FT_CONNECTING, FT_INITIALIZING, FT_RECEIVING, FT_DONE, FT_ERROR, FT_DENIED, FT_SWITCH } JABBER_FILE_STATE;
-typedef enum { FT_RECV, FT_SEND} JABBER_FILE_MODE;
-typedef struct TLEN_FILE_TRANSFER_STRUCT{
- HANDLE hContact;
- JABBER_SOCKET s;
- NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2;
- JABBER_FILE_STATE state;
- char *jid;
- int fileId;
- char *iqId;
- int mode;
-
- // Used by file receiving only
- char *hostName;
- WORD wPort;
- char *localName;
- WORD wLocalPort;
- char *szSavePath;
- long fileReceivedBytes;
- long fileTotalSize;
-
- // Used by file sending only
- HANDLE hFileEvent;
- int fileCount;
- char **files;
- long *filesSize;
- //long fileTotalSize; // Size of the current file (file being sent)
- long allFileTotalSize;
- long allFileReceivedBytes;
- char *szDescription;
- int currentFile;
-
- // New p2p
- BOOL newP2P;
- char *id2;
- SOCKET udps;
- aes_context aes_context;
- unsigned char aes_iv[16];
- TlenProtocol *proto;
-
-} TLEN_FILE_TRANSFER;
-
-typedef struct {
- PROTOSEARCHRESULT hdr;
- char jid[256];
-} JABBER_SEARCH_RESULT;
-
-typedef struct {
- char *iqId;
- PROTOSEARCHRESULT hdr;
- char jid[256];
-} TLEN_CONFERENCE;
-
-
-typedef struct {
- int id;
- TCHAR *name;
-} JABBER_FIELD_MAP;
-
-
-/*******************************************************************
- * Global variables
- *******************************************************************/
-extern HINSTANCE hInst;
-extern HANDLE hMainThread;
-
-/*******************************************************************
- * Function declarations
- *******************************************************************/
-HICON GetIcolibIcon(int iconId);
-void ReleaseIcolibIcon(HICON hIcon);
-
-void JabberLog(TlenProtocol *proto, const char *fmt, ...);
-void __cdecl JabberServerThread(ThreadData *info);
-// jabber_ws.c
-BOOL JabberWsInit(TlenProtocol *proto);
-void JabberWsUninit(TlenProtocol *proto);
-JABBER_SOCKET JabberWsConnect(TlenProtocol *proto, char *host, WORD port);
-int JabberWsSend(TlenProtocol *proto, JABBER_SOCKET s, char *data, int datalen);
-int JabberWsRecv(TlenProtocol *proto, JABBER_SOCKET s, char *data, long datalen);
-int JabberWsSendAES(TlenProtocol *proto, char *data, int datalen, aes_context *aes_ctx, unsigned char *aes_iv);
-int JabberWsRecvAES(TlenProtocol *proto, char *data, long datalen, aes_context *aes_ctx, unsigned char *aes_iv);
-// jabber_util.c
-HANDLE HookEventObj_Ex(const char *name, TlenProtocol *proto, MIRANDAHOOKOBJ hook);
-HANDLE CreateServiceFunction_Ex(const char *name, TlenProtocol *proto, MIRANDASERVICEOBJ service);
-void UnhookEvents_Ex(TlenProtocol *proto);
-void DestroyServices_Ex(TlenProtocol *proto);
-void JabberSerialInit(TlenProtocol *proto);
-void JabberSerialUninit(TlenProtocol *proto);
-unsigned int JabberSerialNext(TlenProtocol *proto);
-int JabberSend(TlenProtocol *proto, const char *fmt, ...);
-HANDLE JabberHContactFromJID(TlenProtocol *proto, const char *jid);
-char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact);
-char *JabberLoginFromJID(const char *jid);
-char *JabberResourceFromJID(const char *jid);
-char *JabberNickFromJID(const char *jid);
-char *JabberLocalNickFromJID(const char *jid);
-char *TlenGroupEncode(const char *str);
-char *TlenGroupDecode(const char *str);
-char *JabberSha1(char *str);
-char *TlenSha1(char *str, int len);
-char *TlenPasswordHash(const char *str);
-void TlenUrlDecode(char *str);
-char *TlenUrlEncode(const char *str);
-char *JabberTextEncode(const char *str);
-char *JabberTextDecode(const char *str);
-char *JabberBase64Encode(const char *buffer, int bufferLen);
-char *JabberBase64Decode(const char *buffer, int *resultLen);
-int JabberGetPictureType(const char* buf);
-void TlenLogMessage(TlenProtocol *proto, HANDLE hContact, DWORD flags, const char *message);
-BOOL IsAuthorized(TlenProtocol *proto, const char *jid);
-//char *JabberGetVersionText();
-time_t JabberIsoToUnixTime(char *stamp);
-time_t TlenTimeToUTC(time_t time);
-void JabberSendPresence(TlenProtocol *proto,int status);
-void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...);
-//char *JabberGetClientJID(char *jid);
-// jabber_misc.c
-void JabberDBAddEvent(TlenProtocol *proto, HANDLE hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob);
-void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick);
-HANDLE JabberDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary);
-void JabberContactListCreateGroup(char *groupName);
-unsigned long JabberForkThread(void (__cdecl *threadcode)(void*), unsigned long stacksize, void *arg);
-// jabber_svc.c
-int JabberGetInfo(PROTO_INTERFACE *ptr, HANDLE hContact, int infoType);
-int TlenRunSearch(TlenProtocol *proto);
-// jabber_advsearch.c
-extern JABBER_FIELD_MAP tlenFieldGender[];
-extern JABBER_FIELD_MAP tlenFieldLookfor[];
-extern JABBER_FIELD_MAP tlenFieldStatus[];
-extern JABBER_FIELD_MAP tlenFieldOccupation[];
-extern JABBER_FIELD_MAP tlenFieldPlan[];
-
-INT_PTR CALLBACK TlenAdvSearchDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-char *TlenAdvSearchCreateQuery(HWND hwndDlg, int iqId);
-
-
-#endif
-
diff --git a/protocols/Tlen/jabber_iq.c b/protocols/Tlen/jabber_iq.c
deleted file mode 100644
index 219f60e53d..0000000000
--- a/protocols/Tlen/jabber_iq.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_iq.h"
-
-
-void JabberIqInit(TlenProtocol *proto)
-{
- InitializeCriticalSection(&proto->csIqList);
- proto->iqList = NULL;
- proto->iqCount = 0;
- proto->iqAlloced = 0;
-}
-
-void JabberIqUninit(TlenProtocol *proto)
-{
- if (proto->iqList) mir_free(proto->iqList);
- proto->iqList = NULL;
- proto->iqCount = 0;
- proto->iqAlloced = 0;
- DeleteCriticalSection(&proto->csIqList);
-}
-
-static void JabberIqRemove(TlenProtocol *proto, int index)
-{
- EnterCriticalSection(&proto->csIqList);
- if (index>=0 && index<proto->iqCount) {
- memmove(proto->iqList+index, proto->iqList+index+1, sizeof(JABBER_IQ_FUNC)*(proto->iqCount-index-1));
- proto->iqCount--;
- }
- LeaveCriticalSection(&proto->csIqList);
-}
-
-static void JabberIqExpire(TlenProtocol *proto)
-{
- int i;
- time_t expire;
-
- EnterCriticalSection(&proto->csIqList);
- expire = time(NULL) - 120; // 2 minute
- i = 0;
- while (i < proto->iqCount) {
- if (proto->iqList[i].requestTime < expire)
- JabberIqRemove(proto, i);
- else
- i++;
- }
- LeaveCriticalSection(&proto->csIqList);
-}
-
-JABBER_IQ_PFUNC JabberIqFetchFunc(TlenProtocol *proto, int iqId)
-{
- int i;
- JABBER_IQ_PFUNC res;
-
- EnterCriticalSection(&proto->csIqList);
- JabberIqExpire(proto);
- for (i=0; i<proto->iqCount && proto->iqList[i].iqId!=iqId; i++);
- if (i < proto->iqCount) {
- res = proto->iqList[i].func;
- JabberIqRemove(proto, i);
- }
- else {
- res = (JABBER_IQ_PFUNC) NULL;
- }
- LeaveCriticalSection(&proto->csIqList);
- return res;
-}
-
-void JabberIqAdd(TlenProtocol *proto, unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_PFUNC func)
-{
- int i;
-
- EnterCriticalSection(&proto->csIqList);
- if (procId == IQ_PROC_NONE)
- i = proto->iqCount;
- else
- for (i=0; i<proto->iqCount && proto->iqList[i].procId!=procId; i++);
-
- if (i>=proto->iqCount && proto->iqCount>=proto->iqAlloced) {
- proto->iqAlloced = proto->iqCount + 8;
- proto->iqList = mir_realloc(proto->iqList, sizeof(JABBER_IQ_FUNC)*proto->iqAlloced);
- }
-
- if (proto->iqList != NULL) {
- proto->iqList[i].iqId = iqId;
- proto->iqList[i].procId = procId;
- proto->iqList[i].func = func;
- proto->iqList[i].requestTime = time(NULL);
- if (i == proto->iqCount) proto->iqCount++;
- }
- LeaveCriticalSection(&proto->csIqList);
-}
-
diff --git a/protocols/Tlen/jabber_iq.h b/protocols/Tlen/jabber_iq.h
deleted file mode 100644
index dfdcf9e91a..0000000000
--- a/protocols/Tlen/jabber_iq.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-#ifndef _JABBER_IQ_H_
-#define _JABBER_IQ_H_
-
-#include "jabber_xml.h"
-#include "jabber.h"
-
-typedef void (*JABBER_IQ_PFUNC)(TlenProtocol *proto, XmlNode *iqNode);
-
-typedef struct JABBER_IQ_FUNC_STRUCT {
- int iqId; // id to match IQ get/set with IQ result
- JABBER_IQ_PROCID procId; // must be unique in the list, except for IQ_PROC_NONE which can have multiple entries
- JABBER_IQ_PFUNC func; // callback function
- time_t requestTime; // time the request was sent, used to remove relinquent entries
-} JABBER_IQ_FUNC;
-
-void JabberIqInit(TlenProtocol *proto);
-void JabberIqUninit(TlenProtocol *proto);
-JABBER_IQ_PFUNC JabberIqFetchFunc(TlenProtocol *proto, int iqId);
-void JabberIqAdd(TlenProtocol *proto, unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_PFUNC func);
-
-void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode);
-void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode);
-void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultTcfg(TlenProtocol *proto, XmlNode *iqNode);
-
-void TlenIqResultChatGroups(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultChatRooms(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultUserRooms(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultUserNicks(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultRoomSearch(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultRoomInfo(TlenProtocol *proto, XmlNode *iqNode);
-void TlenIqResultChatRoomUsers(TlenProtocol *proto, XmlNode *iqNode);
-//void JabberIqResultSetPassword(XmlNode *iqNode, void *userdata);
-
-#endif
-
diff --git a/protocols/Tlen/jabber_iqid.c b/protocols/Tlen/jabber_iqid.c
deleted file mode 100644
index 2c16054038..0000000000
--- a/protocols/Tlen/jabber_iqid.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "resource.h"
-#include "jabber_list.h"
-#include "jabber_iq.h"
-#include "tlen_muc.h"
-
-void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
-{
- char *type;
-
- // RECVED: authentication result
- // ACTION: if successfully logged in, continue by requesting roster list and set my initial status
- if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
-
- if (!strcmp(type, "result")) {
- DBVARIANT dbv;
-
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Nick", &dbv))
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "Nick", proto->threadData->username);
- else
- DBFreeVariant(&dbv);
-// iqId = JabberSerialNext();
-// JabberIqAdd(iqId, IQ_PROC_NONE, JabberIqResultGetRoster);
-// JabberSend(info, "<iq type='get' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
-
- JabberSend(proto, "<iq type='get' id='GetRoster'><query xmlns='jabber:iq:roster'/></iq>");
- JabberSend(proto, "<iq to='tcfg' type='get' id='TcfgGetAfterLoggedIn'></iq>");
- }
- // What to do if password error? etc...
- else if (!strcmp(type, "error")) {
- char text[128];
-
- JabberSend(proto, "</s>");
- _snprintf(text, sizeof(text), "%s %s@%s.", TranslateT("Authentication failed for"), proto->threadData->username, proto->threadData->server);
- MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
- proto->threadData = NULL; // To disallow auto reconnect
- }
-}
-
-void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
- DBVARIANT dbv;
- XmlNode *itemNode, *groupNode;
- JABBER_LIST_ITEM *item;
- HANDLE hContact;
- char *jid, *name, *nick;
- int i;
- char *str;
-
- for (i=0; i<queryNode->numChild; i++) {
- itemNode = queryNode->child[i];
- if (!strcmp(itemNode->name, "item")) {
- if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- str = JabberXmlGetAttrValue(itemNode, "subscription");
- if (!strcmp(str, "remove")) {
- if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE);
- }
- JabberListRemove(proto, LIST_ROSTER, jid);
- } else {
- item = JabberListAdd(proto, LIST_ROSTER, jid);
- if (item != NULL) {
- if (str == NULL) item->subscription = SUB_NONE;
- else if (!strcmp(str, "both")) item->subscription = SUB_BOTH;
- else if (!strcmp(str, "to")) item->subscription = SUB_TO;
- else if (!strcmp(str, "from")) item->subscription = SUB_FROM;
- else item->subscription = SUB_NONE;
- if ((name=JabberXmlGetAttrValue(itemNode, "name")) != NULL) {
- nick = JabberTextDecode(name);
- } else {
- nick = JabberLocalNickFromJID(jid);
- }
- if (nick != NULL) {
- if (item->nick) mir_free(item->nick);
- item->nick = nick;
-
- if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
- // Received roster has a new JID.
- // Add the jid (with empty resource) to Miranda contact list.
- hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
- }
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
- if (item->group) mir_free(item->group);
- if ((groupNode=JabberXmlGetChild(itemNode, "group"))!=NULL && groupNode->text!=NULL) {
- item->group = TlenGroupDecode(groupNode->text);
- JabberContactListCreateGroup(item->group);
- // Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
- if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
- } else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- } else {
- item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
- }
- }
- }
- }
- }
- }
- }
-}
-
-void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode;
- char *type;
- char *str;
-
- // RECVED: roster information
- // ACTION: populate LIST_ROSTER and create contact for any new rosters
- if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
- if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
-
- if (!strcmp(type, "result")) {
- str = JabberXmlGetAttrValue(queryNode, "xmlns");
- if (str!=NULL && !strcmp(str, "jabber:iq:roster")) {
- DBVARIANT dbv;
- XmlNode *itemNode, *groupNode;
- JABBER_SUBSCRIPTION sub;
- JABBER_LIST_ITEM *item;
- HANDLE hContact;
- char *jid, *name, *nick;
- int i, oldStatus;
-
- for (i=0; i<queryNode->numChild; i++) {
- itemNode = queryNode->child[i];
- if (!strcmp(itemNode->name, "item")) {
- str = JabberXmlGetAttrValue(itemNode, "subscription");
- if (str==NULL) sub = SUB_NONE;
- else if (!strcmp(str, "both")) sub = SUB_BOTH;
- else if (!strcmp(str, "to")) sub = SUB_TO;
- else if (!strcmp(str, "from")) sub = SUB_FROM;
- else sub = SUB_NONE;
- //if (str!=NULL && (!strcmp(str, "to") || !strcmp(str, "both"))) {
- if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if ((name=JabberXmlGetAttrValue(itemNode, "name")) != NULL) {
- nick = JabberTextDecode(name);
- } else {
- nick = JabberLocalNickFromJID(jid);
- }
- if (nick != NULL) {
- item = JabberListAdd(proto, LIST_ROSTER, jid);
- if (item->nick) mir_free(item->nick);
- item->nick = nick;
- item->subscription = sub;
- if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
- // Received roster has a new JID.
- // Add the jid (with empty resource) to Miranda contact list.
- hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
- }
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
- if (item->group) mir_free(item->group);
- if ((groupNode=JabberXmlGetChild(itemNode, "group"))!=NULL && groupNode->text!=NULL) {
- item->group = TlenGroupDecode(groupNode->text);
- JabberContactListCreateGroup(item->group);
- // Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
- if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
- }
- else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- }
- else {
- item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
- }
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "AvatarHash", &dbv)) {
- if (item->avatarHash) mir_free(item->avatarHash);
- item->avatarHash = mir_strdup(dbv.pszVal);
- JabberLog(proto, "Setting hash [%s] = %s", nick, item->avatarHash);
- DBFreeVariant(&dbv);
- }
- item->avatarFormat = DBGetContactSettingDword(hContact, proto->iface.m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
- }
- }
- }
- }
- // Delete orphaned contacts (if roster sync is enabled)
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "RosterSync", FALSE) == TRUE) {
- HANDLE *list;
- int listSize, listAllocSize;
-
- listSize = listAllocSize = 0;
- list = NULL;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- str = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(str!=NULL && !strcmp(str, proto->iface.m_szModuleName)) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- if (!JabberListExist(proto, LIST_ROSTER, dbv.pszVal)) {
- JabberLog(proto, "Syncing roster: preparing to delete %s (hContact=0x%x)", dbv.pszVal, hContact);
- if (listSize >= listAllocSize) {
- listAllocSize = listSize + 100;
- if ((list=(HANDLE *) mir_realloc(list, listAllocSize)) == NULL) {
- listSize = 0;
- break;
- }
- }
- list[listSize++] = hContact;
- }
- DBFreeVariant(&dbv);
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
- for (i=0; i<listSize; i++) {
- JabberLog(proto, "Syncing roster: deleting 0x%x", list[i]);
- CallService(MS_DB_CONTACT_DELETE, (WPARAM) list[i], 0);
- }
- if (list != NULL)
- mir_free(list);
- }
- ///////////////////////////////////////
- {
- CLISTMENUITEM clmi;
- memset(&clmi, 0, sizeof(CLISTMENUITEM));
- clmi.cbSize = sizeof(CLISTMENUITEM);
- clmi.flags = CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &clmi);
- if (proto->hMenuChats != NULL){
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM) &clmi);
- }
- }
-
- proto->isOnline = TRUE;
- JabberLog(proto, "Status changed via THREADSTART");
- oldStatus = proto->iface.m_iStatus;
- JabberSendPresence(proto, proto->iface.m_iDesiredStatus);
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->iface.m_iStatus);
- //////////////////////////////////
- }
- }
-}
-
-
-// Tlen actually use jabber:iq:search for other users vCard or jabber:iq:register for own vCard
-void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode, *itemNode, *n;
- char *type, *jid;
- char text[128];
- HANDLE hContact;
- char *nText;
-
-// JabberLog("<iq/> iqIdGetVcard (tlen)");
- if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
-
- if (!strcmp(type, "result")) {
- BOOL hasFirst, hasLast, hasNick, hasEmail, hasCity, hasAge, hasGender, hasSchool, hasLookFor, hasOccupation;
- DBVARIANT dbv;
- int i;
-
- if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if ((itemNode=JabberXmlGetChild(queryNode, "item")) == NULL) return;
- if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) return;
- if (strchr(jid, '@') != NULL) {
- sprintf(text, "%s", jid);
- } else {
- sprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
- }
- DBFreeVariant(&dbv);
- if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginName", &dbv)) return;
- if (strcmp(dbv.pszVal, jid)) {
- DBFreeVariant(&dbv);
- return;
- }
- DBFreeVariant(&dbv);
- }
- } else {
- hContact = NULL;
- }
- hasFirst = hasLast = hasNick = hasEmail = hasCity = hasAge = hasGender = hasOccupation = hasLookFor = hasSchool = FALSE;
- for (i=0; i<itemNode->numChild; i++) {
- n = itemNode->child[i];
- if (n==NULL || n->name==NULL) continue;
- if (!strcmp(n->name, "first")) {
- if (n->text != NULL) {
- hasFirst = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "FirstName", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "last")) {
- if (n->text != NULL) {
- hasLast = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "LastName", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "nick")) {
- if (n->text != NULL) {
- hasNick = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "Nick", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "email")) {
- if (n->text != NULL) {
- hasEmail = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "e-mail", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "c")) {
- if (n->text != NULL) {
- hasCity = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "City", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "b")) {
- if (n->text != NULL) {
- WORD nAge;
- hasAge = TRUE;
- nAge = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Age", nAge);
- }
- }
- else if (!strcmp(n->name, "s")) {
- if (n->text!=NULL && n->text[1]=='\0' && (n->text[0]=='1' || n->text[0]=='2')) {
- hasGender = TRUE;
- DBWriteContactSettingByte(hContact, proto->iface.m_szModuleName, "Gender", (BYTE) (n->text[0]=='1'?'M':'F'));
- }
- }
- else if (!strcmp(n->name, "e")) {
- if (n->text != NULL) {
- hasSchool = TRUE;
- nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "School", nText);
- mir_free(nText);
- }
- }
- else if (!strcmp(n->name, "j")) {
- if (n->text != NULL) {
- WORD nOccupation;
- hasOccupation = TRUE;
- nOccupation = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Occupation", nOccupation);
- }
- }
- else if (!strcmp(n->name, "r")) {
- if (n->text != NULL) {
- WORD nLookFor;
- hasLookFor = TRUE;
- nLookFor = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "LookingFor", nLookFor);
- }
- }
- else if (!strcmp(n->name, "g")) { // voice chat enabled
- if (n->text != NULL) {
- BYTE bVoice;
- bVoice = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "VoiceChat", bVoice);
- }
- }
- else if (!strcmp(n->name, "v")) { // status visibility
- if (n->text != NULL) {
- BYTE bPublic;
- bPublic = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "PublicStatus", bPublic);
- }
- }
- }
- if (!hasFirst)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "FirstName");
- if (!hasLast)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "LastName");
- // We are not removing "Nick"
-// if (!hasNick)
-// DBDeleteContactSetting(hContact, iface.m_szModuleName, "Nick");
- if (!hasEmail)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "e-mail");
- if (!hasCity)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "City");
- if (!hasAge)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "Age");
- if (!hasGender)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "Gender");
- if (!hasSchool)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "School");
- if (!hasOccupation)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "Occupation");
- if (!hasLookFor)
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "LookingFor");
- ProtoBroadcastAck(proto->iface.m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
- }
-}
-
-void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode, *itemNode, *n;
- char *type, *jid, *str;
- int id, i, found;
- JABBER_SEARCH_RESULT jsr = {0};
- DBVARIANT dbv = {0};
-
- found = 0;
-// JabberLog("<iq/> iqIdGetSearch");
- if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
- if ((str=JabberXmlGetAttrValue(iqNode, "id")) == NULL) return;
- id = atoi(str+strlen(JABBER_IQID));
-
- if (!strcmp(type, "result")) {
- if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- for (i=0; i<queryNode->numChild; i++) {
- itemNode = queryNode->child[i];
- if (!strcmp(itemNode->name, "item")) {
- if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (strchr(jid, '@') != NULL) {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s", jid);
- } else {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", jid, dbv.pszVal);
- }
- jsr.jid[sizeof(jsr.jid)-1] = '\0';
- jsr.hdr.id = jid;
- jsr.hdr.flags = 0; //results are ansi
- if ((n=JabberXmlGetChild(itemNode, "nick"))!=NULL && n->text!=NULL)
- jsr.hdr.nick = JabberTextDecode(n->text);
- else
- jsr.hdr.nick = mir_strdup("");
- if ((n=JabberXmlGetChild(itemNode, "first"))!=NULL && n->text!=NULL)
- jsr.hdr.firstName = JabberTextDecode(n->text);
- else
- jsr.hdr.firstName = mir_strdup("");
- if ((n=JabberXmlGetChild(itemNode, "last"))!=NULL && n->text!=NULL)
- jsr.hdr.lastName = JabberTextDecode(n->text);
- else
- jsr.hdr.lastName = mir_strdup("");
- if ((n=JabberXmlGetChild(itemNode, "email"))!=NULL && n->text!=NULL)
- jsr.hdr.email = JabberTextDecode(n->text);
- else
- jsr.hdr.email = mir_strdup("");
-
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
- found = 1;
- mir_free(jsr.hdr.nick);
- mir_free(jsr.hdr.firstName);
- mir_free(jsr.hdr.lastName);
- mir_free(jsr.hdr.email);
- }
- }
- }
- if (proto->searchJID!=NULL) {
- if (!found) {
- if (strchr(proto->searchJID, '@') != NULL) {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s", proto->searchJID);
- } else {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
- }
- jsr.jid[sizeof(jsr.jid)-1] = '\0';
- jsr.hdr.nick = mir_strdup("");
- jsr.hdr.firstName = mir_strdup("");
- jsr.hdr.lastName = mir_strdup("");
- jsr.hdr.email = mir_strdup("");
- jsr.hdr.id = mir_strdup("");
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
- mir_free(jsr.hdr.nick);
- mir_free(jsr.hdr.firstName);
- mir_free(jsr.hdr.lastName);
- mir_free(jsr.hdr.email);
- }
- mir_free(proto->searchJID);
- proto->searchJID = NULL;
- }
- DBFreeVariant(&dbv);
- }
- found = 0;
- if (queryNode->numChild == TLEN_MAX_SEARCH_RESULTS_PER_PAGE) {
- found = TlenRunSearch(proto);
- }
- if (!found) {
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
- }
- } else if (!strcmp(type, "error")) {
- // ProtoBroadcastAck(iface.m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE) id, 0);
- // There is no ACKRESULT_FAILED for ACKTYPE_SEARCH :) look at findadd.c
- // So we will just send a SUCCESS
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
- }
-}
-
-
-void GetConfigItem(XmlNode *node, char *dest, BOOL bMethod, int *methodDest) {
- strcpy(dest, node->text);
- TlenUrlDecode(dest);
- if (bMethod) {
- char *method = JabberXmlGetAttrValue(node, "method");
- if (method != NULL && !strcmpi(method, "POST")) {
- *methodDest = REQUEST_POST;
- } else {
- *methodDest = REQUEST_GET;
- }
- }
-}
-
-void TlenIqResultTcfg(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode, *miniMailNode, *node;
- char *type;
-
- if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
- if (!strcmp(type, "result")) {
- if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if ((miniMailNode=JabberXmlGetChild(queryNode, "mini-mail")) == NULL) return;
- if ((node=JabberXmlGetChild(miniMailNode, "base")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailBase, FALSE, NULL);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "msg")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailMsg, TRUE, &proto->threadData->tlenConfig.mailMsgMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "index")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailIndex, TRUE, &proto->threadData->tlenConfig.mailIndexMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "login")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailLogin, TRUE, &proto->threadData->tlenConfig.mailLoginMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "compose")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.mailCompose, TRUE, &proto->threadData->tlenConfig.mailComposeMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "avatar-get")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.avatarGet, TRUE, &proto->threadData->tlenConfig.avatarGetMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "avatar-upload")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.avatarUpload, TRUE, &proto->threadData->tlenConfig.avatarUploadMthd);
- }
- if ((node=JabberXmlGetChild(miniMailNode, "avatar-remove")) != NULL) {
- GetConfigItem(node, proto->threadData->tlenConfig.avatarRemove, TRUE, &proto->threadData->tlenConfig.avatarRemoveMthd);
- }
- }
-}
-
-void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode = JabberXmlGetChild(iqNode, "query");
- if (queryNode != NULL) {
- char* from;
- if (( from=JabberXmlGetAttrValue( iqNode, "from" )) != NULL ) {
- JABBER_LIST_ITEM *item;
- if (( item=JabberListGetItemPtr( proto, LIST_ROSTER, from ))!=NULL) {
- HANDLE hContact;
- XmlNode *n;
- if ( item->software ) mir_free( item->software );
- if ( item->version ) mir_free( item->version );
- if ( item->system ) mir_free( item->system );
- if (( n=JabberXmlGetChild( queryNode, "name" ))!=NULL && n->text ) {
- item->software = JabberTextDecode( n->text );
- } else
- item->software = NULL;
- if (( n=JabberXmlGetChild( queryNode, "version" ))!=NULL && n->text )
- item->version = JabberTextDecode( n->text );
- else
- item->version = NULL;
- if (( n=JabberXmlGetChild( queryNode, "os" ))!=NULL && n->text )
- item->system = JabberTextDecode( n->text );
- else
- item->system = NULL;
- if (( hContact=JabberHContactFromJID(proto, item->jid )) != NULL ) {
- if (item->software != NULL) {
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "MirVer", item->software);
- } else {
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "MirVer");
- }
- }
- }
- }
- }
-}
-
-void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *queryNode = JabberXmlGetChild(iqNode, "query");
- if (queryNode != NULL) {
- char* from;
- if (( from=JabberXmlGetAttrValue( queryNode, "from" )) != NULL ) {
- JABBER_LIST_ITEM *item;
- if (( item=JabberListGetItemPtr( proto, LIST_ROSTER, from ))!=NULL) {
- HANDLE hContact;
- XmlNode *version = JabberXmlGetChild(queryNode, "version");
- item->protocolVersion = JabberTextDecode(version->text);
- if (( hContact=JabberHContactFromJID(proto, item->jid )) != NULL ) {
- if (item->software == NULL) {
- char str[128];
- mir_snprintf(str, sizeof(str), "Tlen Protocol %s", item->protocolVersion);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "MirVer", str);
- }
- }
- }
- }
- }
-}
-
diff --git a/protocols/Tlen/jabber_list.c b/protocols/Tlen/jabber_list.c
deleted file mode 100644
index 8b916b6584..0000000000
--- a/protocols/Tlen/jabber_list.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-
-
-static void JabberListFreeItemInternal(JABBER_LIST_ITEM *item);
-
-void JabberListInit(TlenProtocol *proto)
-{
- proto->lists = NULL;
- proto->listsCount = 0;
- InitializeCriticalSection(&proto->csLists);
-}
-
-void JabberListUninit(TlenProtocol *proto)
-{
- JabberListWipe(proto);
- DeleteCriticalSection(&proto->csLists);
-}
-
-void JabberListWipe(TlenProtocol *proto)
-{
- int i;
-
- EnterCriticalSection(&proto->csLists);
- for(i=0; i<proto->listsCount; i++)
- JabberListFreeItemInternal(&(proto->lists[i]));
- if (proto->lists != NULL) {
- mir_free(proto->lists);
- proto->lists = NULL;
- }
- proto->listsCount=0;
- LeaveCriticalSection(&proto->csLists);
-}
-
-void JabberListWipeSpecial(TlenProtocol *proto)
-{
- int i;
- EnterCriticalSection(&proto->csLists);
- for(i=0; i<proto->listsCount; i++) {
- if (proto->lists[i].list != LIST_FILE && proto->lists[i].list != LIST_VOICE) {
- JabberListFreeItemInternal(&(proto->lists[i]));
- proto->listsCount--;
- memmove(proto->lists+i, proto->lists+i+1, sizeof(JABBER_LIST_ITEM)*(proto->listsCount-i));
- i--;
- }
- }
- proto->lists = (JABBER_LIST_ITEM *) mir_realloc(proto->lists, sizeof(JABBER_LIST_ITEM)*proto->listsCount);
- LeaveCriticalSection(&proto->csLists);
-}
-
-static void JabberListFreeItemInternal(JABBER_LIST_ITEM *item)
-{
- if (item == NULL)
- return;
-
- if (item->jid) mir_free(item->jid);
- if (item->nick) mir_free(item->nick);
- if (item->statusMessage) mir_free(item->statusMessage);
- if (item->group) mir_free(item->group);
- if (item->messageEventIdStr) mir_free(item->messageEventIdStr);
-// if (item->type) mir_free(item->type);
- //if (item->ft) JabberFileFreeFt(item->ft); // No need to free (it is always free when exit from JabberFileServerThread())
- if (item->roomName) mir_free(item->roomName);
- if (item->version) mir_free(item->version);
- if (item->software) mir_free(item->software);
- if (item->system) mir_free(item->system);
- if (item->avatarHash) mir_free(item->avatarHash);
-
- if (item->protocolVersion) mir_free(item->protocolVersion);
- if (item->id2) mir_free(item->id2);
-}
-
-static char * GetItemId(JABBER_LIST list, const char *jid)
-{
- char *s, *p, *q;
- s = mir_strdup(jid);
- if (list != LIST_PICTURE) {
- _strlwr(s);
- // strip resouce name if any
- if ((p=strchr(s, '@')) != NULL) {
- if ((q=strchr(p, '/')) != NULL)
- *q = '\0';
- }
- }
- return s;
-}
-
-int JabberListExist(TlenProtocol *proto, JABBER_LIST list, const char *jid)
-{
- int i;
- size_t len;
- char *s, *p;
- s = GetItemId(list, jid);
- len = strlen(s);
-
- EnterCriticalSection(&proto->csLists);
- for(i=0; i<proto->listsCount; i++)
- if (proto->lists[i].list==list) {
- p = proto->lists[i].jid;
- if (p && strlen(p)>=len && (p[(int)len]=='\0'||p[(int)len]=='/') && !strncmp(p, s, len)) {
- LeaveCriticalSection(&proto->csLists);
- mir_free(s);
- return i+1;
- }
- }
- LeaveCriticalSection(&proto->csLists);
- mir_free(s);
- return 0;
-}
-
-JABBER_LIST_ITEM *JabberListAdd(TlenProtocol *proto, JABBER_LIST list, const char *jid)
-{
- char *s;
- JABBER_LIST_ITEM *item;
-
- EnterCriticalSection(&proto->csLists);
- if ((item=JabberListGetItemPtr(proto, list, jid)) != NULL) {
- LeaveCriticalSection(&proto->csLists);
- return item;
- }
-
- s = GetItemId(list, jid);
- proto->lists = (JABBER_LIST_ITEM *) mir_realloc(proto->lists, sizeof(JABBER_LIST_ITEM)*(proto->listsCount+1));
- item = &(proto->lists[proto->listsCount]);
- memset(item, 0, sizeof(JABBER_LIST_ITEM));
- item->list = list;
- item->jid = s;
- item->nick = NULL;
- item->status = ID_STATUS_OFFLINE;
- item->statusMessage = NULL;
- item->group = NULL;
- item->messageEventIdStr = NULL;
- item->wantComposingEvent = FALSE;
- item->isTyping = FALSE;
-// item->type = NULL;
- item->ft = NULL;
- item->roomName = NULL;
- item->version = NULL;
- item->software = NULL;
- item->system = NULL;
- item->avatarHash = NULL;
- item->avatarFormat = PA_FORMAT_UNKNOWN;
- item->newAvatarDownloading = FALSE;
- item->versionRequested = FALSE;
- item->infoRequested = FALSE;
- proto->listsCount++;
- LeaveCriticalSection(&proto->csLists);
-
- return item;
-}
-
-void JabberListRemove(TlenProtocol *proto, JABBER_LIST list, const char *jid)
-{
- int i;
-
- EnterCriticalSection(&proto->csLists);
- i = JabberListExist(proto, list, jid);
- if (!i) {
- LeaveCriticalSection(&proto->csLists);
- return;
- }
- i--;
- JabberListFreeItemInternal(&(proto->lists[i]));
- proto->listsCount--;
- memmove(proto->lists+i, proto->lists+i+1, sizeof(JABBER_LIST_ITEM)*(proto->listsCount-i));
- proto->lists = (JABBER_LIST_ITEM *) mir_realloc(proto->lists, sizeof(JABBER_LIST_ITEM)*proto->listsCount);
- LeaveCriticalSection(&proto->csLists);
-}
-
-void JabberListRemoveList(TlenProtocol *proto, JABBER_LIST list)
-{
- int i;
-
- i = 0;
- while ((i=JabberListFindNext(proto, list, i)) >= 0) {
- JabberListRemoveByIndex(proto, i);
- }
-}
-
-void JabberListRemoveByIndex(TlenProtocol *proto, int index)
-{
- EnterCriticalSection(&proto->csLists);
- if (index>=0 && index<proto->listsCount) {
- JabberListFreeItemInternal(&(proto->lists[index]));
- proto->listsCount--;
- memmove(proto->lists+index, proto->lists+index+1, sizeof(JABBER_LIST_ITEM)*(proto->listsCount-index));
- proto->lists = (JABBER_LIST_ITEM *) mir_realloc(proto->lists, sizeof(JABBER_LIST_ITEM)*proto->listsCount);
- }
- LeaveCriticalSection(&proto->csLists);
-}
-
-void JabberListAddResource(TlenProtocol *proto, JABBER_LIST list, const char *jid, int status, const char *statusMessage)
-{
- int i;
-
- EnterCriticalSection(&proto->csLists);
- i = JabberListExist(proto, list, jid);
- if (!i) {
- LeaveCriticalSection(&proto->csLists);
- return;
- }
- i--;
-
- if (proto->lists[i].statusMessage != NULL)
- mir_free(proto->lists[i].statusMessage);
- if (statusMessage)
- proto->lists[i].statusMessage = mir_strdup(statusMessage);
- else
- proto->lists[i].statusMessage = NULL;
- LeaveCriticalSection(&proto->csLists);
-}
-
-void JabberListRemoveResource(TlenProtocol *proto, JABBER_LIST list, const char *jid)
-{
- int i;
- EnterCriticalSection(&proto->csLists);
- i = JabberListExist(proto, list, jid);
- if (!i) {
- LeaveCriticalSection(&proto->csLists);
- return;
- }
- i--;
- LeaveCriticalSection(&proto->csLists);
-}
-
-int JabberListFindNext(TlenProtocol *proto, JABBER_LIST list, int fromOffset)
-{
- int i;
-
- EnterCriticalSection(&proto->csLists);
- i = (fromOffset>=0) ? fromOffset : 0;
- for(; i<proto->listsCount; i++)
- if (proto->lists[i].list == list) {
- LeaveCriticalSection(&proto->csLists);
- return i;
- }
- LeaveCriticalSection(&proto->csLists);
- return -1;
-}
-
-JABBER_LIST_ITEM *JabberListGetItemPtr(TlenProtocol *proto, JABBER_LIST list, const char *jid)
-{
- int i;
-
- EnterCriticalSection(&proto->csLists);
- i = JabberListExist(proto, list, jid);
- if (!i) {
- LeaveCriticalSection(&proto->csLists);
- return NULL;
- }
- i--;
- LeaveCriticalSection(&proto->csLists);
- return &(proto->lists[i]);
-}
-
-JABBER_LIST_ITEM *JabberListFindItemPtrById2(TlenProtocol *proto, JABBER_LIST list, const char *id)
-{
-
- int i;
- size_t len;
- char *p;
-
- len = strlen(id);
-
- EnterCriticalSection(&proto->csLists);
- for(i=0; i<proto->listsCount; i++) {
- if (proto->lists[i].list==list) {
- p = proto->lists[i].id2;
- if (p != NULL) {
- if (!strncmp(p, id, len)) {
- LeaveCriticalSection(&proto->csLists);
- return &(proto->lists[i]);
- }
- }
- }
- }
- LeaveCriticalSection(&proto->csLists);
- return NULL;
-}
-
-JABBER_LIST_ITEM *JabberListGetItemPtrFromIndex(TlenProtocol *proto, int index)
-{
- EnterCriticalSection(&proto->csLists);
- if (index>=0 && index<proto->listsCount) {
- LeaveCriticalSection(&proto->csLists);
- return &(proto->lists[index]);
- }
- LeaveCriticalSection(&proto->csLists);
- return NULL;
-}
-
diff --git a/protocols/Tlen/jabber_list.h b/protocols/Tlen/jabber_list.h
deleted file mode 100644
index 116440a6a1..0000000000
--- a/protocols/Tlen/jabber_list.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-
-#ifndef _JABBER_LIST_H_
-#define _JABBER_LIST_H_
-
-typedef struct JABBER_LIST_ITEM_STRUCT {
- JABBER_LIST list;
- char *jid;
- char *id2;
-
- // LIST_ROSTER
- // jid = jid of the contact
- char *nick;
- int status; // Main status, currently useful for transport where no resource information is kept.
- // On normal contact, this is the same status as shown on contact list.
- JABBER_SUBSCRIPTION subscription;
- char *statusMessage; // Status message when the update is to JID with no resource specified (e.g. transport user)
- char *software;
- char *version;
- char *system;
- char *group;
- char *protocolVersion;
- int avatarFormat;
- char *avatarHash;
- BOOL newAvatarDownloading;
- BOOL versionRequested;
- BOOL infoRequested;
- int idMsgAckPending;
- char *messageEventIdStr;
- BOOL wantComposingEvent;
- BOOL isTyping;
-
- // LIST_ROOM
- // jid = room JID
- // char *name; // room name
- //char *type; // room type
-
- // LIST_CHATROOM
- // jid = room JID
- // char *nick; // my nick in this chat room (SPECIAL: in UTF8)
- // JABBER_RESOURCE_STATUS *resource; // participant nicks in this room
- char *roomName;
-
- // LIST_FILE
- struct TLEN_FILE_TRANSFER_STRUCT *ft;
-} JABBER_LIST_ITEM;
-
-
-void JabberListInit(TlenProtocol *proto);
-void JabberListUninit(TlenProtocol *proto);
-void JabberListWipe(TlenProtocol *proto);
-void JabberListWipeSpecial(TlenProtocol *proto);
-int JabberListExist(TlenProtocol *proto, JABBER_LIST list, const char *jid);
-JABBER_LIST_ITEM *JabberListAdd(TlenProtocol *proto, JABBER_LIST list, const char *jid);
-void JabberListRemove(TlenProtocol *proto, JABBER_LIST list, const char *jid);
-void JabberListRemoveList(TlenProtocol *proto, JABBER_LIST list);
-void JabberListRemoveByIndex(TlenProtocol *proto, int index);
-int JabberListFindNext(TlenProtocol *proto, JABBER_LIST list, int fromOffset);
-JABBER_LIST_ITEM *JabberListGetItemPtr(TlenProtocol *proto, JABBER_LIST list, const char *jid);
-JABBER_LIST_ITEM *JabberListGetItemPtrFromIndex(TlenProtocol *proto, int index);
-JABBER_LIST_ITEM *JabberListFindItemPtrById2(TlenProtocol *proto, JABBER_LIST list, const char *id);
-
-void JabberListAddResource(TlenProtocol *proto, JABBER_LIST list, const char *jid, int status, const char *statusMessage);
-void JabberListRemoveResource(TlenProtocol *proto, JABBER_LIST list, const char *jid);
-
-#endif
-
diff --git a/protocols/Tlen/jabber_misc.c b/protocols/Tlen/jabber_misc.c
deleted file mode 100644
index 33ddf80f1e..0000000000
--- a/protocols/Tlen/jabber_misc.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-
-void JabberDBAddEvent(TlenProtocol *proto, HANDLE hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob)
-{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(DBEVENTINFO);
- dbei.szModule = proto->iface.m_szModuleName;
- dbei.timestamp = (DWORD) time(NULL);
- dbei.flags = flags;
- dbei.eventType = eventType;
- dbei.cbBlob = cbBlob;
- dbei.pBlob = pBlob;
- CallService(MS_DB_EVENT_ADD, (WPARAM) hContact, (LPARAM) &dbei);
-}
-void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick)
-{
- char *s;
- PBYTE pCurBlob;
- PBYTE pBlob;
- DWORD cbBlob;
- HANDLE hContact;
-
- if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
- hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->iface.m_szModuleName);
- // strip resource if present
- s = JabberLoginFromJID(jid);
- _strlwr(s);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "jid", s);
- mir_free(s);
- }
- else {
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "Hidden");
- }
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "Nick", nick);
- JabberLog(proto, "auth request: %s, %s", jid, nick);
- //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
- cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5;
- pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob);
- *((PDWORD) pCurBlob) = 0; pCurBlob += sizeof(DWORD);
- *((PHANDLE) pCurBlob) = hContact; pCurBlob += sizeof(HANDLE);
- strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1;
- *pCurBlob = '\0'; pCurBlob++; //firstName
- *pCurBlob = '\0'; pCurBlob++; //lastName
- strcpy((char *) pCurBlob, jid); pCurBlob += strlen(jid)+1;
- *pCurBlob = '\0'; //reason
- JabberDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, pBlob, cbBlob);
-}
-
-char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact)
-{
- char *p = NULL;
- DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- p = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- return p;
-}
-
-
-HANDLE JabberHContactFromJID(TlenProtocol *proto, const char *jid)
-{
- HANDLE hContact, hContactMatched;
- DBVARIANT dbv;
- char *szProto;
- char *p;
- if (jid == NULL) return (HANDLE) NULL;
- hContactMatched = NULL;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto!=NULL && !strcmp(proto->iface.m_szModuleName, szProto)) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- if ((p=dbv.pszVal) != NULL) {
- if (!stricmp(p, jid)) { // exact match (node@domain/resource)
- hContactMatched = hContact;
- DBFreeVariant(&dbv);
- break;
- }
- }
- DBFreeVariant(&dbv);
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
- if (hContactMatched != NULL) {
- return hContactMatched;
- }
- return NULL;
-}
-
-HANDLE JabberDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary)
-{
- HANDLE hContact;
- if (jid==NULL || jid[0]=='\0')
- return NULL;
-
- if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
- hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->iface.m_szModuleName);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "jid", jid);
- if (nick!=NULL && nick[0]!='\0')
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "Nick", nick);
- if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- }
- return hContact;
-}
-
-static void JabberContactListCreateClistGroup(char *groupName)
-{
- char str[33], newName[128];
- int i;
- DBVARIANT dbv;
- char *name;
-
- for (i=0;;i++) {
- itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
- break;
- name = dbv.pszVal;
- if (name[0]!='\0' && !strcmp(name+1, groupName)) {
- // Already exist, no need to create
- DBFreeVariant(&dbv);
- return;
- }
- DBFreeVariant(&dbv);
- }
-
- // Create new group with id = i (str is the text representation of i)
- newName[0] = 1 | GROUPF_EXPANDED;
- strncpy(newName+1, groupName, sizeof(newName)-1);
- newName[sizeof(newName)-1] = '\0';
- DBWriteContactSettingString(NULL, "CListGroups", str, newName);
- CallService(MS_CLUI_GROUPADDED, i+1, 0);
-}
-
-void JabberContactListCreateGroup(char *groupName)
-{
- char name[128];
- char *p;
-
- if (groupName==NULL || groupName[0]=='\0' || groupName[0]=='\\') return;
-
- strncpy(name, groupName, sizeof(name));
- name[sizeof(name)-1] = '\0';
- for (p=name; *p!='\0'; p++) {
- if (*p == '\\') {
- *p = '\0';
- JabberContactListCreateClistGroup(name);
- *p = '\\';
- }
- }
- JabberContactListCreateClistGroup(name);
-}
-
-
-struct FORK_ARG {
- HANDLE hEvent;
- void (__cdecl *threadcode)(void*);
- void *arg;
-};
-
-static void __cdecl forkthread_r(struct FORK_ARG *fa)
-{
- void (*callercode)(void*) = fa->threadcode;
- void *arg = fa->arg;
- CallService(MS_SYSTEM_THREAD_PUSH, 0, 0);
- SetEvent(fa->hEvent);
- callercode(arg);
- CallService(MS_SYSTEM_THREAD_POP, 0, 0);
- return;
-}
-
-unsigned long JabberForkThread(
- 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((void (__cdecl *)(void*))forkthread_r, stacksize, &fa);
- if ((unsigned long) -1L != rc) {
- WaitForSingleObject(fa.hEvent, INFINITE);
- }
- CloseHandle(fa.hEvent);
- return rc;
-}
diff --git a/protocols/Tlen/jabber_opt.c b/protocols/Tlen/jabber_opt.c
deleted file mode 100644
index 3ef45e4289..0000000000
--- a/protocols/Tlen/jabber_opt.c
+++ /dev/null
@@ -1,708 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-#include "tlen_voice.h"
-#include <commctrl.h>
-#include "resource.h"
-
-static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-typedef struct TabDefStruct {
- DLGPROC dlgProc;
- DWORD dlgId;
- TCHAR *tabName;
-} TabDef;
-
-static TabDef tabPages[] = {
- {TlenBasicOptDlgProc, IDD_OPTIONS_BASIC, _T("General")},
- {TlenVoiceOptDlgProc, IDD_OPTIONS_VOICE, _T("Voice Chats")},
- {TlenAdvOptDlgProc, IDD_OPTIONS_ADVANCED, _T("Advanced")},
- {TlenPopupsDlgProc, IDD_OPTIONS_POPUPS, _T("Notifications")}
- };
-
-void TlenLoadOptions(TlenProtocol *proto)
-{
- proto->tlenOptions.savePassword = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", TRUE);
- proto->tlenOptions.useEncryption = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseEncryption", TRUE);
- proto->tlenOptions.reconnect = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "Reconnect", TRUE);
- proto->tlenOptions.alertPolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
- proto->tlenOptions.rosterSync = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "RosterSync", FALSE);
- proto->tlenOptions.offlineAsInvisible = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "OfflineAsInvisible", FALSE);
- proto->tlenOptions.leaveOfflineMessage = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "LeaveOfflineMessage", TRUE);
- proto->tlenOptions.offlineMessageOption = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "OfflineMessageOption", 0);
- proto->tlenOptions.ignoreAdvertisements = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "IgnoreAdvertisements", TRUE);
- proto->tlenOptions.groupChatPolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.voiceChatPolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.imagePolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
- proto->tlenOptions.enableAvatars = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "EnableAvatars", TRUE);
- proto->tlenOptions.enableVersion = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "EnableVersion", TRUE);
- proto->tlenOptions.useNudge = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseNudge", FALSE);
- proto->tlenOptions.logAlerts = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "LogAlerts", TRUE);
- proto->tlenOptions.sendKeepAlive = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "KeepAlive", TRUE);
- proto->tlenOptions.useNewP2P = TRUE;
-}
-
-static int changed = 0;
-
-static void ApplyChanges(TlenProtocol *proto, int i) {
- changed &= ~i;
- if (changed == 0) {
- TlenLoadOptions(proto);
- }
-}
-
-static void MarkChanges(int i, HWND hWnd) {
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- changed |= i;
-}
-
-
-int TlenOptionsInit(TlenProtocol *proto, WPARAM wParam, LPARAM lParam)
-{
- int i;
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
- odp.hInstance = hInst;
- odp.ptszGroup = TranslateT("Network");
- odp.ptszTitle = proto->iface.m_tszUserName;
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.dwInitParam = (LPARAM)proto;
- for (i = 0; i < SIZEOF(tabPages); i++) {
- odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
- odp.pfnDlgProc = tabPages[i].dlgProc;
- odp.ptszTab = tabPages[i].tabName;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp);
- }
-/*
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
- ZeroMemory(&odp,sizeof(odp));
- odp.cbSize = sizeof(odp);
- odp.position = 100000000;
- odp.hInstance = hInst;
- odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszGroup = TranslateT("PopUps");
- odp.ptszTitle = proto->iface.m_tszUserName;
- odp.dwInitParam = (LPARAM)proto;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
- odp.pfnDlgProc = TlenPopupsDlgProc;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
- }
- */
- return 0;
-}
-
-static LRESULT CALLBACK JabberValidateUsernameWndProc(HWND hwndEdit, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- WNDPROC oldProc = (WNDPROC) GetWindowLongPtr(hwndEdit, GWLP_USERDATA);
-
- switch (msg) {
- case WM_CHAR:
- if (strchr("\"&'/:<>@", wParam&0xff) != NULL)
- return 0;
- break;
- }
- return CallWindowProc(oldProc, hwndEdit, msg, wParam, lParam);
-}
-
-INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char text[256];
- WNDPROC oldProc;
-
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "LoginName", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", TRUE));
-
- oldProc = (WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_USERDATA, (LONG_PTR) oldProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC, (LONG_PTR) JabberValidateUsernameWndProc);
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_EDIT_USERNAME:
- case IDC_EDIT_PASSWORD:
- if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_SAVEPASSWORD:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_REGISTERACCOUNT:
- CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) TLEN_REGISTER);
- break;
- }
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- BOOL reconnectRequired = FALSE;
- DBVARIANT dbv;
-
- GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "LoginName", strlwr(text));
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
- GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "Password", text);
- }
- else
- DBDeleteContactSetting(NULL, proto->iface.m_szModuleName, "Password");
-
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
- if (reconnectRequired && proto->isConnected)
- MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
- TlenLoadOptions(proto);
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char text[256];
- WNDPROC oldProc;
-
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "LoginName", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", TRUE));
-
- CheckDlgButton(hwndDlg, IDC_RECONNECT, proto->tlenOptions.reconnect);
- CheckDlgButton(hwndDlg, IDC_ROSTER_SYNC, proto->tlenOptions.rosterSync);
- CheckDlgButton(hwndDlg, IDC_SHOW_OFFLINE, proto->tlenOptions.offlineAsInvisible);
- CheckDlgButton(hwndDlg, IDC_OFFLINE_MESSAGE, proto->tlenOptions.leaveOfflineMessage);
- CheckDlgButton(hwndDlg, IDC_IGNORE_ADVERTISEMENTS, proto->tlenOptions.ignoreAdvertisements);
- CheckDlgButton(hwndDlg, IDC_AVATARS, proto->tlenOptions.enableAvatars);
- CheckDlgButton(hwndDlg, IDC_VERSIONINFO, proto->tlenOptions.enableVersion);
- CheckDlgButton(hwndDlg, IDC_NUDGE_SUPPORT, proto->tlenOptions.useNudge);
- CheckDlgButton(hwndDlg, IDC_LOG_ALERTS, proto->tlenOptions.logAlerts);
-
- SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all alerts"));
- SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore alerts from unauthorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all alerts"));
- SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_SETCURSEL, proto->tlenOptions.alertPolicy, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always ask me"));
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept invitations from authorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all invitations"));
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore invitations from unauthorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all invitation"));
- SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_SETCURSEL, proto->tlenOptions.groupChatPolicy, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all images"));
- SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore images from unauthorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all images"));
- SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_SETCURSEL, proto->tlenOptions.imagePolicy, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Last message>"));
- //SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Ask me>"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Online"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Away"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("NA"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("DND"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Free for chat"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Invisible"));
- SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_SETCURSEL, proto->tlenOptions.offlineMessageOption, 0);
-
- oldProc = (WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_USERDATA, (LONG_PTR) oldProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC, (LONG_PTR) JabberValidateUsernameWndProc);
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_EDIT_USERNAME:
- case IDC_EDIT_PASSWORD:
- if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- // Fall through
- case IDC_SAVEPASSWORD:
- case IDC_RECONNECT:
- case IDC_ROSTER_SYNC:
- case IDC_IGNORE_ADVERTISEMENTS:
- case IDC_SHOW_OFFLINE:
- case IDC_OFFLINE_MESSAGE:
- MarkChanges(1, hwndDlg);
- break;
- case IDC_LOG_ALERTS:
- CheckDlgButton(hwndDlg, IDC_NUDGE_SUPPORT, BST_UNCHECKED);
- MarkChanges(1, hwndDlg);
- break;
- case IDC_NUDGE_SUPPORT:
- CheckDlgButton(hwndDlg, IDC_LOG_ALERTS, BST_UNCHECKED);
- MarkChanges(1, hwndDlg);
- break;
- case IDC_REGISTERACCOUNT:
- CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) TLEN_REGISTER);
- break;
- case IDC_OFFLINE_MESSAGE_OPTION:
- case IDC_ALERT_POLICY:
- case IDC_MUC_POLICY:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- MarkChanges(1, hwndDlg);
- break;
- default:
- MarkChanges(1, hwndDlg);
- break;
- }
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- BOOL reconnectRequired = FALSE;
- DBVARIANT dbv;
-
- GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "LoginName", strlwr(text));
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
- GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "Password", text);
- }
- else
- DBDeleteContactSetting(NULL, proto->iface.m_szModuleName, "Password");
-
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
- if (reconnectRequired && proto->isConnected)
- MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
- ApplyChanges(proto, 1);
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- {
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always ask me"));
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept invitations from authorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all invitations"));
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore invitations from unauthorized contacts"));
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all invitation"));
- SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_SETCURSEL, proto->tlenOptions.voiceChatPolicy, 0);
- TlenVoiceBuildInDeviceList(proto, GetDlgItem(hwndDlg, IDC_VOICE_DEVICE_IN));
- TlenVoiceBuildOutDeviceList(proto, GetDlgItem(hwndDlg, IDC_VOICE_DEVICE_OUT));
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_VOICE_POLICY:
- case IDC_VOICE_DEVICE_IN:
- case IDC_VOICE_DEVICE_OUT:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- MarkChanges(2, hwndDlg);
- break;
- }
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
- ApplyChanges(proto, 2);
- return TRUE;
- }
- }
- break;
- }
-
- return FALSE;
-}
-
-static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char text[256];
- BOOL bChecked;
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else {
- SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
- }
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE);
-
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "ManualHost", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else
- SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
- SetDlgItemInt(hwndDlg, IDC_HOSTPORT, DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
-
- CheckDlgButton(hwndDlg, IDC_KEEPALIVE, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "KeepAlive", TRUE));
-
- CheckDlgButton(hwndDlg, IDC_USE_SSL, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseEncryption", TRUE));
-
- CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "VisibilitySupport", FALSE));
- // File transfer options
- bChecked = FALSE;
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
- bChecked = TRUE;
- CheckDlgButton(hwndDlg, IDC_FILE_USE_PROXY, TRUE);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
- CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE);
- } else {
- bChecked = FALSE;
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD), bChecked);
-
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Forwarding"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS4"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS5"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyType", 0), 0);
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "FileProxyHost", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyPort", 0), FALSE);
- if (!DBGetContactSettingTString(NULL, proto->iface.m_szModuleName, "FileProxyUsername", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "FileProxyPassword", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_FILE_PROXY_TYPE:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- MarkChanges(4, hwndDlg);
- break;
- case IDC_EDIT_LOGIN_SERVER:
- case IDC_HOST:
- case IDC_HOSTPORT:
- case IDC_FILE_PROXY_HOST:
- case IDC_FILE_PROXY_PORT:
- case IDC_FILE_PROXY_USER:
- case IDC_FILE_PROXY_PASSWORD:
- if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- MarkChanges(4, hwndDlg);
- break;
- case IDC_FILE_USE_PROXY:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- case IDC_FILE_PROXY_USE_AUTH:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH) & IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD_LABEL), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD), bChecked);
- MarkChanges(4, hwndDlg);
- break;
- case IDC_KEEPALIVE:
- case IDC_VISIBILITY_SUPPORT:
- case IDC_USE_SSL:
- MarkChanges(4, hwndDlg);
- break;
- }
- }
- break;
- case WM_NOTIFY:
- {
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- WORD port;
- BOOL useEncryption;
- BOOL reconnectRequired = FALSE;
- DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "LoginServer", strlwr(text));
-
- GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->iface.m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "ManualHost", text);
-
- port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
- if (DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
- reconnectRequired = TRUE;
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "ManualPort", port);
-
- proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
-
- useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseEncryption", TRUE) != useEncryption)
- reconnectRequired = TRUE;
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "UseEncryption", (BYTE) useEncryption);
-
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
- // File transfer options
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "FileProxyHost", text);
- DBWriteContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "FileProxyUsername", text);
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "FileProxyPassword", text);
- if (reconnectRequired && proto->isConnected)
- MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
- ApplyChanges(proto, 4);
- return TRUE;
- }
- }
- }
- break;
- case WM_DESTROY:
- break;
- }
-
- return FALSE;
-}
-
-#define POPUP_DEFAULT_COLORBKG 0xDCBDA5
-#define POPUP_DEFAULT_COLORTXT 0x000000
-
-static void MailPopupPreview(DWORD colorBack, DWORD colorText, char *title, char *emailInfo, int delay)
-{
- POPUPDATAEX ppd;
- char * lpzContactName;
- char * lpzText;
- HICON hIcon;
- lpzContactName = title;
- lpzText = emailInfo;
- ZeroMemory(&ppd, sizeof(ppd));
- ppd.lchContact = NULL;
- hIcon = GetIcolibIcon(IDI_MAIL);
- ppd.lchIcon = CopyIcon(hIcon);
- ReleaseIcolibIcon(hIcon);
- strcpy(ppd.lpzContactName, lpzContactName);
- strcpy(ppd.lpzText, lpzText);
- ppd.colorBack = colorBack;
- ppd.colorText = colorText;
- ppd.PluginWindowProc = NULL;
- ppd.PluginData=NULL;
- if ( ServiceExists( MS_POPUP_ADDPOPUPEX )) {
- ppd.iSeconds = delay;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
-
- }
- else if ( ServiceExists( MS_POPUP_ADDPOPUP )) {
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
- }
-}
-
-static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- {
- BYTE delayMode;
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupEnabled", TRUE));
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
- SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupDelay", 4), FALSE);
- delayMode = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupDelayMode", 0);
- if (delayMode==1) {
- CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE);
- } else if (delayMode==2) {
- CheckDlgButton(hwndDlg, IDC_DELAY_PERMANENT, TRUE);
- } else {
- CheckDlgButton(hwndDlg, IDC_DELAY_POPUP, TRUE);
- }
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_COLORTXT:
- case IDC_COLORBKG:
- case IDC_ENABLEPOPUP:
- case IDC_DELAY:
- case IDC_DELAY_POPUP:
- case IDC_DELAY_CUSTOM:
- case IDC_DELAY_PERMANENT:
- MarkChanges(8, hwndDlg);
- break;
- case IDC_PREVIEW:
- {
- int delay;
- char title[256];
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_POPUP)) {
- delay=0;
- } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) {
- delay=-1;
- } else {
- delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
- }
- _snprintf(title, sizeof(title), Translate("%s mail"), proto->iface.m_szProtoName);
- MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0),
- (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0),
- title,
- "From: test@test.test\nSubject: test",
- delay);
- }
-
- }
- break;
-
-
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- BYTE delayMode;
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
- DBWriteContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
- delayMode=0;
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) {
- delayMode=1;
- } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) {
- delayMode=2;
-
- }
- DBWriteContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupDelayMode", delayMode);
- ApplyChanges(proto, 8);
- return TRUE;
- }
- }
- break;
-
- }
- return FALSE;
-}
-
diff --git a/protocols/Tlen/jabber_svc.c b/protocols/Tlen/jabber_svc.c
deleted file mode 100644
index ecc3b26bfb..0000000000
--- a/protocols/Tlen/jabber_svc.c
+++ /dev/null
@@ -1,1300 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "resource.h"
-#include "jabber_list.h"
-#include "jabber_iq.h"
-#include "tlen_p2p_old.h"
-#include "tlen_avatar.h"
-#include "tlen_file.h"
-
-extern int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam);
-extern int TlenOptionsInit(void *ptr, WPARAM wParam, LPARAM lParam);
-extern int TlenPreShutdown(void *ptr, WPARAM wParam, LPARAM lParam);
-DWORD_PTR TlenGetCaps(PROTO_INTERFACE *ptr, int type, HANDLE hContact)
-{
- if (type == PFLAGNUM_1)
- return PF1_IM|PF1_AUTHREQ|PF1_SERVERCLIST|PF1_MODEMSG|PF1_BASICSEARCH|PF1_SEARCHBYEMAIL|PF1_EXTSEARCH|PF1_EXTSEARCHUI|PF1_SEARCHBYNAME|PF1_FILE;//|PF1_VISLIST|PF1_INVISLIST;
- if (type == PFLAGNUM_2)
- return PF2_ONLINE|PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_HEAVYDND|PF2_FREECHAT;
- if (type == PFLAGNUM_3)
- return PF2_ONLINE|PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_HEAVYDND|PF2_FREECHAT;
- if (type == PFLAGNUM_4)
- return PF4_FORCEAUTH|PF4_NOCUSTOMAUTH|PF4_SUPPORTTYPING|PF4_AVATARS|PF4_IMSENDOFFLINE|PF4_OFFLINEFILES;
- if (type == PFLAG_UNIQUEIDTEXT)
- return (DWORD_PTR) Translate("Tlen login");
- if (type == PFLAG_UNIQUEIDSETTING)
- return (DWORD_PTR) "jid";
- return 0;
-}
-
-INT_PTR TlenGetName(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- strncpy((char *) lParam, proto->iface.m_szProtoName, wParam);
- return 0;
-}
-
-HICON TlenGetIcon(PROTO_INTERFACE *ptr, int iconIndex)
-{
- if ((iconIndex&0xffff) == PLI_PROTOCOL) {
- HICON hIcon = GetIcolibIcon(IDI_TLEN);
- HICON hIconCopy = CopyIcon(hIcon);
- ReleaseIcolibIcon(hIcon);
- return hIconCopy;
- }
- return (HICON) NULL;
-}
-
-int TlenRunSearch(TlenProtocol *proto) {
- int iqId = 0;
- if (!proto->isOnline) return 0;
- if (proto->searchQuery != NULL && proto->searchIndex < 10) {
- iqId = proto->searchID;
- JabberIqAdd(proto, iqId, IQ_PROC_GETSEARCH, JabberIqResultSearch);
- if (proto->searchIndex == 0) {
- JabberSend(proto, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:search'>%s</query></iq>", iqId, proto->searchQuery);
- } else {
- JabberSend(proto, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:search'>%s<f>%d</f></query></iq>", iqId, proto->searchQuery, proto->searchIndex * TLEN_MAX_SEARCH_RESULTS_PER_PAGE);
- }
- proto->searchIndex ++;
- }
- return iqId;
-}
-
-void TlenResetSearchQuery(TlenProtocol *proto) {
- if (proto->searchQuery != NULL) {
- mir_free(proto->searchQuery);
- proto->searchQuery = NULL;
- }
- proto->searchQueryLen = 0;
- proto->searchIndex = 0;
- proto->searchID = JabberSerialNext(proto);
-}
-
-HANDLE TlenBasicSearch(PROTO_INTERFACE *ptr, const char *id)
-{
- char *jid;
- int iqId = 0;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) return 0;
- if (id == NULL) return 0;
- if ((jid=JabberTextEncode(id)) != NULL) {
- proto->searchJID = mir_strdup(id);
- TlenResetSearchQuery(proto);
- JabberStringAppend(&proto->searchQuery, &proto->searchQueryLen, "<i>%s</i>", jid);
- iqId = TlenRunSearch(proto);
- mir_free(jid);
- }
- return (HANDLE)iqId;
-}
-
-HANDLE TlenSearchByEmail(PROTO_INTERFACE *ptr, const char* email)
-{
- char *emailEnc;
- int iqId = 0;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 0;
- if (email == NULL) return 0;
-
- if ((emailEnc=JabberTextEncode(email)) != NULL) {
- TlenResetSearchQuery(proto);
- JabberStringAppend(&proto->searchQuery, &proto->searchQueryLen, "<email>%s</email>", emailEnc);
- iqId = TlenRunSearch(proto);
- mir_free(emailEnc);
- }
- return (HANDLE)iqId;
-}
-
-HANDLE TlenSearchByName(PROTO_INTERFACE *ptr, const char* nick, const char* firstName, const char* lastName)
-{
- char *p;
- int iqId = 0;
-
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) return 0;
-
- TlenResetSearchQuery(proto);
-
- if (nick != NULL && nick[0] != '\0') {
- if ((p=JabberTextEncode(nick)) != NULL) {
- JabberStringAppend(&proto->searchQuery, &proto->searchQueryLen, "<nick>%s</nick>", p);
- mir_free(p);
- }
- }
- if (firstName != NULL && firstName[0] != '\0') {
- if ((p=JabberTextEncode(firstName)) != NULL) {
- JabberStringAppend(&proto->searchQuery, &proto->searchQueryLen, "<first>%s</first>", p);
- mir_free(p);
- }
- }
- if (lastName != NULL && lastName[0] != '\0') {
- if ((p=JabberTextEncode(lastName)) != NULL) {
- JabberStringAppend(&proto->searchQuery, &proto->searchQueryLen, "<last>%s</last>", p);
- mir_free(p);
- }
- }
-
- iqId = TlenRunSearch(proto);
- return (HANDLE)iqId;
-}
-
-HWND TlenCreateAdvSearchUI(PROTO_INTERFACE *ptr, HWND owner)
-{
- return (HWND) CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADVSEARCH), owner, TlenAdvSearchDlgProc);
-}
-
-HWND TlenSearchAdvanced(PROTO_INTERFACE *ptr, HWND owner)
-{
- int iqId;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) return 0;
-
- TlenResetSearchQuery(proto);
- iqId = JabberSerialNext(proto);
- if ((proto->searchQuery = TlenAdvSearchCreateQuery(owner, iqId)) != NULL) {
- iqId = TlenRunSearch(proto);
- }
- return (HWND)iqId;
-}
-
-static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flags)
-{
- HANDLE hContact;
- char *jid, *nick;
-
- if ((hContact=JabberHContactFromJID(proto, newJid)) == NULL) {
- // not already there: add
- jid = mir_strdup(newJid); _strlwr(jid);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->iface.m_szModuleName);
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "jid", jid);
- if ((nick=JabberNickFromJID(newJid)) == NULL)
- nick = mir_strdup(newJid);
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
- mir_free(nick);
- mir_free(jid);
-
- // Note that by removing or disable the "NotOnList" will trigger
- // the plugin to add a particular contact to the roster list.
- // See DBSettingChanged hook at the bottom part of this source file.
- // But the add module will delete "NotOnList". So we will not do it here.
- // Also because we need "MyHandle" and "Group" info, which are set after
- // PS_ADDTOLIST is called but before the add dialog issue deletion of
- // "NotOnList".
- // If temporary add, "NotOnList" won't be deleted, and that's expected.
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- if (flags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
- }
- else {
- // already exist
- // Set up a dummy "NotOnList" when adding permanently only
- if (!(flags&PALF_TEMPORARY))
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- }
-
- return hContact;
-}
-
-HANDLE TlenAddToList(PROTO_INTERFACE *ptr, int flags, PROTOSEARCHRESULT *psr)
-{
- HANDLE hContact;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- JABBER_SEARCH_RESULT *jsr = (JABBER_SEARCH_RESULT*)psr;
- if (jsr->hdr.cbSize != sizeof(JABBER_SEARCH_RESULT))
- return (int) NULL;
- hContact = AddToListByJID(proto, jsr->jid, flags); // wParam is flag e.g. PALF_TEMPORARY
- return hContact;
-}
-
-HANDLE TlenAddToListByEvent(PROTO_INTERFACE *ptr, int flags, int iContact, HANDLE hDbEvent)
-{
- DBEVENTINFO dbei;
- HANDLE hContact;
- char *nick, *firstName, *lastName, *jid;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
- return (int)(HANDLE) NULL;
- if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
- return (int)(HANDLE) NULL;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM) &dbei)) {
- mir_free(dbei.pBlob);
- return (int)(HANDLE) NULL;
- }
- if (strcmp(dbei.szModule, proto->iface.m_szModuleName)) {
- mir_free(dbei.pBlob);
- return (int)(HANDLE) NULL;
- }
-
-/*
- // EVENTTYPE_CONTACTS is when adding from when we receive contact list (not used in Jabber)
- // EVENTTYPE_ADDED is when adding from when we receive "You are added" (also not used in Jabber)
- // Jabber will only handle the case of EVENTTYPE_AUTHREQUEST
- // EVENTTYPE_AUTHREQUEST is when adding from the authorization request dialog
-*/
-
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
- mir_free(dbei.pBlob);
- return (int)(HANDLE) NULL;
- }
-
- nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE));
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
-
- hContact = (HANDLE) AddToListByJID(proto, jid, flags);
- mir_free(dbei.pBlob);
-
- return hContact;
-}
-
-int TlenAuthAllow(PROTO_INTERFACE *ptr, HANDLE hContact)
-{
- DBEVENTINFO dbei;
- char *nick, *firstName, *lastName, *jid;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline)
- return 1;
-
- memset(&dbei, sizeof(dbei), 0);
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hContact, 0)) == (DWORD)(-1))
- return 1;
- if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
- return 1;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hContact, (LPARAM) &dbei)) {
- mir_free(dbei.pBlob);
- return 1;
- }
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
- mir_free(dbei.pBlob);
- return 1;
- }
- if (strcmp(dbei.szModule, proto->iface.m_szModuleName)) {
- mir_free(dbei.pBlob);
- return 1;
- }
-
- nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE));
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
-
- JabberSend(proto, "<presence to='%s' type='subscribed'/>", jid);
-
- // Automatically add this user to my roster if option is enabled
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "AutoAdd", TRUE) == TRUE) {
- HANDLE hContact;
- JABBER_LIST_ITEM *item;
-
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, jid))==NULL || (item->subscription!=SUB_BOTH && item->subscription!=SUB_TO)) {
- JabberLog(proto, "Try adding contact automatically jid=%s", jid);
- if ((hContact=AddToListByJID(proto, jid, 0)) != NULL) {
- // Trigger actual add by removing the "NotOnList" added by AddToListByJID()
- // See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
- }
- }
- }
-
- mir_free(dbei.pBlob);
- return 0;
-}
-
-int TlenAuthDeny(PROTO_INTERFACE *ptr, HANDLE hContact, const TCHAR* szReason)
-{
- DBEVENTINFO dbei;
- char *nick, *firstName, *lastName, *jid;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline)
- return 1;
-
- memset(&dbei, sizeof(dbei), 0);
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hContact, 0)) == (DWORD)(-1))
- return 1;
- if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
- return 1;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hContact, (LPARAM) &dbei)) {
- mir_free(dbei.pBlob);
- return 1;
- }
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
- mir_free(dbei.pBlob);
- return 1;
- }
- if (strcmp(dbei.szModule, proto->iface.m_szModuleName)) {
- mir_free(dbei.pBlob);
- return 1;
- }
-
- nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE));
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
-
- JabberSend(proto, "<presence to='%s' type='unsubscribed'/>", jid);
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
- mir_free(dbei.pBlob);
- return 0;
-}
-
-static void TlenConnect(TlenProtocol *proto, int initialStatus)
-{
- if (!proto->isConnected) {
- ThreadData *thread;
- int oldStatus;
-
- thread = (ThreadData *) mir_alloc(sizeof(ThreadData));
- memset(thread, 0, sizeof(ThreadData));
- thread->proto = proto;
- proto->iface.m_iDesiredStatus = initialStatus;
-
- oldStatus = proto->iface.m_iStatus;
- proto->iface.m_iStatus = ID_STATUS_CONNECTING;
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->iface.m_iStatus);
- thread->hThread = (HANDLE) JabberForkThread((void (__cdecl *)(void*))JabberServerThread, 0, thread);
- }
-}
-
-int TlenSetStatus(PROTO_INTERFACE *ptr, int iNewStatus)
-{
- int oldStatus;
- HANDLE s;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- proto->iface.m_iDesiredStatus = iNewStatus;
-
- if (iNewStatus == ID_STATUS_OFFLINE) {
- if (proto->threadData) {
- if (proto->isConnected) {
- JabberSendPresence(proto, ID_STATUS_OFFLINE);
- }
- s = proto;
- proto->threadData = NULL;
- if (proto->isConnected) {
- Sleep(200);
-// JabberSend(s, "</s>");
- // Force closing connection
- proto->isConnected = FALSE;
- proto->isOnline = FALSE;
- Netlib_CloseHandle(s);
- }
- }
- else {
- if (proto->iface.m_iStatus != ID_STATUS_OFFLINE) {
- oldStatus = proto->iface.m_iStatus;
- proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->iface.m_iStatus);
- }
- }
- }
- else if (iNewStatus != proto->iface.m_iStatus) {
- if (!proto->isConnected)
- TlenConnect(proto, iNewStatus);
- else {
- // change status
- oldStatus = proto->iface.m_iStatus;
- // send presence update
- JabberSendPresence(proto, iNewStatus);
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->iface.m_iStatus);
- }
- }
- return 0;
-}
-
-INT_PTR TlenGetStatus(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- return proto->iface.m_iStatus;
-}
-
-
-int TlenSetAwayMsg(PROTO_INTERFACE *ptr, int iStatus, const char* msg )
-{
- char **szMsg;
- char *newModeMsg;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- JabberLog(proto, "SetAwayMsg called, wParam=%d lParam=%s", iStatus, msg);
-
- newModeMsg = JabberTextEncode(msg);
-
- EnterCriticalSection(&proto->modeMsgMutex);
-
- switch (iStatus) {
- case ID_STATUS_ONLINE:
- szMsg = &proto->modeMsgs.szOnline;
- break;
- case ID_STATUS_AWAY:
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- szMsg = &proto->modeMsgs.szAway;
- break;
- case ID_STATUS_NA:
- szMsg = &proto->modeMsgs.szNa;
- break;
- case ID_STATUS_DND:
- case ID_STATUS_OCCUPIED:
- szMsg = &proto->modeMsgs.szDnd;
- break;
- case ID_STATUS_FREECHAT:
- szMsg = &proto->modeMsgs.szFreechat;
- break;
- case ID_STATUS_INVISIBLE:
- szMsg = &proto->modeMsgs.szInvisible;
- break;
- default:
- LeaveCriticalSection(&proto->modeMsgMutex);
- return 1;
- }
-
- if ((*szMsg==NULL && newModeMsg==NULL) ||
- (*szMsg!=NULL && newModeMsg!=NULL && !strcmp(*szMsg, newModeMsg))) {
- // Message is the same, no update needed
- if (newModeMsg != NULL) mir_free(newModeMsg);
- }
- else {
- // Update with the new mode message
- if (*szMsg != NULL) mir_free(*szMsg);
- *szMsg = newModeMsg;
- // Send a presence update if needed
- if (iStatus == proto->iface.m_iStatus) {
- JabberSendPresence(proto, proto->iface.m_iStatus);
- }
- }
-
- LeaveCriticalSection(&proto->modeMsgMutex);
- return 0;
-}
-
-int JabberGetInfo(PROTO_INTERFACE *ptr, HANDLE hContact, int infoType)
-{
- DBVARIANT dbv;
- int iqId;
- char *nick, *pNick;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 1;
- if (hContact==NULL) {
- iqId = JabberSerialNext(proto);
- JabberIqAdd(proto, iqId, IQ_PROC_NONE, TlenIqResultVcard);
- JabberSend(proto, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:register'></query></iq>", iqId);
- } else {
- if (DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) return 1;
- if ((nick=JabberNickFromJID(dbv.pszVal)) != NULL) {
- if ((pNick=JabberTextEncode(nick)) != NULL) {
- iqId = JabberSerialNext(proto);
- JabberIqAdd(proto, iqId, IQ_PROC_NONE, TlenIqResultVcard);
- JabberSend(proto, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:search'><i>%s</i></query></iq>", iqId, pNick);
- mir_free(pNick);
- }
- mir_free(nick);
- }
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-int TlenSetApparentMode(PROTO_INTERFACE *ptr, HANDLE hContact, int mode)
-{
- DBVARIANT dbv;
- int oldMode;
- char *jid;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 0;
- if (!DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "VisibilitySupport", FALSE)) return 0;
- if (mode!=0 && mode!=ID_STATUS_ONLINE && mode!=ID_STATUS_OFFLINE) return 1;
- oldMode = DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "ApparentMode", 0);
- if ((int) mode == oldMode) return 1;
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "ApparentMode", (WORD) mode);
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- jid = dbv.pszVal;
- switch (mode) {
- case ID_STATUS_ONLINE:
- if (proto->iface.m_iStatus==ID_STATUS_INVISIBLE || oldMode==ID_STATUS_OFFLINE)
- JabberSend(proto, "<presence to='%s'><show>available</show></presence>", jid);
- break;
- case ID_STATUS_OFFLINE:
- if (proto->iface.m_iStatus!=ID_STATUS_INVISIBLE || oldMode==ID_STATUS_ONLINE)
- JabberSend(proto, "<presence to='%s' type='invisible'/>", jid);
- break;
- case 0:
- if (oldMode==ID_STATUS_ONLINE && proto->iface.m_iStatus==ID_STATUS_INVISIBLE)
- JabberSend(proto, "<presence to='%s' type='invisible'/>", jid);
- else if (oldMode==ID_STATUS_OFFLINE && proto->iface.m_iStatus!=ID_STATUS_INVISIBLE)
- JabberSend(proto, "<presence to='%s'><show>available</show></presence>", jid);
- break;
- }
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-typedef struct{
- TlenProtocol *proto;
- HANDLE hContact;
-} SENDACKTHREADDATA;
-
-static void __cdecl JabberSendMessageAckThread(void *ptr)
-{
- SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- SleepEx(10, TRUE);
- ProtoBroadcastAck(data->proto->iface.m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
- mir_free(data);
-}
-
-static void __cdecl TlenSendMessageFailedThread(void *ptr)
-{
- SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- SleepEx(10, TRUE);
- ProtoBroadcastAck(data->proto->iface.m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 2, 0);
- mir_free(data);
-}
-
-static void __cdecl TlenGetAwayMsgThread(void *ptr)
-{
- DBVARIANT dbv;
- JABBER_LIST_ITEM *item;
- SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- if (!DBGetContactSetting(data->hContact, data->proto->iface.m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
- if (item->statusMessage != NULL) {
- ProtoBroadcastAck(data->proto->iface.m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) item->statusMessage);
- return;
- }
- }
- else {
- DBFreeVariant(&dbv);
- }
- }
- ProtoBroadcastAck(data->proto->iface.m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) "");
- mir_free(data);
-}
-
-INT_PTR TlenSendAlert(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact = ( HANDLE )wParam;
- DBVARIANT dbv;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (proto->isOnline && !DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- JabberSend(proto, "<m tp='a' to='%s'/>", dbv.pszVal);
-
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-
-int TlenSendMessage(PROTO_INTERFACE *ptr, HANDLE hContact, int flags, const char* msg)
-{
- DBVARIANT dbv;
- char *msgEnc;
- JABBER_LIST_ITEM *item;
- int id;
- char msgType[16];
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline || DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = proto;
- tdata->hContact = hContact;
- JabberForkThread(TlenSendMessageFailedThread, 0, (void *) tdata);
- return 2;
- }
- if (!strcmp(msg, "<alert>")) {
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = proto;
- tdata->hContact = hContact;
- JabberSend(proto, "<m tp='a' to='%s'/>", dbv.pszVal);
- JabberForkThread(JabberSendMessageAckThread, 0, (void *) tdata);
- } else if (!strcmp(msg, "<image>")) {
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = proto;
- tdata->hContact = hContact;
- id = JabberSerialNext(proto);
- JabberSend(proto, "<message to='%s' type='%s' crc='%x' idt='%d'/>", dbv.pszVal, "pic", 0x757f044, id);
- JabberForkThread(JabberSendMessageAckThread, 0, (void *) tdata);
- } else {
- if ((msgEnc=JabberTextEncode(msg)) != NULL) {
- if (JabberListExist(proto, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/')==NULL) {
- strcpy(msgType, "groupchat");
- } else if (DBGetContactSettingByte(hContact, proto->iface.m_szModuleName, "bChat", FALSE)) {
- strcpy(msgType, "privchat");
- } else {
- strcpy(msgType, "chat");
- }
- if (!strcmp(msgType, "groupchat") || DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "MsgAck", FALSE) == FALSE) {
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = proto;
- tdata->hContact = hContact;
- if (!strcmp(msgType, "groupchat")) {
- JabberSend(proto, "<message to='%s' type='%s'><body>%s</body></message>", dbv.pszVal, msgType, msgEnc);
- } else if (!strcmp(msgType, "privchat")) {
- JabberSend(proto, "<m to='%s'><b n='6' s='10' f='0' c='000000'>%s</b></m>", dbv.pszVal, msgEnc);
- } else {
- id = JabberSerialNext(proto);
- JabberSend(proto, "<message to='%s' type='%s' id='"JABBER_IQID"%d'><body>%s</body><x xmlns='jabber:x:event'><composing/></x></message>", dbv.pszVal, msgType, id, msgEnc);
- }
- JabberForkThread(JabberSendMessageAckThread, 0, (void *) tdata);
- }
- else {
- id = JabberSerialNext(proto);
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL)
- item->idMsgAckPending = id;
- JabberSend(proto, "<message to='%s' type='%s' id='"JABBER_IQID"%d'><body>%s</body><x xmlns='jabber:x:event'><offline/><delivered/><composing/></x></message>", dbv.pszVal, msgType, id, msgEnc);
- }
- }
- mir_free(msgEnc);
- }
- DBFreeVariant(&dbv);
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// JabberGetAvatarInfo - retrieves the avatar info
-
-static INT_PTR TlenGetAvatarInfo(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- BOOL downloadingAvatar = FALSE;
- char *avatarHash = NULL;
- JABBER_LIST_ITEM *item = NULL;
- DBVARIANT dbv;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
- if (!proto->tlenOptions.enableAvatars) return GAIR_NOAVATAR;
-
- if (AI->hContact != NULL) {
- if (!DBGetContactSetting(AI->hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
- DBFreeVariant(&dbv);
- if (item != NULL) {
- downloadingAvatar = item->newAvatarDownloading;
- avatarHash = item->avatarHash;
- }
- }
- } else {
- if (proto->threadData != NULL) {
- avatarHash = proto->threadData->avatarHash;
- }
- }
- if ((avatarHash == NULL || avatarHash[0] == '\0') && !downloadingAvatar) {
- return GAIR_NOAVATAR;
- }
- if (avatarHash != NULL && !downloadingAvatar) {
- TlenGetAvatarFileName(proto, item, AI->filename, sizeof(AI->filename));
- AI->format = ( AI->hContact == NULL ) ? proto->threadData->avatarFormat : item->avatarFormat;
- return GAIR_SUCCESS;
- }
- if (( wParam & GAIF_FORCE ) != 0 && AI->hContact != NULL && proto->isOnline) {
- /* get avatar */
- return GAIR_WAITFOR;
- }
- return GAIR_NOAVATAR;
-}
-
-HANDLE TlenGetAwayMsg(PROTO_INTERFACE *ptr, HANDLE hContact)
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = proto;
- tdata->hContact = hContact;
- JabberForkThread((void (__cdecl *)(void*))TlenGetAwayMsgThread, 0, (void *) tdata);
- return (HANDLE)1;
-}
-
-HANDLE TlenFileAllow(PROTO_INTERFACE *ptr, HANDLE hContact, HANDLE hTransfer, const char* szPath)
-{
- TLEN_FILE_TRANSFER *ft;
- JABBER_LIST_ITEM *item;
- char *nick;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 0;
-
- ft = (TLEN_FILE_TRANSFER *) hTransfer;
- ft->szSavePath = mir_strdup(szPath);
- if ((item=JabberListAdd(proto, LIST_FILE, ft->iqId)) != NULL) {
- item->ft = ft;
- }
- nick = JabberNickFromJID(ft->jid);
- if (ft->newP2P) {
- JabberSend(proto, "<iq to='%s'><query xmlns='p2p'><fs t='%s' e='5' i='%s' v='1'/></query></iq>", ft->jid, ft->jid, ft->iqId);
- } else {
- JabberSend(proto, "<f t='%s' i='%s' e='5' v='1'/>", nick, ft->iqId);
- }
- mir_free(nick);
- return (HANDLE)hTransfer;
-}
-
-int TlenFileDeny(PROTO_INTERFACE *ptr, HANDLE hContact, HANDLE hTransfer, const char* szReason)
-{
- TLEN_FILE_TRANSFER *ft;
- char *nick;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 1;
-
- ft = (TLEN_FILE_TRANSFER *) hTransfer;
- nick = JabberNickFromJID(ft->jid);
- if (ft->newP2P) {
- JabberSend(proto, "<f i='%s' e='4' t='%s'/>", ft->iqId, nick);\
- } else {
- JabberSend(proto, "<f i='%s' e='4' t='%s'/>", ft->iqId, nick);\
- }
- mir_free(nick);
- TlenP2PFreeFileTransfer(ft);
- return 0;
-}
-
-int TlenFileCancel(PROTO_INTERFACE *ptr, HANDLE hContact, HANDLE hTransfer)
-{
- TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *) hTransfer;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- JabberLog(proto, "Invoking FileCancel()");
- if (ft->s != NULL) {
- ft->state = FT_ERROR;
- Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
- HANDLE hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
- SetEvent(hEvent);
- }
- } else {
- TlenP2PFreeFileTransfer(ft);
- }
- return 0;
-}
-
-HANDLE TlenSendFile(PROTO_INTERFACE *ptr, HANDLE hContact, const char* szDescription, char** ppszFiles)
-{
- TLEN_FILE_TRANSFER *ft;
- int i, j;
- struct _stat statbuf;
- DBVARIANT dbv;
- char *nick, *p, idStr[10];
- JABBER_LIST_ITEM *item;
- int id;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 0;
-// if (DBGetContactSettingWord(ccs->hContact, iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
- if (DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) return 0;
- ft = TlenFileCreateFT(proto, dbv.pszVal);
- for(ft->fileCount=0; ppszFiles[ft->fileCount]; ft->fileCount++);
- ft->files = (char **) mir_alloc(sizeof(char *) * ft->fileCount);
- ft->filesSize = (long *) mir_alloc(sizeof(long) * ft->fileCount);
- ft->allFileTotalSize = 0;
- for(i=j=0; i<ft->fileCount; i++) {
- if (_stat(ppszFiles[i], &statbuf))
- JabberLog(proto, "'%s' is an invalid filename", ppszFiles[i]);
- else {
- ft->filesSize[j] = statbuf.st_size;
- ft->files[j++] = mir_strdup(ppszFiles[i]);
- ft->allFileTotalSize += statbuf.st_size;
- }
- }
- ft->fileCount = j;
- ft->szDescription = mir_strdup(szDescription);
- ft->hContact = hContact;
- ft->currentFile = 0;
- DBFreeVariant(&dbv);
-
- id = JabberSerialNext(proto);
- _snprintf(idStr, sizeof(idStr), "%d", id);
- if ((item=JabberListAdd(proto, LIST_FILE, idStr)) != NULL) {
- ft->iqId = mir_strdup(idStr);
- nick = JabberNickFromJID(ft->jid);
- item->ft = ft;
- if (proto->tlenOptions.useNewP2P) {
- JabberSend(proto, "<iq to='%s'><query xmlns='p2p'><fs t='%s' e='1' i='%s' c='%d' s='%d' v='%d'/></query></iq>",
- ft->jid, ft->jid, idStr, ft->fileCount, ft->allFileTotalSize, ft->fileCount);
-
- ft->newP2P = TRUE;
- } else {
- if (ft->fileCount == 1) {
- if ((p=strrchr(ppszFiles[0], '\\')) != NULL)
- p++;
- else
- p = ppszFiles[0];
- p = JabberTextEncode(p);
- JabberSend(proto, "<f t='%s' n='%s' e='1' i='%s' c='1' s='%d' v='1'/>", nick, p, idStr, ft->allFileTotalSize);
- mir_free(p);
- }
- else
- JabberSend(proto, "<f t='%s' e='1' i='%s' c='%d' s='%d' v='1'/>", nick, idStr, ft->fileCount, ft->allFileTotalSize);
- }
- mir_free(nick);
- }
-
- return (HANDLE) ft;
-}
-
-int TlenRecvMessage(PROTO_INTERFACE *ptr, HANDLE hContact, PROTORECVEVENT* evt)
-{
- CCSDATA ccs = { hContact, PSR_MESSAGE, 0, ( LPARAM )evt };
- return CallService( MS_PROTO_RECVMSG, 0, ( LPARAM )&ccs );
-}
-
-int TlenRecvFile(PROTO_INTERFACE *ptr, HANDLE hContact, PROTORECVFILE* evt)
-{
- CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt };
- return CallService( MS_PROTO_RECVFILE, 0, ( LPARAM )&ccs );
-}
-
-
-static char* settingToChar( DBCONTACTWRITESETTING* cws )
-{
- switch( cws->value.type ) {
- case DBVT_ASCIIZ:
- return mir_strdup( cws->value.pszVal );
- case DBVT_UTF8:
- return mir_utf8decode(mir_strdup(cws->value.pszVal), NULL);
- }
- return NULL;
-}
-
-int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- // no action for hContact == NULL or when offline
- if ((HANDLE) wParam == NULL) return 0;
- if (!proto->isConnected) return 0;
-
- if (!strcmp(cws->szModule, "CList")) {
- HANDLE hContact;
- DBVARIANT dbv;
- JABBER_LIST_ITEM *item;
- char *szProto, *nick, *jid, *group;
-
- hContact = (HANDLE) wParam;
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto==NULL || strcmp(szProto, proto->iface.m_szModuleName)) return 0;
-// if (DBGetContactSettingByte(hContact, iface.m_szModuleName, "ChatRoom", 0) != 0) return 0;
- // A contact's group is changed
- if (!strcmp(cws->szSetting, "Group")) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
- nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "Nick", &dbv)) {
- nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- nick = JabberNickFromJID(item->jid);
- }
- if (nick != NULL) {
- // Note: we need to compare with item->group to prevent infinite loop
- if (cws->value.type==DBVT_DELETED && item->group!=NULL) {
- JabberLog(proto, "Group set to nothing");
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'></item></query></iq>", nick, item->jid);
- } else if (cws->value.pszVal != NULL) {
- char *newGroup = settingToChar(cws);
- if (item->group==NULL || strcmp(newGroup, item->group)) {
- JabberLog(proto, "Group set to %s", newGroup);
- if ((group=TlenGroupEncode(newGroup)) != NULL) {
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, item->jid, group);
- mir_free(group);
- }
- }
- mir_free(newGroup);
- }
- mir_free(nick);
- }
- }
- else {
- DBFreeVariant(&dbv);
- }
- }
- }
- // A contact is renamed
- else if (!strcmp(cws->szSetting, "MyHandle")) {
- char *newNick;
-
-// hContact = (HANDLE) wParam;
-// szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
-// if (szProto==NULL || strcmp(szProto, iface.m_szModuleName)) return 0;
-
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- jid = dbv.pszVal;
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- if (cws->value.type == DBVT_DELETED) {
- newNick = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_NOMYHANDLE));
- } else if (cws->value.pszVal!=NULL) {
- newNick = settingToChar(cws);
- } else {
- newNick = NULL;
- }
- // Note: we need to compare with item->nick to prevent infinite loop
- if (newNick!=NULL && (item->nick==NULL || (item->nick!=NULL && strcmp(item->nick, newNick)))) {
- if ((nick=JabberTextEncode(newNick)) != NULL) {
- JabberLog(proto, "Nick set to %s", newNick);
- if (item->group!=NULL && (group=TlenGroupEncode(item->group))!=NULL) {
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, group);
- mir_free(group);
- } else {
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'></item></query></iq>", nick, jid);
- }
- mir_free(nick);
- }
- }
- if (newNick != NULL) mir_free(newNick);
- }
- DBFreeVariant(&dbv);
- }
- }
- // A temporary contact has been added permanently
- else if (!strcmp(cws->szSetting, "NotOnList")) {
- char *jid, *nick, *pGroup;
-
- if (cws->value.type==DBVT_DELETED || (cws->value.type==DBVT_BYTE && cws->value.bVal==0)) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- jid = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- JabberLog(proto, "Add %s permanently to list", jid);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
- nick = JabberTextEncode(dbv.pszVal); //Utf8Encode
- DBFreeVariant(&dbv);
- }
- else {
- nick = JabberNickFromJID(jid);
- }
- if (nick != NULL) {
- JabberLog(proto, "jid=%s nick=%s", jid, nick);
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
- if ((pGroup=TlenGroupEncode(dbv.pszVal)) != NULL) {
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, pGroup);
- JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
- mir_free(pGroup);
- }
- DBFreeVariant(&dbv);
- }
- else {
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'/></query></iq>", nick, jid);
- JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
- }
- mir_free(nick);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- }
- mir_free(jid);
- }
- }
- }
- }
-
- return 0;
-}
-
-int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- char *szProto;
- DBVARIANT dbv;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if(!proto->isOnline) // should never happen
- return 0;
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (szProto==NULL || strcmp(szProto, proto->iface.m_szModuleName))
- return 0;
- if (!DBGetContactSetting((HANDLE) wParam, proto->iface.m_szModuleName, "jid", &dbv)) {
- char *jid, *p, *q;
-
- jid = dbv.pszVal;
- if ((p=strchr(jid, '@')) != NULL) {
- if ((q=strchr(p, '/')) != NULL)
- *q = '\0';
- }
- if (JabberListExist(proto, LIST_ROSTER, jid)) {
- // Remove from roster, server also handles the presence unsubscription process.
- JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
- }
-
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-int TlenUserIsTyping(PROTO_INTERFACE *ptr, HANDLE hContact, int type)
-{
- DBVARIANT dbv;
- JABBER_LIST_ITEM *item;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!proto->isOnline) return 0;
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal))!=NULL /*&& item->wantComposingEvent==TRUE*/) {
- switch (type) {
- case PROTOTYPE_SELFTYPING_OFF:
- JabberSend(proto, "<m tp='u' to='%s'/>", dbv.pszVal);
- break;
- case PROTOTYPE_SELFTYPING_ON:
- JabberSend(proto, "<m tp='t' to='%s'/>", dbv.pszVal);
- break;
- }
- }
- DBFreeVariant(&dbv);
- }
- return 0;
-}
-
-INT_PTR TlenGetMyAvatar(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- char* buf = ( char* )wParam;
- int size = ( int )lParam;
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if ( buf == NULL || size <= 0 )
- return -1;
-
- TlenGetAvatarFileName( proto, NULL, buf, size );
- return 0;
-}
-
-static INT_PTR CALLBACK TlenChangeAvatarDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
-{
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
- {
- HICON hIcon = GetIcolibIcon(IDI_TLEN);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) hIcon);
- ReleaseIcolibIcon(hIcon);
- }
- CheckDlgButton(hwndDlg, IDC_PUBLICAVATAR, TRUE);
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- {
- int result = LOWORD(wParam);
- if (IsDlgButtonChecked(hwndDlg, IDC_PUBLICAVATAR)) {
- result |= 0x10000;
- }
- EndDialog(hwndDlg, result);
- }
- return TRUE;
- }
- break;
- }
- return 0;
-}
-
-INT_PTR TlenSetMyAvatar(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- char* szFileName = ( char* )lParam;
- char tFileName[ MAX_PATH ];
- int fileIn;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if(!proto->isOnline) return 1;
- if (szFileName != NULL) {
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_CHANGEAVATAR), NULL, TlenChangeAvatarDlgProc, (LPARAM) NULL);
- TlenGetAvatarFileName( proto, NULL, tFileName, MAX_PATH);
- if ( CopyFileA( szFileName, tFileName, FALSE ) == FALSE ) {
- return 1;
- }
- fileIn = open( tFileName, O_RDWR | O_BINARY, S_IREAD | S_IWRITE );
- if ( fileIn != -1 ) {
- long dwPngSize = filelength(fileIn);
- BYTE* pResult = (BYTE *)mir_alloc(dwPngSize);
- if (pResult != NULL) {
- read( fileIn, pResult, dwPngSize );
- close( fileIn );
- TlenUploadAvatar(proto, pResult, dwPngSize, (result & 0x10000) != 0);
- mir_free(pResult);
- }
- }
- } else {
- TlenRemoveAvatar(proto);
- }
- return 0;
-}
-
-INT_PTR TlenGetAvatarCaps(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- switch (wParam) {
- case AF_MAXSIZE:
- {
- POINT* size = (POINT*)lParam;
- if ( size )
- size->x = size->y = 64;
- }
- return 0;
- case AF_PROPORTION:
- return PIP_SQUARE;
- case AF_FORMATSUPPORTED:
- return (lParam == PA_FORMAT_PNG) ? 1 : 0;
- case AF_ENABLED:
- return (proto->tlenOptions.enableAvatars && proto->isOnline) ? 1 : 0;
- case AF_DONTNEEDDELAYS:
- return 1;
- case AF_MAXFILESIZE:
- return 10 * 1024;
- case AF_DELAYAFTERFAIL:
- return 0;
- }
- return 0;
-}
-
-
-int TlenOnEvent( PROTO_INTERFACE *ptr, PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam )
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- switch( eventType ) {
- case EV_PROTO_ONLOAD: return TlenOnModulesLoaded(proto, 0, 0 );
- case EV_PROTO_ONOPTIONS: return TlenOptionsInit(proto, wParam, lParam );
- case EV_PROTO_ONEXIT: return TlenPreShutdown(proto, 0, 0 );
- case EV_PROTO_ONRENAME:
- {
- CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( CLISTMENUITEM );
- clmi.flags = CMIM_NAME | CMIF_TCHAR;
- clmi.ptszName = proto->iface.m_tszUserName;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )proto->hMenuRoot, ( LPARAM )&clmi );
- /* FIXME: Rename network user as well */
- }
- }
- return 1;
-}
-
-// PSS_ADDED
-int TlenAuthRecv(PROTO_INTERFACE *ptr, HANDLE hContact, PROTORECVEVENT* evt )
-{
- return 1;
-}
-
-// PSS_AUTHREQUEST
-int TlenAuthRequest(PROTO_INTERFACE *ptr, HANDLE hContact, const TCHAR* szMessage )
-{
- return 1;
-}
-
-HANDLE TlenChangeInfo(PROTO_INTERFACE *ptr, int iInfoType, void* pInfoData )
-{
- return NULL;
-}
-
-int TlenRecvContacts(PROTO_INTERFACE *ptr, HANDLE hContact, PROTORECVEVENT* evt)
-{
- return 1;
-}
-
-
-extern INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-INT_PTR TlenAccMgrUI(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, TlenAccMgrUIDlgProc, (LPARAM) ptr);
-}
-
-void TlenInitServicesVTbl(TlenProtocol *proto) {
- char s[128];
- proto->iface.vtbl = (PROTO_INTERFACE_VTBL*) mir_alloc(sizeof(PROTO_INTERFACE_VTBL));
- proto->iface.vtbl->AddToList = TlenAddToList;
- proto->iface.vtbl->AddToListByEvent = TlenAddToListByEvent;
- proto->iface.vtbl->AuthDeny = TlenAuthDeny;
- proto->iface.vtbl->AuthRecv = TlenAuthRecv;
- proto->iface.vtbl->AuthRequest = TlenAuthRequest;
- proto->iface.vtbl->Authorize = TlenAuthAllow;
- proto->iface.vtbl->ChangeInfo = TlenChangeInfo;
- proto->iface.vtbl->FileAllow = TlenFileAllow;
- proto->iface.vtbl->FileCancel = TlenFileCancel;
- proto->iface.vtbl->FileDeny = TlenFileDeny;
- proto->iface.vtbl->FileResume = NULL;
- proto->iface.vtbl->SearchBasic = TlenBasicSearch;
- proto->iface.vtbl->SearchByEmail = TlenSearchByEmail;
- proto->iface.vtbl->SearchByName = TlenSearchByName;
- proto->iface.vtbl->SearchAdvanced = TlenSearchAdvanced;
- proto->iface.vtbl->CreateExtendedSearchUI = TlenCreateAdvSearchUI;
-
- proto->iface.vtbl->RecvContacts = TlenRecvContacts;
- proto->iface.vtbl->RecvFile = TlenRecvFile;
- proto->iface.vtbl->RecvMsg = TlenRecvMessage;
- proto->iface.vtbl->RecvUrl = NULL;
-
- proto->iface.vtbl->SendContacts = NULL;
- proto->iface.vtbl->SendFile = TlenSendFile;
- proto->iface.vtbl->SendMsg = TlenSendMessage;
- proto->iface.vtbl->SendUrl = NULL;
-
- proto->iface.vtbl->GetCaps = TlenGetCaps;
- proto->iface.vtbl->GetIcon = TlenGetIcon;
- proto->iface.vtbl->GetInfo = JabberGetInfo;
- proto->iface.vtbl->SetApparentMode = TlenSetApparentMode;
- proto->iface.vtbl->SetStatus = TlenSetStatus;
-
-
- proto->iface.vtbl->GetAwayMsg = TlenGetAwayMsg;
- proto->iface.vtbl->RecvAwayMsg = NULL;
- proto->iface.vtbl->SendAwayMsg = NULL;
- proto->iface.vtbl->SetAwayMsg = TlenSetAwayMsg;
-
- proto->iface.vtbl->UserIsTyping = TlenUserIsTyping;
-
- proto->iface.vtbl->OnEvent = TlenOnEvent;
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_GETNAME);
- CreateServiceFunction_Ex(s, proto, TlenGetName);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_GETAVATARINFO);
- CreateServiceFunction_Ex(s, proto, TlenGetAvatarInfo);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, "/SendNudge");
- CreateServiceFunction_Ex(s, proto, TlenSendAlert);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_GETAVATARCAPS);
- CreateServiceFunction_Ex(s, proto, TlenGetAvatarCaps);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_SETMYAVATAR);
- CreateServiceFunction_Ex(s, proto, TlenSetMyAvatar);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_GETMYAVATAR);
- CreateServiceFunction_Ex(s, proto, TlenGetMyAvatar);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_GETSTATUS);
- CreateServiceFunction_Ex(s, proto, TlenGetStatus);
-
- sprintf(s, "%s%s", proto->iface.m_szModuleName, PS_CREATEACCMGRUI);
- CreateServiceFunction_Ex(s, proto, TlenAccMgrUI);
-
-}
-
diff --git a/protocols/Tlen/jabber_thread.c b/protocols/Tlen/jabber_thread.c
deleted file mode 100644
index b78cb1e9b5..0000000000
--- a/protocols/Tlen/jabber_thread.c
+++ /dev/null
@@ -1,1465 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-
-#include "commons.h"
-#include "jabber_list.h"
-#include "jabber_iq.h"
-#include "resource.h"
-#include "tlen_p2p_old.h"
-#include "tlen_file.h"
-#include "tlen_muc.h"
-#include "tlen_voice.h"
-#include "tlen_avatar.h"
-#include "tlen_presence.h"
-#include "tlen_picture.h"
-#include <io.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-extern void TlenProcessP2P(XmlNode *node, void *userdata);
-
-//static void __cdecl TlenProcessInvitation(struct ThreadData *info);
-static void __cdecl JabberKeepAliveThread(void *ptr);
-static void JabberProcessStreamOpening(XmlNode *node, ThreadData *info);
-static void JabberProcessStreamClosing(XmlNode *node, ThreadData *info);
-static void JabberProcessProtocol(XmlNode *node, ThreadData *info);
-static void JabberProcessMessage(XmlNode *node, ThreadData *info);
-static void JabberProcessIq(XmlNode *node, ThreadData *info);
-static void TlenProcessW(XmlNode *node, ThreadData *info);
-static void TlenProcessM(XmlNode *node, ThreadData *info);
-static void TlenProcessN(XmlNode *node, ThreadData *info);
-static void TlenProcessP(XmlNode *node, ThreadData *info);
-static void TlenProcessV(XmlNode *node, ThreadData *info);
-static void TlenProcessAvatar(XmlNode* node, ThreadData *info);
-static void TlenProcessCipher(XmlNode *node, ThreadData *info);
-
-static VOID NTAPI JabberDummyApcFunc(ULONG_PTR param)
-{
- return;
-}
-
-static char onlinePassword[128];
-static HANDLE hEventPasswdDlg;
-
-static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char text[128];
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- sprintf(text, "%s %s", Translate("Enter password for"), (char *) lParam);
- SetDlgItemTextA(hwndDlg, IDC_JID, text);
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, sizeof(onlinePassword));
- //EndDialog(hwndDlg, (int) onlinePassword);
- //return TRUE;
- // Fall through
- case IDCANCEL:
- //EndDialog(hwndDlg, 0);
- SetEvent(hEventPasswdDlg);
- DestroyWindow(hwndDlg);
- return TRUE;
- }
- break;
- }
-
- return FALSE;
-}
-
-static VOID NTAPI JabberPasswordCreateDialogApcProc(ULONG_PTR param)
-{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_PASSWORD), NULL, JabberPasswordDlgProc, (LPARAM) param);
-}
-
-void __cdecl JabberServerThread(ThreadData *info)
-{
- DBVARIANT dbv;
- char jidStr[128];
- char *connectHost;
- char *buffer;
- int datalen;
- XmlState xmlState;
- HANDLE hContact;
- int jabberNetworkBufferSize;
- int oldStatus = ID_STATUS_OFFLINE;
- int reconnectMaxTime;
- int numRetry;
- int reconnectTime;
- char *str;
- CLISTMENUITEM clmi;
- int loginErr = 0;
- JabberLog(info->proto, "Thread started");
-
-
- // Normal server connection, we will fetch all connection parameters
- // e.g. username, password, etc. from the database.
-
- if (info->proto->threadData != NULL) {
- // Will not start another connection thread if a thread is already running.
- // Make APC call to the main thread. This will immediately wake the thread up
- // in case it is asleep in the reconnect loop so that it will immediately
- // reconnect.
- QueueUserAPC(JabberDummyApcFunc, info->proto->threadData->hThread, 0);
- JabberLog(info->proto, "Thread ended, another normal thread is running");
- mir_free(info);
- return;
- }
-
- info->proto->threadData = info;
-
- if (!DBGetContactSetting(NULL, info->proto->iface.m_szModuleName, "LoginName", &dbv)) {
- strncpy(info->username, dbv.pszVal, sizeof(info->username));
- info->username[sizeof(info->username)-1] = '\0';
- _strlwr(info->username);
- DBWriteContactSettingString(NULL, info->proto->iface.m_szModuleName, "LoginName", info->username);
- DBFreeVariant(&dbv);
-
- } else {
- JabberLog(info->proto, "Thread ended, login name is not configured");
- loginErr = LOGINERR_BADUSERID;
- }
-
- if (loginErr == 0) {
- if (!DBGetContactSetting(NULL, info->proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- strncpy(info->server, dbv.pszVal, sizeof(info->server));
- info->server[sizeof(info->server)-1] = '\0';
- _strlwr(info->server);
- DBWriteContactSettingString(NULL, info->proto->iface.m_szModuleName, "LoginServer", info->server);
- DBFreeVariant(&dbv);
- } else {
- JabberLog(info->proto, "Thread ended, login server is not configured");
- loginErr = LOGINERR_NONETWORK;
- }
- }
-
- if (loginErr == 0) {
- if (!info->proto->tlenOptions.savePassword) {
- // Ugly hack: continue logging on only the return value is &(onlinePassword[0])
- // because if WM_QUIT while dialog box is still visible, p is returned with some
- // exit code which may not be NULL.
- // Should be better with modeless.
- onlinePassword[0] = (char) -1;
- hEventPasswdDlg = CreateEvent(NULL, FALSE, FALSE, NULL);
- QueueUserAPC(JabberPasswordCreateDialogApcProc, hMainThread, (DWORD) jidStr);
- WaitForSingleObject(hEventPasswdDlg, INFINITE);
- CloseHandle(hEventPasswdDlg);
- //if ((p=(char *)DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PASSWORD), NULL, JabberPasswordDlgProc, (LPARAM) jidStr)) != onlinePassword) {
- if (onlinePassword[0] != (char) -1) {
- strncpy(info->password, onlinePassword, sizeof(info->password));
- info->password[sizeof(info->password)-1] = '\0';
- } else {
- JabberLog(info->proto, "Thread ended, password request dialog was canceled");
- loginErr = LOGINERR_BADUSERID;
- }
- } else {
- if (!DBGetContactSetting(NULL, info->proto->iface.m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- strncpy(info->password, dbv.pszVal, sizeof(info->password));
- info->password[sizeof(info->password)-1] = '\0';
- DBFreeVariant(&dbv);
- } else {
- JabberLog(info->proto, "Thread ended, password is not configured");
- loginErr = LOGINERR_BADUSERID;
- }
- }
- }
-
- jabberNetworkBufferSize = 2048;
- if ((buffer=(char *) mir_alloc(jabberNetworkBufferSize+1)) == NULL) { // +1 is for '\0' when debug logging this buffer
- JabberLog(info->proto, "Thread ended, network buffer cannot be allocated");
- loginErr = LOGINERR_NONETWORK;
- }
-
- if (loginErr != 0) {
- info->proto->threadData = NULL;
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, loginErr);
- mir_free(info);
- return;
- }
-
- _snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
- DBWriteContactSettingString(NULL, info->proto->iface.m_szModuleName, "jid", jidStr);
-
- if (!DBGetContactSetting(NULL, info->proto->iface.m_szModuleName, "ManualHost", &dbv)) {
- strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
- info->manualHost[sizeof(info->manualHost)-1] = '\0';
- DBFreeVariant(&dbv);
- }
- info->port = DBGetContactSettingWord(NULL, info->proto->iface.m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
- info->useEncryption = info->proto->tlenOptions.useEncryption;
-
- if (info->manualHost[0])
- connectHost = info->manualHost;
- else
- connectHost = info->server;
-
- JabberLog(info->proto, "Thread server='%s' port='%d'", connectHost, info->port);
-
-
- if (!DBGetContactSetting(NULL, info->proto->iface.m_szModuleName, "AvatarHash", &dbv)) {
- strcpy(info->proto->threadData->avatarHash, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- info->avatarFormat = DBGetContactSettingDword(NULL, info->proto->iface.m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
-
-
- reconnectMaxTime = 10;
- numRetry = 0;
-
- for (;;) { // Reconnect loop
-
- info->s = JabberWsConnect(info->proto, connectHost, info->port);
- if (info->s == NULL) {
- JabberLog(info->proto, "Connection failed (%d)", WSAGetLastError());
- if (info->proto->threadData == info) {
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
- if (info->proto->tlenOptions.reconnect == TRUE) {
- reconnectTime = rand() % reconnectMaxTime;
- JabberLog(info->proto, "Sleeping %d seconds before automatic reconnecting...", reconnectTime);
- SleepEx(reconnectTime * 1000, TRUE);
- if (reconnectMaxTime < 10*60) // Maximum is 10 minutes
- reconnectMaxTime *= 2;
- if (info->proto->threadData == info) { // Make sure this is still the active thread for the main Jabber connection
- JabberLog(info->proto, "Reconnecting to the network...");
- if (numRetry < MAX_CONNECT_RETRIES)
- numRetry++;
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_CONNECTING + numRetry;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
- continue;
- }
- else {
- JabberLog(info->proto, "Thread ended, connection failed");
- mir_free(buffer);
- mir_free(info);
- return;
- }
- }
- info->proto->threadData = NULL;
- }
- JabberLog(info->proto, "Thread ended, connection failed");
- mir_free(buffer);
- mir_free(info);
- return;
- }
-
- // Determine local IP
- /*
- socket = CallService(MS_NETLIB_GETSOCKET, (WPARAM) proto, 0);
- struct sockaddr_in saddr;
- int len;
-
- len = sizeof(saddr);
- getsockname(socket, (struct sockaddr *) &saddr, &len);
- jabberLocalIP = saddr.sin_addr.S_un.S_addr;
- JabberLog("Local IP = %s", inet_ntoa(saddr.sin_addr));
- */
-
- // User may change status to OFFLINE while we are connecting above
- if (info->proto->iface.m_iDesiredStatus!=ID_STATUS_OFFLINE) {
-
- info->proto->isConnected = TRUE;
- JabberForkThread(JabberKeepAliveThread, 0, info->proto);
-
- JabberXmlInitState(&xmlState);
- JabberXmlSetCallback(&xmlState, 1, ELEM_OPEN, JabberProcessStreamOpening, info);
- JabberXmlSetCallback(&xmlState, 1, ELEM_CLOSE, JabberProcessStreamClosing, info);
- JabberXmlSetCallback(&xmlState, 2, ELEM_CLOSE, JabberProcessProtocol, info);
-
- info->useAES = FALSE;
-
- if (info->useEncryption) {
- JabberSend(info->proto, "<s s='1' v='9' t='06000106'>");
-
- } else {
- JabberSend(info->proto, "<s v='3'>");
- }
-
- JabberLog(info->proto, "Entering main recv loop");
- datalen = 0;
-
- for (;;) {
- int recvResult, bytesParsed;
-
- if (info->useAES) {
- recvResult = JabberWsRecvAES(info->proto, buffer+datalen, jabberNetworkBufferSize-datalen, &info->aes_in_context, info->aes_in_iv);
- } else {
- recvResult = JabberWsRecv(info->proto, info->s, buffer+datalen, jabberNetworkBufferSize-datalen);
- }
-
- if (recvResult <= 0)
- break;
- datalen += recvResult;
-
- buffer[datalen] = '\0';
- JabberLog(info->proto, "RECV:%s", buffer);
-
- bytesParsed = JabberXmlParse(&xmlState, buffer, datalen);
- JabberLog(info->proto, "bytesParsed = %d", bytesParsed);
- if (bytesParsed > 0) {
- if (bytesParsed < datalen)
- memmove(buffer, buffer+bytesParsed, datalen-bytesParsed);
- datalen -= bytesParsed;
- }
- else if (datalen == jabberNetworkBufferSize) {
- jabberNetworkBufferSize += 2048;
- JabberLog(info->proto, "Increasing network buffer size to %d", jabberNetworkBufferSize);
- if ((buffer=(char *) mir_realloc(buffer, jabberNetworkBufferSize+1)) == NULL) {
- JabberLog(info->proto, "Cannot reallocate more network buffer, go offline now");
- break;
- }
- }
- else {
- JabberLog(info->proto, "Unknown state: bytesParsed=%d, datalen=%d, jabberNetworkBufferSize=%d", bytesParsed, datalen, jabberNetworkBufferSize);
- }
- }
-
- JabberXmlDestroyState(&xmlState);
-
- info->proto->isOnline = FALSE;
- info->proto->isConnected = FALSE;
-
- memset(&clmi, 0, sizeof(CLISTMENUITEM));
- clmi.cbSize = sizeof(CLISTMENUITEM);
- clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuMUC, (LPARAM) &clmi);
- if (info->proto->hMenuChats != NULL){
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) info->proto->hMenuChats, (LPARAM) &clmi);
- }
-
- // Set status to offline
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
-
- // Set all contacts to offline
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- str = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(str!=NULL && !strcmp(str, info->proto->iface.m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE);
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
-
- JabberListWipeSpecial(info->proto);
- }
- else {
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
- }
-
- Netlib_CloseHandle(info->s);
-
- if (info->proto->tlenOptions.reconnect==FALSE)
- break;
-
- if (info->proto->threadData != info) // Make sure this is still the main Jabber connection thread
- break;
- reconnectTime = rand() % 10;
- JabberLog(info->proto, "Sleeping %d seconds before automatic reconnecting...", reconnectTime);
- SleepEx(reconnectTime * 1000, TRUE);
- reconnectMaxTime = 20;
- if (info->proto->threadData != info) // Make sure this is still the main Jabber connection thread
- break;
- JabberLog(info->proto, "Reconnecting to the network...");
- info->proto->iface.m_iDesiredStatus = oldStatus; // Reconnect to my last status
- oldStatus = info->proto->iface.m_iStatus;
- info->proto->iface.m_iStatus = ID_STATUS_CONNECTING;
- numRetry = 1;
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->iface.m_iStatus);
- }
-
- JabberLog(info->proto, "Thread ended: server='%s'", info->server);
-
- if (info->proto->threadData==info) {
- info->proto->threadData = NULL;
- }
-
- mir_free(buffer);
- if (info->streamId) mir_free(info->streamId);
- JabberLog(info->proto, "Exiting ServerThread");
- mir_free(info);
-}
-
-static void TlenSendAuth(TlenProtocol *proto) {
- int iqId;
- char *p;
- char *str;
- char text[128];
- str = TlenPasswordHash(proto->threadData->password);
- sprintf(text, "%s%s", proto->threadData->streamId, str);
- mir_free(str);
- str = JabberSha1(text);
- if ((p=JabberTextEncode(proto->threadData->username)) != NULL) {
- iqId = JabberSerialNext(proto->threadData->proto);
- JabberIqAdd(proto, iqId, IQ_PROC_NONE, JabberIqResultAuth);
- JabberSend(proto, "<iq type='set' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:auth'><username>%s</username><digest>%s</digest><resource>t</resource><host>tlen.pl</host></query></iq>", iqId, p /*info->username*/, str);
- mir_free(p);
- }
- mir_free(str);
-}
-
-static void JabberProcessStreamOpening(XmlNode *node, ThreadData *info)
-{
- char *sid, *s;
-
- if (node->name==NULL || strcmp(node->name, "s"))
- return;
-
- if ((sid=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if (info->streamId) mir_free(info->streamId);
- info->streamId = mir_strdup(sid);
- }
- if ((s=JabberXmlGetAttrValue(node, "s")) != NULL && !strcmp(s, "1")) {
- int i;
- char *k1, *k2, *k3;
- unsigned char aes_key[32];
- char aes_key_str[140], aes_iv_str[40];
- mpi k1_mpi, k2_mpi, aes_mpi;
- size_t slen;
-
- k1=JabberXmlGetAttrValue(node, "k1");
- k2=JabberXmlGetAttrValue(node, "k2");
- k3=JabberXmlGetAttrValue(node, "k3");
-
- memset(&info->aes_in_context, 0, sizeof (aes_context));
- memset(&info->aes_out_context, 0, sizeof (aes_context));
- memset(&aes_mpi, 0, sizeof (mpi));
- mpi_read_string(&aes_mpi, 16, k3);
- mpi_write_binary(&aes_mpi, info->aes_in_iv, 16);
- for (i = 0; i < 16; i++) {
- info->aes_out_iv[i] = rand();
- aes_key[i] = rand();
- }
- memset(&aes_mpi, 0, sizeof (mpi));
- mpi_read_binary(&aes_mpi, info->aes_out_iv, 16);
- slen = 40;
- mpi_write_string(&aes_mpi, 16, aes_iv_str, &slen);
- aes_setkey_dec(&info->aes_in_context, aes_key, 128);
- aes_setkey_enc(&info->aes_out_context, aes_key, 128);
- memset(&aes_mpi, 0, sizeof (mpi));
- mpi_read_binary(&aes_mpi, aes_key, 16);
- memset(&k1_mpi, 0, sizeof (mpi));
- mpi_read_string( &k1_mpi, 16, k1 );
- memset(&k2_mpi, 0, sizeof (mpi));
- mpi_read_string( &k2_mpi, 16, k2 );
- memset(&aes_mpi, 0, sizeof (mpi));
- mpi_read_binary(&aes_mpi, (unsigned char *)aes_key, 16);
- mpi_exp_mod( &aes_mpi, &aes_mpi, &k1_mpi, &k2_mpi, NULL );
- slen = 140;
- mpi_write_string(&aes_mpi, 16, aes_key_str, &slen);
- JabberSend(info->proto, "<cipher k1='%s' k2='%s'/>", aes_key_str, aes_iv_str);
- } else {
- TlenSendAuth(info->proto);
- }
-}
-
-static void JabberProcessStreamClosing(XmlNode *node, ThreadData *info)
-{
- Netlib_CloseHandle(info->proto);
- if (node->name && !strcmp(node->name, "stream:error") && node->text)
- MessageBoxA(NULL, Translate(node->text), Translate("Jabber Connection Error"), MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
-}
-
-static void JabberProcessProtocol(XmlNode *node, ThreadData *info)
-{
- if (!strcmp(node->name, "message"))
- JabberProcessMessage(node, info);
- else if (!strcmp(node->name, "presence"))
- TlenProcessPresence(node, info->proto);
- else if (!strcmp(node->name, "iq"))
- JabberProcessIq(node, info);
- else if (!strcmp(node->name, "f"))
- TlenProcessF(node, info);
- else if (!strcmp(node->name, "w"))
- TlenProcessW(node, info);
- else if (!strcmp(node->name, "m"))
- TlenProcessM(node, info);
- else if (!strcmp(node->name, "n"))
- TlenProcessN(node, info);
- else if (!strcmp(node->name, "p"))
- TlenProcessP(node, info);
- else if (!strcmp(node->name, "v"))
- TlenProcessV(node, info);
- else if (!strcmp(node->name, "avatar"))
- TlenProcessAvatar(node, info);
- else if (!strcmp(node->name, "cipher"))
- TlenProcessCipher(node, info);
- else
- JabberLog(info->proto, "Invalid top-level tag (only <message/> <presence/> <iq/> <f/> <w/> <m/> <n/> <p/> <v/> <cipher/> and <avatar/> allowed)");
-
-}
-
-static void TlenProcessCipher(XmlNode *node, ThreadData *info)
-{
- char *type;
- type=JabberXmlGetAttrValue(node, "type");
- info->useAES = TRUE;
- JabberSend(info->proto, "<cipher type='ok'/>");
- TlenSendAuth(info->proto);
-}
-
-static void TlenProcessIqGetVersion(TlenProtocol *proto, XmlNode* node)
-{
- OSVERSIONINFO osvi = { 0 };
- char mversion[256];
- char* from, *version, *mver;
- char* os = NULL;
- JABBER_LIST_ITEM *item;
-
- if (proto->iface.m_iStatus == ID_STATUS_INVISIBLE) return;
- if (!proto->tlenOptions.enableVersion) return;
- if (( from=JabberXmlGetAttrValue( node, "from" )) == NULL ) return;
- if (( item=JabberListGetItemPtr( proto, LIST_ROSTER, from )) ==NULL) return;
- version = JabberTextEncode( TLEN_VERSION_STRING );
- osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
- if ( GetVersionEx( &osvi )) {
- switch ( osvi.dwPlatformId ) {
- case VER_PLATFORM_WIN32_NT:
- if ( osvi.dwMajorVersion == 5 ) {
- if ( osvi.dwMinorVersion == 2 ) os = JabberTextEncode( Translate( "Windows Server 2003" ));
- else if ( osvi.dwMinorVersion == 1 ) os = JabberTextEncode( Translate( "Windows XP" ));
- else if ( osvi.dwMinorVersion == 0 ) os = JabberTextEncode( Translate( "Windows 2000" ));
- }
- else if ( osvi.dwMajorVersion <= 4 ) {
- os = JabberTextEncode( Translate( "Windows NT" ));
- }
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- if ( osvi.dwMajorVersion == 4 ) {
- if ( osvi.dwMinorVersion == 0 ) os = JabberTextEncode( Translate( "Windows 95" ));
- if ( osvi.dwMinorVersion == 10 ) os = JabberTextEncode( Translate( "Windows 98" ));
- if ( osvi.dwMinorVersion == 90 ) os = JabberTextEncode( Translate( "Windows ME" ));
- }
- break;
- } }
-
- if ( os == NULL ) os = JabberTextEncode( Translate( "Windows" ));
-
- strcpy(mversion, "Miranda IM ");
- CallService( MS_SYSTEM_GETVERSIONTEXT, sizeof( mversion ) - 11, ( LPARAM )mversion + 11 );
- strcat(mversion, " (Tlen v.");
- strcat(mversion, TLEN_VERSION_STRING);
- strcat(mversion, ")");
- mver = JabberTextEncode( mversion );
- JabberSend( proto, "<message to='%s' type='iq'><iq type='result'><query xmlns='jabber:iq:version'><name>%s</name><version>%s</version><os>%s</os></query></iq></message>", from, mver?mver:"", version?version:"", os?os:"" );
- if (!item->versionRequested) {
- item->versionRequested = TRUE;
- JabberSend(proto, "<message to='%s' type='iq'><iq type='get'><query xmlns='jabber:iq:version'/></iq></message>", from);
- }
-
- if ( mver ) mir_free( mver );
- if ( version ) mir_free( version );
- if ( os ) mir_free( os );
-}
-
-// Support for Tlen avatars - avatar token used to access web interface
-static void TlenProcessAvatar(XmlNode* node, ThreadData *info)
-{
- XmlNode *tokenNode, *aNode;
- tokenNode = JabberXmlGetChild(node, "token");
- aNode = JabberXmlGetChild(node, "a");
- if (tokenNode != NULL) {
- char *token = tokenNode->text;
- strcpy(info->avatarToken, token);
- }
- if (aNode != NULL) {
- if (TlenProcessAvatarNode(info->proto, node, NULL)) {
- }
- }
-}
-
-static void JabberProcessMessage(XmlNode *node, ThreadData *info)
-{
- HANDLE hContact;
- CCSDATA ccs;
- PROTORECVEVENT recv;
- XmlNode *bodyNode, *subjectNode, *xNode, *n;
- char *from, *type, *nick, *p, *localMessage, *idStr;
- DWORD msgTime;
- BOOL delivered, composing;
- int i;
- JABBER_LIST_ITEM *item;
- BOOL isChatRoomJid;
-
- if (!node->name || strcmp(node->name, "message")) return;
-
- if ((type=JabberXmlGetAttrValue(node, "type"))!=NULL && !strcmp(type, "error")) {
- }
- else {
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- char *fromJid = JabberLoginFromJID(from);
- if (info->proto->tlenOptions.ignoreAdvertisements && strstr(from, "b73@tlen.pl") == from) {
- return;
- }
- // If message is from a stranger (not in roster), item is NULL
- item = JabberListGetItemPtr(info->proto, LIST_ROSTER, fromJid);
- isChatRoomJid = JabberListExist(info->proto, LIST_CHATROOM, from);
-
- if (isChatRoomJid && type!=NULL && !strcmp(type, "groupchat")) {
- //JabberGroupchatProcessMessage(node, userdata);
- } else if (type!=NULL && !strcmp(type, "pic")) {
- TlenProcessPic(node, info->proto);
- } else if (type!=NULL && !strcmp(type, "iq")) {
- XmlNode *iqNode;
- // Jabber-compatible iq
- if ((iqNode=JabberXmlGetChild(node, "iq")) != NULL) {
- JabberXmlAddAttr(iqNode, "from", from);
- JabberProcessIq(iqNode, info);
- }
- } else {
- if ((bodyNode=JabberXmlGetChild(node, "body")) != NULL) {
- if (bodyNode->text != NULL) {
- if ((subjectNode=JabberXmlGetChild(node, "subject"))!=NULL && subjectNode->text!=NULL && subjectNode->text[0]!='\0') {
- p = (char *) mir_alloc(strlen(subjectNode->text)+strlen(bodyNode->text)+5);
- sprintf(p, "%s\r\n%s", subjectNode->text, bodyNode->text);
- localMessage = JabberTextDecode(p);
- mir_free(p);
- } else {
- localMessage = JabberTextDecode(bodyNode->text);
- }
-
- msgTime = 0;
- delivered = composing = FALSE;
- i = 1;
- while ((xNode=JabberXmlGetNthChild(node, "x", i)) != NULL) {
- if ((p=JabberXmlGetAttrValue(xNode, "xmlns")) != NULL) {
- if (!strcmp(p, "jabber:x:delay") && msgTime==0) {
- if ((p=JabberXmlGetAttrValue(xNode, "stamp")) != NULL) {
- msgTime = JabberIsoToUnixTime(p);
- }
- }
- else if (!strcmp(p, "jabber:x:event")) {
- // Check whether any event is requested
- if (!delivered && (n=JabberXmlGetChild(xNode, "delivered"))!=NULL) {
- delivered = TRUE;
- idStr = JabberXmlGetAttrValue(node, "id");
- JabberSend(info->proto, "<message to='%s'><x xmlns='jabber:x:event'><delivered/><id>%s</id></x></message>", from, (idStr!=NULL)?idStr:"");
- }
- if (item!=NULL && JabberXmlGetChild(xNode, "composing")!=NULL) {
- composing = TRUE;
- if (item->messageEventIdStr)
- mir_free(item->messageEventIdStr);
- idStr = JabberXmlGetAttrValue(node, "id");
- item->messageEventIdStr = (idStr==NULL)?NULL:mir_strdup(idStr);
- }
- }
- }
- i++;
- }
-
- if (item != NULL) {
- item->wantComposingEvent = composing;
- if (item->isTyping) {
- item->isTyping = FALSE;
- if ((hContact=JabberHContactFromJID(info->proto, fromJid)) != NULL)
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
- }
- }
-
- if ((hContact=JabberHContactFromJID(info->proto, fromJid)) == NULL) {
- // Create a temporary contact
- if (isChatRoomJid) {
- if ((p=strchr(from, '/'))!=NULL && p[1]!='\0')
- p++;
- else
- p = from;
- nick = JabberTextEncode(p);
- hContact = JabberDBCreateContact(info->proto, from, nick, TRUE);
- }
- else {
- nick = JabberLocalNickFromJID(from);
- hContact = JabberDBCreateContact(info->proto, from, nick, TRUE);
- }
- mir_free(nick);
- }
-
- if (msgTime == 0) {
- msgTime = time(NULL);
- } else {
- HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) hContact, 0);
- if (hDbEvent != NULL) {
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) &dbei);
- if (msgTime < dbei.timestamp) {
- msgTime = dbei.timestamp + 1;
- }
- }
- if (msgTime > (DWORD)time(NULL)) {
- msgTime = time(NULL);
- }
- }
- recv.flags = 0;
- recv.timestamp = (DWORD) msgTime;
- recv.szMessage = localMessage;
- recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
-
- mir_free(localMessage);
- }
- }
- }
- mir_free(fromJid);
- }
- }
-}
-
-static void JabberProcessIq(XmlNode *node, ThreadData *info)
-{
- HANDLE hContact;
- XmlNode *queryNode = NULL;
- char *type, *jid, *nick;
- char *xmlns = NULL;
- char *idStr, *str;
- int id;
- int i;
- JABBER_IQ_PFUNC pfunc;
-
- if (!node->name || strcmp(node->name, "iq")) return;
- type=JabberXmlGetAttrValue(node, "type");
-// if ((type=JabberXmlGetAttrValue(node, "type")) == NULL) return;
-
- id = -1;
- if ((idStr=JabberXmlGetAttrValue(node, "id")) != NULL) {
- if (!strncmp(idStr, JABBER_IQID, strlen(JABBER_IQID)))
- id = atoi(idStr+strlen(JABBER_IQID));
- }
-
- queryNode = JabberXmlGetChild(node, "query");
- if (queryNode != NULL) {
- xmlns = JabberXmlGetAttrValue(queryNode, "xmlns");
- }
-
-
- /////////////////////////////////////////////////////////////////////////
- // MATCH BY ID
- /////////////////////////////////////////////////////////////////////////
- if ((pfunc=JabberIqFetchFunc(info->proto, id)) != NULL) {
- JabberLog(info->proto, "Handling iq request for id=%d", id);
- pfunc(info->proto, node);
- /////////////////////////////////////////////////////////////////////////
- // MORE GENERAL ROUTINES, WHEN ID DOES NOT MATCH
- /////////////////////////////////////////////////////////////////////////
- // new p2p connections
- } else if (xmlns != NULL && !strcmp(xmlns, "p2p")) {
- if (info->proto->tlenOptions.useNewP2P) {
- TlenProcessP2P(node, info);
- }
- }
- // RECVED: <iq type='set'><query ...
- else if (!strcmp(type, "set") && queryNode!=NULL && xmlns!=NULL) {
-
- // RECVED: roster push
- // ACTION: similar to iqIdGetRoster above
- if (!strcmp(xmlns, "jabber:iq:roster")) {
- XmlNode *itemNode, *groupNode;
- JABBER_LIST_ITEM *item;
- char *name;
-
- JabberLog(info->proto, "<iq/> Got roster push, query has %d children", queryNode->numChild);
- for (i=0; i<queryNode->numChild; i++) {
- itemNode = queryNode->child[i];
- if (!strcmp(itemNode->name, "item")) {
- if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if ((str=JabberXmlGetAttrValue(itemNode, "subscription")) != NULL) {
- // we will not add new account when subscription=remove
- if (!strcmp(str, "to") || !strcmp(str, "both") || !strcmp(str, "from") || !strcmp(str, "none")) {
- if ((name=JabberXmlGetAttrValue(itemNode, "name")) != NULL) {
- nick = JabberTextDecode(name);
- } else {
- nick = JabberLocalNickFromJID(jid);
- }
- if (nick != NULL) {
- if ((item=JabberListAdd(info->proto, LIST_ROSTER, jid)) != NULL) {
- if (item->nick) mir_free(item->nick);
- item->nick = nick;
- if ((hContact=JabberHContactFromJID(info->proto, jid)) == NULL) {
- // Received roster has a new JID.
- // Add the jid (with empty resource) to Miranda contact list.
- hContact = JabberDBCreateContact(info->proto, jid, nick, FALSE);
- }
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
- if (item->group) mir_free(item->group);
- if ((groupNode=JabberXmlGetChild(itemNode, "group"))!=NULL && groupNode->text!=NULL) {
- item->group = TlenGroupDecode(groupNode->text);
- JabberContactListCreateGroup(item->group);
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- }
- else {
- item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
- }
- if (!strcmp(str, "none") || (!strcmp(str, "from") && strchr(jid, '@')!=NULL)) {
- if (DBGetContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE);
- }
- }
- else {
- mir_free(nick);
- }
- }
- }
- if ((item=JabberListGetItemPtr(info->proto, LIST_ROSTER, jid)) != NULL) {
- if (!strcmp(str, "both")) item->subscription = SUB_BOTH;
- else if (!strcmp(str, "to")) item->subscription = SUB_TO;
- else if (!strcmp(str, "from")) item->subscription = SUB_FROM;
- else item->subscription = SUB_NONE;
- JabberLog(info->proto, "Roster push for jid=%s, set subscription to %s", jid, str);
- // subscription = remove is to remove from roster list
- // but we will just set the contact to offline and not actually
- // remove, so that history will be retained.
- if (!strcmp(str, "remove")) {
- if ((hContact=JabberHContactFromJID(info->proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE);
- JabberListRemove(info->proto, LIST_ROSTER, jid);
- }
- }
- }
- }
- }
- }
- }
- }
-
- }
- // RECVED: <iq type='get'><query ...
- else if ( !strcmp( type, "get" ) && queryNode!=NULL && xmlns!=NULL ) {
- // RECVED: software version query
- // ACTION: return my software version
- if ( !strcmp( xmlns, "jabber:iq:version" )) TlenProcessIqGetVersion(info->proto, node);
- }
- // RECVED: <iq type='result'><query ...
- else if ( !strcmp( type, "result") && queryNode!=NULL) {
- if (xmlns!=NULL ) {
- if ( !strcmp(xmlns, "jabber:iq:roster" )) {
- JabberIqResultRoster(info->proto, node);
- } else if ( !strcmp( xmlns, "jabber:iq:version" )) {
- TlenIqResultVersion(info->proto, node);
- } else if ( !strcmp( xmlns, "jabber:iq:info" )) {
- TlenIqResultInfo(info->proto, node);
- }
- } else {
- char *from;
- if (( from=JabberXmlGetAttrValue( node, "from" )) != NULL ) {
- if ( !strcmp(from, "tcfg" )) {
- TlenIqResultTcfg(info->proto, node);
- }
- }
- }
- }
- // RECVED: <iq type='error'> ...
- else if (!strcmp(type, "error")) {
- JABBER_LIST_ITEM *item;
- // Check for multi-user chat errors
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strstr(from, "@c")!=NULL || !strcmp(from, "c")) {
- TlenMUCRecvError(info->proto, from, node);
- return;
- }
- }
-
- // Check for file transfer deny by comparing idStr with ft->iqId
- i = 0;
- while ((i=JabberListFindNext(info->proto, LIST_FILE, i)) >= 0) {
- item = JabberListGetItemPtrFromIndex(info->proto,i);
- if (item->ft->state==FT_CONNECTING && !strcmp(idStr, item->ft->iqId)) {
- item->ft->state = FT_DENIED;
- if (item->ft->hFileEvent != NULL)
- SetEvent(item->ft->hFileEvent); // Simulate the termination of file server connection
- }
- i++;
- }
- }
- // RECVED: <iq type='1'>...
- else if (!strcmp(type, "1")) { // Chat groups list result
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultChatGroups(info->proto, node);
- }
- }
- }
- else if (!strcmp(type, "2")) { // Chat rooms list result
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultChatRooms(info->proto, node);
- }
- }
- } else if (!strcmp(type, "3")) { // room search result - result to iq type 3 query
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultRoomSearch(info->proto, node);
- }
- }
- } else if (!strcmp(type, "4")) { // chat room users list
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strstr(from, "@c")!=NULL) {
- TlenIqResultChatRoomUsers(info->proto, node);
- }
- }
- } else if (!strcmp(type, "5")) { // room name & group & flags info - sent on joining the room
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strstr(from, "@c")!=NULL) {
- TlenIqResultRoomInfo(info->proto, node);
- }
- }
- } else if (!strcmp(type, "6")) { // new nick registered
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultUserNicks(info->proto, node);
- }
- }
- } else if (!strcmp(type, "7")) { // user nicknames list
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultUserNicks(info->proto, node);
- }
- }
- } else if (!strcmp(type, "8")) { // user chat rooms list
- char *from;
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (strcmp(from, "c")==0) {
- TlenIqResultUserRooms(info->proto, node);
- }
- }
- }
-}
-
-/*
- * Web messages
- */
-static void TlenProcessW(XmlNode *node, ThreadData *info)
-{
- HANDLE hContact;
- CCSDATA ccs;
- PROTORECVEVENT recv;
- char *f, *e, *s, *body;
- char *str, *localMessage;
- int strSize;
-
- if (!node->name || strcmp(node->name, "w")) return;
- if ((body=node->text) == NULL) return;
-
- if ((f=JabberXmlGetAttrValue(node, "f")) != NULL) {
-
- char webContactName[128];
- sprintf(webContactName, Translate("%s Web Messages"), info->proto->iface.m_szProtoName);
- if ((hContact=JabberHContactFromJID(info->proto, webContactName)) == NULL) {
- hContact = JabberDBCreateContact(info->proto, webContactName, webContactName, TRUE);
- }
-
- s = JabberXmlGetAttrValue(node, "s");
- e = JabberXmlGetAttrValue(node, "e");
-
- str = NULL;
- strSize = 0;
- JabberStringAppend(&str, &strSize, "%s\r\n%s: ", Translate("Web message"), Translate("From"));
-
- if (f != NULL)
- JabberStringAppend(&str, &strSize, "%s", f);
- JabberStringAppend(&str, &strSize, "\r\n%s: ", Translate("E-mail"));
- if (e != NULL)
- JabberStringAppend(&str, &strSize, "%s", e);
- JabberStringAppend(&str, &strSize, "\r\n\r\n%s", body);
-
- localMessage = JabberTextDecode(str);
-
- recv.flags = 0;
- recv.timestamp = (DWORD) time(NULL);
- recv.szMessage = localMessage;
- recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
-
- mir_free(localMessage);
- mir_free(str);
- }
-}
-
-/*
- * Typing notification, multi-user conference messages and invitations
- */
-static void TlenProcessM(XmlNode *node, ThreadData *info)
-{
- HANDLE hContact;
- CCSDATA ccs;
- PROTORECVEVENT recv;
- char *f;//, *from;//username
- char *tp;//typing start/stop
- char *p, *n, *r, *s, *str, *localMessage;
- int i;
- XmlNode *xNode, *invNode, *bNode, *subjectNode;
-
- if (!node->name || strcmp(node->name, "m")) return;
-
- if ((f=JabberXmlGetAttrValue(node, "f")) != NULL) {
- char *fLogin = JabberLoginFromJID(f);
- if ((hContact=JabberHContactFromJID(info->proto, fLogin)) != NULL) {
- if ((tp=JabberXmlGetAttrValue(node, "tp")) != NULL) {
- JABBER_LIST_ITEM *item = JabberListGetItemPtr(info->proto, LIST_ROSTER, fLogin);
- if(!strcmp(tp, "t")) { //contact is writing
- if (item!=NULL ) {
- item->isTyping = TRUE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_INFINITE);
- }
- }
- else if(!strcmp(tp, "u")) {//contact stopped writing
- if (item!=NULL) {
- item->isTyping = FALSE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
- }
- }
- else if(!strcmp(tp, "a")) {//alert was received
- int bAlert = TRUE;
- if (info->proto->tlenOptions.alertPolicy == TLEN_ALERTS_IGNORE_ALL) {
- bAlert = FALSE;
- } else if (info->proto->tlenOptions.alertPolicy == TLEN_ALERTS_IGNORE_NIR) {
- bAlert = IsAuthorized(info->proto, fLogin);
- }
- if (bAlert) {
- if (info->proto->tlenOptions.useNudge) {
- NotifyEventHooks(info->proto->hTlenNudge,(WPARAM) hContact,0);
- } else {
- if (info->proto->tlenOptions.logAlerts) {
- TlenLogMessage(info->proto, hContact, 0, Translate("An alert has been received."));
- }
- SkinPlaySound("TlenAlertNotify");
- }
- }
- }
- }
- }
- mir_free(fLogin);
- if ((p=strchr(f, '@')) != NULL) {
- if ((p=strchr(p, '/'))!=NULL && p[1]!='\0') { // message from user
- time_t timestamp;
- s = JabberXmlGetAttrValue(node, "s");
- if (s != NULL) {
- timestamp = TlenTimeToUTC(atol(s));
- if (timestamp > time(NULL)) {
- timestamp = time(NULL);
- }
- } else {
- timestamp = time(NULL);
- }
- tp=JabberXmlGetAttrValue(node, "tp");
- bNode = JabberXmlGetChild(node, "b");
- f = JabberTextDecode(f);
- if (bNode != NULL && bNode->text != NULL) {
- if (tp != NULL && !strcmp(tp, "p")) {
- /* MUC private message */
- str = JabberResourceFromJID(f);
- hContact = JabberDBCreateContact(info->proto, f, str, TRUE);
- DBWriteContactSettingByte(hContact, info->proto->iface.m_szModuleName, "bChat", TRUE);
- mir_free(str);
- localMessage = JabberTextDecode(bNode->text);
- recv.flags = 0;
- recv.timestamp = (DWORD) timestamp;
- recv.szMessage = localMessage;
- recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
- mir_free(localMessage);
- } else {
- /* MUC message */
- TlenMUCRecvMessage(info->proto, f, timestamp, bNode);
- }
- }
- mir_free(f);
- } else { // message from chat room (system)
- subjectNode = JabberXmlGetChild(node, "subject");
- if (subjectNode != NULL) {
- f = JabberTextDecode(f);
- localMessage = "";
- if (subjectNode->text!=NULL) {
- localMessage = subjectNode->text;
- }
- localMessage = JabberTextDecode(localMessage);
- TlenMUCRecvTopic(info->proto, f, localMessage);
- mir_free(localMessage);
- mir_free(f);
- }
- }
- }
- i=1;
- while ((xNode=JabberXmlGetNthChild(node, "x", i)) != NULL) {
- invNode=JabberXmlGetChild(xNode, "inv");
- if (invNode != NULL) {
- r = JabberTextDecode(f);
- f = JabberXmlGetAttrValue(invNode, "f");
- f = JabberTextDecode(f);
- n = JabberXmlGetAttrValue(invNode, "n");
- if (n!=NULL && strstr(r, n)!=r) {
- n = JabberTextDecode(n);
- } else {
- n = mir_strdup(Translate("Private conference"));
- //n = JabberNickFromJID(r);
- }
- TlenMUCRecvInvitation(info->proto, r, n, f, "");
- mir_free(n);
- mir_free(r);
- mir_free(f);
- break;
- }
- i++;
- }
- }
-}
-
-static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo)
-{
- POPUPDATAEX ppd;
- char * lpzContactName;
- char * lpzText;
-
- if (!DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupEnabled", TRUE)) {
- return;
- }
- lpzContactName = title;
- lpzText = emailInfo;
- ZeroMemory(&ppd, sizeof(ppd));
- ppd.lchContact = NULL;
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
- strcpy(ppd.lpzContactName, lpzContactName);
- strcpy(ppd.lpzText, lpzText);
- ppd.colorBack = DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupBack", 0);
- ppd.colorText = DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupText", 0);
- ppd.PluginWindowProc = NULL;
- ppd.PluginData=NULL;
- if ( ServiceExists( MS_POPUP_ADDPOPUPEX )) {
- BYTE delayMode;
- int delay;
- delayMode = DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "MailPopupDelayMode", 0);
- delay = 0;
- if (delayMode==1) {
- delay = DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "MailPopupDelay", 4);
- } else if (delayMode==2) {
- delay = -1;
- }
- ppd.iSeconds = delay;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
-
- }
- else if ( ServiceExists( MS_POPUP_ADDPOPUP )) {
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
- }
-}
-/*
- * Incoming e-mail notification
- */
-static void TlenProcessN(XmlNode *node, ThreadData *info)
-{
- char *f, *s;
- char *str, *popupTitle, *popupText;
- int strSize;
-
- if (!node->name || strcmp(node->name, "n")) return;
-
- s = JabberXmlGetAttrValue(node, "s");
- f = JabberXmlGetAttrValue(node, "f");
- if (s != NULL && f!=NULL) {
- str = NULL;
- strSize = 0;
-
- JabberStringAppend(&str, &strSize, Translate("%s mail"), info->proto->iface.m_szProtoName);
- popupTitle = JabberTextDecode(str);
- mir_free(str);
-
- str = NULL;
- strSize = 0;
-
- JabberStringAppend(&str, &strSize, "%s: %s\n", Translate("From"), f);
- JabberStringAppend(&str, &strSize, "%s: %s", Translate("Subject"), s);
- popupText = JabberTextDecode(str);
- TlenMailPopup(info->proto, popupTitle, popupText);
- SkinPlaySound("TlenMailNotify");
-
- mir_free(popupTitle);
- mir_free(popupText);
- mir_free(str);
- }
-}
-
-/*
- * Presence is chat rooms
- */
-static void TlenProcessP(XmlNode *node, ThreadData *info)
-{
- char jid[512];
- char *f, *id, *tp, *a, *n, *k;
- XmlNode *sNode, *xNode, *iNode, *kNode;
- int status, flags;
-
- if (!node->name || strcmp(node->name, "p")) return;
-
- // presence from users in chat room
- flags = 0;
- status = ID_STATUS_ONLINE;
- f = JabberXmlGetAttrValue(node, "f");
- xNode = JabberXmlGetChild(node, "x");
- if (xNode != NULL) { // x subtag present (message from chat room) - change user rights only
- char *temp, *iStr;
- iNode = JabberXmlGetChild(xNode, "i");
- if (iNode != NULL) {
- iStr = JabberXmlGetAttrValue(iNode, "i");
- temp = mir_alloc(strlen(f)+strlen(iStr)+2);
- strcpy(temp, f);
- strcat(temp, "/");
- strcat(temp, iStr);
- f = JabberTextDecode(temp);
- mir_free(temp);
- node = iNode;
- status = 0;
- } else {
- f = JabberTextDecode(f);
- }
- } else {
- f = JabberTextDecode(f);
- }
- a = JabberXmlGetAttrValue(node, "z");
- if (a!=NULL) {
- if (atoi(a) &1 ) {
- flags |= USER_FLAGS_REGISTERED;
- }
- }
- a = JabberXmlGetAttrValue(node, "a");
- if (a!=NULL) {
- if (atoi(a) == 2) {
- flags |= USER_FLAGS_ADMIN;
- }
- if (atoi(a) == 1) {
- flags |= USER_FLAGS_OWNER;
- }
- if (atoi(a) == 3) {
- //flags |= USER_FLAGS_MEMBER;
- }
- if (atoi(a) == 5) {
- flags |= USER_FLAGS_GLOBALOWNER;
- }
- }
- sNode = JabberXmlGetChild(node, "s");
- if (sNode != NULL) {
- if (!strcmp(sNode->text, "unavailable")) {
- status = ID_STATUS_OFFLINE;
- }
- }
- kNode = JabberXmlGetChild(node, "kick");
- k = NULL;
- if (kNode != NULL) {
- k = JabberXmlGetAttrValue(kNode, "r");
- if (k==NULL) {
- k = "";
- }
- k = JabberTextDecode(k);
- }
- tp = JabberXmlGetAttrValue(node, "tp");
- if (tp!=NULL && !strcmp(tp, "c")) { // new chat room has just been created
- id = JabberXmlGetAttrValue(node, "id");
- if (id != NULL) {
- n = JabberXmlGetAttrValue(node, "n");
- if (n!=NULL) {
- n = JabberTextDecode(n);
- } else {
- n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
- }
- sprintf(jid, "%s/%s", f, info->username);
-// if (!DBGetContactSetting(NULL, iface.m_szModuleName, "LoginName", &dbv)) {
- // always real username
-// sprintf(jid, "%s/%s", f, dbv.pszVal);
- TlenMUCCreateWindow(info->proto, f, n, 0, NULL, id);
- TlenMUCRecvPresence(info->proto, jid, ID_STATUS_ONLINE, flags, k);
-// DBFreeVariant(&dbv);
-// }
- mir_free(n);
- }
- } else {
- TlenMUCRecvPresence(info->proto, f, status, flags, k); // user presence
- }
- if (k!=NULL) {
- mir_free(k);
- }
- mir_free(f);
-}
-/*
- * Voice chat
- */
-static void TlenProcessV(XmlNode *node, ThreadData *info)
-{
- char jid[128];
- JABBER_LIST_ITEM *item;
- char *from, *id, *e, *p;
-// if (!node->name || strcmp(node->name, "v")) return;
-
- if ((from=JabberXmlGetAttrValue(node, "f")) != NULL) {
- if (strchr(from, '@') == NULL) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
- } else {
- _snprintf(jid, sizeof(jid), "%s", from);
- }
- if ((e=JabberXmlGetAttrValue(node, "e")) != NULL) {
- if (!strcmp(e, "1")) {
- if ((id=JabberXmlGetAttrValue(node, "i")) != NULL) {
- SkinPlaySound("TlenVoiceNotify");
- TlenVoiceAccept(info->proto, id, from);
- }
- } else if (!strcmp(e, "3")) {
- // FILE_RECV : e='3' : invalid transfer error
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if (item->ft != NULL) {
- HANDLE hEvent = item->ft->hFileEvent;
- item->ft->hFileEvent = NULL;
- item->ft->state = FT_ERROR;
- if (item->ft->s != NULL) {
- Netlib_CloseHandle(item->ft->s);
- item->ft->s = NULL;
- if (hEvent != NULL) {
- SetEvent(hEvent);
- }
- } else {
- TlenP2PFreeFileTransfer(item->ft);
- }
- } else {
- JabberListRemove(info->proto, LIST_VOICE, p);
- }
- }
- }
- } else if (!strcmp(e, "4")) {
- // FILE_SEND : e='4' : File sending request was denied by the remote client
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if (!strcmp(item->ft->jid, jid)) {
- TlenVoiceCancelAll(info->proto);
- //JabberListRemove(info->proto, LIST_VOICE, p);
- }
- }
- }
- } else if (!strcmp(e, "5")) {
- // FILE_SEND : e='5' : Voice request was accepted
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- JabberLog(info->proto, "should start voice 1 ? %s ?? %s", jid, item->ft->jid);
- if (!strcmp(item->ft->jid, jid)) {
- JabberLog(info->proto, "starting voice 1");
- TlenVoiceStart(item->ft, 1);
- }
- }
- }
- } else if (!strcmp(e, "6")) {
- // FILE_RECV : e='6' : IP and port information to connect to get file
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if ((p=JabberXmlGetAttrValue(node, "a")) != NULL) {
- item->ft->hostName = mir_strdup(p);
- if ((p=JabberXmlGetAttrValue(node, "p")) != NULL) {
- item->ft->wPort = atoi(p);
- TlenVoiceStart(item->ft, 0);
- //JabberForkThread((void (__cdecl *)(void*))TlenVoiceReceiveThread, 0, item->ft);
- }
- }
- }
- }
- }
- else if (!strcmp(e, "7")) {
- // FILE_RECV : e='7' : IP and port information to connect to send file
- // in case the conection to the given server was not successful
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- if ((p=JabberXmlGetAttrValue(node, "a")) != NULL) {
- if (item->ft->hostName!=NULL) mir_free(item->ft->hostName);
- item->ft->hostName = mir_strdup(p);
- if ((p=JabberXmlGetAttrValue(node, "p")) != NULL) {
- item->ft->wPort = atoi(p);
- item->ft->state = FT_SWITCH;
- SetEvent(item->ft->hFileEvent);
- }
- }
- }
- }
- }
- else if (!strcmp(e, "8")) {
- // FILE_RECV : e='8' : transfer error
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- item->ft->state = FT_ERROR;
- SetEvent(item->ft->hFileEvent);
- }
- }
- }
-
- }
- }
-}
-
-static void __cdecl JabberKeepAliveThread(void *ptr)
-{
- NETLIBSELECT nls = {0};
-
- TlenProtocol *proto = (TlenProtocol *)ptr;
- nls.cbSize = sizeof(NETLIBSELECT);
- nls.dwTimeout = 60000; // 60000 millisecond (1 minute)
- nls.hExceptConns[0] = proto->threadData->s;
- for (;;) {
- if (CallService(MS_NETLIB_SELECT, 0, (LPARAM) &nls) != 0)
- break;
- if (proto->tlenOptions.sendKeepAlive)
- JabberSend(proto, " \t ");
- }
- JabberLog(proto, "Exiting KeepAliveThread");
-}
-
diff --git a/protocols/Tlen/jabber_util.c b/protocols/Tlen/jabber_util.c
deleted file mode 100644
index 1caa390f10..0000000000
--- a/protocols/Tlen/jabber_util.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-#include <ctype.h>
-#include <win2k.h>
-
-HANDLE HookEventObj_Ex(const char *name, TlenProtocol *proto, MIRANDAHOOKOBJ hook) {
- proto->hookNum ++;
- proto->hHooks = (HANDLE *) mir_realloc(proto->hHooks, sizeof(HANDLE) * (proto->hookNum));
- proto->hHooks[proto->hookNum - 1] = HookEventObj(name, hook, proto);
- return proto->hHooks[proto->hookNum - 1] ;
-}
-
-HANDLE CreateServiceFunction_Ex(const char *name, TlenProtocol *proto, MIRANDASERVICEOBJ service) {
- proto->serviceNum++;
- proto->hServices = (HANDLE *) mir_realloc(proto->hServices, sizeof(HANDLE) * (proto->serviceNum));
- proto->hServices[proto->serviceNum - 1] = CreateServiceFunctionObj(name, service, proto);
- return proto->hServices[proto->serviceNum - 1] ;
-}
-
-void UnhookEvents_Ex(TlenProtocol *proto) {
- unsigned int i;
- for (i=0; i<proto->hookNum; ++i) {
- if (proto->hHooks[i] != NULL) {
- UnhookEvent(proto->hHooks[i]);
- }
- }
- mir_free(proto->hHooks);
- proto->hookNum = 0;
- proto->hHooks = NULL;
-}
-
-void DestroyServices_Ex(TlenProtocol *proto) {
- unsigned int i;
- for (i=0; i<proto->serviceNum; ++i) {
- if (proto->hServices[i] != NULL) {
- DestroyServiceFunction(proto->hServices[i]);
- }
- }
- mir_free(proto->hServices);
- proto->serviceNum = 0;
- proto->hServices = NULL;
-}
-
-void JabberSerialInit(TlenProtocol *proto)
-{
- InitializeCriticalSection(&proto->csSerial);
- proto->serial = 0;
-}
-
-void JabberSerialUninit(TlenProtocol *proto)
-{
- DeleteCriticalSection(&proto->csSerial);
-}
-
-unsigned int JabberSerialNext(TlenProtocol *proto)
-{
- unsigned int ret;
-
- EnterCriticalSection(&proto->csSerial);
- ret = proto->serial;
- proto->serial++;
- LeaveCriticalSection(&proto->csSerial);
- return ret;
-}
-
-void JabberLog(TlenProtocol *proto, const char *fmt, ...)
-{
-#ifdef ENABLE_LOGGING
- char *str;
- va_list vararg;
- int strsize;
- char *text;
- char *p, *q;
- int extra;
-
- va_start(vararg, fmt);
- str = (char *) mir_alloc(strsize=2048);
- while (_vsnprintf(str, strsize, fmt, vararg) == -1)
- str = (char *) mir_realloc(str, strsize+=2048);
- va_end(vararg);
-
- extra = 0;
- for (p=str; *p!='\0'; p++)
- if (*p=='\n' || *p=='\r')
- extra++;
- text = (char *) mir_alloc(strlen("TLEN")+2+strlen(str)+2+extra);
- sprintf(text, "[%s]", "TLEN");
- for (p=str,q=text+strlen(text); *p!='\0'; p++,q++) {
- if (*p == '\r') {
- *q = '\\';
- *(q+1) = 'r';
- q++;
- }
- else if (*p == '\n') {
- *q = '\\';
- *(q+1) = 'n';
- q++;
- }
- else
- *q = *p;
- }
- *q = '\n';
- *(q+1) = '\0';
- if (proto->hNetlibUser!=NULL) {
- CallService(MS_NETLIB_LOG, (WPARAM) proto->hNetlibUser, (LPARAM) text);
- }
- //OutputDebugString(text);
- mir_free(text);
- mir_free(str);
-#endif
-}
-
-// Caution: DO NOT use JabberSend() to send binary (non-string) data
-int JabberSend(TlenProtocol *proto, const char *fmt, ...)
-{
- char *str;
- int size;
- va_list vararg;
- int result = 0;
-
- EnterCriticalSection(&proto->csSend);
-
- va_start(vararg,fmt);
- size = 512;
- str = (char *) mir_alloc(size);
- while (_vsnprintf(str, size, fmt, vararg) == -1) {
- size += 512;
- str = (char *) mir_realloc(str, size);
- }
- va_end(vararg);
-
- JabberLog(proto, "SEND:%s", str);
- size = (int)strlen(str);
- if (proto->threadData != NULL) {
- if (proto->threadData->useAES) {
- result = JabberWsSendAES(proto, str, size, &proto->threadData->aes_out_context, proto->threadData->aes_out_iv);
- } else {
- result = JabberWsSend(proto, proto->threadData->s, str, size);
- }
- }
- LeaveCriticalSection(&proto->csSend);
-
- mir_free(str);
- return result;
-}
-
-
-char *JabberResourceFromJID(const char *jid)
-{
- char *p;
- char *nick;
-
- p=strchr(jid, '/');
- if (p != NULL && p[1]!='\0') {
- p++;
- if ((nick=(char *) mir_alloc(1+strlen(jid)-(p-jid))) != NULL) {
- strncpy(nick, p, strlen(jid)-(p-jid));
- nick[strlen(jid)-(p-jid)] = '\0';
- }
- }
- else {
- nick = mir_strdup(jid);
- }
-
- return nick;
-}
-
-char *JabberNickFromJID(const char *jid)
-{
- char *p;
- char *nick;
-
- if ((p=strchr(jid, '@')) == NULL)
- p = strchr(jid, '/');
- if (p != NULL) {
- if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
- nick[p-jid] = '\0';
- }
- }
- else {
- nick = mir_strdup(jid);
- }
-
- return nick;
-}
-
-char *JabberLoginFromJID(const char *jid)
-{
- char *p;
- char *nick;
-
- p = strchr(jid, '/');
- if (p != NULL) {
- if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
- nick[p-jid] = '\0';
- }
- }
- else {
- nick = mir_strdup(jid);
- }
- return nick;
-}
-
-char *JabberLocalNickFromJID(const char *jid)
-{
- char *p;
- char *localNick;
-
- p = JabberNickFromJID(jid);
- localNick = JabberTextDecode(p);
- mir_free(p);
- return localNick;
-}
-
-char *JabberSha1(char *str)
-{
- mir_sha1_ctx sha;
- DWORD digest[5];
- char* result;
-
- if ( str == NULL )
- return NULL;
-
- mir_sha1_init( &sha );
- mir_sha1_append( &sha, (mir_sha1_byte_t* )str, (int)strlen( str ));
- mir_sha1_finish( &sha, (mir_sha1_byte_t* )digest );
- if ((result=(char *)mir_alloc(41)) == NULL)
- return NULL;
- sprintf(result, "%08x%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]), (int)htonl(digest[4]));
- return result;
-}
-
-char *TlenSha1(char *str, int len)
-{
- mir_sha1_ctx sha;
- mir_sha1_byte_t digest[20];
- char* result;
- int i;
-
- if ( str == NULL )
- return NULL;
-
- mir_sha1_init( &sha );
- mir_sha1_append( &sha, (mir_sha1_byte_t* )str, len);
- mir_sha1_finish( &sha, digest );
- if (( result=( char* )mir_alloc( 20 )) == NULL )
- return NULL;
- for (i=0; i<20; i++)
- result[i]=digest[4*(i>>2)+(3-(i&0x3))];
- return result;
-}
-
-char *TlenPasswordHash(const char *str)
-{
- int magic1 = 0x50305735, magic2 = 0x12345671, sum = 7;
- char *p, *res;
-
- if (str == NULL) return NULL;
- for (p=(char *)str; *p!='\0'; p++) {
- if (*p!=' ' && *p!='\t') {
- magic1 ^= (((magic1 & 0x3f) + sum) * ((char) *p)) + (magic1 << 8);
- magic2 += (magic2 << 8) ^ magic1;
- sum += ((char) *p);
- }
- }
- magic1 &= 0x7fffffff;
- magic2 &= 0x7fffffff;
- res = (char *) mir_alloc(17);
- sprintf(res, "%08x%08x", magic1, magic2);
- return res;
-}
-
-char *TlenUrlEncode(const char *str)
-{
- char *p, *q, *res;
- unsigned char c;
-
- if (str == NULL) return NULL;
- res = (char *) mir_alloc(3*strlen(str) + 1);
- for (p=(char *)str,q=res; *p!='\0'; p++,q++) {
- if (*p == ' ') {
- *q = '+';
- }
- else if (*p<0x20 || *p>=0x7f || strchr("%&+:'<>\"", *p)!=NULL) {
- // Convert first from CP1252 to ISO8859-2
- switch ((unsigned char) *p) {
- case 0xa5: c = (unsigned char) 0xa1; break;
- case 0x8c: c = (unsigned char) 0xa6; break;
- case 0x8f: c = (unsigned char) 0xac; break;
- case 0xb9: c = (unsigned char) 0xb1; break;
- case 0x9c: c = (unsigned char) 0xb6; break;
- case 0x9f: c = (unsigned char) 0xbc; break;
- default: c = (unsigned char) *p; break;
- }
- sprintf(q, "%%%02X", c);
- q += 2;
- }
- else {
- *q = *p;
- }
- }
- *q = '\0';
- return res;
-}
-
-void TlenUrlDecode(char *str)
-{
- char *p, *q;
- unsigned int code;
-
- if (str == NULL) return;
- for (p=q=str; *p!='\0'; p++,q++) {
- if (*p == '+') {
- *q = ' ';
- }
- else if (*p=='%' && *(p+1)!='\0' && isxdigit(*(p+1)) && *(p+2)!='\0' && isxdigit(*(p+2))) {
- sscanf(p+1, "%2x", &code);
- *q = (char) code;
- // Convert from ISO8859-2 to CP1252
- switch ((unsigned char) *q) {
- case 0xa1: *q = (char) 0xa5; break;
- case 0xa6: *q = (char) 0x8c; break;
- case 0xac: *q = (char) 0x8f; break;
- case 0xb1: *q = (char) 0xb9; break;
- case 0xb6: *q = (char) 0x9c; break;
- case 0xbc: *q = (char) 0x9f; break;
- }
- p += 2;
- }
- else {
- *q = *p;
- }
- }
- *q = '\0';
-}
-
-char * TlenGroupDecode(const char *str)
-{
- char *p, *q;
- if (str == NULL) return NULL;
- p = q = JabberTextDecode(str);
- for (; *p!='\0'; p++) {
- if (*p == '/') {
- *p = '\\';
- }
- }
- return q;
-}
-
-char * TlenGroupEncode(const char *str)
-{
- char *p, *q;
- if (str == NULL) return NULL;
- p = q = mir_strdup(str);
- for (; *p!='\0'; p++) {
- if (*p == '\\') {
- *p = '/';
- }
- }
- p = JabberTextEncode(q);
- mir_free(q);
- return p;
-}
-
-char *JabberTextEncode(const char *str)
-{
- char *s1;
-
- if (str == NULL) return NULL;
- if ((s1=TlenUrlEncode(str)) == NULL)
- return NULL;
- return s1;
-}
-
-char *JabberTextDecode(const char *str)
-{
- char *s1;
-
- if (str == NULL) return NULL;
- s1 = mir_strdup(str);
- TlenUrlDecode(s1);
- return s1;
-}
-
-static char b64table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-char *JabberBase64Encode(const char *buffer, int bufferLen)
-{
- int n;
- unsigned char igroup[3];
- char *p, *peob;
- char *res, *r;
-
- if (buffer==NULL || bufferLen<=0) return NULL;
- if ((res=(char *) mir_alloc((((bufferLen+2)/3)*4) + 1)) == NULL) return NULL;
-
- for (p=(char*)buffer,peob=p+bufferLen,r=res; p<peob;) {
- igroup[0] = igroup[1] = igroup[2] = 0;
- for (n=0; n<3; n++) {
- if (p >= peob) break;
- igroup[n] = (unsigned char) *p;
- p++;
- }
- if (n > 0) {
- r[0] = b64table[ igroup[0]>>2 ];
- r[1] = b64table[ ((igroup[0]&3)<<4) | (igroup[1]>>4) ];
- r[2] = b64table[ ((igroup[1]&0xf)<<2) | (igroup[2]>>6) ];
- r[3] = b64table[ igroup[2]&0x3f ];
- if (n < 3) {
- r[3] = '=';
- if (n < 2)
- r[2] = '=';
- }
- r += 4;
- }
- }
- *r = '\0';
-
- return res;
-}
-
-static unsigned char b64rtable[256];
-
-char *JabberBase64Decode(const char *str, int *resultLen)
-{
- char *res;
- unsigned char *p, *r, igroup[4], a[4];
- int n, num, count;
-
- if (str==NULL || resultLen==NULL) return NULL;
- if ((res=(char *) mir_alloc(((strlen(str)+3)/4)*3)) == NULL) return NULL;
-
- for (n=0; n<256; n++)
- b64rtable[n] = (unsigned char) 0x80;
- for (n=0; n<26; n++)
- b64rtable['A'+n] = n;
- for (n=0; n<26; n++)
- b64rtable['a'+n] = n + 26;
- for (n=0; n<10; n++)
- b64rtable['0'+n] = n + 52;
- b64rtable['+'] = 62;
- b64rtable['/'] = 63;
- b64rtable['='] = 0;
- count = 0;
- for (p=(unsigned char *)str,r=(unsigned char *)res; *p!='\0';) {
- for (n=0; n<4; n++) {
- if ( *p == '\r' || *p == '\n' ) {
- n--; p++;
- continue;
- }
-
- if ( *p=='\0' ) {
- if ( n == 0 )
- goto LBL_Exit;
- mir_free( res );
- return NULL;
- }
-
- if ( b64rtable[*p]==0x80 ) {
- mir_free( res );
- return NULL;
- }
-
- a[n] = *p;
- igroup[n] = b64rtable[*p];
- p++;
- }
- r[0] = igroup[0]<<2 | igroup[1]>>4;
- r[1] = igroup[1]<<4 | igroup[2]>>2;
- r[2] = igroup[2]<<6 | igroup[3];
- r += 3;
- num = ( a[2]=='='?1:( a[3]=='='?2:3 ));
- count += num;
- if ( num < 3 ) break;
- }
-LBL_Exit:
- *resultLen = count;
- return res;
-}
-
-/*
- * Apply Polish Daylight Saving Time rules to get "DST-unbiased" timestamp
- */
-
-time_t TlenTimeToUTC(time_t time) {
- struct tm *timestamp;
- timestamp = gmtime(&time);
- if ( (timestamp->tm_mon > 2 && timestamp->tm_mon < 9) ||
- (timestamp->tm_mon == 2 && timestamp->tm_mday - timestamp->tm_wday >= 25) ||
- (timestamp->tm_mon == 9 && timestamp->tm_mday - timestamp->tm_wday < 25)) {
- //time -= 3600;
- } else {
- //time += 3600;
- }
- return time;
-}
-
-time_t JabberIsoToUnixTime(char *stamp)
-{
- struct tm timestamp;
- char date[9];
- char *p;
- int i, y;
- time_t t;
-
- if (stamp == NULL) return (time_t) 0;
-
- p = stamp;
-
- // Get the date part
- for (i=0; *p!='\0' && i<8 && isdigit(*p); p++,i++)
- date[i] = *p;
-
- // Parse year
- if (i == 6) {
- // 2-digit year (1970-2069)
- y = (date[0]-'0')*10 + (date[1]-'0');
- if (y < 70) y += 100;
- }
- else if (i == 8) {
- // 4-digit year
- y = (date[0]-'0')*1000 + (date[1]-'0')*100 + (date[2]-'0')*10 + date[3]-'0';
- y -= 1900;
- }
- else
- return (time_t) 0;
- timestamp.tm_year = y;
- // Parse month
- timestamp.tm_mon = (date[i-4]-'0')*10 + date[i-3]-'0' - 1;
- // Parse date
- timestamp.tm_mday = (date[i-2]-'0')*10 + date[i-1]-'0';
-
- // Skip any date/time delimiter
- for (; *p!='\0' && !isdigit(*p); p++);
-
- // Parse time
- if (sscanf(p, "%d:%d:%d", &(timestamp.tm_hour), &(timestamp.tm_min), &(timestamp.tm_sec)) != 3)
- return (time_t) 0;
-
- timestamp.tm_isdst = 0; // DST is already present in _timezone below
- _tzset();
- t = mktime(&timestamp);
- t -= _timezone;
- t = TlenTimeToUTC(t);
-
- if (t >= 0)
- return t;
- else
- return (time_t) 0;
-}
-
-void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...)
-{
- va_list vararg;
- char *p;
- int size, len;
-
- if (str == NULL) return;
-
- if (*str==NULL || *sizeAlloced<=0) {
- *sizeAlloced = size = 2048;
- *str = (char *) mir_alloc(size);
- len = 0;
- }
- else {
- len = (int)strlen(*str);
- size = *sizeAlloced - (int)strlen(*str);
- }
-
- p = *str + len;
- va_start(vararg, fmt);
- while (_vsnprintf(p, size, fmt, vararg) == -1) {
- size += 2048;
- (*sizeAlloced) += 2048;
- *str = (char *) mir_realloc(*str, *sizeAlloced);
- p = *str + len;
- }
- va_end(vararg);
-}
-
-int JabberGetPictureType( const char* buf )
-{
- if ( buf != NULL ) {
- if ( memcmp( buf, "GIF89", 5 ) == 0 ) return PA_FORMAT_GIF;
- if ( memcmp( buf, "\x89PNG", 4 ) == 0 ) return PA_FORMAT_PNG;
- if ( memcmp( buf, "BM", 2 ) == 0 ) return PA_FORMAT_BMP;
- if ( memcmp( buf, "\xFF\xD8", 2 ) == 0 ) return PA_FORMAT_JPEG;
- }
- return PA_FORMAT_UNKNOWN;
-}
-
-BOOL IsAuthorized(TlenProtocol *proto, const char *jid)
-{
- JABBER_LIST_ITEM *item = JabberListGetItemPtr(proto, LIST_ROSTER, jid);
- if (item != NULL) {
- return item->subscription == SUB_BOTH || item->subscription == SUB_FROM;
- }
- return FALSE;
-}
-
-
-void TlenLogMessage(TlenProtocol *proto, HANDLE hContact, DWORD flags, const char *message)
-{
- int size = (int)strlen(message) + 2;
- char *localMessage = (char *)mir_alloc(size);
- strcpy(localMessage, message);
- localMessage[size - 1] = '\0';
- JabberDBAddEvent(proto, hContact, EVENTTYPE_MESSAGE, flags, (PBYTE)message, (DWORD)size);
- mir_free(localMessage);
-}
diff --git a/protocols/Tlen/jabber_ws.c b/protocols/Tlen/jabber_ws.c
deleted file mode 100644
index 49599fa0e3..0000000000
--- a/protocols/Tlen/jabber_ws.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-
-BOOL JabberWsInit(TlenProtocol *proto)
-{
- NETLIBUSER nlu = {0};
- NETLIBUSERSETTINGS nlus = {0};
- TCHAR name[128];
-
-
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
- mir_sntprintf( name, SIZEOF(name), TranslateT("%s connection"), proto->iface.m_tszUserName);
- nlu.ptszDescriptiveName = name;
- nlu.szSettingsModule = proto->iface.m_szModuleName;
- proto->hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
-
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
- mir_sntprintf( name, SIZEOF(name), TranslateT("%s SOCKS connection"), proto->iface.m_tszUserName);
- nlu.ptszDescriptiveName = name;
- proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
- nlus.cbSize = sizeof(nlus);
- nlus.useProxy = 0;
- CallService(MS_NETLIB_SETUSERSETTINGS, (WPARAM) proto->hFileNetlibUser, (LPARAM) &nlus);
-
- return (proto->hNetlibUser!=NULL)?TRUE:FALSE;
-}
-
-void JabberWsUninit(TlenProtocol *proto)
-{
- if (proto->hNetlibUser!=NULL) Netlib_CloseHandle(proto->hNetlibUser);
- if (proto->hFileNetlibUser!=NULL) Netlib_CloseHandle(proto->hFileNetlibUser);
- proto->hNetlibUser = NULL;
- proto->hFileNetlibUser = NULL;
-}
-
-JABBER_SOCKET JabberWsConnect(TlenProtocol *proto, char *host, WORD port)
-{
- NETLIBOPENCONNECTION nloc = {0};
-
- nloc.cbSize = sizeof(NETLIBOPENCONNECTION); //NETLIBOPENCONNECTION_V1_SIZE;
- nloc.szHost = host;
- nloc.wPort = port;
- nloc.flags = 0;
- nloc.timeout = 6;
- return (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) proto->hNetlibUser, (LPARAM) &nloc);
-}
-
-int JabberWsSend(TlenProtocol *proto, JABBER_SOCKET s, char *data, int datalen)
-{
- int len;
- if ((len=Netlib_Send(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT))==SOCKET_ERROR || len!=datalen) {
- JabberLog(proto, "Netlib_Send() failed, error=%d", WSAGetLastError());
- return FALSE;
- }
- return TRUE;
-}
-
-int JabberWsRecv(TlenProtocol *proto, JABBER_SOCKET s, char *data, long datalen)
-{
- int ret;
- ret = Netlib_Recv(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT);
- if(ret == SOCKET_ERROR) {
- JabberLog(proto, "Netlib_Recv() failed, error=%d", WSAGetLastError());
- return 0;
- }
- if(ret == 0) {
- JabberLog(proto, "Connection closed gracefully");
- return 0;
- }
- return ret;
-}
-
-
-int JabberWsSendAES(TlenProtocol *proto, char *data, int datalen, aes_context *aes_ctx, unsigned char *aes_iv)
-{
- int len, sendlen;
- unsigned char aes_input[16];
- unsigned char aes_output[256];
- if (proto->threadData == NULL) {
- return FALSE;
- }
- while (datalen > 0) {
- len = 0;
- while (datalen > 0 && len < 256) {
- int pad = datalen < 16 ? 16 - datalen : 0;
- memcpy(aes_input, data, datalen < 16 ? datalen : 16);
- memset(aes_input + 16 - pad, ' ', pad);
- aes_crypt_cbc(aes_ctx, AES_ENCRYPT, 16, aes_iv, aes_input, aes_output + len);
- datalen -= 16;
- data += 16;
- len += 16;
- }
- if (len > 0) {
- JabberLog(proto, "Sending %d bytes", len);
- if ((sendlen=Netlib_Send(proto->threadData->s, (char *)aes_output, len, MSG_NODUMP))==SOCKET_ERROR || len!=sendlen) {
- JabberLog(proto, "Netlib_Send() failed, error=%d", WSAGetLastError());
- return FALSE;
- }
- }
- }
- return TRUE;
-}
-
-int JabberWsRecvAES(TlenProtocol *proto, char *data, long datalen, aes_context *aes_ctx, unsigned char *aes_iv)
-{
- int ret, len = 0, maxlen = datalen;
- unsigned char aes_input[16];
- unsigned char *aes_output = (unsigned char *)data;
- if (proto->threadData == NULL) {
- return 0;
- }
- for (maxlen = maxlen & ~0xF; maxlen != 0; maxlen = maxlen & 0xF) {
- ret = Netlib_Recv(proto->threadData->s, data, maxlen, MSG_NODUMP);
- if(ret == SOCKET_ERROR) {
- JabberLog(proto, "Netlib_Recv() failed, error=%d", WSAGetLastError());
- return 0;
- }
- if(ret == 0) {
- JabberLog(proto, "Connection closed gracefully");
- return 0;
- }
- data += ret;
- len += ret;
- maxlen -= ret;
- }
-
- ret = len;
- while (len > 15) {
- memcpy(aes_input, aes_output, 16);
- aes_crypt_cbc(aes_ctx, AES_DECRYPT, 16, aes_iv, aes_input, aes_output);
- aes_output += 16;
- len -= 16;
- }
- return ret;
-}
-
diff --git a/protocols/Tlen/jabber_xml.c b/protocols/Tlen/jabber_xml.c
deleted file mode 100644
index 6925e60eb1..0000000000
--- a/protocols/Tlen/jabber_xml.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <ctype.h>
-
-static BOOL JabberXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *elemText, char *elemAttr);
-static void JabberXmlRemoveChild(XmlNode *node, XmlNode *child);
-
-void JabberXmlInitState(XmlState *xmlState)
-{
- if (xmlState == NULL) return;
- xmlState->root.name = NULL;
- xmlState->root.depth = 0;
- xmlState->root.numAttr = 0;
- xmlState->root.maxNumAttr = 0;
- xmlState->root.attr = NULL;
- xmlState->root.numChild = 0;
- xmlState->root.maxNumChild = 0;
- xmlState->root.child = NULL;
- xmlState->root.text = NULL;
- xmlState->root.state = NODE_OPEN;
- xmlState->callback1_open = NULL;
- xmlState->callback1_close = NULL;
- xmlState->callback2_open = NULL;
- xmlState->callback2_close = NULL;
- xmlState->userdata1_open = NULL;
- xmlState->userdata1_close = NULL;
- xmlState->userdata2_open = NULL;
- xmlState->userdata2_close = NULL;
-}
-
-void JabberXmlDestroyState(XmlState *xmlState)
-{
- int i;
- XmlNode *node;
-
- if (xmlState == NULL) return;
- // Note: cannot use JabberXmlFreeNode() to free xmlState->root
- // because it will do mir_free(xmlState->root) which is not freeable.
- node = &(xmlState->root);
- // Free all children first
- for (i=0; i<node->numChild; i++)
- JabberXmlFreeNode(node->child[i]);
- if (node->child) mir_free(node->child);
- // Free all attributes
- for (i=0; i<node->numAttr; i++) {
- if (node->attr[i]->name) mir_free(node->attr[i]->name);
- if (node->attr[i]->value) mir_free(node->attr[i]->value);
- mir_free(node->attr[i]);
- }
- if (node->attr) mir_free(node->attr);
- // Free string field
- if (node->text) mir_free(node->text);
- if (node->name) mir_free(node->name);
-}
-
-BOOL JabberXmlSetCallback(XmlState *xmlState, int depth, XmlElemType type, void (*callback)(), void *userdata)
-{
- if (depth==1 && type==ELEM_OPEN) {
- xmlState->callback1_open = callback;
- xmlState->userdata1_open = userdata;
- }
- else if (depth==1 && type==ELEM_CLOSE) {
- xmlState->callback1_close = callback;
- xmlState->userdata1_close = userdata;
- }
- else if (depth==2 && type==ELEM_OPEN) {
- xmlState->callback2_open = callback;
- xmlState->userdata2_open = userdata;
- }
- else if (depth==2 && type==ELEM_CLOSE) {
- xmlState->callback2_close = callback;
- xmlState->userdata2_close = userdata;
- }
- else
- return FALSE;
-
- return TRUE;
-}
-
-#define TAG_MAX_LEN 50
-#define ATTR_MAX_LEN 1024
-int JabberXmlParse(XmlState *xmlState, char *buffer, int datalen)
-{
- char *p, *q, *r, *eob;
- char *str;
- int num;
- char tag[TAG_MAX_LEN];
- char attr[ATTR_MAX_LEN];
- XmlElemType elemType = 0;
-
- eob = buffer + datalen;
- num = 0;
- // Skip leading whitespaces
- for (p=buffer; p<eob && isspace(*p); p++,num++);
- while (num < datalen) {
- if (*p == '<') { // found starting bracket
- for (q=p+1; q<eob && *q!='>'; q++);
- if (q < eob) { // found closing bracket
- for (r=p+1; *r!='>' && *r!=' ' && *r!='\t'; r++);
- if (r-(p+1) > TAG_MAX_LEN) {
-// JabberLog("TAG_MAX_LEN too small, ignore current tag");
- }
- else {
- if (*(p+1) == '/') { // closing tag
- strncpy(tag, p+2, r-(p+2));
- tag[r-(p+2)] = '\0';
- elemType = ELEM_CLOSE;
- }
- else {
- if (*(r-1) == '/') { // single open/close tag
- strncpy(tag, p+1, r-(p+1)-1);
- tag[r-(p+1)-1] = '\0';
- elemType = ELEM_OPENCLOSE;
- }
- else {
- strncpy(tag, p+1, r-(p+1));
- tag[r-(p+1)] = '\0';
- elemType = ELEM_OPEN;
- }
- }
- for (;r<q && (*r==' ' || *r=='\t'); r++);
- if (q-r > ATTR_MAX_LEN) {
-// JabberLog("ATTR_MAX_LEN too small, ignore current tag");
- }
- else {
- strncpy(attr, r, q-r);
- if ((q-r)>0 && attr[q-r-1]=='/') {
- attr[q-r-1] = '\0';
- elemType = ELEM_OPENCLOSE;
- }
- else
- attr[q-r] = '\0';
- JabberXmlProcessElem(xmlState, elemType, tag, attr);
- }
- }
- num += (q-p+1);
- p = q + 1;
- if (elemType==ELEM_CLOSE || elemType==ELEM_OPENCLOSE) {
- // Skip whitespaces after end tags
- for (; p<eob && isspace(*p); p++,num++);
- }
- }
- else
- break;
- }
- else { // found inner text
- for (q=p+1; q<eob && *q!='<'; q++);
- if (q < eob) { // found starting bracket of the next element
- str = (char *) mir_alloc(q-p+1);
- strncpy(str, p, q-p);
- str[q-p] = '\0';
- JabberXmlProcessElem(xmlState, ELEM_TEXT, str, NULL);
- mir_free(str);
- num += (q-p);
- p = q;
- }
- else
- break;
- }
- }
-
- return num;
-}
-
-static void JabberXmlParseAttr(XmlNode *node, char *text)
-{
- char *kstart, *vstart;
- int klen, vlen;
- char *p;
- XmlAttr *a;
-
- if (node==NULL || text==NULL || strlen(text)<=0)
- return;
-
- for (p=text;;) {
-
- // Skip leading whitespaces
- for (;*p!='\0' && (*p==' ' || *p=='\t'); p++);
- if (*p == '\0')
- break;
-
- // Fetch key
- kstart = p;
- for (;*p!='\0' && *p!='=' && *p!=' ' && *p!='\t'; p++);
- klen = p-kstart;
-
- if (node->numAttr >= node->maxNumAttr) {
- node->maxNumAttr = node->numAttr + 20;
- node->attr = (XmlAttr **) mir_realloc(node->attr, node->maxNumAttr*sizeof(XmlAttr *));
- }
- a = node->attr[node->numAttr] = (XmlAttr *) mir_alloc(sizeof(XmlAttr));
- node->numAttr++;
-
- // Skip possible whitespaces between key and '='
- for (;*p!='\0' && (*p==' ' || *p=='\t'); p++);
-
- if (*p == '\0') {
- a->name = (char *) mir_alloc(klen+1);
- strncpy(a->name, kstart, klen);
- a->name[klen] = '\0';
- a->value = mir_strdup("");
- break;
- }
-
- if (*p != '=') {
- a->name = (char *) mir_alloc(klen+1);
- strncpy(a->name, kstart, klen);
- a->name[klen] = '\0';
- a->value = mir_strdup("");
- continue;
- }
-
- // Found '='
- p++;
-
- // Skip possible whitespaces between '=' and value
- for (;*p!='\0' && (*p==' ' || *p=='\t'); p++);
-
- if (*p == '\0') {
- a->name = (char *) mir_alloc(klen+1);
- strncpy(a->name, kstart, klen);
- a->name[klen] = '\0';
- a->value = mir_strdup("");
- break;
- }
-
- // Fetch value
- if (*p=='\'' || *p=='"') {
- p++;
- vstart = p;
- for (;*p!='\0' && *p!=*(vstart-1); p++);
- vlen = p-vstart;
- if (*p != '\0') p++;
- }
- else {
- vstart = p;
- for (;*p!='\0' && *p!=' ' && *p!='\t'; p++);
- vlen = p-vstart;
- }
-
- a->name = (char *) mir_alloc(klen+1);
- strncpy(a->name, kstart, klen);
- a->name[klen] = '\0';
- a->value = (char *) mir_alloc(vlen+1);
- strncpy(a->value, vstart, vlen);
- a->value[vlen] = '\0';
- }
-}
-
-static BOOL JabberXmlProcessElem(XmlState *xmlState, XmlElemType elemType, char *elemText, char *elemAttr)
-{
- XmlNode *node, *parentNode, *n;
- //BOOL activateCallback = FALSE;
- char *text, *attr;
-
- if (elemText == NULL) return FALSE;
-
- if (elemType==ELEM_OPEN && !strcmp(elemText, "?xml")) {
-// JabberLog("XML: skip <?xml> tag");
- return TRUE;
- }
-
- // Find active node
- node = &(xmlState->root);
- parentNode = NULL;
- while (node->numChild>0 && node->child[node->numChild-1]->state==NODE_OPEN) {
- parentNode = node;
- node = node->child[node->numChild-1];
- }
-
- if (node->state != NODE_OPEN) return FALSE;
-
- text = mir_strdup(elemText);
-
- if (elemAttr)
- attr = mir_strdup(elemAttr);
- else
- attr = NULL;
-
- switch (elemType) {
- case ELEM_OPEN:
- if (node->numChild >= node->maxNumChild) {
- node->maxNumChild = node->numChild + 20;
- node->child = (XmlNode **) mir_realloc(node->child, node->maxNumChild*sizeof(XmlNode *));
- }
- n = node->child[node->numChild] = (XmlNode *) mir_alloc(sizeof(XmlNode));
- node->numChild++;
- n->name = text;
- n->depth = node->depth + 1;
- n->state = NODE_OPEN;
- n->numChild = n->maxNumChild = 0;
- n->child = NULL;
- n->numAttr = n->maxNumAttr = 0;
- n->attr = NULL;
- JabberXmlParseAttr(n, attr);
- n->text = NULL;
- if (n->depth==1 && xmlState->callback1_open!=NULL)
- (*(xmlState->callback1_open))(n, xmlState->userdata1_open);
- if (n->depth==2 && xmlState->callback2_open!=NULL)
- (*xmlState->callback2_open)(n, xmlState->userdata2_open);
- break;
- case ELEM_OPENCLOSE:
- if (node->numChild >= node->maxNumChild) {
- node->maxNumChild = node->numChild + 20;
- node->child = (XmlNode **) mir_realloc(node->child, node->maxNumChild*sizeof(XmlNode *));
- }
- n = node->child[node->numChild] = (XmlNode *) mir_alloc(sizeof(XmlNode));
- node->numChild++;
- n->name = text;
- n->depth = node->depth + 1;
- n->state = NODE_CLOSE;
- n->numChild = n->maxNumAttr = 0;
- n->child = NULL;
- n->numAttr = n->maxNumAttr = 0;
- n->attr = NULL;
- JabberXmlParseAttr(n, attr);
- n->text = NULL;
- if (n->depth==1 && xmlState->callback1_close!=NULL) {
- (*(xmlState->callback1_close))(n, xmlState->userdata1_close);
- JabberXmlRemoveChild(node, n);
- }
- if (n->depth==2 && xmlState->callback2_close!=NULL) {
- (*xmlState->callback2_close)(n, xmlState->userdata2_close);
- JabberXmlRemoveChild(node, n);
- }
- break;
- case ELEM_CLOSE:
- if (node->name!=NULL && !strcmp(node->name, text)) {
- node->state = NODE_CLOSE;
- if (node->depth==1 && xmlState->callback1_close!=NULL) {
- (*(xmlState->callback1_close))(node, xmlState->userdata1_close);
- JabberXmlRemoveChild(parentNode, node);
- }
- if (node->depth==2 && xmlState->callback2_close!=NULL) {
- (*xmlState->callback2_close)(node, xmlState->userdata2_close);
- JabberXmlRemoveChild(parentNode, node);
- }
- mir_free(text);
- }
- else {
-// JabberLog("XML: Closing </%s> without opening tag", text);
- mir_free(text);
- if (attr) mir_free(attr);
- return FALSE;
- }
- break;
- case ELEM_TEXT:
- node->text = text;
- break;
- default:
- mir_free(text);
- if (attr) mir_free(attr);
- return FALSE;
- }
-
- if (attr) mir_free(attr);
-
- return TRUE;
-}
-
-char *JabberXmlGetAttrValue(XmlNode *node, char *key)
-{
- int i;
-
- if (node==NULL || node->numAttr<=0 || key==NULL || strlen(key)<=0)
- return NULL;
- for (i=0; i<node->numAttr; i++) {
- if (node->attr[i]->name && !strcmp(key, node->attr[i]->name))
- return node->attr[i]->value;
- }
- return NULL;
-}
-
-XmlNode *JabberXmlGetChild(XmlNode *node, char *tag)
-{
- return JabberXmlGetNthChild(node, tag, 1);
-}
-
-XmlNode *JabberXmlGetNthChild(XmlNode *node, char *tag, int nth)
-{
- int i, num;
-
- if (node==NULL || node->numChild<=0 || tag==NULL || strlen(tag)<=0 || nth<1)
- return NULL;
- num = 1;
- for (i=0; i<node->numChild; i++) {
- if (node->child[i]->name && !strcmp(tag, node->child[i]->name)) {
- if (num == nth) {
- return node->child[i];
- }
- num++;
- }
- }
- return NULL;
-}
-
-XmlNode *JabberXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrKey, char *attrValue)
-{
- int i;
- char *str;
-
- if (node==NULL || node->numChild<=0 || tag==NULL || strlen(tag)<=0 || attrKey==NULL || strlen(attrKey)<=0 || attrValue==NULL || strlen(attrValue)<=0)
- return NULL;
- for (i=0; i<node->numChild; i++) {
- if (node->child[i]->name && !strcmp(tag, node->child[i]->name)) {
- if ((str=JabberXmlGetAttrValue(node->child[i], attrKey)) != NULL)
- if (!strcmp(str, attrValue))
- return node->child[i];
- }
- }
- return NULL;
-}
-
-static void JabberXmlRemoveChild(XmlNode *node, XmlNode *child)
-{
- int i;
-
- if (node==NULL || child==NULL || node->numChild<=0) return;
- for (i=0; i<node->numChild; i++) {
- if (node->child[i] == child)
- break;
- }
- if (i < node->numChild) {
- for (++i; i<node->numChild; i++)
- node->child[i-1] = node->child[i];
- node->numChild--;
- JabberXmlFreeNode(child);
- }
-}
-
-void JabberXmlFreeNode(XmlNode *node)
-{
- int i;
-
- if (node == NULL) return;
- // Free all children first
- for (i=0; i<node->numChild; i++)
- JabberXmlFreeNode(node->child[i]);
- if (node->child) mir_free(node->child);
- // Free all attributes
- for (i=0; i<node->numAttr; i++) {
- if (node->attr[i]->name) mir_free(node->attr[i]->name);
- if (node->attr[i]->value) mir_free(node->attr[i]->value);
- mir_free(node->attr[i]);
- }
- if (node->attr) mir_free(node->attr);
- // Free string field
- if (node->text) mir_free(node->text);
- if (node->name) mir_free(node->name);
- // Free the node itself
- mir_free(node);
-}
-
-XmlNode *JabberXmlCopyNode(XmlNode *node)
-{
- XmlNode *n;
- int i;
-
- if (node == NULL) return NULL;
- n = (XmlNode *) mir_alloc(sizeof(XmlNode));
- // Copy attributes
- if (node->numAttr > 0) {
- n->attr = (XmlAttr **) mir_alloc(node->numAttr*sizeof(XmlAttr *));
- for (i=0; i<node->numAttr; i++) {
- n->attr[i] = (XmlAttr *) mir_alloc(sizeof(XmlAttr));
- if (node->attr[i]->name) n->attr[i]->name = mir_strdup(node->attr[i]->name);
- else n->attr[i]->name = NULL;
- if (node->attr[i]->value) n->attr[i]->value = mir_strdup(node->attr[i]->value);
- else n->attr[i]->value = NULL;
- }
- }
- else
- n->attr = NULL;
- // Recursively copy children
- if (node->numChild > 0) {
- n->child = (XmlNode **) mir_alloc(node->numChild*sizeof(XmlNode *));
- for (i=0; i<node->numChild; i++)
- n->child[i] = JabberXmlCopyNode(node->child[i]);
- }
- else
- n->child = NULL;
- // Copy other fields
- n->numAttr = node->numAttr;
- n->maxNumAttr = node->numAttr;
- n->numChild = node->numChild;
- n->maxNumChild = node->numChild;
- n->depth = node->depth;
- n->state = node->state;
- n->name = (node->name)?mir_strdup(node->name):NULL;
- n->text = (node->text)?mir_strdup(node->text):NULL;
-
- return n;
-}
-
-XmlNode *JabberXmlCreateNode(char *name)
-{
- XmlNode *n;
-
- if (name == NULL)
- return NULL;
-
- n = (XmlNode *) mir_alloc(sizeof(XmlNode));
- memset(n, 0, sizeof(XmlNode));
- n->name = mir_strdup(name);
- return n;
-}
-
-void JabberXmlAddAttr(XmlNode *n, char *name, char *value)
-{
- int i;
-
- if (n==NULL || name==NULL || value==NULL)
- return;
-
- i = n->numAttr;
- (n->numAttr)++;
- n->attr = (XmlAttr **) mir_realloc(n->attr, sizeof(XmlAttr *) * n->numAttr);
- n->attr[i] = (XmlAttr *) mir_alloc(sizeof(XmlAttr));
- n->attr[i]->name = mir_strdup(name);
- n->attr[i]->value = mir_strdup(value);
-}
-
-XmlNode *JabberXmlAddChild(XmlNode *n, char *name)
-{
- int i;
-
- if (n==NULL || name==NULL)
- return NULL;
-
- i = n->numChild;
- n->numChild++;
- n->child = (XmlNode **) mir_realloc(n->child, sizeof(XmlNode *) * n->numChild);
- n->child[i] = (XmlNode *) mir_alloc(sizeof(XmlNode));
- memset(n->child[i], 0, sizeof(XmlNode));
- n->child[i]->name = mir_strdup(name);
- return n->child[i];
-}
-
-void JabberXmlAddText(XmlNode *n, char *text)
-{
- if (n!=NULL && text!=NULL) {
- if (n->text) mir_free(n->text);
- n->text = mir_strdup(text);
- }
-}
-
diff --git a/protocols/Tlen/jabber_xml.h b/protocols/Tlen/jabber_xml.h
deleted file mode 100644
index 98949b92f6..0000000000
--- a/protocols/Tlen/jabber_xml.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _JABBER_XML_H_
-#define _JABBER_XML_H_
-
-typedef enum { ELEM_OPEN, ELEM_CLOSE, ELEM_OPENCLOSE, ELEM_TEXT } XmlElemType;
-typedef enum { NODE_OPEN, NODE_CLOSE } XmlNodeType;
-
-typedef struct tagXmlAttr {
- char *name;
- char *value;
-} XmlAttr;
-
-typedef struct tagXmlNode {
- int depth; // depth of the current node (1=root)
- char *name; // tag name of the current node
- int numAttr; // number of attributes
- int maxNumAttr; // internal use (num of slots currently allocated to attr)
- XmlAttr **attr; // attribute list
- int numChild; // number of direct child nodes
- int maxNumChild; // internal use (num of slots currently allocated to child)
- struct tagXmlNode **child; // child node list
- char *text;
- XmlNodeType state; // internal use by parser
-} XmlNode;
-
-typedef struct tagXmlState {
- XmlNode root; // root is the document (depth = 0);
- // callback for depth=n element on opening/closing
- void (*callback1_open)();
- void (*callback1_close)();
- void (*callback2_open)();
- void (*callback2_close)();
- void *userdata1_open;
- void *userdata1_close;
- void *userdata2_open;
- void *userdata2_close;
-} XmlState;
-
-void JabberXmlInitState(XmlState *xmlState);
-void JabberXmlDestroyState(XmlState *xmlState);
-BOOL JabberXmlSetCallback(XmlState *xmlState, int depth, XmlElemType type, void (*callback)(), void *userdata);
-int JabberXmlParse(XmlState *xmlState, char *buffer, int datalen);
-char *JabberXmlGetAttrValue(XmlNode *node, char *key);
-XmlNode *JabberXmlGetChild(XmlNode *node, char *tag);
-XmlNode *JabberXmlGetNthChild(XmlNode *node, char *tag, int nth);
-XmlNode *JabberXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrKey, char *attrValue);
-void JabberXmlFreeNode(XmlNode *node);
-XmlNode *JabberXmlCopyNode(XmlNode *node);
-
-XmlNode *JabberXmlCreateNode(char *name);
-void JabberXmlAddAttr(XmlNode *n, char *name, char *value);
-XmlNode *JabberXmlAddChild(XmlNode *n, char *name);
-void JabberXmlAddText(XmlNode *n, char *text);
-
-#endif
-
diff --git a/protocols/Tlen/resource.h b/protocols/Tlen/resource.h
deleted file mode 100644
index f3a350630e..0000000000
--- a/protocols/Tlen/resource.h
+++ /dev/null
@@ -1,147 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by Tlen.rc
-//
-
-#define IDI_TLEN 100
-#define IDI_MAIL 101
-#define IDI_MUC 102
-#define IDI_CHATS 103
-#define IDI_GRANT 104
-#define IDI_REQUEST 105
-#define IDI_VOICE 106
-#define IDI_MICROPHONE 107
-#define IDI_SPEAKER 108
-#define IDI_IMAGE 109
-
-#define IDD_OPTIONS_BASIC 151
-#define IDD_OPTIONS_VOICE 152
-#define IDD_OPTIONS_POPUPS 153
-#define IDD_OPTIONS_ADVANCED 154
-#define IDD_USER_INFO 155
-#define IDD_USER_VCARD 156
-#define IDD_PASSWORD 157
-#define IDD_ADVSEARCH 158
-#define IDD_VOICE 159
-#define IDD_ACCEPT_VOICE 160
-#define IDD_USER_CHANGEAVATAR 161
-#define IDD_ACCMGRUI 162
-
-#define IDC_TABS 1000
-#define IDC_EDIT_USERNAME 1001
-#define IDC_SAVE 1002
-#define IDC_EDIT_PASSWORD 1003
-#define IDC_EDIT_LOGIN_SERVER 1004
-#define IDC_INFO_JID 1007
-#define IDC_INFO_RESOURCE 1008
-#define IDC_SHOW_OFFLINE 1012
-#define IDC_OFFLINE_MESSAGE 1013
-#define IDC_OFFLINE_MESSAGE_OPTION 1014
-#define IDC_VISIBILITY_SUPPORT 1015
-#define IDC_NUDGE_SUPPORT 1016
-#define IDC_LOG_ALERTS 1017
-
-#define IDC_SUBSCRIPTION 1039
-#define IDC_REGISTERACCOUNT 1040
-#define IDC_SIMPLE 1041
-#define IDC_KEEPALIVE 1042
-#define IDC_HOST 1043
-#define IDC_HOSTPORT 1044
-#define IDC_USE_SSL 1045
-#define IDC_SAVEPASSWORD 1048
-#define IDC_ROSTER_ALERTS 1049
-#define IDC_PASSWORD 1050
-#define IDC_RECONNECT 1050
-#define IDC_JID 1051
-#define IDC_ROSTER_SYNC 1052
-#define IDC_ALERT_POLICY 1053
-#define IDC_MUC_POLICY 1054
-#define IDC_VOICE_POLICY 1055
-#define IDC_IGNORE_ADVERTISEMENTS 1056
-#define IDC_AVATARS 1057
-#define IDC_VERSIONINFO 1058
-#define IDC_IMAGE_POLICY 1059
-#define IDC_CITY 1060
-#define IDC_FULLNAME 1061
-#define IDC_NICKNAME 1062
-#define IDC_FIRSTNAME 1063
-#define IDC_LASTNAME 1064
-#define IDC_BIRTH 1065
-#define IDC_AGE 1065
-#define IDC_OCCUPATION 1066
-#define IDC_EMAIL 1073
-#define IDC_GENDER 1096
-#define IDC_VOICECONVERSATIONS 1097
-#define IDC_PUBLICSTATUS 1098
-#define IDC_VCQUALITY 1100
-#define IDC_VUMETERIN 1101
-#define IDC_VUMETEROUT 1102
-#define IDC_BYTESIN 1103
-#define IDC_BYTESOUT 1104
-#define IDC_MICROPHONE 1105
-#define IDC_SPEAKER 1106
-#define IDC_ACCEPT 1107
-
-#define IDC_FILE_PROXY_TYPE_LABEL 1108
-#define IDC_FILE_PROXY_TYPE 1109
-#define IDC_FILE_PROXY_HOST_LABEL 1110
-#define IDC_FILE_PROXY_HOST 1111
-#define IDC_FILE_PROXY_PORT_LABEL 1112
-#define IDC_FILE_PROXY_PORT 1113
-#define IDC_FILE_PROXY_USE_AUTH 1114
-#define IDC_FILE_PROXY_USER 1115
-#define IDC_FILE_PROXY_USER_LABEL 1116
-#define IDC_FILE_PROXY_PASSWORD_LABEL 1117
-#define IDC_FILE_PROXY_PASSWORD 1118
-#define IDC_FILE_USE_PROXY 1119
-#define IDC_VOICE_DEVICE_IN 1120
-#define IDC_VOICE_DEVICE_OUT 1121
-
-#define IDC_MSG_ACK 1124
-#define IDC_SERVER 1125
-#define IDC_NICK 1129
-#define IDC_LIST 1133
-#define IDC_ENTER 1144
-#define IDC_AGEFROM 1152
-#define IDC_AGETO 1153
-#define IDC_LOOKFOR 1154
-#define IDC_SCHOOL 1155
-#define IDC_FROM 1175
-#define IDC_DELAY 1180
-#define IDC_COLORBKG 1181
-#define IDC_COLORTXT 1182
-#define IDC_PREVIEW 1183
-#define IDC_ENABLEPOPUP 1184
-#define IDC_DELAY_PERMANENT 1185
-#define IDC_DELAY_CUSTOM 1186
-#define IDC_DELAY_POPUP 1187
-#define IDC_TLEN 1190
-#define IDC_GENDER_TEXT 1195
-#define IDC_OCCUPATION_TEXT 1199
-#define IDC_LOOKFOR_TEXT 1200
-#define IDC_GROUP 1203
-#define IDC_SOFTWARE 1204
-#define IDC_VERSION 1205
-#define IDC_SYSTEM 1206
-#define IDC_AVATAR 1210
-#define IDC_SETAVATAR 1211
-#define IDC_DELETEAVATAR 1212
-#define IDC_AVATAR_LIST 1213
-#define IDC_OLD_AVATAR 1214
-#define IDC_BROWSEAVATAR 1215
-#define IDC_PUBLICAVATAR 1216
-
-#define IDC_STATUS 1414
-#define IDC_PLAN 1415
-#define IDC_PERSONALGROUP 1434
-#define IDC_EXTRAGROUP 1435
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 190
-#define _APS_NEXT_COMMAND_VALUE 40017
-#define _APS_NEXT_CONTROL_VALUE 1204
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/Tlen/tlen.c b/protocols/Tlen/tlen.c
deleted file mode 100644
index 2f8d860a64..0000000000
--- a/protocols/Tlen/tlen.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "commons.h"
-#include "jabber.h"
-#include "tlen_muc.h"
-#include "tlen_file.h"
-#include "tlen_voice.h"
-#include "jabber_list.h"
-#include "jabber_iq.h"
-#include "resource.h"
-#include "tlen_picture.h"
-#include <m_file.h>
-#include <richedit.h>
-#include <ctype.h>
-#include <m_icolib.h>
-#include <m_genmenu.h>
-#include "m_mucc.h"
-#include "m_updater.h"
-
-
-struct MM_INTERFACE mmi;
-struct SHA1_INTERFACE sha1i;
-struct MD5_INTERFACE md5i;
-struct UTF8_INTERFACE utfi;
-HINSTANCE hInst;
-PLUGINLINK *pluginLink;
-HANDLE hMainThread;
-
-PLUGININFOEX pluginInfoEx = {
- sizeof(PLUGININFOEX),
-#ifdef _UNICODE
-#ifdef _X64
- "Tlen Protocol (x64, Unicode)",
-#else
- "Tlen Protocol (Unicode)",
-#endif
-#else
- "Tlen Protocol",
-#endif
- PLUGIN_MAKE_VERSION(TLEN_MAJOR_VERSION,TLEN_MINOR_VERSION,TLEN_RELEASE_NUM,TLEN_BUILD_NUM),
- "Tlen protocol plugin for Miranda IM (version: "TLEN_VERSION_STRING" ; compiled: "__DATE__" "__TIME__")",
- "Santithorn Bunchua, Adam Strzelecki, Piotr Piastucki",
- "the_leech@users.berlios.de",
- "(c) 2002-2012 Santithorn Bunchua, Piotr Piastucki",
- "http://mtlen.berlios.de",
- 0,
- 0,
-#if defined( _UNICODE )
-#ifdef _X64
- {0x3ba4a3c6, 0x27b5, 0x4c78, { 0x92, 0x8c, 0x38, 0x2a, 0xe1, 0xd3, 0x2a, 0xb5 }}
-#else
- {0x748f8934, 0x781a, 0x528d, { 0x52, 0x08, 0x00, 0x12, 0x65, 0x40, 0x4a, 0xb3 }}
-#endif
-#else
- {0x11fc3484, 0x475c, 0x11dc, { 0x83, 0x14, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }}
-#endif
-};
-
-// Main jabber server connection thread global variables
-
-void TlenLoadOptions(TlenProtocol *proto);
-int TlenOptionsInit(void *ptr, WPARAM wParam, LPARAM lParam);
-int TlenUserInfoInit(void *ptr, WPARAM wParam, LPARAM lParam);
-int TlenSystemModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam);
-extern void TlenInitServicesVTbl(TlenProtocol *proto);
-extern int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam);
-extern int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam);
-
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved)
-{
-#ifdef _DEBUG
- _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
-#endif
-
- hInst = hModule;
- return TRUE;
-}
-
-__declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx( DWORD mirandaVersion )
-{
- if ( mirandaVersion < PLUGIN_MAKE_VERSION( 0,8,0,15 )) {
- MessageBox( NULL, TranslateT("The Tlen protocol plugin cannot be loaded. It requires Miranda IM 0.8.0.15 or later."), TranslateT("Tlen Protocol Plugin"), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST );
- return NULL;
- }
-
- return &pluginInfoEx;
-}
-
-extern "C" __declspec(dllexport) const MUUID interfaces[] = {MIID_PROTOCOL, MIID_LAST};
-__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
-{
- return interfaces;
-}
-
-struct
-{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
-{
- { _T("Protocol icon"), "PROTO", IDI_TLEN },
- { _T("Tlen inbox"), "MAIL", IDI_MAIL },
- { _T("Group chats"), "MUC", IDI_MUC },
- { _T("Tlen chats"), "CHATS", IDI_CHATS },
- { _T("Grant authorization"), "GRANT", IDI_GRANT },
- { _T("Request authorization"),"REQUEST", IDI_REQUEST },
- { _T("Voice chat"), "VOICE", IDI_VOICE },
- { _T("Microphone"), "MICROPHONE", IDI_MICROPHONE },
- { _T("Speaker"), "SPEAKER", IDI_SPEAKER },
- { _T("Send image"), "IMAGE", IDI_IMAGE }
-};
-
-static HANDLE GetIconHandle(int iconId) {
- int i;
- for(i = 0; i < SIZEOF(iconList); i++)
- if(iconList[i].defIconID == iconId)
- return iconList[i].hIconLibItem;
- return NULL;
-}
-
-HICON GetIcolibIcon(int iconId) {
- HANDLE handle = GetIconHandle(iconId);
- if (handle != NULL) {
- return (HICON) CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)handle);
- }
- return NULL;
-}
-
-void ReleaseIcolibIcon(HICON hIcon) {
- CallService( MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0 );
-}
-
-/*
-static int TlenIconsChanged(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-*/
-
-static void TlenRegisterIcons()
-{
- SKINICONDESC sid = { 0 };
- char path[MAX_PATH];
- TCHAR szSectionName[100];
- int i;
- mir_sntprintf(szSectionName, SIZEOF( szSectionName ), _T("%s/%s"), _T("Protocols"), _T("Tlen"));
-
- GetModuleFileNameA(hInst, path, MAX_PATH);
- sid.cbSize = sizeof(SKINICONDESC);
- sid.cx = sid.cy = 16;
- sid.ptszSection = szSectionName;
- sid.pszDefaultFile = path;
- sid.flags = SIDF_TCHAR;
-
- for ( i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "TLEN_%s", iconList[i].szName );
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = ( HANDLE )CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- }
-}
-
-static int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- CLISTMENUITEM clmi = {0};
- JABBER_LIST_ITEM *item;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- clmi.cbSize = sizeof(CLISTMENUITEM);
- if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- if (item->subscription==SUB_NONE || item->subscription==SUB_FROM)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
-
- if (item->subscription==SUB_NONE || item->subscription==SUB_TO)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
-
- if (item->status!=ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
-
- if (item->status!=ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto))
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
-
- if (item->status!=ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuPicture, (LPARAM) &clmi);
-
- DBFreeVariant(&dbv);
- return 0;
- }
- DBFreeVariant(&dbv);
- }
- }
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
- return 0;
-}
-
-INT_PTR TlenContactMenuHandleRequestAuth(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- JabberSend(proto, "<presence to='%s' type='subscribe'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- }
- return 0;
-}
-
-INT_PTR TlenContactMenuHandleGrantAuth(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- JabberSend(proto, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- }
- return 0;
-}
-
-INT_PTR TlenContactMenuHandleSendPicture(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
- SendPicture(proto, hContact);
- }
- return 0;
-}
-
-INT_PTR TlenMenuHandleInbox(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- char szFileName[ MAX_PATH ];
- DBVARIANT dbv;
- NETLIBHTTPREQUEST req;
- NETLIBHTTPHEADER headers[2];
- NETLIBHTTPREQUEST *resp;
- char *login = NULL, *password = NULL;
- char form[1024];
- char cookie[1024];
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginName", &dbv)) {
- login = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "SavePassword", TRUE) == TRUE) {
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- } else if (proto->threadData != NULL && strlen(proto->threadData->password) > 0) {
- password = mir_strdup(proto->threadData->password);
- }
-
- ZeroMemory(&cookie, sizeof(cookie));
- if (login != NULL && password != NULL) {
- mir_snprintf( form, SIZEOF(form), "username=%s&password=%s", login, password);
- headers[0].szName = "Content-Type";
- headers[0].szValue = "application/x-www-form-urlencoded";
- ZeroMemory(&req, sizeof(req));
- req.cbSize = sizeof(req);
- req.requestType = REQUEST_POST;
- req.flags = 0;
- req.headersCount = 1;
- req.headers = headers;
- req.pData = form;
- req.dataLength = (int)strlen(form);
- req.szUrl = "http://poczta.o2.pl/login.html";
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)proto->hNetlibUser, (LPARAM)&req);
- if (resp != NULL) {
- if (resp->resultCode/100==2 || resp->resultCode == 302) {
- int i;
- for (i=0; i<resp->headersCount; i++ ) {
- if (strcmpi(resp->headers[i].szName, "Set-Cookie")==0) {
- char *start = strstr(resp->headers[i].szValue, "ssid=");
- if (start != NULL) {
- char *end = strstr(resp->headers[i].szValue, ";");
- start = start + 5;
- if (end == NULL) {
- end = resp->headers[i].szValue + strlen(resp->headers[i].szValue);
- }
- strncpy(cookie, start, (end - start));
- break;
- }
- }
- }
- }
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
- }
- }
- mir_free(login);
- mir_free(password);
- _snprintf(szFileName, sizeof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
- CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) szFileName);
- return 0;
-}
-
-int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) {
-
- char str[128];
- TlenProtocol *proto = (TlenProtocol *)ptr;
- /* Set all contacts to offline */
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(szProto!=NULL && !strcmp(szProto, proto->iface.m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE);
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
- TlenMUCInit(proto);
- sprintf(str, "%s", Translate("Incoming mail"));
- SkinAddNewSoundEx("TlenMailNotify", proto->iface.m_szProtoName, str);
- sprintf(str, "%s", Translate("Alert"));
- SkinAddNewSoundEx("TlenAlertNotify", proto->iface.m_szProtoName, str);
- sprintf(str, "%s", Translate("Voice chat"));
- SkinAddNewSoundEx("TlenVoiceNotify", proto->iface.m_szProtoName, str);
-
- HookEventObj_Ex(ME_USERINFO_INITIALISE, proto, TlenUserInfoInit);
-
- return 0;
-}
-
-int TlenPreShutdown(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- JabberLog(ptr, "TLEN TlenPreShutdown");
- //TlenProtocol *proto = (TlenProtocol *)ptr;
- return 0;
-}
-
-
-static void initMenuItems(TlenProtocol *proto)
-{
-
- char text[_MAX_PATH];
- CLISTMENUITEM mi, clmi;
- memset(&mi, 0, sizeof(CLISTMENUITEM));
- mi.cbSize = sizeof(CLISTMENUITEM);
- memset(&clmi, 0, sizeof(CLISTMENUITEM));
- clmi.cbSize = sizeof(CLISTMENUITEM);
- clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
-
- mi.pszContactOwner = proto->iface.m_szModuleName;
- mi.popupPosition = 500090000;
-
- strcpy(text, proto->iface.m_szModuleName);
- mi.pszService = text;
- mi.ptszName = proto->iface.m_tszUserName;
- mi.position = -1999901009;
- mi.pszPopupName = (char *)-1;
- mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetIconHandle(IDI_TLEN);
- proto->hMenuRoot = (HANDLE)CallService( MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
-
- mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB;
- //mi.pszPopupName = (char *)proto->hMenuRoot;
- mi.hParentMenu = (HGENMENU)proto->hMenuRoot;
-
- proto->hMenuChats = NULL;
- if(ServiceExists(MS_MUCC_NEW_WINDOW))
- {
- sprintf(text, "%s/MainMenuChats", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleChats);
- mi.pszName = "Tlen Chats";
- mi.position = 2000050001;
- mi.icolibItem = GetIconHandle(IDI_CHATS);
- mi.pszService = text;
- proto->hMenuChats = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuChats, (LPARAM) &clmi);
- }
-
- // "Multi-User Conference"
- sprintf(text, "%s/MainMenuMUC", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleMUC);
- mi.pszName = "Multi-User Conference";
- mi.position = 2000050002;
- mi.icolibItem = GetIconHandle(IDI_MUC);
- mi.pszService = text;
- proto->hMenuMUC = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuMUC, (LPARAM) &clmi);
-
- sprintf(text, "%s/MainMenuInbox", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenMenuHandleInbox);
- mi.pszName = "Tlen Mail";
- mi.position = 2000050003;
- mi.icolibItem = GetIconHandle(IDI_MAIL);
- mi.pszService = text;
- proto->hMenuInbox = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
-
- mi.hParentMenu = NULL;
-
-
- // "Send picture"
- sprintf(text, "%s/SendPicture", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleSendPicture);
- mi.flags = CMIF_ICONFROMICOLIB;
- mi.pszName = "Send picture";
- mi.position = -2000019030;
- mi.icolibItem = GetIconHandle(IDI_IMAGE);
- mi.pszService = text;
- proto->hMenuPicture = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
-
- // "Invite to MUC"
- sprintf(text, "%s/ContactMenuMUC", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenMUCContactMenuHandleMUC);
- mi.pszName = "Multi-User Conference";
- mi.position = -2000019020;
- mi.icolibItem = GetIconHandle(IDI_MUC);
- mi.pszService = text;
- proto->hMenuContactMUC = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
-
- // "Invite to voice chat"
- sprintf(text, "%s/ContactMenuVoice", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenVoiceContactMenuHandleVoice);
- mi.pszName = "Voice Chat";
- mi.position = -2000019010;
- mi.icolibItem = GetIconHandle(IDI_VOICE);
- mi.pszService = text;
- proto->hMenuContactVoice = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
-
- // "Request authorization"
- sprintf(text, "%s/RequestAuth", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleRequestAuth);
- mi.pszName = "Request authorization";
- mi.position = -2000001001;
- mi.icolibItem = GetIconHandle(IDI_REQUEST);
- mi.pszService = text;
- proto->hMenuContactRequestAuth = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
-
- // "Grant authorization"
- sprintf(text, "%s/GrantAuth", proto->iface.m_szModuleName);
- CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleGrantAuth);
- mi.pszName = "Grant authorization";
- mi.position = -2000001000;
- mi.icolibItem = GetIconHandle(IDI_GRANT);
- mi.pszService = text;
- proto->hMenuContactGrantAuth = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi);
-}
-
-static void uninitMenuItems(TlenProtocol *proto) {
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)proto->hMenuChats, (LPARAM) 0);
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)proto->hMenuMUC, (LPARAM) 0);
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)proto->hMenuInbox, (LPARAM) 0);
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)proto->hMenuRoot, (LPARAM) 0);
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)proto->hMenuContactMUC, (LPARAM) 0);
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)proto->hMenuPicture, (LPARAM) 0);
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)proto->hMenuContactVoice, (LPARAM) 0);
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)proto->hMenuContactRequestAuth, (LPARAM) 0);
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)proto->hMenuContactGrantAuth, (LPARAM) 0);
-}
-
-
-static TlenProtocol *tlenProtoInit( const char* pszProtoName, const TCHAR* tszUserName )
-{
- DBVARIANT dbv;
- char text[_MAX_PATH];
- TlenProtocol *proto = (TlenProtocol *)mir_alloc(sizeof(TlenProtocol));
- memset(proto, 0, sizeof(TlenProtocol));
- proto->iface.m_tszUserName = mir_tstrdup( tszUserName );
- proto->iface.m_szModuleName = mir_strdup(pszProtoName);
- proto->iface.m_szProtoName = mir_strdup(pszProtoName);
- _strlwr( proto->iface.m_szProtoName );
- proto->iface.m_szProtoName[0] = toupper( proto->iface.m_szProtoName[0] );
- proto->iface.m_iStatus = ID_STATUS_OFFLINE;
- TlenInitServicesVTbl(proto);
-
- InitializeCriticalSection(&proto->modeMsgMutex);
- InitializeCriticalSection(&proto->csSend);
-
- sprintf(text, "%s/%s", proto->iface.m_szModuleName, "Nudge");
- proto->hTlenNudge = CreateHookableEvent(text);
-
- HookEventObj_Ex(ME_SYSTEM_MODULESLOADED, proto, TlenSystemModulesLoaded);
- HookEventObj_Ex(ME_OPT_INITIALISE, proto, TlenOptionsInit);
- HookEventObj_Ex(ME_DB_CONTACT_SETTINGCHANGED, proto, JabberDbSettingChanged);
- HookEventObj_Ex(ME_DB_CONTACT_DELETED, proto, JabberContactDeleted);
- HookEventObj_Ex(ME_CLIST_PREBUILDCONTACTMENU, proto, TlenPrebuildContactMenu);
-// HookEventObj_Ex(ME_SKIN2_ICONSCHANGED, proto, TlenIconsChanged);
- HookEventObj_Ex(ME_SYSTEM_PRESHUTDOWN, proto, TlenPreShutdown);
-
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- DBFreeVariant(&dbv);
- } else {
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "LoginServer", "tlen.pl");
- }
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "ManualHost", &dbv)) {
- DBFreeVariant(&dbv);
- } else {
- DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "ManualHost", "s1.tlen.pl");
- }
-
- TlenLoadOptions(proto);
-
- JabberWsInit(proto);
- JabberSerialInit(proto);
- JabberIqInit(proto);
- JabberListInit(proto);
-
- return proto;
-}
-
-int TlenSystemModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam)
-{
-
- TlenProtocol *proto = (TlenProtocol *)ptr;
- initMenuItems(proto);
-
- // updater plugin support
- if(ServiceExists(MS_UPDATE_REGISTERFL))
- {
- PLUGININFO* pluginInfoPtr = (PLUGININFO*)&pluginInfoEx;
- #ifdef _UNICODE
- #ifdef _X64
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)4435, (LPARAM)pluginInfoPtr); //x64 version
- #else
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)4405, (LPARAM)pluginInfoPtr); //Unicode version
- #endif
- #else
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)4404, (LPARAM)pluginInfoPtr); //ANSI version
- #endif
- }
-
- return 0;
-}
-
-static int tlenProtoUninit( TlenProtocol *proto )
-{
- uninitMenuItems(proto);
- TlenVoiceCancelAll(proto);
- TlenFileCancelAll(proto);
- if (proto->hTlenNudge)
- DestroyHookableEvent(proto->hTlenNudge);
- UnhookEvents_Ex(proto);
- JabberListUninit(proto);
- JabberIqUninit(proto);
- JabberSerialUninit(proto);
- DeleteCriticalSection(&proto->modeMsgMutex);
- DeleteCriticalSection(&proto->csSend);
- //DestroyServices_Ex(proto);
- JabberWsUninit(proto);
- mir_free(proto->modeMsgs.szOnline);
- mir_free(proto->modeMsgs.szAway);
- mir_free(proto->modeMsgs.szNa);
- mir_free(proto->modeMsgs.szDnd);
- mir_free(proto->modeMsgs.szFreechat);
- mir_free(proto->modeMsgs.szInvisible);
- mir_free(proto);
- return 0;
-}
-
-int __declspec(dllexport) Load(PLUGINLINK *link)
-{
- PROTOCOLDESCRIPTOR pd;
-
- pluginLink = link;
- mir_getMMI( &mmi );
- mir_getMD5I( &md5i );
- mir_getSHA1I( &sha1i );
- mir_getUTFI( &utfi );
-
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
-
- srand((unsigned) time(NULL));
-
- TlenRegisterIcons();
-
- // Register protocol module
- ZeroMemory(&pd, sizeof(PROTOCOLDESCRIPTOR));
- pd.cbSize = sizeof(PROTOCOLDESCRIPTOR);
- pd.szName = "TLEN";
- pd.fnInit = ( pfnInitProto )tlenProtoInit;
- pd.fnUninit = ( pfnUninitProto )tlenProtoUninit;
- pd.type = PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM) &pd);
-
- return 0;
-}
-
-int __declspec(dllexport) Unload(void)
-{
- return 0;
-}
-
diff --git a/protocols/Tlen/tlen.rc b/protocols/Tlen/tlen.rc
deleted file mode 100644
index ba930c75be..0000000000
--- a/protocols/Tlen/tlen.rc
+++ /dev/null
@@ -1,439 +0,0 @@
-#include "resource.h"
-#include "commons.h"
-#ifdef __MINGW32__
- #define WINVER 0x500
- #define _WIN32_IE 0x500
-#endif
-#include <windows.h>
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1)
-#endif
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif
-#ifdef APSTUDIO_INVOKED
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""winres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ACCMGRUI DIALOGEX 0, 0, 186, 134
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Username:",IDC_STATIC,0,14,38,12,SS_CENTERIMAGE
- EDITTEXT IDC_EDIT_USERNAME,65,14,115,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,0,30,38,12,SS_CENTERIMAGE
- EDITTEXT IDC_EDIT_PASSWORD,65,30,115,12,ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Save password",IDC_SAVEPASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,46,115,10
- CONTROL "Create new account",IDC_REGISTERACCOUNT,"Hyperlink",
- 0x0,0,62,100,8
-END
-
-
-IDD_OPTIONS_BASIC DIALOGEX 0, 0, 304, 200
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
-BEGIN
- GROUPBOX "Tlen",IDC_TLEN,0,0,304,42
- LTEXT "Username:",IDC_STATIC,8,12,52,8
- EDITTEXT IDC_EDIT_USERNAME,70,10,86,12,ES_AUTOHSCROLL
- CONTROL "Create new account",IDC_REGISTERACCOUNT,"Hyperlink",
- 0x0,170,12,100,8
- LTEXT "Password:",IDC_STATIC,8,26,52,8
- EDITTEXT IDC_EDIT_PASSWORD,70,24,86,12,ES_PASSWORD |
- ES_AUTOHSCROLL
- CONTROL "Save password",IDC_SAVEPASSWORD,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,170,26,100,10
- GROUPBOX "Options",IDC_SIMPLE,0,44,304,156
- CONTROL "Automatically reconnect after unintentional disconnection",
- IDC_RECONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8, 56,239,10
- CONTROL "Leave status message after disconnection",
- IDC_OFFLINE_MESSAGE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,8,68,168,10
- COMBOBOX IDC_OFFLINE_MESSAGE_OPTION,190,67,75,140,
- CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "Ignore advertisements",
- IDC_IGNORE_ADVERTISEMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8, 80,250,10
- CONTROL "Automatically delete contacts not in my roster",
- IDC_ROSTER_SYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8, 92,250,10
- CONTROL "Show offline users with status messages as invisible in contact list",
- IDC_SHOW_OFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 8,104,250,10
- CONTROL "Enable avatars",
- IDC_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 8,116,250,10
- CONTROL "Send and receive client version information",
- IDC_VERSIONINFO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 8,128,250,10
- LTEXT "Alert policy",IDC_STATIC,8,140,70,8
- COMBOBOX IDC_ALERT_POLICY,95,139,190,100,
- CBS_DROPDOWNLIST | WS_TABSTOP
- CONTROL "Use Nudge plugin",
- IDC_NUDGE_SUPPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 24,153,120,10
- CONTROL "Log alerts as messages",
- IDC_LOG_ALERTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 150,153,130,10
- LTEXT "Group chat policy",IDC_STATIC,8,168,70,8
- COMBOBOX IDC_MUC_POLICY,95,166,190,100,
- CBS_DROPDOWNLIST | WS_TABSTOP
- LTEXT "Image transfer policy",IDC_STATIC,8,183,70,8
- COMBOBOX IDC_IMAGE_POLICY,95,181,190,100,
- CBS_DROPDOWNLIST | WS_TABSTOP
-END
-
-
-IDD_OPTIONS_VOICE DIALOGEX 0, 0, 304, 200
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
-BEGIN
- GROUPBOX "Voice Chats",IDC_STATIC,0,0,304,57
- LTEXT "Voice chat policy",IDC_STATIC,8,12,70,8
- COMBOBOX IDC_VOICE_POLICY,95,10,190,100,
- CBS_DROPDOWNLIST | WS_TABSTOP
- LTEXT "Recording device:",IDC_STATIC,8,26,105,8
- COMBOBOX IDC_VOICE_DEVICE_IN,120,24,110,100,CBS_DROPDOWNLIST |
- WS_TABSTOP
- LTEXT "Playback device:",IDC_STATIC,8,40,105,8
- COMBOBOX IDC_VOICE_DEVICE_OUT,120,38,110,100,CBS_DROPDOWNLIST |
- WS_TABSTOP
-END
-
-IDD_OPTIONS_ADVANCED DIALOGEX 0, 0, 304, 200
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
-BEGIN
- GROUPBOX "Expert Options",IDC_STATIC,0,0,304,74
- LTEXT "Login server:",IDC_STATIC,8,18,75,8
- EDITTEXT IDC_EDIT_LOGIN_SERVER,90,16,90,12,ES_AUTOHSCROLL
- LTEXT "Connection Host:",IDC_STATIC,8,32,75,8
- EDITTEXT IDC_HOST,90,30,90,12,ES_AUTOHSCROLL | WS_DISABLED
- LTEXT "Port:",IDC_STATIC,194,32,35,8
- EDITTEXT IDC_HOSTPORT,230,30,26,12,ES_AUTOHSCROLL | ES_NUMBER |
- WS_DISABLED
- CONTROL "Keep connection alive",IDC_KEEPALIVE,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,8,47,250,10
- CONTROL "Enable encryption",IDC_USE_SSL,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,8,60,250,10
-
- CONTROL "Enable Always Visible and Never Visible",
- IDC_VISIBILITY_SUPPORT,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE |
- WS_TABSTOP,8,60,250,10
-
- GROUPBOX "P2P Connections",IDC_STATIC,0,100,304,98
- CONTROL "Use proxy for incoming connections",IDC_FILE_USE_PROXY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,114,271,10
- LTEXT "Proxy type:",IDC_FILE_PROXY_TYPE_LABEL,10,130,48,8,
- WS_DISABLED
- COMBOBOX IDC_FILE_PROXY_TYPE,68,128,80,48,CBS_DROPDOWNLIST |
- WS_DISABLED | WS_VSCROLL | WS_TABSTOP
- LTEXT "Proxy server:",IDC_FILE_PROXY_HOST_LABEL,10,145,48,8,
- WS_DISABLED
- EDITTEXT IDC_FILE_PROXY_HOST,68,143,80,12,ES_AUTOHSCROLL |
- WS_DISABLED | WS_GROUP
- LTEXT "Port:",IDC_FILE_PROXY_PORT_LABEL,174,145,25,8,
- WS_DISABLED
- EDITTEXT IDC_FILE_PROXY_PORT,204,143,30,12,ES_AUTOHSCROLL |
- ES_NUMBER | WS_DISABLED
- CONTROL "Proxy requires authorization",IDC_FILE_PROXY_USE_AUTH,
- "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,8,
- 160,271,10
- LTEXT "Username:",IDC_FILE_PROXY_USER_LABEL,10,176,47,8,
- WS_DISABLED
- EDITTEXT IDC_FILE_PROXY_USER,68,175,80,12,ES_AUTOHSCROLL |
- WS_DISABLED
- LTEXT "Password:",IDC_FILE_PROXY_PASSWORD_LABEL,153,176,45,8,
- WS_DISABLED
- EDITTEXT IDC_FILE_PROXY_PASSWORD,204,175,81,12,ES_PASSWORD |
- ES_AUTOHSCROLL | WS_DISABLED
-
-
-END
-
-IDD_OPTIONS_POPUPS DIALOG DISCARDABLE 0, 0, 304, 143
-STYLE WS_CHILD
-FONT 8, "MS Sans Serif"
-BEGIN
-
- GROUPBOX "Mail Notification",IDC_STATIC,0,0,304,110
- CONTROL "Enable incoming mail notification",IDC_ENABLEPOPUP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,267,10
- GROUPBOX "Colours",IDC_STATIC,8,26,140,55
- LTEXT "Background",IDC_STATIC,47,43,95,8
- LTEXT "Text",IDC_STATIC,47,62,96,8
- CONTROL "",IDC_COLORBKG,"ColourPicker",WS_TABSTOP,17,41,24,12
- CONTROL "",IDC_COLORTXT,"ColourPicker",WS_TABSTOP,17,59,24,12
- GROUPBOX "Delay",IDC_STATIC,157,26,140,55
- CONTROL "&From PopUp plugin",IDC_DELAY_POPUP,"Button",
- BS_AUTORADIOBUTTON,164,40,125,10
- CONTROL "&Custom",IDC_DELAY_CUSTOM,"Button",BS_AUTORADIOBUTTON,
- 164,53,98,10
- EDITTEXT IDC_DELAY,267,51,21,14,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "P&ermanent",IDC_DELAY_PERMANENT,"Button",
- BS_AUTORADIOBUTTON,164,67,123,10
- PUSHBUTTON "Preview",IDC_PREVIEW,119,90,70,14
-END
-
-IDD_PASSWORD DIALOG DISCARDABLE 0, 0, 151, 63
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION
-CAPTION "Jabber Password"
-FONT 8, "MS Shell Dlg"
-BEGIN
- EDITTEXT IDC_JID,7,7,137,12,ES_READONLY | NOT WS_BORDER | NOT
- WS_TABSTOP
- EDITTEXT IDC_PASSWORD,7,22,137,12,ES_PASSWORD | ES_AUTOHSCROLL
- DEFPUSHBUTTON "OK",IDOK,23,42,50,14
- PUSHBUTTON "Cancel",IDCANCEL,77,42,50,14
-END
-
-IDD_USER_VCARD DIALOGEX 0, 0, 222, 140
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Nick name:",IDC_STATIC,5,8,51,8
- EDITTEXT IDC_NICKNAME,58,6,102,12,ES_AUTOHSCROLL
- LTEXT "First name:",IDC_STATIC,5,21,51,8
- EDITTEXT IDC_FIRSTNAME,58,19,102,12,ES_AUTOHSCROLL
- LTEXT "Last name:",IDC_STATIC,5,34,51,8
- EDITTEXT IDC_LASTNAME,58,32,102,12,ES_AUTOHSCROLL
- LTEXT "E-mail:",IDC_STATIC,5,47,51,8
- EDITTEXT IDC_EMAIL,58,45,102,12,ES_AUTOHSCROLL
- LTEXT "Gender:",IDC_STATIC,5,61,51,8
- COMBOBOX IDC_GENDER,58,59,55,52,CBS_DROPDOWN | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "Year of birth:",IDC_STATIC,120,61,53,8
- EDITTEXT IDC_AGE,176,59,27,12,ES_AUTOHSCROLL
- LTEXT "City:",IDC_STATIC,6,75,51,8
- EDITTEXT IDC_CITY,58,73,102,12,ES_AUTOHSCROLL
- LTEXT "School:",IDC_STATIC,5,88,51,8
- EDITTEXT IDC_SCHOOL,58,86,102,12,ES_AUTOHSCROLL
- LTEXT "Occupation:",IDC_STATIC,5,102,51,8
- COMBOBOX IDC_OCCUPATION,57,100,102,96,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
- LTEXT "Looking for:",IDC_STATIC,5,116,51,8
- COMBOBOX IDC_LOOKFOR,57,114,102,96,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "Voice chats",IDC_VOICECONVERSATIONS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,5,130,107,10
- CONTROL "Publicly visible status",IDC_PUBLICSTATUS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,112,130,107,10
- PUSHBUTTON "Save changes",IDC_SAVE,164,111,53,16
-END
-
-IDD_USER_CHANGEAVATAR DIALOGEX 0, 0, 180, 80
-STYLE DS_SETFONT | DS_3DLOOK | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-CAPTION "Avatar"
-BEGIN
- GROUPBOX "Avatar Options",IDC_STATIC,5,2,170,55
- CONTROL "Public avatar",IDC_PUBLICAVATAR,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,15,15,150,13
- PUSHBUTTON "OK",IDOK,115,62,60,13
-END
-
-
-IDD_USER_INFO DIALOG DISCARDABLE 0, 0, 222, 146
-STYLE DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "Tlen login:",IDC_STATIC,5,2,48,8
- EDITTEXT IDC_INFO_JID,53,2,73,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER
- LTEXT "Subscription:",IDC_STATIC,5,14,48,8,NOT WS_GROUP
- EDITTEXT IDC_SUBSCRIPTION,53,14,131,12,ES_READONLY | NOT WS_BORDER |
- NOT WS_TABSTOP
- LTEXT "School:",IDC_STATIC,5,44,48,8
- EDITTEXT IDC_SCHOOL,53,44,131,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER
- LTEXT "Occupation:",IDC_STATIC,5,56,48,8
- EDITTEXT IDC_OCCUPATION_TEXT,53,56,135,12,ES_AUTOHSCROLL |
- ES_READONLY | NOT WS_BORDER
- LTEXT "Looking for:",IDC_STATIC,5,68,48,8
- EDITTEXT IDC_LOOKFOR_TEXT,53,68,136,12,ES_AUTOHSCROLL |
- ES_READONLY | NOT WS_BORDER
- LTEXT "Software:",IDC_STATIC,5,100,48,8
- EDITTEXT IDC_SOFTWARE,54,100,140,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER | NOT WS_TABSTOP
- LTEXT "Version:",IDC_STATIC,5,112,48,8
- EDITTEXT IDC_VERSION,54,112,140,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER | NOT WS_TABSTOP
- LTEXT "System:",IDC_STATIC,5,124,48,8
- EDITTEXT IDC_SYSTEM,54,124,140,12,ES_AUTOHSCROLL | ES_READONLY |
- NOT WS_BORDER | NOT WS_TABSTOP
-END
-
-IDD_ADVSEARCH DIALOGEX 0, 0, 334, 178
-STYLE DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_BORDER
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Personal Information",IDC_PERSONALGROUP,7,7,156,164
- LTEXT "First name:",IDC_STATIC,15,22,50,8
- EDITTEXT IDC_FIRSTNAME,65,20,91,12,ES_AUTOHSCROLL
- LTEXT "Last name:",IDC_STATIC,15,37,50,8
- EDITTEXT IDC_LASTNAME,65,35,91,12,ES_AUTOHSCROLL
- LTEXT "Nickname:",IDC_STATIC,15,52,50,8
- EDITTEXT IDC_NICK,65,50,91,12,ES_AUTOHSCROLL
- LTEXT "E-mail:",IDC_STATIC,15,67,50,8
- EDITTEXT IDC_EMAIL,65,65,91,12,ES_AUTOHSCROLL
- LTEXT "Gender:",IDC_STATIC,15,85,50,8
- COMBOBOX IDC_GENDER,65,83,91,51,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "Age:",IDC_STATIC,15,100,50,8
- EDITTEXT IDC_AGEFROM,65,98,27,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "to",IDC_STATIC,98,100,21,8
- EDITTEXT IDC_AGETO,123,98,27,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "City:",IDC_STATIC,15,118,50,8
- EDITTEXT IDC_CITY,65,116,91,12,ES_AUTOHSCROLL
- LTEXT "Occupation:",IDC_STATIC,15,135,50,8
- COMBOBOX IDC_OCCUPATION,65,133,91,93,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
- LTEXT "School:",IDC_STATIC,15,150,50,8
- EDITTEXT IDC_SCHOOL,65,148,91,12,ES_AUTOHSCROLL
- GROUPBOX "Extra Search Criterias",IDC_EXTRAGROUP,171,7,156,67
- LTEXT "Status:",IDC_STATIC,177,22,50,8
- COMBOBOX IDC_STATUS,227,20,91,113,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "Looking for:",IDC_STATIC,177,37,50,8
- COMBOBOX IDC_LOOKFOR,227,35,91,172,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "Plan:",IDC_STATIC,177,52,50,8,WS_DISABLED
- COMBOBOX IDC_PLAN,227,50,91,113,CBS_DROPDOWNLIST | WS_DISABLED |
- WS_VSCROLL | WS_TABSTOP
-END
-
-IDD_VOICE DIALOG DISCARDABLE 0, 0, 151, 122
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "Tlen Voice Chat"
-FONT 8, "MS Shell Dlg"
-BEGIN
- CONTROL "",IDC_MICROPHONE,"MButtonClass",0x0,12,7,16,16,
- 0x18000000L
- CONTROL "",IDC_VUMETERIN,"Static",SS_OWNERDRAW,47,10,120,8
- CONTROL "",IDC_SPEAKER,"MButtonClass",0x0,12,29,16,16,
- 0x18000000L
- CONTROL "",IDC_VUMETEROUT,"Static",SS_OWNERDRAW,47,31,120,8
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,53,140,4
- LTEXT "Quality",IDC_STATIC,10,64,45,8
- COMBOBOX IDC_VCQUALITY,55,62,88,100,CBS_DROPDOWNLIST | WS_VSCROLL
- LTEXT "In",IDC_STATIC,10,80,25,8
- LTEXT "",IDC_BYTESIN,35,80,30,8
- LTEXT "Out",IDC_STATIC,90,80,25,8
- LTEXT "",IDC_BYTESOUT,115,80,30,8
- EDITTEXT IDC_STATUS,10,91,131,8,ES_CENTER | ES_AUTOHSCROLL |
- WS_DISABLED | NOT WS_BORDER
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,100,140,4
- PUSHBUTTON "Finish",IDCANCEL,50,106,50,14
-END
-
-IDD_ACCEPT_VOICE DIALOG DISCARDABLE 0, 0, 210, 70
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Tlen Voice Chat Invitation"
-FONT 8, "MS Shell Dlg"
-BEGIN
- DEFPUSHBUTTON "&Accept",IDC_ACCEPT,98,50,50,14
- PUSHBUTTON "Cancel",IDCANCEL,155,50,50,14
- LTEXT "From:",IDC_STATIC,25,24,60,8
- LTEXT "The following invitation to join a voice chat is received.",
- IDC_STATIC,3,4,204,8
- EDITTEXT IDC_FROM,85,20,100,12,ES_AUTOHSCROLL | ES_READONLY
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,3,40,203,4
-END
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION TLEN_FILEVERSION_STRING
- PRODUCTVERSION TLEN_FILEVERSION_STRING
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "041504e3"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "http://mtlen.berlios.de\0"
- VALUE "FileDescription", "Tlen Protocol Plugin for Miranda IM\0"
- VALUE "FileVersion", TLEN_VERSION_STRING
- VALUE "InternalName", "tlen\0"
- VALUE "LegalCopyright", "Copyright (c) 2002-2011 Santithorn Bunchua, Piotr Piastucki\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "tlen.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "Tlen Protocol Plugin\0"
- VALUE "ProductVersion", TLEN_VERSION_STRING
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x415, 1251
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_TLEN ICON DISCARDABLE "icos/tlen.ico"
-IDI_MAIL ICON DISCARDABLE "icos/mail.ico"
-IDI_MUC ICON DISCARDABLE "icos/groupchats.ico"
-IDI_CHATS ICON DISCARDABLE "icos/tlenchats.ico"
-IDI_GRANT ICON DISCARDABLE "icos/auth_grant.ico"
-IDI_REQUEST ICON DISCARDABLE "icos/auth_request.ico"
-IDI_VOICE ICON DISCARDABLE "icos/voicechat.ico"
-IDI_MICROPHONE ICON DISCARDABLE "icos/microphone.ico"
-IDI_SPEAKER ICON DISCARDABLE "icos/speaker.ico"
-IDI_IMAGE ICON DISCARDABLE "icos/image.ico"
-#endif // English (U.S.) resources
-
-
-
diff --git a/protocols/Tlen/tlen_10.vcxproj b/protocols/Tlen/tlen_10.vcxproj
deleted file mode 100644
index 606d56b8d8..0000000000
--- a/protocols/Tlen/tlen_10.vcxproj
+++ /dev/null
@@ -1,928 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug Ansi|x64">
- <Configuration>Debug Ansi</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Unicode|Win32">
- <Configuration>Debug Unicode</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Unicode|x64">
- <Configuration>Debug Unicode</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug x64|Win32">
- <Configuration>Debug x64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Ansi|Win32">
- <Configuration>Debug Ansi</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug x64|x64">
- <Configuration>Debug x64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Ansi|x64">
- <Configuration>Release Ansi</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Unicode|Win32">
- <Configuration>Release Unicode</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Unicode|x64">
- <Configuration>Release Unicode</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release x64|Win32">
- <Configuration>Release x64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Ansi|Win32">
- <Configuration>Release Ansi</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release x64|x64">
- <Configuration>Release x64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>tlen</ProjectName>
- <ProjectGuid>{33276462-8313-4192-8306-13717ECCA60A}</ProjectGuid>
- <RootNamespace>jabber</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">true</IgnoreImportLibrary>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">true</IgnoreImportLibrary>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">true</IgnoreImportLibrary>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">$(SolutionDir)$(Configuration)/Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">true</IgnoreImportLibrary>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_X64;X64;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_X64;X64;NDEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalOptions>/ALIGN:4096 /ignore:4108 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>false</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Precise</FloatingPointModel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>false</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Precise</FloatingPointModel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_X64;X64;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>false</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Precise</FloatingPointModel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/jabber.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;./ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_X64;X64;_DEBUG;_WINDOWS;_USRDLL;JABBER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>false</StringPooling>
- <ExceptionHandling>
- </ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Precise</FloatingPointModel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <PrecompiledHeaderFile>jabber.h</PrecompiledHeaderFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <BrowseInformationFile>
- </BrowseInformationFile>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0409</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;version.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
- <GenerateMapFile>false</GenerateMapFile>
- <MapFileName>
- </MapFileName>
- <BaseAddress>0x32500000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="crypto\aes.c" />
- <ClCompile Include="crypto\bignum.c" />
- <ClCompile Include="codec\gsm_codec.c" />
- <ClCompile Include="codec\gsm_long.c" />
- <ClCompile Include="codec\gsm_lpc.c" />
- <ClCompile Include="codec\gsm_preprocess.c" />
- <ClCompile Include="codec\gsm_rpe.c" />
- <ClCompile Include="codec\gsm_short.c" />
- <ClCompile Include="jabber_iq.c" />
- <ClCompile Include="jabber_iqid.c" />
- <ClCompile Include="jabber_list.c" />
- <ClCompile Include="jabber_misc.c" />
- <ClCompile Include="jabber_opt.c" />
- <ClCompile Include="jabber_svc.c" />
- <ClCompile Include="jabber_thread.c" />
- <ClCompile Include="jabber_util.c" />
- <ClCompile Include="jabber_ws.c" />
- <ClCompile Include="jabber_xml.c" />
- <ClCompile Include="crypto\padlock.c" />
- <ClCompile Include="tlen.c" />
- <ClCompile Include="tlen_advsearch.c" />
- <ClCompile Include="tlen_avatar.c" />
- <ClCompile Include="tlen_file.c" />
- <ClCompile Include="tlen_muc.c" />
- <ClCompile Include="tlen_p2p_new.c" />
- <ClCompile Include="tlen_p2p_old.c" />
- <ClCompile Include="tlen_picture.c" />
- <ClCompile Include="tlen_presence.c" />
- <ClCompile Include="tlen_userinfo.c" />
- <ClCompile Include="tlen_voice.c" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="tlen.rc" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="commons.h" />
- <ClInclude Include="crypto\polarssl\aes.h" />
- <ClInclude Include="crypto\polarssl\bignum.h" />
- <ClInclude Include="crypto\polarssl\bn_mul.h" />
- <ClInclude Include="crypto\polarssl\config.h" />
- <ClInclude Include="codec\gsm.h" />
- <ClInclude Include="jabber.h" />
- <ClInclude Include="jabber_iq.h" />
- <ClInclude Include="jabber_list.h" />
- <ClInclude Include="jabber_xml.h" />
- <ClInclude Include="crypto\polarssl\padlock.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="tlen_avatar.h" />
- <ClInclude Include="tlen_file.h" />
- <ClInclude Include="tlen_muc.h" />
- <ClInclude Include="tlen_p2p_new.h" />
- <ClInclude Include="tlen_p2p_old.h" />
- <ClInclude Include="tlen_picture.h" />
- <ClInclude Include="tlen_presence.h" />
- <ClInclude Include="tlen_voice.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="icos\auth_grant.ico" />
- <None Include="icos\auth_request.ico" />
- <None Include="icos\groupchats.ico" />
- <None Include="icos\image.ico" />
- <None Include="icos\mail.ico" />
- <None Include="icos\microphone.ico" />
- <None Include="icos\speaker.ico" />
- <None Include="icos\tlen.ico" />
- <None Include="icos\tlenbig.ico" />
- <None Include="icos\tlenchats.ico" />
- <None Include="icos\tlensmall.ico" />
- <None Include="icos\voicechat.ico" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/protocols/Tlen/tlen_advsearch.c b/protocols/Tlen/tlen_advsearch.c
deleted file mode 100644
index 5e3d5465b8..0000000000
--- a/protocols/Tlen/tlen_advsearch.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "resource.h"
-
-static void InitComboBox(HWND hwndCombo, JABBER_FIELD_MAP *fieldMap)
-{
- int i, n;
-
- n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T(""));
- SendMessage(hwndCombo, CB_SETITEMDATA, n, 0);
- SendMessage(hwndCombo, CB_SETCURSEL, n, 0);
- for(i=0;;i++) {
- if (fieldMap[i].name == NULL)
- break;
- n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateTS(fieldMap[i].name));
- SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id);
- }
-}
-
-INT_PTR CALLBACK TlenAdvSearchDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- InitComboBox(GetDlgItem(hwndDlg, IDC_GENDER), tlenFieldGender);
- InitComboBox(GetDlgItem(hwndDlg, IDC_LOOKFOR), tlenFieldLookfor);
- InitComboBox(GetDlgItem(hwndDlg, IDC_STATUS), tlenFieldStatus);
- InitComboBox(GetDlgItem(hwndDlg, IDC_OCCUPATION), tlenFieldOccupation);
- InitComboBox(GetDlgItem(hwndDlg, IDC_PLAN), tlenFieldPlan);
- return TRUE;
- }
- return FALSE;
-}
-
-static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
-{
- char text[512];
- char *localFieldName, *localText;
-
- if (hwndDlg==NULL || fieldName==NULL || str==NULL || strSize==NULL)
- return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text));
- if (text[0]) {
- if ((localFieldName=JabberTextEncode(fieldName)) != NULL) {
- if ((localText=JabberTextEncode(text)) != NULL) {
- JabberStringAppend(str, strSize, "<%s>%s</%s>", localFieldName, localText, localFieldName);
- mir_free(localText);
- }
- mir_free(localFieldName);
- }
- }
-}
-
-static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
-{
- int value;
- char *localFieldName;
-
- if (hwndDlg==NULL || fieldName==NULL || str==NULL || strSize==NULL)
- return;
- value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
- if (value > 0) {
- if ((localFieldName=JabberTextEncode(fieldName)) != NULL) {
- JabberStringAppend(str, strSize, "<%s>%d</%s>", localFieldName, value, localFieldName);
- mir_free(localFieldName);
- }
- }
-}
-
-char *TlenAdvSearchCreateQuery(HWND hwndDlg, int iqId)
-{
- char *str;
- int strSize;
-
- if (hwndDlg == NULL) return NULL;
- str = NULL;
- FetchField(hwndDlg, IDC_FIRSTNAME, "first", &str, &strSize);
- FetchField(hwndDlg, IDC_LASTNAME, "last", &str, &strSize);
- FetchField(hwndDlg, IDC_NICK, "nick", &str, &strSize);
- FetchField(hwndDlg, IDC_EMAIL, "email", &str, &strSize);
- FetchCombo(hwndDlg, IDC_GENDER, "s", &str, &strSize);
- FetchField(hwndDlg, IDC_AGEFROM, "d", &str, &strSize);
- FetchField(hwndDlg, IDC_AGETO, "u", &str, &strSize);
- FetchField(hwndDlg, IDC_CITY, "c", &str, &strSize);
- FetchCombo(hwndDlg, IDC_OCCUPATION, "j", &str, &strSize);
- FetchField(hwndDlg, IDC_SCHOOL, "e", &str, &strSize);
- FetchCombo(hwndDlg, IDC_STATUS, "m", &str, &strSize);
- FetchCombo(hwndDlg, IDC_LOOKFOR, "r", &str, &strSize);
- FetchCombo(hwndDlg, IDC_PLAN, "p", &str, &strSize);
- return str;
-}
diff --git a/protocols/Tlen/tlen_avatar.c b/protocols/Tlen/tlen_avatar.c
deleted file mode 100644
index e06c793344..0000000000
--- a/protocols/Tlen/tlen_avatar.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include <stdio.h>
-#include "jabber.h"
-#include "jabber_list.h"
-#include "tlen_avatar.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* TlenGetAvatarFileName() - gets a file name for the avatar image */
-
-void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, char* pszDest, int cbLen)
-{
- DWORD dwAttributes;
- int tPathLen;
- int format = PA_FORMAT_PNG;
- char* szFileType;
- char *tmpPath = Utils_ReplaceVars( "%miranda_avatarcache%" );
- tPathLen = mir_snprintf( pszDest, cbLen, "%s\\Tlen", tmpPath );
- mir_free(tmpPath);
- dwAttributes = GetFileAttributesA( pszDest );
- if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) {
- CallService( MS_UTILS_CREATEDIRTREE, 0, ( LPARAM )pszDest );
- }
- pszDest[ tPathLen++ ] = '\\';
- if (item != NULL) {
- format = item->avatarFormat;
- } else if (proto->threadData != NULL) {
- format = proto->threadData->avatarFormat;
- } else {
- format = DBGetContactSettingDword(NULL, proto->iface.m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
- }
- szFileType = "png";
- switch(format) {
- case PA_FORMAT_JPEG: szFileType = "jpg"; break;
- case PA_FORMAT_ICON: szFileType = "ico"; break;
- case PA_FORMAT_PNG: szFileType = "png"; break;
- case PA_FORMAT_GIF: szFileType = "gif"; break;
- case PA_FORMAT_BMP: szFileType = "bmp"; break;
- }
- if ( item != NULL ) {
- char* hash;
- hash = JabberSha1(item->jid);
- mir_snprintf( pszDest + tPathLen, MAX_PATH - tPathLen, "%s.%s", hash, szFileType );
- mir_free( hash );
- } else {
- mir_snprintf( pszDest + tPathLen, MAX_PATH - tPathLen, "%s_avatar.%s", proto->iface.m_szModuleName, szFileType );
- }
-}
-
-static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) {
- char tFileName[ MAX_PATH ];
- if (hContact == NULL) {
- proto->threadData->avatarHash[0] = '\0';
- }
- TlenGetAvatarFileName( proto, NULL, tFileName, sizeof tFileName );
- DeleteFileA(tFileName);
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "AvatarHash");
- DBDeleteContactSetting(hContact, proto->iface.m_szModuleName, "AvatarFormat");
- ProtoBroadcastAck(proto->iface.m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
-}
-
-static void SetAvatar(TlenProtocol *proto, HANDLE hContact, JABBER_LIST_ITEM *item, char *data, int len, DWORD format) {
- FILE* out;
- char filename[MAX_PATH];
- char md5[33];
- mir_md5_state_t ctx;
- DWORD digest[4];
-
- if (format == PA_FORMAT_UNKNOWN && len > 4) {
- format = JabberGetPictureType(data);
- }
-
- mir_md5_init( &ctx );
- mir_md5_append( &ctx, ( BYTE* )data, len);
- mir_md5_finish( &ctx, ( BYTE* )digest );
-
- sprintf( md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]));
- if (item != NULL) {
- char *hash = item->avatarHash;
- item->avatarFormat = format;
- item->avatarHash = mir_strdup(md5);
- mir_free(hash);
- } else {
- proto->threadData->avatarFormat = format;
- strcpy(proto->threadData->avatarHash, md5);
- }
- TlenGetAvatarFileName(proto, item, filename, sizeof filename );
- DeleteFileA(filename);
- out = fopen( filename, "wb" );
- if ( out != NULL ) {
- fwrite( data, len, 1, out );
- fclose( out );
- DBWriteContactSettingString(hContact, "ContactPhoto", "File", filename );
- DBWriteContactSettingString(hContact, proto->iface.m_szModuleName, "AvatarHash", md5);
- DBWriteContactSettingDword(hContact, proto->iface.m_szModuleName, "AvatarFormat", format);
- }
- ProtoBroadcastAck( proto->iface.m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0);
-}
-
-int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, JABBER_LIST_ITEM *item) {
- XmlNode *aNode;
- char *oldHash = NULL;
- char *md5 = NULL, *type = NULL;
- HANDLE hContact;
- hContact = NULL;
- if (item != NULL) {
- if ((hContact=JabberHContactFromJID(proto, item->jid)) == NULL) return 0;
- }
- if (item == NULL) {
- oldHash = proto->threadData->avatarHash;
- } else {
- oldHash = item->avatarHash;
- }
- if (avatarNode != NULL) {
- aNode = JabberXmlGetChild(avatarNode, "a");
- if (aNode != NULL) {
- type = JabberXmlGetAttrValue(aNode, "type");
- md5 = JabberXmlGetAttrValue(aNode, "md5");
- }
- }
- if (md5 != NULL) {
- /* check contact's avatar hash - md5 */
- if (oldHash == NULL || strcmp(oldHash, md5)) {
- if (item != NULL) {
- item->newAvatarDownloading = TRUE;
- }
- TlenGetAvatar(proto, hContact);
- return 1;
- }
- } else {
- /* remove avatar */
- if (oldHash != NULL) {
- if (item != NULL) {
- item->avatarHash = NULL;
- mir_free(oldHash);
- item->newAvatarDownloading = FALSE;
- }
- RemoveAvatar(proto, hContact);
- return 1;
- }
- }
- return 0;
-}
-
-void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, JABBER_LIST_ITEM *item) {
- HANDLE hContact;
- if ((hContact=JabberHContactFromJID(proto, item->jid)) == NULL) return;
- TlenProcessAvatarNode(proto, JabberXmlGetChild(node, "avatar"), item);
-}
-
-
-static char *replaceTokens(const char *base, const char *uri, const char *login, const char* token, int type, int access) {
- char *result;
- int i, l, size;
- l = (int)strlen(uri);
- size = (int)strlen(base);
- for (i = 0; i < l; ) {
- if (!strncmp(uri + i, "^login^", 7)) {
- size += (int)strlen(login);
- i += 7;
- } else if (!strncmp(uri + i, "^type^", 6)) {
- size++;
- i += 6;
- } else if (!strncmp(uri + i, "^token^", 7)) {
- size += (int)strlen(token);
- i += 7;
- } else if (!strncmp(uri + i, "^access^", 8)) {
- size++;
- i += 8;
- } else {
- size++;
- i++;
- }
- }
- result = (char *)mir_alloc(size +1);
- strcpy(result, base);
- size = (int)strlen(base);
- for (i = 0; i < l; ) {
- if (!strncmp(uri + i, "^login^", 7)) {
- strcpy(result + size, login);
- size += (int)strlen(login);
- i += 7;
- } else if (!strncmp(uri + i, "^type^", 6)) {
- result[size++] = '0' + type;
- i += 6;
- } else if (!strncmp(uri + i, "^token^", 7)) {
- strcpy(result + size, token);
- size += (int)strlen(token);
- i += 7;
- } else if (!strncmp(uri + i, "^access^", 8)) {
- result[size++] = '0' + access;
- i += 8;
- } else {
- result[size++] = uri[i++];
- }
- }
- result[size] = '\0';
- return result;
-}
-
-
-static int getAvatarMutex = 0;
-
-typedef struct {
- TlenProtocol *proto;
- HANDLE hContact;
-} TLENGETAVATARTHREADDATA;
-
-static void TlenGetAvatarThread(void *ptr) {
-
- JABBER_LIST_ITEM *item = NULL;
- NETLIBHTTPREQUEST req;
- NETLIBHTTPREQUEST *resp;
- TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)ptr;
- HANDLE hContact = data->hContact;
- char *request;
- char *login = NULL;
- if (hContact != NULL) {
- char *jid = JabberJIDFromHContact(data->proto, hContact);
- login = JabberNickFromJID(jid);
- item = JabberListGetItemPtr(data->proto, LIST_ROSTER, jid);
- mir_free(jid);
- } else {
- login = mir_strdup(data->proto->threadData->username);
- }
- if ((data->proto->threadData != NULL && hContact == NULL) || item != NULL) {
- DWORD format = PA_FORMAT_UNKNOWN;
- if (item!= NULL) {
- item->newAvatarDownloading = TRUE;
- }
- request = replaceTokens(data->proto->threadData->tlenConfig.mailBase, data->proto->threadData->tlenConfig.avatarGet, login, data->proto->threadData->avatarToken, 0, 0);
- ZeroMemory(&req, sizeof(req));
- req.cbSize = sizeof(req);
- req.requestType = data->proto->threadData->tlenConfig.avatarGetMthd;
- req.flags = 0;
- req.headersCount = 0;
- req.headers = NULL;
- req.dataLength = 0;
- req.szUrl = request;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)&req);
- if (item!= NULL) {
- item->newAvatarDownloading = FALSE;
- }
- if (resp != NULL) {
- if (resp->resultCode/100==2) {
- if (resp->dataLength > 0) {
- int i;
- for (i=0; i<resp->headersCount; i++ ) {
- if (strcmpi(resp->headers[i].szName, "Content-Type")==0) {
- if (strcmpi(resp->headers[i].szValue, "image/png")==0) {
- format = PA_FORMAT_PNG;
- } else if (strcmpi(resp->headers[i].szValue, "image/x-png")==0) {
- format = PA_FORMAT_PNG;
- } else if (strcmpi(resp->headers[i].szValue, "image/jpeg")==0) {
- format = PA_FORMAT_JPEG;
- } else if (strcmpi(resp->headers[i].szValue, "image/jpg")==0) {
- format = PA_FORMAT_JPEG;
- } else if (strcmpi(resp->headers[i].szValue, "image/gif")==0) {
- format = PA_FORMAT_GIF;
- } else if (strcmpi(resp->headers[i].szValue, "image/bmp")==0) {
- format = PA_FORMAT_BMP;
- }
- break;
- }
- }
- SetAvatar(data->proto, hContact, item, resp->pData, resp->dataLength, format);
- } else {
- RemoveAvatar(data->proto, hContact);
- }
- }
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
- }
- mir_free(request);
- mir_free(login);
- }
- if (hContact == NULL) {
- getAvatarMutex = 0;
- }
- mir_free(data);
-}
-
-void TlenGetAvatar(TlenProtocol *proto, HANDLE hContact) {
- if (hContact == NULL) {
- if (getAvatarMutex != 0) {
- return;
- }
- getAvatarMutex = 1;
- }
- {
- TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)mir_alloc(sizeof(TLENGETAVATARTHREADDATA));
- data->proto = proto;
- data->hContact = hContact;
- JabberForkThread(TlenGetAvatarThread, 0, data);
- }
-}
-
-typedef struct {
- TlenProtocol *proto;
- NETLIBHTTPREQUEST *req;
-}TLENREMOVEAVATARTHREADDATA;
-
-static void TlenRemoveAvatarRequestThread(void *ptr) {
- NETLIBHTTPREQUEST *resp;
- TLENREMOVEAVATARTHREADDATA *data = ptr;
- NETLIBHTTPREQUEST *req = (NETLIBHTTPREQUEST *)data->req;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)req);
- mir_free(req->szUrl);
- mir_free(req->headers);
- mir_free(req->pData);
- mir_free(req);
- if (resp != NULL) {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)resp);
- RemoveAvatar(data->proto, NULL);
- }
- mir_free(data);
-
-}
-
-typedef struct {
- TlenProtocol *proto;
- NETLIBHTTPREQUEST *req;
- char *data;
- int length;
-}TLENUPLOADAVATARTHREADDATA;
-
-static void TlenUploadAvatarRequestThread(void *ptr) {
- NETLIBHTTPREQUEST *resp;
- TLENUPLOADAVATARTHREADDATA * data = (TLENUPLOADAVATARTHREADDATA *) ptr;
- NETLIBHTTPREQUEST *req = data->req;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)req);
- if (resp != NULL) {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)resp);
- SetAvatar(data->proto, NULL, NULL, data->data, data->length, PA_FORMAT_PNG);
- }
- mir_free(req->szUrl);
- mir_free(req->headers);
- mir_free(req->pData);
- mir_free(req);
- mir_free(data->data);
- mir_free(data);
-}
-
-void TlenRemoveAvatar(TlenProtocol *proto) {
- NETLIBHTTPREQUEST *req;
- char *request;
- if (proto->threadData != NULL) {
- TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA *)mir_alloc(sizeof(TLENREMOVEAVATARTHREADDATA));
- req = (NETLIBHTTPREQUEST *)mir_alloc(sizeof(NETLIBHTTPREQUEST));
- data->proto =proto;
- data->req = req;
- request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarRemove, "", proto->threadData->avatarToken, 0, 0);
- ZeroMemory(req, sizeof(NETLIBHTTPREQUEST));
- req->cbSize = sizeof(NETLIBHTTPREQUEST);
- req->requestType = proto->threadData->tlenConfig.avatarGetMthd;
- req->szUrl = request;
- JabberForkThread(TlenRemoveAvatarRequestThread, 0, data);
- }
-}
-
-
-void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access) {
- NETLIBHTTPREQUEST *req;
- NETLIBHTTPHEADER *headers;
- TLENUPLOADAVATARTHREADDATA *threadData;
- char *request;
- unsigned char *buffer;
- if (proto->threadData != NULL && dataLen > 0 && data != NULL) {
- char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n";
- char *mpartTail = "\r\n--AaB03x--\r\n";
- int size, sizeHead = (int)strlen(mpartHead), sizeTail = (int)strlen(mpartTail);
- request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarUpload, "", proto->threadData->avatarToken, 0, access);
- threadData = (TLENUPLOADAVATARTHREADDATA *)mir_alloc(sizeof(TLENUPLOADAVATARTHREADDATA));
- threadData->proto = proto;
- req = (NETLIBHTTPREQUEST *)mir_alloc(sizeof(NETLIBHTTPREQUEST));
- headers = (NETLIBHTTPHEADER *)mir_alloc(sizeof(NETLIBHTTPHEADER));
- ZeroMemory(req, sizeof(NETLIBHTTPREQUEST));
- req->cbSize = sizeof(NETLIBHTTPREQUEST);
- req->requestType = proto->threadData->tlenConfig.avatarUploadMthd;
- req->szUrl = request;
- req->flags = 0;
- headers[0].szName = "Content-Type";
- headers[0].szValue = "multipart/form-data; boundary=AaB03x";
- req->headersCount = 1;
- req->headers = headers;
- size = dataLen + sizeHead + sizeTail;
- buffer = mir_alloc(size);
- memcpy(buffer, mpartHead, sizeHead);
- memcpy(buffer + sizeHead, data, dataLen);
- memcpy(buffer + sizeHead + dataLen, mpartTail, sizeTail);
- req->dataLength = size;
- req->pData = buffer;
- threadData->req = req;
- threadData->data = (char *) mir_alloc(dataLen);
- memcpy(threadData->data, data, dataLen);
- threadData->length = dataLen;
- JabberForkThread(TlenUploadAvatarRequestThread, 0, threadData);
- }
-}
-
diff --git a/protocols/Tlen/tlen_avatar.h b/protocols/Tlen/tlen_avatar.h
deleted file mode 100644
index 48a258ed38..0000000000
--- a/protocols/Tlen/tlen_avatar.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _TLEN_AVATAR_H_
-#define _TLEN_AVATAR_H_
-
-void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, JABBER_LIST_ITEM *item);
-int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, JABBER_LIST_ITEM *item);
-void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, char* pszDest, int cbLen);
-void TlenGetAvatar(TlenProtocol *proto, HANDLE hContact);
-void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access);
-void TlenRemoveAvatar(TlenProtocol *proto);
-
-#endif // TLEN_AVATAR_H_INCLUDED
diff --git a/protocols/Tlen/tlen_czaty/AdminWindow.cpp b/protocols/Tlen/tlen_czaty/AdminWindow.cpp
deleted file mode 100644
index a29c6fa2f2..0000000000
--- a/protocols/Tlen/tlen_czaty/AdminWindow.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "AdminWindow.h"
-#include "Utils.h"
-
-
-static INT_PTR CALLBACK UserKickDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int i;
- const char *banOptions[]={"No ban", "1 minute", "5 minutes", "15 minutes", "30 minutes",
- "1 hour", "6 hours", "1 day", "3 days", "1 week", "2 weeks", "4 weeks"};
- const int banTime[] = {0, 1, 5, 15, 30, 60, 360, 1440, 4320, 10080, 20160, 40320};
- const char *roleOptions[]={"No role", "Member", "Admin", "Moderator"};
- const int roleMask[] = {0, MUCC_EF_USER_MEMBER, MUCC_EF_USER_ADMIN, MUCC_EF_USER_MODERATOR};
- AdminWindow *adminWindow;
- adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- adminWindow = (AdminWindow *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow);
- adminWindow->setKickTabHWND(hwndDlg);
- for (i=0;i<12;i++) {
- SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_ADDSTRING, 0, (LPARAM) banOptions[i]);
- }
- SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_SETCURSEL, 0, 0);
- for (i=0;i<3;i++) {
- SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_ADDSTRING, 0, (LPARAM) roleOptions[i]);
- }
- SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_SETCURSEL, 0, 0);
- SetDlgItemTextA(hwndDlg, IDC_NICK, adminWindow->getNick());
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- {
- char nick[256], reason[256];
- GetDlgItemTextA(hwndDlg, IDC_NICK, nick, sizeof(nick));
- GetDlgItemTextA(hwndDlg, IDC_REASON, reason, sizeof(reason));
- if (strlen(nick)>0) {
- int iSel = SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_GETCURSEL, 0, 0);
- if (iSel>=0 && iSel<12) {
- adminWindow->getParent()->kickAndBan(nick, banTime[iSel] * 60, reason);
- }
- }
- }
-// EndDialog(hwndDlg, 1);
-// return TRUE;
- break;
- case IDC_SET_ROLE:
- {
- char nick[256];
- GetDlgItemTextA(hwndDlg, IDC_NICK, nick, sizeof(nick));
- if (strlen(nick)>0) {
- int iSel = SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_GETCURSEL, 0, 0);
- if (iSel>=0 && iSel<3) {
- adminWindow->getParent()->setRights(nick, roleMask[iSel]);
- }
- }
- }
- break;
-// EndDialog(hwndDlg, 1);
-// return TRUE;
- case IDCANCEL:
-// EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
-// EndDialog(hwndDlg, 0);
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK UserBrowserDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{ int i;
- const char *browseOptions[]={"Banned", "Owners", "Administrators", "Members", "Moderators"};
- const int browserFlags[]={MUCC_EF_USER_BANNED, MUCC_EF_USER_OWNER, MUCC_EF_USER_ADMIN, MUCC_EF_USER_MEMBER, MUCC_EF_USER_MODERATOR};
- LVCOLUMN lvCol;
- HWND lv;
- AdminWindow *adminWindow;
- adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- adminWindow = (AdminWindow *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow);
- adminWindow->setBrowserTabHWND(hwndDlg);
- lv = GetDlgItem(hwndDlg, IDC_LIST);
- ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT);
- lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
- lvCol.pszText = TranslateT("Login");
- lvCol.cx = 80;
- lvCol.iSubItem = 0;
- ListView_InsertColumn(lv, 0, &lvCol);
- lvCol.pszText = TranslateT("Nick name");
- lvCol.cx = 80;
- lvCol.iSubItem = 1;
- ListView_InsertColumn(lv, 1, &lvCol);
- lvCol.pszText = TranslateT("When");
- lvCol.cx = 95;
- lvCol.iSubItem = 2;
- ListView_InsertColumn(lv, 2, &lvCol);
- lvCol.pszText = TranslateT("Admin");
- lvCol.cx = 80;
- lvCol.iSubItem = 2;
- ListView_InsertColumn(lv, 3, &lvCol);
- lvCol.pszText = TranslateT("Reason");
- lvCol.cx = 70;
- lvCol.iSubItem = 2;
- ListView_InsertColumn(lv, 5, &lvCol);
- lvCol.pszText = TranslateT("Remaining");
- lvCol.cx = 80;
- lvCol.iSubItem = 2;
- ListView_InsertColumn(lv, 4, &lvCol);
- for (i=0;i<(adminWindow->getParent()->getRoomFlags() & MUCC_EF_ROOM_MEMBERS_ONLY ? 4 : 3);i++) {
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_ADDSTRING, 0, (LPARAM) browseOptions[i]);
- }
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_SETCURSEL, 0, 0);
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_SHOW:
- int iSel;
- iSel = SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_GETCURSEL, 0, 0);
- if (iSel< 5) {
- adminWindow->queryUsers(browserFlags[iSel]);
- }
- break;
-// return TRUE;
- case IDCANCEL:
-// EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
-// EndDialog(hwndDlg, 0);
- break;
- case WM_MEASUREITEM:
- if (wParam == IDC_LIST) {
- MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam;
- lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON);
- return TRUE;
- }
- break;
- case WM_DRAWITEM:
- if (wParam == IDC_LIST) {
- RECT rc;
- int x, w;
- TCHAR text[256];
- DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam;
- switch (lpDis->itemAction) {
- default:
- case ODA_SELECT:
- case ODA_DRAWENTIRE:
- if (lpDis->itemState & ODS_SELECTED) {
- HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2);
- FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1));
- DeleteObject(hBrush);
- SetTextColor(lpDis->hDC, 0);
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- else {
- FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1));
- SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT));
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- x = lpDis->rcItem.left + 1;
- for (int col=0;col<6;col++) {
- w = ListView_GetColumnWidth(GetDlgItem(hwndDlg, IDC_LIST), col);
- rc.left = x;
- rc.top = lpDis->rcItem.top;
- rc.bottom = lpDis->rcItem.bottom;
- rc.right = x+w-2;
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, col, text, sizeof(text)/sizeof(TCHAR));
- if (_tcslen(text)==0) {
- _tcscpy(text, _TEXT("-"));
- }
- DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- x+=w;
- }
- break;
- }
- }
- break;
- case WM_NOTIFY:
- LPNMHDR pNmhdr;
- pNmhdr = (LPNMHDR)lParam;
- if (pNmhdr->idFrom == IDC_LIST && adminWindow->getBrowserMode() == MUCC_EF_USER_BANNED) {
- switch (pNmhdr->code) {
- case NM_RCLICK:
- {
- LVHITTESTINFO hti;
- int hitItem;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(pNmhdr->hwndFrom, &hti.pt);
- if ((hitItem = ListView_HitTest(pNmhdr->hwndFrom,&hti)) !=-1) {
- LVITEM lvi = {0};
- HMENU hMenu;
- int iSelection;
- TCHAR nick[256];
- lvi.mask = TVIF_TEXT;
- lvi.iItem = hitItem;
- lvi.iSubItem = 0;
- lvi.pszText = nick;
- lvi.cchTextMax = sizeof(nick)/sizeof(TCHAR);
- ListView_GetItem(pNmhdr->hwndFrom, &lvi);
- hMenu=GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)), 3);
- CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0);
- iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, NULL);
- DestroyMenu(hMenu);
- if (iSelection == ID_USERMENU_UNBAN) {
- char* lps1 = Utils::mucc_mir_t2a(nick);
- adminWindow->getParent()->unban(lps1);
- Utils::mucc_mir_free(lps1);
- }
- }
-
- }
- break;
- }
- }
-
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK AdminDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwnd;
- TCITEM tci;
- HWND tc;
- AdminWindow *adminWindow;
- adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- adminWindow = (AdminWindow *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_ADMINISTRATION]);
-
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USER_KICK), hwndDlg, UserKickDlgProc, (LPARAM) adminWindow);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- ShowWindow(hwnd, SW_SHOW);
-
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USER_BROWSER), hwndDlg, UserBrowserDlgProc, (LPARAM) adminWindow);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- adminWindow->setCurrentTab(0);
- adminWindow->setHWND(hwndDlg);
-
- tc = GetDlgItem(hwndDlg, IDC_TABS);
- tci.mask = TCIF_TEXT;
- tci.pszText = TranslateT("Administration");
- TabCtrl_InsertItem(tc, 0, &tci);
- tci.pszText = TranslateT("Browser");
- TabCtrl_InsertItem(tc, 1, &tci);
-
- return FALSE;
- case WM_NOTIFY:
- switch (wParam) {
- case IDC_TABS:
- switch (((LPNMHDR) lParam)->code) {
- case TCN_SELCHANGE:
- switch (adminWindow->getCurrentTab()) {
- case 0:
- ShowWindow(adminWindow->getKickTabHWND(), SW_HIDE);
- break;
- case 1:
- ShowWindow(adminWindow->getBrowserTabHWND(), SW_HIDE);
- break;
- }
- adminWindow->setCurrentTab(TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)));
- switch (adminWindow->getCurrentTab()) {
- case 0:
- ShowWindow(adminWindow->getKickTabHWND(), SW_SHOW);
- break;
- case 1:
- ShowWindow(adminWindow->getBrowserTabHWND(), SW_SHOW);
- break;
- }
- break;
- }
- break;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- delete adminWindow;
- // EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- delete adminWindow;
- // EndDialog(hwndDlg, 0);
- break;
- }
- return FALSE;
-}
-
-
-
-AdminWindow::AdminWindow(ChatWindow *parent, const char *nick, int mode) {
- this->parent = parent;
- hWnd = NULL;
- browserMode = 0;
- this->nick = NULL;
- Utils::copyString(&this->nick, nick);
-}
-
-AdminWindow::~AdminWindow() {
-
- if (hWnd != NULL) {
- EndDialog(hWnd, 0);
- }
- if (parent != NULL) {
- parent->setAdminWindow(NULL);
- }
- if (nick != NULL) {
- delete nick;
- }
-}
-
-void AdminWindow::start() {
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_ADMIN), NULL, AdminDlgProc, (LPARAM) this);
-}
-
-void AdminWindow::setHWND(HWND hWnd) {
- this->hWnd = hWnd;
-}
-
-void AdminWindow::setCurrentTab(int t) {
- currentTab = t;
-}
-
-int AdminWindow::getCurrentTab() {
- return currentTab;
-}
-
-
-void AdminWindow::setKickTabHWND(HWND hWnd) {
- hKickTabWnd = hWnd;
-}
-
-void AdminWindow::setBrowserTabHWND(HWND hWnd) {
- hBrowserTabWnd = hWnd;
-}
-
-HWND AdminWindow::getKickTabHWND() {
- return hKickTabWnd;
-}
-
-HWND AdminWindow::getBrowserTabHWND() {
- return hBrowserTabWnd;
-}
-
-void AdminWindow::queryUsers(int queryType) {
- MUCCEVENT muce;
- EnableWindow(GetDlgItem(getBrowserTabHWND(), IDC_SHOW), FALSE);
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_USERS;
- muce.pszModule = parent->getModule();
- muce.pszID = parent->getRoomId();
- muce.dwFlags = queryType;
- browserMode = queryType;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
-}
-
-ChatWindow * AdminWindow::getParent() {
- return parent;
-}
-
-void AdminWindow::queryResultUsers(MUCCQUERYRESULT *queryResult) {
- ListView_DeleteAllItems(GetDlgItem(getBrowserTabHWND(), IDC_LIST));
- for (int i=0;i<queryResult->iItemsNum;i++) {
-
- char timestampStr[100];
- DBTIMETOSTRING dbtts;
- LVITEM lvItem;
-
- lvItem.mask = LVIF_TEXT;// | LVIF_PARAM;
- lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetItemCount(GetDlgItem(getBrowserTabHWND(), IDC_LIST));
- lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszID);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
-// lvItem.lParam = (LPARAM) room;
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- Utils::mucc_mir_free(lvItem.pszText);
-
- lvItem.iSubItem = 1;
- lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText);
- Utils::mucc_mir_free(lvItem.pszText);
-
- lvItem.iSubItem = 2;
- dbtts.cbDest = 90;
- dbtts.szDest = timestampStr;
- dbtts.szFormat = (char *)"d t";
- timestampStr[0]='\0';
- if (queryResult->pItems[i].dwFlags) {
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)queryResult->pItems[i].dwFlags, (LPARAM) & dbtts);
- }
- lvItem.pszText = Utils::mucc_mir_a2t(timestampStr);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText);
- Utils::mucc_mir_free(lvItem.pszText);
-
- lvItem.iSubItem = 3;
- lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszNick);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText);
- Utils::mucc_mir_free(lvItem.pszText);
-
- lvItem.iSubItem = 4;
- timestampStr[0] = '\0';
- if (queryResult->pItems[i].iCount > 0) {
- int days = queryResult->pItems[i].iCount / (60*60*24);
- int hours = (queryResult->pItems[i].iCount % (60*60*24)) / (60*60);
- int minutes = (queryResult->pItems[i].iCount % (60*60)) / 60;
- int seconds = queryResult->pItems[i].iCount % 60;
- if (days != 0) {
- sprintf(timestampStr, "%dd%dh%dm%ds", days, hours, minutes, seconds);
- } else if (hours != 0) {
- sprintf(timestampStr, "%dh%dm%ds", hours, minutes, seconds);
- } else if (minutes != 0) {
- sprintf(timestampStr, "%dm%ds", minutes, seconds);
- } else {
- sprintf(timestampStr, "%ds", seconds);
- }
- }
- lvItem.pszText = Utils::mucc_mir_a2t(timestampStr);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText);
- Utils::mucc_mir_free(lvItem.pszText);
-
- lvItem.iSubItem = 5;
- lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszText);
- if (lvItem.pszText == NULL) lvItem.pszText = _TEXT("");
- ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem);
- ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText);
- Utils::mucc_mir_free(lvItem.pszText);
-
-/*
- ptr = new HelperContact(queryResult->pItems[i].pszID, queryResult->pItems[i].pszName);
- if (lastptr !=NULL) {
- lastptr->setNext(ptr);
- } else {
- contactList=ptr;
- }
- lastptr=ptr;
-
- */
- }
- EnableWindow(GetDlgItem(getBrowserTabHWND(), IDC_SHOW), TRUE);
-}
-
-const char *AdminWindow::getNick() {
- return nick;
-}
-
-int AdminWindow::getBrowserMode() {
- return browserMode;
-}
diff --git a/protocols/Tlen/tlen_czaty/AdminWindow.h b/protocols/Tlen/tlen_czaty/AdminWindow.h
deleted file mode 100644
index a73cdb9285..0000000000
--- a/protocols/Tlen/tlen_czaty/AdminWindow.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-class AdminWindow;
-#ifndef ADMINWINDOW_INCLUDED
-#define ADMINWINDOW_INCLUDED
-
-#include "mucc.h"
-#include "ChatWindow.h"
-
-class AdminWindow {
-private:
- HWND hWnd;
- HWND hKickTabWnd, hBrowserTabWnd;
- int currentTab;
- int browserMode;
- ChatWindow *parent;
- char *nick;
-public:
- enum BROWSER_MODE {
- BROWSE_BANNED = 1,
- BROWSE_OWNERS = 2,
- BROWSE_ADMINS = 3,
- BROWSE_MEMBERS = 4,
- BROWSE_MODERATORS = 5
- };
- AdminWindow (ChatWindow *parent, const char *nick, int mode);
- ~AdminWindow();
- void start();
- void setHWND(HWND);
- void setKickTabHWND(HWND);
- void setBrowserTabHWND(HWND);
- HWND getKickTabHWND();
- HWND getBrowserTabHWND();
- int getCurrentTab();
- int getBrowserMode();
- void setCurrentTab(int);
- void queryUsers(int);
- ChatWindow* getParent();
- const char *getNick();
- void queryResultUsers(MUCCQUERYRESULT *queryResult);
-};
-
-#endif
-
diff --git a/protocols/Tlen/tlen_czaty/ChatContainer.cpp b/protocols/Tlen/tlen_czaty/ChatContainer.cpp
deleted file mode 100644
index 11e523e337..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatContainer.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatContainer.h"
-#include "Utils.h"
-#include "Options.h"
-
-#define DM_CREATECHILD (WM_USER+10)
-#define DM_ADDCHILD (WM_USER+11)
-#define DM_ACTIVATECHILD (WM_USER+12)
-#define DM_CHANGECHILDDATA (WM_USER+13)
-#define DM_REMOVECHILD (WM_USER+14)
-
-#define DM_SETUNREAD (WM_USER+15)
-#define DM_FLASHWINDOW (WM_USER+16)
-
-#define TIMERID_FLASHWND 1
-#define TIMEOUT_FLASHWND 900
-
-ChatContainer * ChatContainer::list = NULL;
-bool ChatContainer::released = false;
-CRITICAL_SECTION ChatContainer::mutex;
-
-//BOOL CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static void __cdecl StartThread(void *vContainer);
-
-void ChatContainer::release() {
- released = true;
- for (ChatContainer *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) {
- ptr2 = ptr->getNext();
- SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0);
- }
- DeleteCriticalSection(&mutex);
-}
-
-void ChatContainer::init() {
- released = false;
- InitializeCriticalSection(&mutex);
-}
-
-int ChatContainer::getDefaultOptions() {
- return FLAG_USE_TABS;
-}
-
-ChatContainer * ChatContainer::getWindow() {
- ChatContainer *ptr;
- EnterCriticalSection(&mutex);
- if (list == NULL || !(Options::getChatContainerOptions() & ChatContainer::FLAG_USE_TABS)) {
- ptr = new ChatContainer();
- } else {
- ptr = list;
- }
- LeaveCriticalSection(&mutex);
- return ptr;
-}
-
-ChatContainer::ChatContainer() {
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- hWnd = NULL;
- prev = next =NULL;
- active = NULL;
- childCount = 0;
- nFlash = 0;
- nFlashMax = 3;
- Utils::forkThread((void (__cdecl *)(void *))StartThread, 0, (void *) this);
- WaitForSingleObject(hEvent, INFINITE);
- EnterCriticalSection(&mutex);
- setNext(list);
- if (next!=NULL) {
- next->setPrev(this);
- }
- list = this;
- LeaveCriticalSection(&mutex);
-}
-
-ChatContainer::~ChatContainer() {
- if (!released) {
- EnterCriticalSection(&mutex);
- if (getPrev()!=NULL) {
- getPrev()->setNext(next);
- } else if (list==this) {
- list = getNext();
- }
- if (getNext()!=NULL) {
- getNext()->setPrev(prev);
- }
- LeaveCriticalSection(&mutex);
- }
- if (hEvent!=NULL) {
- CloseHandle(hEvent);
- }
-}
-
-void ChatContainer::setHWND(HWND hWnd) {
- this->hWnd = hWnd;
-}
-
-HWND ChatContainer::getHWND() {
- return hWnd;
-}
-
-HANDLE ChatContainer::getEvent() {
- return hEvent;
-}
-
-ChatContainer * ChatContainer::getNext() {
- return next;
-}
-
-void ChatContainer::setNext(ChatContainer * next) {
- this->next = next;
-}
-
-ChatContainer * ChatContainer::getPrev() {
- return prev;
-}
-
-void ChatContainer::setPrev(ChatContainer * prev) {
- this->prev = prev;
-}
-
-void ChatContainer::show(bool bShow) {
- ShowWindow(hWnd, bShow ? SW_SHOW : SW_HIDE);
-}
-
-ChatWindow * ChatContainer::getActive() {
- return active;
-}
-
-int ChatContainer::getFlash() {
- return nFlash;
-}
-
-int ChatContainer::getFlashMax() {
- return nFlashMax;
-}
-
-int ChatContainer::getFlashTimeout() {
- return TIMEOUT_FLASHWND;
-}
-
-void ChatContainer::setFlash(int n) {
- nFlash = n;
-}
-
-void ChatContainer::activateChild(ChatWindow *window) {
- RECT rcChild;
- getChildWindowRect(&rcChild);
- if (window!=NULL) {
- SetWindowPos(window->getHWND(), HWND_TOP, rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, SWP_NOSIZE);
- }
- if(window != active) {
- ChatWindow *prev = active;
- active = window;
- SendMessage(hWnd, WM_SIZE, 0, 0);
- ShowWindow(active->getHWND(), SW_SHOW);
-// SendMessage(active->getHWND(), DM_UPDATETITLE, 0, 0);
- if (prev!=NULL) {
- ShowWindow(prev->getHWND(), SW_HIDE);
- }
- SetWindowTextA(hWnd, window->getRoomName());
- }
- TCITEM tci;
- tci.mask = TCIF_IMAGE;
- tci.iImage = -1;
- TabCtrl_SetItem(GetDlgItem(hWnd, IDC_TABS), getChildTab(window), &tci);
- SendMessage(active->getHWND(), WM_ACTIVATE, WA_ACTIVE, 0);
- SetFocus(active->getHWND());
-}
-
-
-void ChatContainer::addChild(ChatWindow *child) {
- TCITEM tci;
- int tabId;
- HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
- childCount++;
- tci.mask = TCIF_TEXT | TCIF_PARAM;
- LPTSTR lps1 = Utils::mucc_mir_a2t(child->getRoomName());
- tci.pszText = lps1;
- tci.lParam = (LPARAM) child;
- tabId = TabCtrl_InsertItem(hwndTabs, childCount-1, &tci);
- TabCtrl_SetCurSel(hwndTabs, tabId);
- Utils::mucc_mir_free(lps1);
- activateChild(child);
- SendMessage(hWnd, WM_SIZE, 0, 0);
- ShowWindow(hWnd, SW_SHOWNORMAL);
- SetForegroundWindow(hWnd);
-}
-
-void ChatContainer::changeChildData(ChatWindow *child) {
- int tabId;
- HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
- tabId = getChildTab(child);
- if (tabId >=0) {
- TCITEM tci;
- tci.mask = TCIF_TEXT;
- LPTSTR lps1 = Utils::mucc_mir_a2t(child->getRoomName());
- tci.pszText = lps1;
- TabCtrl_SetItem(hwndTabs, childCount-1, &tci);
- Utils::mucc_mir_free(lps1);
- }
- if (child == active) {
- SetWindowTextA(hWnd, child->getRoomName());
- }
-}
-
-
-void ChatContainer::removeChild(ChatWindow *child) {
- HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
- int iSel = getChildTab(child);
- if (iSel >= 0) {
- TabCtrl_DeleteItem(hwndTabs, iSel);
- }
- childCount--;
- if (childCount > 0) {
- TCITEM tci;
- if (iSel == childCount) iSel--;
- TabCtrl_SetCurSel(hwndTabs, iSel);
- tci.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) {
- child = (ChatWindow *)tci.lParam;
- activateChild(child);
- }
- } else {//if (!released) {
- SendMessage(hWnd, WM_CLOSE, 0, 0);
- }
-}
-
-void ChatContainer::setUnread(ChatWindow *child, int unread) {
- if (!unread || child != active) {
- TCITEM tci;
- tci.mask = TCIF_IMAGE;
- if (unread) {
- tci.iImage = 0;
- } else {
- tci.iImage = -1;
- }
- TabCtrl_SetItem(GetDlgItem(hWnd, IDC_TABS), getChildTab(child), &tci);
- }
-}
-
-
-void ChatContainer::getChildWindowRect(RECT *rcChild)
-{
- RECT rc, rcTabs; //rcStatus,
- HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
- int l = TabCtrl_GetItemCount(hwndTabs);
- GetClientRect(hWnd, &rc);
- GetClientRect(hwndTabs, &rcTabs);
- TabCtrl_AdjustRect(hwndTabs, FALSE, &rcTabs);
-// GetWindowRect(dat->hwndStatus, &rcStatus);
- rcChild->left = 0;
- rcChild->right = rc.right;
- if (l > 1) {
- rcChild->top = rcTabs.top - 1;
- } else {
- rcChild->top = 0;
- }
- rcChild->bottom = rc.bottom - rc.top;// - (rcStatus.bottom - rcStatus.top);
-}
-
-ChatWindow * ChatContainer::getChildFromTab(int tabId) {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hWnd, IDC_TABS), tabId, &tci);
- return (ChatWindow *)tci.lParam;
-}
-
-int ChatContainer::getChildTab(ChatWindow *child) {
- TCITEM tci;
- int l, i;
- HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
- l = TabCtrl_GetItemCount(hwndTabs);
- for (i = 0; i < l; i++) {
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTabs, i, &tci);
- if (child == (ChatWindow *) tci.lParam) {
- return i;
- }
- }
- return -1;
-
-}
-
-HWND ChatContainer::remoteCreateChild(DLGPROC proc, ChatWindow *ptr) {
- return (HWND) SendMessage(hWnd, DM_CREATECHILD, (WPARAM)proc, (LPARAM) ptr);
-}
-
-void ChatContainer::remoteAddChild(ChatWindow *ptr) {
- SendMessage(hWnd, DM_ADDCHILD, (WPARAM)0, (LPARAM) ptr);
-}
-
-void ChatContainer::remoteChangeChildData(ChatWindow *ptr) {
- SendMessage(hWnd, DM_CHANGECHILDDATA, (WPARAM)0, (LPARAM) ptr);
-}
-
-void ChatContainer::remoteRemoveChild(ChatWindow *ptr) {
- SendMessage(hWnd, DM_REMOVECHILD, (WPARAM)0, (LPARAM) ptr);
-}
-
-void ChatContainer::remoteSetUnread(ChatWindow *ptr, int unread) {
- SendMessage(hWnd, DM_SETUNREAD, (WPARAM)unread, (LPARAM) ptr);
-}
-
-void ChatContainer::remoteFlashWindow() {
- SendMessage(hWnd, DM_FLASHWINDOW, 0, 0);
-}
-
-INT_PTR CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- ChatContainer *container;
- container = (ChatContainer *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (container==NULL && msg!=WM_INITDIALOG) return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]);
- container = (ChatContainer *) lParam;
- container->setHWND(hwndDlg);
- TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TABS), hImageList);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) container);
- ShowWindow(hwndDlg, SW_SHOW);
- SetEvent(container->getEvent());
- return TRUE;
- case WM_GETMINMAXINFO:
- MINMAXINFO *mmi;
- RECT rcChild, rcWindow;
- mmi = (MINMAXINFO *) lParam;
- GetWindowRect(hwndDlg, &rcWindow);
- container->getChildWindowRect(&rcChild);
- mmi->ptMinTrackSize.x = 380;
- mmi->ptMinTrackSize.y = 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top);
- return FALSE;
- case WM_SIZE:
- if (IsIconic(hwndDlg) || wParam == SIZE_MINIMIZED) break;
- {
- RECT rc, rcChild, rcWindow;
- GetClientRect(hwndDlg, &rc);
- HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
- MoveWindow(hwndTabs, 0, 0, (rc.right - rc.left), (rc.bottom - rc.top) - 0, FALSE);
- RedrawWindow(hwndTabs, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE);
- container->getChildWindowRect(&rcChild);
- if ((rcChild.bottom-rcChild.top) < 130 || (rcChild.right-rcChild.left) < 380) {
- GetWindowRect(hwndDlg, &rcWindow);
- if ((rcChild.bottom-rcChild.top) < 130) {
- rcWindow.bottom = rcWindow.top + 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top);
- }
- if ((rcChild.right-rcChild.left) < 380) {
- rcWindow.right = rcWindow.left + 380;
- }
- MoveWindow(hwndDlg, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
- container->getChildWindowRect(&rcChild);
- }
- if (container->getActive()!=NULL) {
- MoveWindow(container->getActive()->getHWND(), rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, TRUE);
- }
- }
- return TRUE;
- case DM_CREATECHILD:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_LOG), hwndDlg, (DLGPROC) wParam, (LPARAM) lParam));
- return TRUE;
- case DM_ADDCHILD:
- container->addChild((ChatWindow *) lParam);
- return TRUE;
- case DM_REMOVECHILD:
- container->removeChild((ChatWindow *) lParam);
- return TRUE;
- case DM_CHANGECHILDDATA:
- container->removeChild((ChatWindow *) lParam);
- return TRUE;
- case DM_SETUNREAD:
- container->setUnread((ChatWindow *) lParam, (int)wParam);
- return TRUE;
- case DM_FLASHWINDOW:
- if (GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg) {
- container->setFlash(0);
- SetTimer(hwndDlg, TIMERID_FLASHWND, container->getFlashTimeout(), NULL);
- }
- return TRUE;
- case WM_NOTIFY:
- {
- NMHDR* pNMHDR = (NMHDR*) lParam;
- switch (pNMHDR->code) {
- case TCN_SELCHANGE:
- {
- TCITEM tci = {0};
- HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
- int iSel = TabCtrl_GetCurSel(hwndTabs);
- tci.mask = TCIF_PARAM;
- if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) {
- ChatWindow * chatWindow = (ChatWindow *) tci.lParam;
- container->activateChild(chatWindow);
- }
- }
- break;
- case NM_CLICK:
- {
- FILETIME ft;
- TCHITTESTINFO thinfo;
- int tabId;
- HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
- GetSystemTimeAsFileTime(&ft);
- GetCursorPos(&thinfo.pt);
- ScreenToClient(hwndTabs, &thinfo.pt);
- tabId = TabCtrl_HitTest(hwndTabs, &thinfo);
- if (tabId != -1 && tabId == container->lastClickTab &&
- (ft.dwLowDateTime - container->lastClickTime) < (GetDoubleClickTime() * 10000)) {
- SendMessage(container->getChildFromTab(tabId)->getHWND(), WM_CLOSE, 0, 0);
- container->lastClickTab = -1;
- } else {
- container->lastClickTab = tabId;
- }
- container->lastClickTime = ft.dwLowDateTime;
- }
- break;
- }
-
- }
- break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
- case WM_MOUSEACTIVATE:
- if (KillTimer(hwndDlg, TIMERID_FLASHWND)) {
- FlashWindow(hwndDlg, FALSE);
- }
- /*
- if (container->getActive()!=NULL) {
- container->setUnread(container->getActive(), 0);
- SendMessage(container->getActive()->getHWND(), WM_ACTIVATE, WA_ACTIVE, 0);
- }*/
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- return FALSE;
- case WM_TIMER:
- if (wParam == TIMERID_FLASHWND) {
- if ((container->getFlash() > container->getFlashMax()) || (GetActiveWindow() == hwndDlg) || (GetForegroundWindow() == hwndDlg)) {
- KillTimer(hwndDlg, TIMERID_FLASHWND);
- FlashWindow(hwndDlg, FALSE);
- } else if (container->getFlash() < container->getFlashMax()) {
- FlashWindow(hwndDlg, TRUE);
- container->setFlash(container->getFlash()+1);
- }
- }
- break;
- case WM_DESTROY:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0);
- delete container;
- return TRUE;
-
- }
- return FALSE;
-}
-
-
-static void __cdecl StartThread(void *vContainer) {
- OleInitialize(NULL);
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_CONTAINER), NULL, ContainerDlgProc, (LPARAM) vContainer);
- //MessageBox(NULL, "ChatContainer dies.", "MW", MB_OK);
- OleUninitialize();
-
-}
diff --git a/protocols/Tlen/tlen_czaty/ChatContainer.h b/protocols/Tlen/tlen_czaty/ChatContainer.h
deleted file mode 100644
index 4414068033..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatContainer.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-class ChatContainer;
-
-#ifndef CHATCONTAINER_INCLUDED
-#define CHATCONTAINER_INCLUDED
-#include "mucc.h"
-#include "ChatEvent.h"
-#include "ChatUser.h"
-#include "AdminWindow.h"
-
-class ChatContainerChild {
-public:
- ChatWindow *window;
- ChatContainerChild *next;
- ChatContainerChild *prev;
-};
-
-class ChatContainer{
-
-private:
- static ChatContainer * list;
- static bool released;
- static CRITICAL_SECTION mutex;
- HWND hWnd;
- HANDLE hEvent;
- int childCount;
- int width, height;
- int nFlash, nFlashMax;
- ChatContainer *next, *prev;
- ChatWindow * active;
- ChatContainer();
-protected:
- friend INT_PTR CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- void addChild(ChatWindow *);
- void activateChild(ChatWindow *);
- void changeChildData(ChatWindow *);
- void removeChild(ChatWindow *);
- void setUnread(ChatWindow *child, int unread);
- void getChildWindowRect(RECT *rcChild);
- ChatWindow * getChildFromTab(int tabId);
- int getChildTab(ChatWindow *);
- int getChildCount();
- void setChildCount(int);
- ChatWindow * getActive();
- ChatContainerChild *getChildren();
- ChatContainer * getNext();
- void setNext(ChatContainer *);
- ChatContainer * getPrev();
- void setPrev(ChatContainer *);
- int lastClickTime;
- int lastClickTab;
- HANDLE getEvent();
- void setHWND(HWND);
- int getFlash();
- int getFlashMax();
- int getFlashTimeout();
- void setFlash(int);
-public:
- enum FLAGS {
- FLAG_USE_TABS = 0x00000001,
- };
-
- ~ChatContainer();
- static void init();
- static void release();
- static ChatContainer * getWindow();
- static int getDefaultOptions();
- void show(bool bShow);
- HWND getHWND();
-
- HWND remoteCreateChild(DLGPROC proc, ChatWindow *);
- void remoteAddChild(ChatWindow *);
- void remoteChangeChildData(ChatWindow *);
- void remoteRemoveChild(ChatWindow *);
- void remoteSetUnread(ChatWindow *ptr, int unread);
- void remoteFlashWindow();
-};
-
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ChatEvent.cpp b/protocols/Tlen/tlen_czaty/ChatEvent.cpp
deleted file mode 100644
index 246c168f22..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatEvent.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatEvent.h"
-#include "Options.h"
-#include "Utils.h"
-#include <string.h>
-
-ChatEvent::ChatEvent() {
-
- next = prev = NULL;
- event.cbSize = sizeof(MUCCEVENT);
- event.iType = 0;
- event.pszID = NULL;
- event.pszModule = NULL;
- event.pszName = NULL;
- event.pszNick = NULL;
- event.pszText = NULL;
- event.pszUID = NULL;
-}
-
-ChatEvent::ChatEvent(const MUCCEVENT *e) {
-
- event.cbSize = sizeof(MUCCEVENT);
- event.iType = e->iType;
- event.bIsMe = e->bIsMe;
- event.color = e->color;
- event.dwData = e->dwData;
- event.dwFlags = e->dwFlags;
- event.iFont = e->iFont;
- event.iFontSize = e->iFontSize;
- event.time = e->time;
- event.pszID = NULL;
- event.pszModule = NULL;
- event.pszName = NULL;
- event.pszNick = NULL;
- event.pszText = NULL;
- event.pszUID = NULL;
-// Utils::copyString((char **)&(event.pszID), e->pszID);
-// Utils::copyString((char **)&(event.pszModule), e->pszModule);
-// Utils::copyString((char **)&(event.pszName), e->pszName);
- if (e->iType == MUCC_EVENT_STATUS || e->iType == MUCC_EVENT_MESSAGE) {
- Utils::copyString((char **)&(event.pszNick), e->pszNick);
- }
- if (e->iType == MUCC_EVENT_ERROR || e->iType == MUCC_EVENT_MESSAGE || e->iType == MUCC_EVENT_TOPIC) {
- Utils::copyString((char **)&(event.pszText), e->pszText);
- }
-// Utils::copyString((char **)&(event.pszUID), e->pszUID);
- next = prev = NULL;
-}
-
-ChatEvent::~ChatEvent() {
-
- if (event.pszID != NULL) {
- delete (char *)event.pszID;
- }
- if (event.pszModule != NULL) {
- delete (char *)event.pszModule;
- }
- if (event.pszName != NULL) {
- delete (char *)event.pszName;
- }
- if (event.pszNick != NULL) {
- delete (char *)event.pszNick;
- }
- if (event.pszText != NULL) {
- delete (char *)event.pszText;
- }
- if (event.pszUID != NULL) {
- delete (char *)event.pszUID;
- }
- if (next != NULL) {
- next->setPrev(prev);
- }
- if (prev != NULL) {
- prev->setNext(next);
- }
-}
-
-ChatEvent * ChatEvent::getNext() {
- return next;
-}
-
-ChatEvent * ChatEvent::getPrev() {
- return prev;
-}
-
-void ChatEvent::setNext(ChatEvent *next) {
- this->next = next;
-}
-
-void ChatEvent::setPrev(ChatEvent * prev) {
- this->prev = prev;
-}
-
-const MUCCEVENT * ChatEvent::getEvent() {
- return &event;
-}
-
-ChatEventList::ChatEventList() {
- eventListEnd = &eventListRoot;
- setMaxSize(DEFAULT_MAX_SIZE);
- currentSize = 0;
-}
-
-ChatEventList::~ChatEventList() {
- while (eventListRoot.getNext()!=NULL) {
- delete eventListRoot.getNext();
- }
-}
-
-int ChatEventList::addEvent(const MUCCEVENT *muccevent) {
- int trimmed = 0;
- ChatEvent *event = new ChatEvent(muccevent);
- event->setPrev(eventListEnd);
- eventListEnd->setNext(event);
- eventListEnd=event;
- currentSize++;
- if (currentSize>hiMaxSize) {
- while (currentSize>loMaxSize && eventListRoot.getNext()!=NULL) {
- delete eventListRoot.getNext();
- currentSize--;
- trimmed = 1;
- }
- }
- return trimmed;
-}
-
-ChatEvent * ChatEventList::getEvents() {
- return eventListRoot.getNext();
-}
-
-void ChatEventList::setMaxSize(int s) {
- loMaxSize = s;
- if (s>200) {
- hiMaxSize = s + s/10;
- } else {
- hiMaxSize = s + 20;
- }
-}
-
-void ChatEventList::clear() {
- ChatEvent *event = eventListRoot.getNext();
- eventListRoot.setNext(NULL);
- eventListEnd = &eventListRoot;
- currentSize = 0;
- if (event!=NULL) {
- event->setPrev(NULL);
- while (event->getNext()!=NULL) {
- delete event->getNext();
- }
- delete event;
- }
-}
-
-
diff --git a/protocols/Tlen/tlen_czaty/ChatEvent.h b/protocols/Tlen/tlen_czaty/ChatEvent.h
deleted file mode 100644
index 37e045380f..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatEvent.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef CHATEVENT_INCLUDED
-#define CHATEVENT_INCLUDED
-#include "mucc.h"
-
-class ChatEvent {
-private:
- ChatEvent * prev;
- ChatEvent * next;
- MUCCEVENT event;
-public:
- ChatEvent();
- ChatEvent(const MUCCEVENT *);
- ~ChatEvent();
- ChatEvent * getPrev();
- ChatEvent * getNext();
- void setPrev(ChatEvent *);
- void setNext(ChatEvent *);
- const MUCCEVENT *getEvent();
-};
-
-class ChatEventList {
-private:
- ChatEvent eventListRoot;
- ChatEvent * eventListEnd;
- int loMaxSize;
- int hiMaxSize;
- int currentSize;
-public:
- enum {
- DEFAULT_MAX_SIZE = 100
- };
- ChatEventList();
- ~ChatEventList();
- ChatEvent * getEvents();
- int addEvent(const MUCCEVENT *);
- void clear();
- void setMaxSize(int s);
-};
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ChatGroup.cpp b/protocols/Tlen/tlen_czaty/ChatGroup.cpp
deleted file mode 100644
index a5c47d724f..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatGroup.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatGroup.h"
-#include "Utils.h"
-
-ChatGroup::ChatGroup() {
- prev = next = NULL;
- parent = child =NULL;
- name = NULL;
- id = 0;
-}
-
-ChatGroup::~ChatGroup() {
- if (name!=NULL) delete name;
- if (id!=NULL) delete id;
-}
-ChatGroup * ChatGroup::getNext() {
- return next;
-}
-
-void ChatGroup::setNext(ChatGroup *next) {
- this->next = next;
-}
-
-ChatGroup * ChatGroup::getPrev() {
- return prev;
-}
-
-void ChatGroup::setPrev(ChatGroup *prev) {
- this->prev = prev;
-}
-
-ChatGroup * ChatGroup::getChild() {
- return child;
-}
-
-void ChatGroup::addChild(ChatGroup *child) {
- ChatGroup *group;
- for (group=getChild();group!=NULL && group->getNext()!=NULL;group=group->getNext()) {
- }
- if (group==NULL) this->child = child;
- else {
- group->setNext(child);
- }
- child->setPrev(group);
- child->setNext(NULL);
-}
-
-ChatGroup * ChatGroup::getListNext() {
- return listNext;
-}
-
-void ChatGroup::setListNext(ChatGroup *next) {
- this->listNext = next;
-}
-
-const char *ChatGroup::getId() {
- return id;
-}
-
-void ChatGroup::setId(const char *id) {
- Utils::copyString(&this->id, id);
-}
-
-HTREEITEM ChatGroup::getTreeItem() {
- return hItem;
-}
-
-void ChatGroup::setTreeItem(HTREEITEM hItem) {
- this->hItem=hItem;
-}
-
-const char *ChatGroup::getName() {
- return name;
-}
-
-void ChatGroup::setName(const char *name) {
- Utils::copyString(&this->name, name);
-}
-
diff --git a/protocols/Tlen/tlen_czaty/ChatGroup.h b/protocols/Tlen/tlen_czaty/ChatGroup.h
deleted file mode 100644
index c04abf81ba..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatGroup.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef CHATGROUP_INCLUDED
-#define CHATGROUP_INCLUDED
-#include "mucc.h"
-
-class ChatGroup {
-private:
- HTREEITEM hItem;
- ChatGroup * parent;
- ChatGroup * child;
- ChatGroup * prev;
- ChatGroup * next;
- ChatGroup * listNext;
- char * name;
- char * id;
-public:
- ChatGroup();
- ~ChatGroup();
- ChatGroup * getPrev();
- ChatGroup * getNext();
- ChatGroup * getListNext();
- ChatGroup * getChild();
- ChatGroup * getParent();
- HTREEITEM getTreeItem();
- const char * getName();
- const char * getId();
- void setPrev(ChatGroup *);
- void setNext(ChatGroup *);
- void setListNext(ChatGroup *);
- void addChild(ChatGroup *);
- void setParent(ChatGroup *);
- void setName(const char *);
- void setTreeItem(HTREEITEM );
- void setId(const char *);
-};
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ChatRoom.cpp b/protocols/Tlen/tlen_czaty/ChatRoom.cpp
deleted file mode 100644
index 2f9c1389c2..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatRoom.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatRoom.h"
-#include "Utils.h"
-
-
-ChatRoom::ChatRoom() {
- next = prev = NULL;
- name = NULL;
- id = NULL;
-}
-
-ChatRoom::~ChatRoom() {
- if (name!=NULL) delete name;
- if (id!=NULL) delete id;
-}
-
-void ChatRoom::setId(const char *id) {
- Utils::copyString(&this->id, id);
-}
-
-void ChatRoom::setName(const char *name) {
- Utils::copyString(&this->name, name);
-}
-
-const char* ChatRoom::getId() {
- return id;
-}
-
-const char* ChatRoom::getName() {
- return name;
-}
-
-ChatRoom *ChatRoom::getNext() {
- return next;
-}
-
-void ChatRoom::setNext(ChatRoom *next) {
- this->next = next;
-}
-
-void ChatRoom::setFlags(int flags) {
- this->flags = flags;
-}
-
-int ChatRoom::getFlags() {
- return flags;
-}
-
diff --git a/protocols/Tlen/tlen_czaty/ChatRoom.h b/protocols/Tlen/tlen_czaty/ChatRoom.h
deleted file mode 100644
index 51593f00c2..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatRoom.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef CHATROOM_INCLUDED
-#define CHATROOM_INCLUDED
-#include "mucc.h"
-
-
-class ChatRoom {
-private:
- HTREEITEM hItem;
- ChatRoom * prev;
- ChatRoom * next;
- char * name;
- char * id;
- int flags;
-public:
- ChatRoom();
- ~ChatRoom();
- ChatRoom * getPrev();
- ChatRoom * getNext();
- HTREEITEM getTreeItem();
- const char * getName();
- const char * getId();
- int getFlags();
- void setPrev(ChatRoom *);
- void setNext(ChatRoom *);
- void setName(const char *);
- void setTreeItem(HTREEITEM );
- void setId(const char *);
- void setFlags(int);
-};
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ChatUser.cpp b/protocols/Tlen/tlen_czaty/ChatUser.cpp
deleted file mode 100644
index cb5baea1a8..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatUser.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatUser.h"
-#include "Utils.h"
-
-ChatUser::ChatUser() {
- id = NULL;
- nick = NULL;
- hTreeItem = NULL;
- me = 0;
-}
-
-ChatUser::~ChatUser() {
- if (id!=NULL) delete id;
- if (nick!=NULL) delete nick;
-}
-
-void ChatUser::setNick(const char *nick) {
- Utils::copyString(&this->nick, nick);
-}
-
-void ChatUser::setId(const char *id) {
- Utils::copyString(&this->id, id);
-}
-
-const char *ChatUser::getNick() {
- return nick;
-}
-
-const char *ChatUser::getId() {
- return id;
-}
-
-void ChatUser::setNext(ChatUser *next) {
- this->next = next;
-}
-
-ChatUser * ChatUser::getNext() {
- return next;
-}
-
-void ChatUser::setFlags(int flags) {
- this->flags = flags;
-}
-
-int ChatUser::getFlags() {
- return flags;
-}
-
-void ChatUser::setMe(int me) {
- this->me = me;
-}
-
-int ChatUser::isMe() {
- return me;
-}
-
-void ChatUser::setHTreeItem(HTREEITEM hti) {
- hTreeItem = hti;
-}
-
-HTREEITEM ChatUser::getHTreeItem() {
- return hTreeItem;
-}
diff --git a/protocols/Tlen/tlen_czaty/ChatUser.h b/protocols/Tlen/tlen_czaty/ChatUser.h
deleted file mode 100644
index 0084a14608..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatUser.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef CHATUSER_INCLUDED
-#define CHATUSER_INCLUDED
-#include "mucc.h"
-
-class ChatUser {
-private:
- char * nick;
- char * id;
- int flags;
- int me;
- ChatUser * next;
- HTREEITEM hTreeItem;
-public:
- ChatUser();
- ~ChatUser();
- void setNick(const char *);
- void setId(const char *);
- const char * getNick();
- const char * getId();
- void setNext(ChatUser *);
- int getFlags();
- void setFlags(int );
- HTREEITEM getHTreeItem();
- void setHTreeItem(HTREEITEM);
- ChatUser * getNext();
- void setMe(int);
- int isMe();
-};
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ChatWindow.cpp b/protocols/Tlen/tlen_czaty/ChatWindow.cpp
deleted file mode 100644
index 97dc986381..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatWindow.cpp
+++ /dev/null
@@ -1,2108 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "ChatWindow.h"
-#include "HelperDialog.h"
-#include "Utils.h"
-#include "Options.h"
-#include "m_smileyadd.h"
-#include "m_ieview.h"
-//#include "m_chat.h"
-
-static int logPixelSY;
-static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...);
-static char *JabberRtfEscape(char *str);
-//static DWORD CALLBACK Log_StreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb);
-
-COLORREF ChatWindow::colorListBg, ChatWindow::colorListText, ChatWindow::colorListGroupText;
-HFONT ChatWindow::hListGroupFont=NULL;
-HFONT ChatWindow::hListFont=NULL;
-
-ChatWindow * ChatWindow::list = NULL;
-bool ChatWindow::released = false;
-CRITICAL_SECTION ChatWindow::mutex;
-
-static WNDPROC oldSplitterWndProc, oldEditWndProc;
-static HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
-
-void ChatWindow::release() {
- released = true;
- for (ChatWindow *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) {
- ptr2 = ptr->getNext();
- //SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0);
- }
- DeleteCriticalSection(&mutex);
- DestroyCursor(hCurSplitNS);
- DestroyCursor(hCurSplitWE);
- DestroyCursor(hCurHyperlinkHand);
-}
-
-void ChatWindow::init() {
- hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
- hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
- hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
- if (hCurHyperlinkHand == NULL) {
- hCurHyperlinkHand = LoadCursor(NULL, IDC_ARROW);
- }
- released = false;
- InitializeCriticalSection(&mutex);
-}
-
-/* chat.dll mod*/
-/*
-static bool gcRegistered = false;
-
-static void __stdcall StartThread(void *vChat) { //__cdecl
- ChatWindow *chat = (ChatWindow *)vChat;
- if (!gcRegistered) {
- gcRegistered = true;
- GCREGISTER gcr = {0};
- gcr.cbSize = sizeof(GCREGISTER);
- gcr.dwFlags = 0;
- gcr.iMaxText = 0;
- gcr.nColors = 0;
- gcr.pColors = 0;
- gcr.pszModuleDispName = chat->getModule();
- gcr.pszModule = chat->getModule();
- if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr)) {
- MessageBox(NULL, "cannot register", "CHAT", MB_OK);
- }
- }
- GCWINDOW gcw = {0};
- gcw.cbSize = sizeof(GCWINDOW);
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = chat->getModule();
- gcw.pszName = chat->getRoomName();
- gcw.pszID = chat->getRoomId();
- gcw.pszStatusbarText = "status";
- gcw.bDisableNickList = FALSE;
- gcw.dwItemData = (DWORD) chat;
- if(CallService(MS_GC_NEWCHAT, 0, (LPARAM) &gcw)) {
- MessageBox(NULL, "cannot create", "CHAT", MB_OK);
- }
-
- GCDEST gcdest;
- GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
- const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"};
- gcdest.pszModule = (char *)chat->getModule();
- gcdest.pszID = (char *)chat->getRoomId();
- gcevent.bAddToLog = FALSE;
- gcevent.time = 0;
- gcdest.iType = GC_EVENT_ADDGROUP;
- for (int i=0;i<5;i++) {
- gcevent.pszStatus = Translate(groupNames[i]);
- CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent);
- }
-
-
- gcdest.iType = GC_EVENT_CONTROL;
- CallService(MS_GC_EVENT, WINDOW_INITDONE, (LPARAM)&gcevent);
- CallService(MS_GC_EVENT, WINDOW_ONLINE, (LPARAM)&gcevent);
-}
-*/
-
-ChatWindow::ChatWindow(MUCCWINDOW *mucw) {
- prev = next = NULL;
- adminWindow = NULL;
- hWnd = NULL;
- hWndLog = NULL;
- module = roomId = roomName = topic = NULL;
- hSplitterPos = 0;
- vSplitterPos = 0;
- wasFirstMessage = 0;
- isEmpty = true;
- isStarted = 0;
- options = Options::getChatWindowOptions();
- bBold = bItalic = bUnderline = 0;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- hEditFont = NULL;
- userMe = NULL;
- users = NULL;
- for (int i=0;i<5;i++) {
- hUserGroups[i] = NULL;
- }
- setModule(mucw->pszModule);
- setRoomId(mucw->pszID);
- setRoomName(mucw->pszName);
- EnterCriticalSection(&mutex);
- setNext(list);
- if (next!=NULL) {
- next->setPrev(this);
- }
- list = this;
- LeaveCriticalSection(&mutex);
- container = ChatContainer::getWindow();
- hWnd = container->remoteCreateChild(LogDlgProc, this);
- container->remoteAddChild(this);
- /* chat.dll mod*/
-/* CallFunctionAsync(StartThread, (void *)this);*/
-}
-
-ChatWindow::~ChatWindow () {
- if (!released) {
- EnterCriticalSection(&mutex);
- if (getPrev()!=NULL) {
- getPrev()->setNext(next);
- } else if (list==this) {
- list = getNext();
- }
- if (getNext()!=NULL) {
- getNext()->setPrev(prev);
- }
- LeaveCriticalSection(&mutex);
- }
- if (adminWindow!=NULL) {
- delete adminWindow;
- }
- if (hEvent!=NULL) {
- CloseHandle(hEvent);
- }
- while (users!=NULL) {
- ChatUser *user = users;
- users = users->getNext();
- delete user;
- }
- if (module!=NULL) {
- delete module;
- }
- if (roomId!=NULL) {
- delete roomId;
- }
- if (roomName!=NULL) {
- delete roomName;
- }
- if (topic!=NULL) {
- delete topic;
- }
- container->remoteRemoveChild(this);
-};
-
-
-void ChatWindow::setPrev(ChatWindow *prev) {
- this->prev = prev;
-}
-
-ChatWindow * ChatWindow::getPrev() {
- return prev;
-}
-
-void ChatWindow::setNext(ChatWindow *next) {
- this->next = next;
-}
-
-ChatWindow * ChatWindow::getNext() {
- return next;
-}
-
-void ChatWindow::setHWND(HWND hWnd) {
- this->hWnd = hWnd;
-}
-
-HWND ChatWindow::getHWND() {
- return hWnd;
-}
-
-void ChatWindow::setHWNDLog(HWND hWnd) {
- this->hWndLog = hWnd;
-}
-
-HWND ChatWindow::getHWNDLog() {
- return hWndLog;
-}
-
-HANDLE ChatWindow::getEvent() {
- return hEvent;
-}
-
-ChatContainer * ChatWindow::getContainer() {
- return container;
-}
-
-void ChatWindow::setAdminWindow(AdminWindow *aw) {
- this->adminWindow = aw;
-}
-
-AdminWindow* ChatWindow::getAdminWindow() {
- return adminWindow;
-}
-
-void ChatWindow::setModule(const char *module) {
- Utils::copyString(&this->module, module);
-}
-
-const char * ChatWindow::getModule() {
- return module;
-}
-
-void ChatWindow::setRoomId(const char *roomId) {
- Utils::copyString(&this->roomId, roomId);
-}
-
-const char * ChatWindow::getRoomId() {
- return roomId;
-}
-
-void ChatWindow::setRoomName(const char *roomName) {
-// char str[300];
- Utils::copyString(&this->roomName, roomName);
-// sprintf(str, "%s %08X", roomName, roomFlags);
-// SetWindowText(hWnd, str);
- SetWindowTextA(hWnd, roomName);
-}
-
-void ChatWindow::setRoomFlags(int flags) {
-// char str[300];
- roomFlags = flags;
-// sprintf(str, "%s %08X", roomName, roomFlags);
-// SetWindowText(hWnd, str);
-}
-
-int ChatWindow::getRoomFlags() {
- return roomFlags;
-}
-
-const char * ChatWindow::getRoomName() {
- return roomName;
-}
-
-void ChatWindow::setOptions(int options) {
- if (options != this->options) {
- this->options = options;
- rebuildLog();
- }
-}
-
-int ChatWindow::getOptions() {
- return options;
-}
-
-static void __cdecl StartAdminThread(void *vChat) {
- ChatWindow *chat = (ChatWindow *)vChat;
- chat->getAdminWindow()->start();
-}
-
-void ChatWindow::startAdminDialog(int mode) {
- if (adminWindow==NULL) {
- ChatUser *user = getSelectedUser();
- if (user != NULL) {
- adminWindow = new AdminWindow(this, user->getId(), mode);
- } else {
- adminWindow = new AdminWindow(this, "", mode);
- }
- Utils::forkThread((void (__cdecl *)(void *))StartAdminThread, 0, (void *) this);
- }
-}
-void ChatWindow::addUser(ChatUser *user) {
- user->setNext(users);
- users = user;
-}
-void ChatWindow::removeUser(ChatUser *user) {
- ChatUser *user2;
- for (user2=users;user2!=NULL;user2=user2->getNext()) {
- if (user2->getNext()==user) break;
- }
- if (user2!=NULL) {
- user2->setNext(user->getNext());
- } else if (users==user) {
- users = user->getNext();
- }
-}
-
-ChatUser * ChatWindow::getMe() {
- return userMe;
-}
-
-ChatUser * ChatWindow::findUser(const char *userId) {
- ChatUser *user;
- for (user=users;user!=NULL;user=user->getNext()) {
- if (!(strcmp(user->getId(), userId))) break;
- }
- return user;
-}
-
-ChatUser * ChatWindow::findUserByNick(const char *nick) {
- ChatUser *user;
- for (user=users;user!=NULL;user=user->getNext()) {
- if (!(strcmp(user->getNick(), nick))) break;
- }
- return user;
-}
-
-ChatUser *ChatWindow::getSelectedUser() {
- HTREEITEM hTreeItem = TreeView_GetSelection(GetDlgItem(hWnd, IDC_TREELIST));
- if (hTreeItem!=NULL) {
- TVITEM tvi;
- tvi.mask = TVIF_PARAM;
- tvi.hItem = hTreeItem;
- TreeView_GetItem(GetDlgItem(hWnd, IDC_TREELIST), &tvi);
- return (ChatUser *) tvi.lParam;
- }
- return NULL;
-}
-
-int ChatWindow::startPriv() {
- ChatUser *user = getSelectedUser();
- if (user!=NULL) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_START_PRIV;
- mucce.pszModule = getModule();
- mucce.pszID = getRoomId();
- mucce.pszUID = user->getId();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce);
- }
- return 0;
-}
-
-int ChatWindow::unban(const char *id) {
- if (id!=NULL) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_UNBAN;
- mucce.pszModule = getModule();
- mucce.pszID = getRoomId();
- mucce.pszUID = id;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce);
- }
- return 0;
-}
-
-
-int ChatWindow::kickAndBan(const char *id, int time, const char *reason) {
- if (id!=NULL) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_KICK_BAN;
- mucce.pszModule = getModule();
- mucce.pszID = getRoomId();
- mucce.pszUID = id;
- mucce.dwData = time;
- mucce.pszText = reason;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce);
- }
- return 0;
-}
-
-int ChatWindow::kickAndBan(int time) {
- ChatUser *user = getSelectedUser();
- if (user!=NULL) {
- kickAndBan(user->getId(), time, "");
- }
- return 0;
-}
-
-int ChatWindow::setRights(const char *id, int flags) {
- if (id!=NULL) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_SET_USER_ROLE;
- mucce.pszModule = getModule();
- mucce.pszID = getRoomId();
- mucce.pszUID = id;
- mucce.dwFlags = flags;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce);
- }
- return 0;
-}
-
-int ChatWindow::setRights(int flags) {
- ChatUser *user = getSelectedUser();
- if (user!=NULL) {
- setRights(user->getId(), flags);
- }
- return 0;
-}
-
-int ChatWindow::getUserGroup(ChatUser *user) {
- int group = 4;
- if (user->getFlags()&MUCC_EF_USER_GLOBALOWNER) {
- group = 0;
- } else if (user->getFlags()&MUCC_EF_USER_OWNER) {
- group = 1;
- } else if (user->getFlags()&MUCC_EF_USER_ADMIN) {
- group = 2;
- } else if (user->getFlags()&MUCC_EF_USER_MODERATOR) {
- group = 3;
- }
- return group;
-}
-
-int ChatWindow::changePresence(const MUCCEVENT *event) {
- int i, group, bLogEvent = FALSE;
- const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"};
- ChatUser *user = findUser(event->pszUID);
- if (event->dwData == ID_STATUS_ONLINE || (user!=NULL && event->dwData!=ID_STATUS_OFFLINE)) {
- if (user == NULL) {
- user = new ChatUser();
- user->setId(event->pszUID);
- user->setNick(event->pszNick);
- user->setFlags(event->dwFlags);
- user->setMe(event->bIsMe);
- addUser(user);
- if (user->isMe()) {
- userMe = user;
- }
- bLogEvent = TRUE;
- } else {
- group = getUserGroup(user);
- user->setFlags(event->dwFlags);
- TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), user->getHTreeItem());
- if (TreeView_GetChild(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group))==NULL) {
- TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group));
- setTreeItem(group, NULL);
- }
- }
- if (user->isMe()) {
- if (user->getFlags() & MUCC_EF_USER_OWNER || user->getFlags() & MUCC_EF_USER_ADMIN) {
- EnableWindow(GetDlgItem(hWnd, IDC_TOPIC_BUTTON), TRUE);
- } else {
- EnableWindow(GetDlgItem(hWnd, IDC_TOPIC_BUTTON), FALSE);
- }
- }
- group = getUserGroup(user);
- TVINSERTSTRUCT tvis;
- if (getTreeItem(group)==NULL) {
- for (i=group-1;i>=0;i--) {
- if (getTreeItem(i)!=NULL) break;
- }
- tvis.hParent = NULL;
- if (i>=0) {
- tvis.hInsertAfter = getTreeItem(i);
- } else {
- tvis.hInsertAfter = TVI_FIRST;
- }
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_CHILDREN;
- tvis.item.lParam = (LPARAM) NULL;
- tvis.item.cChildren = 1;
- LPTSTR lps1 = Utils::mucc_mir_a2t(Translate(groupNames[group]));
- tvis.item.pszText = lps1;
- //tvis.item.state = INDEXTOSTATEIMAGEMASK(1);
- //tvis.item.stateMask = TVIS_STATEIMAGEMASK ;
- setTreeItem(group, TreeView_InsertItem(GetDlgItem(hWnd, IDC_TREELIST), &tvis));
- Utils::mucc_mir_free(lps1);
- }
- tvis.hParent = getTreeItem(group);
- tvis.hInsertAfter = TVI_SORT;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
- LPTSTR lps2 = Utils::mucc_mir_a2t(user->getNick());
- tvis.item.pszText = lps2;
- tvis.item.lParam = (LPARAM) user;
- user->setHTreeItem(TreeView_InsertItem(GetDlgItem(hWnd, IDC_TREELIST), &tvis));
- TreeView_Expand(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group), TVE_EXPAND);
- Utils::mucc_mir_free(lps2);
- }
- else {
- if (user != NULL) {
- group = getUserGroup(user);
- TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), user->getHTreeItem());
- if (TreeView_GetChild(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group))==NULL) {
- TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group));
- setTreeItem(group, NULL);
- }
- removeUser(user);
- delete user;
- bLogEvent = TRUE;
- }
- }
- if (bLogEvent && wasFirstMessage) {
- logEvent(event);
- }
- return 1;
-}
-int ChatWindow::changeTopic(const MUCCEVENT *event) {
-
- SetDlgItemTextA(hWnd, IDC_TOPIC, event->pszText);
-//if (wasFirstMessage) {
- logEvent(event);
-// }
- return 1;
-}
-
-int ChatWindow::changeRoomInfo(const MUCCEVENT *event) {
-
- Utils::log("setting room info !");
- setRoomName(event->pszName);
- setRoomFlags(event->dwFlags);
- return 1;
-}
-
-const char * ChatWindow::getFontName(int index) {
- const char *fontNames[] = {"Arial",
- "Comic Sans MS",
- "Courier New",
- "Impact",
- "Lucida Console",
- "MS Sans Serif",
- "Tahoma",
- "Times New Roman",
- "Trebuchet MS",
- "Verdana"};
- if (index>9 || index<0) index = 0;
- return fontNames[index];
-}
-int ChatWindow::getFontNameNum() {
- return 10;
-}
-int ChatWindow::getFontSize(int index) {
- return index+7;
-}
-int ChatWindow::getFontSizeNum() {
- return 10;
-}
-
-void ChatWindow::refreshSettings() {
- SendDlgItemMessage(hWnd, IDC_LOG, EM_SETBKGNDCOLOR , 0, Options::getLogBgColor());
- SendDlgItemMessage(hWnd, IDC_TREELIST, TVM_SETBKCOLOR, 0, Options::getListBgColor());
- eventList.setMaxSize(Options::getLogLimit());
-}
-
-void ChatWindow::refreshSettings(int force) {
-
- if (hListFont!=NULL && !force) {
- return;
- }
- EnterCriticalSection(&mutex);
- if (hListFont!=NULL) {
- DeleteObject(hListFont);
- }
- if (hListGroupFont!=NULL) {
- DeleteObject(hListGroupFont);
- }
- Font * font = Options::getFont(Options::FONT_USERLIST);
- colorListText = font->getColor();
- hListFont = CreateFontA(font->getSize(), 0, 0, 0,
- font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL,
- font->getStyle() & Font::ITALIC ? 1 : 0,
- font->getStyle() & Font::UNDERLINE ? 1 : 0, 0,
- font->getCharSet(),
- OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_ROMAN,
- font->getFace());
- font = Options::getFont(Options::FONT_USERLISTGROUP);
- colorListGroupText = font->getColor();
- hListGroupFont = CreateFontA(font->getSize(), 0, 0, 0,
- font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL,
- font->getStyle() & Font::ITALIC ? 1 : 0,
- font->getStyle() & Font::UNDERLINE ? 1 : 0, 0,
- font->getCharSet(),
- OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_ROMAN,
- font->getFace());
-
- for (ChatWindow *ptr=list;ptr!=NULL;ptr=ptr->getNext()) {
- ptr->refreshSettings();
- InvalidateRect(ptr->getHWND(), NULL, FALSE);
- }
- LeaveCriticalSection(&mutex);
-}
-HFONT ChatWindow::getListFont() {
- return hListFont;
-}
-
-HFONT ChatWindow::getListGroupFont() {
- return hListGroupFont;
-}
-
-COLORREF ChatWindow::getListTextColor() {
- return colorListText;
-}
-
-COLORREF ChatWindow::getListGroupTextColor() {
- return colorListGroupText;
-}
-
-HTREEITEM ChatWindow::getTreeItem(int index) {
- return hUserGroups[index];
-}
-
-void ChatWindow::setTreeItem(int index, HTREEITEM hTreeItem) {
- hUserGroups[index]=hTreeItem;
-}
-
-int ChatWindow::getDefaultOptions() {
- return FLAG_SHOW_NICKNAMES | FLAG_SHOW_TIMESTAMP | FLAG_FORMAT_ALL | FLAG_LOG_MESSAGES | FLAG_OPT_SENDONENTER;
-}
-
-void ChatWindow::clearLog() {
- if (getHWNDLog()!=NULL) {
- IEVIEWEVENT iee;
- ZeroMemory(&iee, sizeof(iee));
- iee.cbSize = sizeof(iee);
- iee.iType = IEE_CLEAR_LOG;
- iee.dwFlags = IEEF_NO_UNICODE;
- iee.hwnd = hWndLog;
- iee.hContact = NULL;
- iee.codepage = CP_ACP;
- iee.pszProto = getModule();
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
- } else {
- SetDlgItemTextA(getHWND(), IDC_LOG, "");
- }
- isEmpty = true;
- eventList.clear();
-}
-
-void ChatWindow::rebuildLog() {
- int nMin, nMax;
- HWND hwndLog;
- if (getHWNDLog()!=NULL) {
- IEVIEWEVENT iee;
- ZeroMemory(&iee, sizeof(iee));
- iee.cbSize = sizeof(iee);
- iee.iType = IEE_CLEAR_LOG;
- iee.dwFlags = IEEF_NO_UNICODE;
- iee.hwnd = hWndLog;
- iee.hContact = NULL;
- iee.codepage = CP_ACP;
- iee.pszProto = getModule();
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
- } else {
- SetDlgItemTextA(getHWND(), IDC_LOG, "");
- }
- isEmpty = true;
- for (ChatEvent* event=eventList.getEvents();event!=NULL;event=event->getNext()) {
- appendMessage(event->getEvent());
- }
- if (getHWNDLog()==NULL) {
- if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) PostMessage(getHWND(), WM_TLEN_SMILEY, 0, 0);
- hwndLog = GetDlgItem(getHWND(), IDC_LOG);
- int len = GetWindowTextLengthA(hwndLog);
- SendMessage(hwndLog, EM_SETSEL, len - 1, len - 1);
- GetScrollRange(hwndLog, SB_VERT, &nMin, &nMax);
- SetScrollPos(hwndLog, SB_VERT, nMax, TRUE);
- PostMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nMax), (LPARAM) NULL);
- }
-}
-
-int ChatWindow::logEvent(const MUCCEVENT *event) {
- /* chat.dll mod*/
- /*
- if (event->iType == MUCC_EVENT_MESSAGE) {
- GCDEST gcdest;
- GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
- gcdest.pszModule = (char *)this->getModule();
- gcdest.pszID = (char *)this->getRoomId();
- gcdest.iType = GC_EVENT_MESSAGE;
- gcevent.pszText = event->pszText;
- gcevent.pszNick = event->pszNick;
- gcevent.pszUID = event->pszUID;
- gcevent.bIsMe = event->bIsMe;
- gcevent.bAddToLog = TRUE;
- gcevent.time = event->time;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent);
-
- }
- if (event->iType == MUCC_EVENT_STATUS) {
- const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"};
- GCDEST gcdest;
- GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
- gcdest.pszModule = (char *)this->getModule();
- gcdest.pszID = (char *)this->getRoomId();
- gcevent.pszText = event->pszText;
- gcevent.pszNick = event->pszNick;
- int group = 4;
- if (event->dwFlags&MUCC_EF_USER_GLOBALOWNER) {
- group = 0;
- } else if (event->dwFlags&MUCC_EF_USER_OWNER) {
- group = 1;
- } else if (event->dwFlags&MUCC_EF_USER_ADMIN) {
- group = 2;
- } else if (event->dwFlags&MUCC_EF_USER_MODERATOR) {
- group = 3;
- }
- gcevent.pszStatus = Translate(groupNames[group]);
- gcevent.pszUID = event->pszUID;
- gcevent.bIsMe = event->bIsMe;
- gcevent.bAddToLog = TRUE;
- gcevent.time = event->time;
- if (event->dwData == ID_STATUS_ONLINE) {
- gcdest.iType = GC_EVENT_JOIN;
- } else {
- gcdest.iType = GC_EVENT_PART;
- }
- CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent);
- }
- */
- /* chat.dll mod*/
-
- int nMin, nMax;
- HWND hwndLog;
- if (event->iType != MUCC_EVENT_ERROR) {
- if (eventList.addEvent(event)) {
- rebuildLog();
- return 1;
- }
- }
- if (event->iType == MUCC_EVENT_MESSAGE) {
- wasFirstMessage = 1;
- appendMessage(event);
- container->remoteSetUnread(this, 1);
- } else {
- appendMessage(event);
- }
- if (event->iType==MUCC_EVENT_MESSAGE && getOptions() & FLAG_FLASH_MESSAGES) {
- container->remoteFlashWindow();
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE && getOptions() & FLAG_FLASH_JOINED) {
- container->remoteFlashWindow();
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE && getOptions() & FLAG_FLASH_LEFT) {
- container->remoteFlashWindow();
- } else if (event->iType==MUCC_EVENT_TOPIC && getOptions() & FLAG_FLASH_TOPIC) {
- container->remoteFlashWindow();
- }
- if (getHWNDLog()==NULL) {
- if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) PostMessage(getHWND(), WM_TLEN_SMILEY, 0, 0);
- hwndLog = GetDlgItem(getHWND(), IDC_LOG);
- int len = GetWindowTextLengthA(hwndLog);
- SendMessage(hwndLog, EM_SETSEL, len - 1, len - 1);
- GetScrollRange(hwndLog, SB_VERT, &nMin, &nMax);
- SetScrollPos(hwndLog, SB_VERT, nMax, TRUE);
- PostMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nMax), (LPARAM) NULL);
- }
- return 1;
-}
-
-void ChatWindow::createRTFHeader() {
- char *rtf;
- int i, msgSize;
- //, , iFontSize, bItalic, bBold, bUnderline;
- rtf = NULL;
- JabberStringAppend(&rtf, &msgSize, "{\\rtf1\\ansi\\deff0{\\fonttbl");
-
- for (i=0;i<FontList::getFontNum();i++) {
- Font *font = FontList::getFont(i);
- JabberStringAppend(&rtf, &msgSize, "{\\f%u\\fnil\\fcharset%u %s;}", font->getCharSet(), font->getFace());
- }
- JabberStringAppend(&rtf, &msgSize, "}{\\colortbl ");
- for (i=0;i<FontList::getFontNum();i++) {
- Font *font = FontList::getFont(i);
- DWORD color = font->getColor();
- JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF);
- }
- JabberStringAppend(&rtf, &msgSize, "}");
-}
-
-
-int ChatWindow::appendMessage(const MUCCEVENT *event) {
- char timestampStr[100], str[512];
- char *rtf, *escapedStr = NULL, *escapedNick = NULL;
- Font *fontTimestamp, *fontName, *fontMessage; //*fontColon,
- int msgSize;
- DWORD color;
- int iFontSize, bItalic, bBold, bUnderline;
- HWND hwndLog;
- DBTIMETOSTRING dbtts;
- CHARRANGE sel;
- SETTEXTEX stt;
- //tm *ltime;
-
- if (event->iType!=MUCC_EVENT_STATUS && event->iType!=MUCC_EVENT_STATUS && event->iType!=MUCC_EVENT_ERROR
- && event->iType!=MUCC_EVENT_TOPIC && event->iType != MUCC_EVENT_MESSAGE) {
- return 0;
- }
- if (event->iType==MUCC_EVENT_MESSAGE && !(getOptions() & FLAG_LOG_MESSAGES)) {
- return 0;
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE && !(getOptions() & FLAG_LOG_JOINED)) {
- return 0;
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE && !(getOptions() & FLAG_LOG_LEFT)) {
- return 0;
- } else if (event->iType==MUCC_EVENT_TOPIC && !(getOptions() & FLAG_LOG_TOPIC)) {
- return 0;
- }
-
- if (getHWNDLog()!=NULL) {
- IEVIEWEVENTDATA ied;
- IEVIEWEVENT iee;
- IEVIEWWINDOW iew;
- ZeroMemory(&iee, sizeof(iee));
- iee.cbSize = sizeof(iee);
- iee.dwFlags = IEEF_NO_UNICODE;
- iee.hwnd = hWndLog;
- iee.hContact = NULL;
- iee.iType = IEE_LOG_MEM_EVENTS;
- iee.codepage = CP_ACP;
- iee.pszProto = getModule();
- iee.eventData = &ied;
- iee.count = 1;
-
- ied.cbSize = sizeof(IEVIEWEVENTDATA);
- if (event->iType==MUCC_EVENT_MESSAGE) {
- ied.iType = IEED_MUCC_EVENT_MESSAGE;
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE) {
- ied.iType = IEED_MUCC_EVENT_JOINED;
- } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE) {
- ied.iType = IEED_MUCC_EVENT_LEFT;
- } else if (event->iType==MUCC_EVENT_TOPIC) {
- ied.iType = IEED_MUCC_EVENT_TOPIC;
- } else if (event->iType==MUCC_EVENT_ERROR) {
- ied.iType = IEED_MUCC_EVENT_ERROR;
- }
- ied.dwFlags = getOptions() & FLAG_FORMAT_ALL;
- ied.next = NULL;
- ied.color = event->color;
- ied.fontSize = event->iFontSize;
- ied.fontStyle = event->dwFlags;
- ied.fontName = getFontName(event->iFont);
- ied.pszNick = event->pszNick;
- ied.pszText = event->pszText;
- ied.time = event->time;
- ied.dwData = getOptions(); // event->dwData;
- ied.bIsMe = event->bIsMe;
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
-
- iew.cbSize = sizeof(IEVIEWWINDOW);
- iew.iType = IEW_SCROLLBOTTOM;
- iew.hwnd = hWndLog;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
- return 1;
- }
- rtf = NULL;
- fontTimestamp = FontList::getFont(FontList::FONT_TIMESTAMP);
-// fontColon = FontList::getFont(FontList::FONT_COLON);
- if (event->iType == MUCC_EVENT_MESSAGE) {
- escapedStr=JabberRtfEscape((char *)event->pszText);
- escapedNick=JabberRtfEscape((char *)event->pszNick);
- if (event->bIsMe) {
- fontName = FontList::getFont(FontList::FONT_MYNAME);
- fontMessage = FontList::getFont(FontList::FONT_OUTMESSAGE);
- } else {
- fontName = FontList::getFont(FontList::FONT_OTHERSNAMES);
- fontMessage = FontList::getFont(FontList::FONT_INMESSAGE);
- }
- } else {
- fontName = FontList::getFont(FontList::FONT_ERROR);
- if (event->iType == MUCC_EVENT_ERROR) {
- escapedStr = JabberRtfEscape((char *)event->pszText);
- fontMessage = FontList::getFont(FontList::FONT_ERROR);
- } else if (event->iType == MUCC_EVENT_STATUS) {
- if (event->dwData == ID_STATUS_ONLINE) {
- fontMessage = FontList::getFont(FontList::FONT_JOINED);
- _snprintf(str, sizeof(str), Translate("%s has joined."), event->pszNick);
- } else {
- fontMessage = FontList::getFont(FontList::FONT_LEFT);
- _snprintf(str, sizeof(str), Translate("%s has left."), event->pszNick);
- }
- escapedStr = JabberRtfEscape(str);
- } else if (event->iType == MUCC_EVENT_TOPIC) {
- fontMessage = FontList::getFont(FontList::FONT_TOPIC);
- _snprintf(str, sizeof(str), Translate("The topic is %s."), event->pszText);
- escapedStr = JabberRtfEscape(str);
- }
- }
- //ltime = localtime(&event->time);
- JabberStringAppend(&rtf, &msgSize, "{\\rtf1\\ansi\\deff0{\\fonttbl");
- JabberStringAppend(&rtf, &msgSize, "{\\f0\\fnil\\fcharset%u %s;}", fontTimestamp->getCharSet(), fontTimestamp->getFace());
- JabberStringAppend(&rtf, &msgSize, "{\\f1\\fnil\\fcharset%u %s;}", fontName->getCharSet(), fontName->getFace());
- if (event->iType == MUCC_EVENT_MESSAGE && getOptions()&FLAG_FORMAT_FONT) {
- JabberStringAppend(&rtf, &msgSize, "{\\f2\\fnil\\fcharset%u %s;}", fontMessage->getCharSet(), getFontName(event->iFont));
- } else {
- JabberStringAppend(&rtf, &msgSize, "{\\f2\\fnil\\fcharset%u %s;}", fontMessage->getCharSet(), fontMessage->getFace());
- }
- JabberStringAppend(&rtf, &msgSize, "}{\\colortbl ");
- color = fontTimestamp->getColor();
- JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF);
- color = fontName->getColor();
- JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF);
- if (event->iType == MUCC_EVENT_MESSAGE && getOptions()&FLAG_FORMAT_COLOR && event->color!=0xFFFFFFFF) {
- color = event->color;
- } else {
- color = fontMessage->getColor();
- }
- JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF);
- JabberStringAppend(&rtf, &msgSize, "}\\pard");
- if (!isEmpty) {
- JabberStringAppend(&rtf, &msgSize, "\\par");
- }
- isEmpty = false;
- if (event->iType == MUCC_EVENT_MESSAGE) {
- if (getOptions()&FLAG_SHOW_DATE || getOptions()&FLAG_SHOW_TIMESTAMP) {
- bBold = fontTimestamp->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontTimestamp->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontTimestamp->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontTimestamp->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- dbtts.cbDest = 90;
- dbtts.szDest = timestampStr;
- timestampStr[0]='\0';
- //time_t time = time
- if (getOptions()&FLAG_SHOW_DATE && getOptions()&FLAG_SHOW_TIMESTAMP) {
- if (getOptions()&FLAG_LONG_DATE) {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"D s" : (char *)"D t";
- } else {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"d s" : (char *)"d t";
- }
- } else if (getOptions()&FLAG_SHOW_DATE) {
- dbtts.szFormat = getOptions()&FLAG_LONG_DATE ? (char *)"D" : (char *)"d";
- } else if (getOptions()&FLAG_SHOW_TIMESTAMP) {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"s" : (char *)"t";
- } else {
- dbtts.szFormat = (char *)"";
- }
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)event->time, (LPARAM) & dbtts);
- JabberStringAppend(&rtf, &msgSize, "\\f0\\cf0\\fs%d\\b%d\\i%d%s %s ",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- timestampStr);
- }
- bBold = fontName->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontName->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontName->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontName->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- if (getOptions()&FLAG_SHOW_NICKNAMES) {
- JabberStringAppend(&rtf, &msgSize, "\\f1\\cf1\\fs%d\\b%d\\i%d%s %s: ",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- escapedNick);
- }
- bBold = fontMessage->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontMessage->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontMessage->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontMessage->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- if (getOptions()&FLAG_FORMAT_STYLE) {
- bBold = bItalic = bUnderline = 0;
- if (event->dwFlags & MUCC_EF_FONT_BOLD) bBold = 1;
- if (event->dwFlags & MUCC_EF_FONT_ITALIC) bItalic = 1;
- if (event->dwFlags & MUCC_EF_FONT_UNDERLINE) bUnderline = 1;
- }
- if (getOptions()&FLAG_FORMAT_SIZE) {
- if (event->iFontSize != 0) iFontSize = 2 * event->iFontSize;
- }
- if (getOptions()&FLAG_MSGINNEWLINE) {
- JabberStringAppend(&rtf, &msgSize, "\\line");
- }
- JabberStringAppend(&rtf, &msgSize, "\\f2\\cf2\\fs%d\\b%d\\i%d%s %s",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- escapedStr);
- } else {
- if (event->iType == MUCC_EVENT_ERROR) {
- bBold = fontName->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontName->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontName->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontName->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- JabberStringAppend(&rtf, &msgSize, "\\f1\\cf1\\fs%d\\b%d\\i%d%s %s: ",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- Translate("Error"));
- } else {
- if (getOptions()&FLAG_SHOW_DATE || getOptions()&FLAG_SHOW_TIMESTAMP) {
- bBold = fontTimestamp->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontTimestamp->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontTimestamp->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontTimestamp->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- dbtts.cbDest = 90;
- dbtts.szDest = timestampStr;
- timestampStr[0]='\0';
- //time_t time = time
- if (getOptions()&FLAG_SHOW_DATE && getOptions()&FLAG_SHOW_TIMESTAMP) {
- if (getOptions()&FLAG_LONG_DATE) {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"D s" : (char *)"D t";
- } else {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"d s" : (char *)"d t";
- }
- } else if (getOptions()&FLAG_SHOW_DATE) {
- dbtts.szFormat = getOptions()&FLAG_LONG_DATE ? (char *)"D" : (char *)"d";
- } else if (getOptions()&FLAG_SHOW_TIMESTAMP) {
- dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"s" : (char *)"t";
- } else {
- dbtts.szFormat = (char *)"";
- }
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)event->time, (LPARAM) & dbtts);
- JabberStringAppend(&rtf, &msgSize, "\\f0\\cf0\\fs%d\\b%d\\i%d%s %s ",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- timestampStr);
- }
- }
- bBold = fontMessage->getStyle() & Font::BOLD ? 1 : 0;
- bItalic = fontMessage->getStyle() & Font::ITALIC ? 1 : 0;
- bUnderline = fontMessage->getStyle() & Font::UNDERLINE ? 1 : 0;
- iFontSize = fontMessage->getSize();
- iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY;
- JabberStringAppend(&rtf, &msgSize, "\\f2\\cf2\\fs%d\\b%d\\i%d%s %s",
- iFontSize,
- bBold,
- bItalic,
- bUnderline?"\\ul":"",
- escapedStr);
- }
- JabberStringAppend(&rtf, &msgSize, "}");
- hwndLog = GetDlgItem(getHWND(), IDC_LOG);
- sel.cpMin = sel.cpMax = GetWindowTextLength(hwndLog);
- SendMessage(hwndLog, EM_EXSETSEL, 0, (LPARAM) &sel);
- stt.flags = ST_SELECTION;
- stt.codepage = CP_ACP;
- SendMessage(hwndLog, EM_SETTEXTEX, (WPARAM) &stt, (LPARAM) rtf);
- free(rtf);
- if (escapedStr!=NULL) free(escapedStr);
- if (escapedNick!=NULL) free(escapedNick);
- return 1;
-}
-
-void ChatWindow::setFont(int font, int size, int bBold, int bItalic, int bUnderline, COLORREF color) {
- if (hEditFont!=NULL) {
- DeleteObject(hEditFont);
- }
- hEditFont = CreateFontA(MulDiv(-size, logPixelSY, 74), 0, 0, 0, bBold?FW_BOLD:FW_NORMAL,
- bItalic, bUnderline, 0, 238, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
- FIXED_PITCH | FF_ROMAN,
- getFontName(font));
- SendDlgItemMessage(hWnd, IDC_EDIT, WM_SETFONT, (WPARAM) hEditFont, TRUE);
- this->font = font;
- this->fontSize = size;
- this->bBold = bBold;
- this->bItalic = bItalic;
- this->bUnderline = bUnderline;
- this->fontColor = color;
-}
-
-int ChatWindow::getFontStyle() {
- int style = 0;
- if (bBold) style |= MUCC_EF_FONT_BOLD;
- if (bItalic) style |= MUCC_EF_FONT_ITALIC;
- if (bUnderline) style |= MUCC_EF_FONT_UNDERLINE;
- return style;
-}
-
-int ChatWindow::getFont() {
- return font;
-}
-
-int ChatWindow::getFontSize() {
- return fontSize;
-}
-
-COLORREF ChatWindow::getFontColor() {
- return fontColor;
-}
-
-void ChatWindow ::queryResultContacts(MUCCQUERYRESULT *queryResult) {
- HelperDialog::inviteDlg(this, queryResult);
-}
-
-void ChatWindow ::queryResultUsers(MUCCQUERYRESULT *queryResult) {
- if (adminWindow!=NULL) {
- adminWindow->queryResultUsers(queryResult);
- }
-}
-
-ChatWindow * ChatWindow::getWindow(const char *module, const char *roomId) {
- ChatWindow *ptr;
- EnterCriticalSection(&mutex);
- for (ptr=list;ptr!=NULL;ptr=ptr->getNext()) {
- if (strcmp(ptr->getRoomId(), roomId)==0 && strcmp(ptr->getModule(), module)==0) {
- break;
- }
- }
- LeaveCriticalSection(&mutex);
- return ptr;
-}
-
-
-static DWORD CALLBACK EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-{
- char *szFilename = (char *)dwCookie;
- FILE *file;
- file = fopen(szFilename, "ab");
- if (file != NULL) {
- *pcb = (LONG)fwrite(pbBuff, (size_t)cb, (size_t)1, file);
- fclose(file);
- return 0;
- }
- return 1;
-}
-
-static BOOL CALLBACK EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- ChatWindow *chat;
- chat = (ChatWindow *) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- switch (msg) {
-// case WM_GETDLGCODE:
-// return DLGC_WANTALLKEYS; //DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTALLKEYS;
- case WM_CHAR:
- if (wParam=='\r' || wParam=='\n') {
- if (((GetKeyState(VK_CONTROL)&0x8000)==0) == ((Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_SENDONENTER) != 0)) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return FALSE;
- }
- }
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) { //ctrl-a
- SendMessage(hwnd, EM_SETSEL, 0, -1);
- return 0;
- }
- if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w
- SendMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
- return 0;
- }
- break;
- }
- return CallWindowProc(oldEditWndProc, hwnd, msg, wParam, lParam);
-}
-
-static BOOL CALLBACK SplitterWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- ChatWindow *chat;
- chat = (ChatWindow *) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
- case WM_SETCURSOR:
- RECT rc;
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE);
- return TRUE;
- case WM_LBUTTONDOWN:
- SetCapture(hwnd);
- return 0;
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- HWND hParent;
- RECT rc;
- POINT pt;
- hParent = GetParent(hwnd);
- GetClientRect(hwnd, &rc);
- if (rc.right < rc.bottom) {
- pt.x = LOWORD(GetMessagePos());
- GetClientRect(hParent, &rc);
- ScreenToClient(hParent, &pt);
- if (pt.x < chat->vSplitterMinLeft)
- pt.x = chat->vSplitterMinLeft;
- if (rc.right-pt.x < chat->vSplitterMinRight)
- pt.x = rc.right-chat->vSplitterMinRight;
- if (chat->vSplitterPos != rc.right-pt.x) {
- chat->vSplitterPos = rc.right-pt.x;
- SendMessage(hParent, WM_SIZE, SIZE_RESTORED, (rc.bottom<<16)+rc.right);
- }
- } else {
- pt.y = HIWORD(GetMessagePos());
- GetClientRect(hParent, &rc);
- ScreenToClient(hParent, &pt);
- if (pt.y < chat->hSplitterMinTop)
- pt.y = chat->hSplitterMinTop;
- if (rc.bottom-pt.y < chat->hSplitterMinBottom)
- pt.y = rc.bottom-chat->hSplitterMinBottom;
- if (chat->hSplitterPos != rc.bottom-pt.y) {
- chat->hSplitterPos = rc.bottom-pt.y;
- SendMessage(hParent, WM_SIZE, SIZE_RESTORED, (rc.bottom<<16)+rc.right);
- }
- }
- }
- return 0;
- case WM_LBUTTONUP:
- ReleaseCapture();
- return 0;
- }
- return CallWindowProc(oldSplitterWndProc, hwnd, msg, wParam, lParam);
-}
-
-
-
-
-static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int i;
- ChatWindow *chatWindow;
- chatWindow = (ChatWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (msg!=WM_INITDIALOG && chatWindow==NULL) {
- return FALSE;
- }
- switch (msg) {
- case WM_INITDIALOG:
- HDC hdc;
- TranslateDialogDefault(hwndDlg);
- hdc = GetDC(NULL);
- logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]);
-
- chatWindow = (ChatWindow *) lParam;
- chatWindow->setHWND(hwndDlg);
- ChatWindow::refreshSettings(0);
- oldSplitterWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HSPLIT), GWLP_WNDPROC, (LONG_PTR) SplitterWndProc);
- oldSplitterWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_VSPLIT), GWLP_WNDPROC, (LONG_PTR) SplitterWndProc);
- oldEditWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_WNDPROC, (LONG_PTR) EditWndProc);
- ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), SW_HIDE);
- chatWindow->hSplitterMinTop = 90;
- chatWindow->hSplitterMinBottom = 40;
- chatWindow->hSplitterPos=50;
- chatWindow->vSplitterMinLeft = 100;
- chatWindow->vSplitterMinRight = 80;
- chatWindow->vSplitterPos=110;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) chatWindow);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_USERDATA, (LONG_PTR) chatWindow);
- chatWindow->refreshSettings();
-
- SetWindowTextA(hwndDlg, chatWindow->getRoomName());
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_BOLD]);
- SendDlgItemMessage(hwndDlg, IDC_ITALIC, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_ITALIC]);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_UNDERLINE]);
- SendDlgItemMessage(hwndDlg, IDC_SMILEYBTN, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_SMILEY]);
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
-
- // LoadImage(hInst, smadd_iconinfo.SmileyIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_OPTIONS]);
- SendDlgItemMessage(hwndDlg, IDC_INVITE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_INVITE]);
-
- SendDlgItemMessage(hwndDlg, IDC_TOPIC_BUTTON, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_INVITE, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALIC, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALIC, BUTTONSETASPUSHBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_SMILEYBTN, BUTTONSETASFLATBTN, 0, 0);
-
- SetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE,GetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE)|TVS_NOHSCROLL);
- SendDlgItemMessage(hwndDlg,IDC_TREELIST, CCM_SETVERSION,(WPARAM)5,0);
- //TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREELIST), hImageList, TVSIL_STATE);
- TreeView_SetItemHeight(GetDlgItem(hwndDlg, IDC_TREELIST), 16);
- TreeView_SetIndent(GetDlgItem(hwndDlg, IDC_TREELIST), 16);
- for(i=0;i<chatWindow->getFontSizeNum();i++) {
- char str[10];
- sprintf(str, "%d", chatWindow->getFontSize(i));
- int n = SendDlgItemMessageA(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM) str);
- SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SETITEMDATA, n, chatWindow->getFontSize(i));
- }
- SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SETCURSEL, Options::getChatWindowFontSize(), 0);
- for(i=0;i<chatWindow->getFontNameNum();i++) {
- int n = SendDlgItemMessageA(hwndDlg, IDC_FONT, CB_ADDSTRING, 0, (LPARAM) chatWindow->getFontName(i));
- SendDlgItemMessage(hwndDlg, IDC_FONT, CB_SETITEMDATA, n, i);
- }
- SendDlgItemMessage(hwndDlg, IDC_FONT, CB_SETCURSEL, Options::getChatWindowFont(), 0);
- CheckDlgButton(hwndDlg, IDC_BOLD, Options::getChatWindowFontStyle()&Font::BOLD ? TRUE : FALSE);
- CheckDlgButton(hwndDlg, IDC_ITALIC, Options::getChatWindowFontStyle()&Font::ITALIC ? TRUE : FALSE);
- CheckDlgButton(hwndDlg, IDC_UNDERLINE, Options::getChatWindowFontStyle()&Font::UNDERLINE ? TRUE : FALSE);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_SETCOLOUR, 0, (LPARAM)Options::getChatWindowFontColor());
- chatWindow->setFont(Options::getChatWindowFont(),
- chatWindow->getFontSize(Options::getChatWindowFontSize()),
- Options::getChatWindowFontStyle()&Font::BOLD ? 1 : 0,
- Options::getChatWindowFontStyle()&Font::ITALIC ? 1 : 0,
- Options::getChatWindowFontStyle()&Font::UNDERLINE ? 1 : 0,
- Options::getChatWindowFontColor());
- if (ServiceExists(MS_IEVIEW_WINDOW) && Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_ENABLEIEVIEW) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
- ieWindow.dwMode = IEWM_MUCC;
- ieWindow.parent = hwndDlg;
- ieWindow.x = 0;
- ieWindow.y = 0;
- ieWindow.cx = 200;
- ieWindow.cy = 300;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- chatWindow->setHWNDLog(ieWindow.hwnd);
- ShowWindow(GetDlgItem(hwndDlg, IDC_LOG), SW_HIDE);
- }
- SetWindowPos(hwndDlg, HWND_TOP, 0, 0, 540, 370, SWP_NOMOVE | SWP_SHOWWINDOW);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDIT));
- chatWindow->clearLog();
- SetEvent(chatWindow->getEvent());
- return TRUE;
- break;
- case DM_CHAT_EVENT:
- MUCCEVENT *mucEvent;
- mucEvent = (MUCCEVENT *) lParam;
- switch (mucEvent->iType) {
- case MUCC_EVENT_MESSAGE:
- chatWindow->logEvent(mucEvent);
- break;
- case MUCC_EVENT_TOPIC:
- chatWindow->changeTopic(mucEvent);
- break;
- case MUCC_EVENT_STATUS:
- chatWindow->changePresence(mucEvent);
- break;
- case MUCC_EVENT_ERROR:
- chatWindow->logEvent(mucEvent);
- break;
- //case MUCC_EVENT_LEAVE:
- // DestroyWindow(hwndDlg);
- // break;
- case MUCC_EVENT_ROOM_INFO:
- chatWindow->changeRoomInfo(mucEvent);
- break;
- }
- return TRUE;
- case DM_CHAT_QUERY:
- MUCCQUERYRESULT *queryResult;
- queryResult = (MUCCQUERYRESULT *)lParam;
- switch (queryResult->iType) {
- case MUCC_EVENT_QUERY_CONTACTS:
- chatWindow->queryResultContacts(queryResult);
- break;
- case MUCC_EVENT_QUERY_USERS:
- chatWindow->queryResultUsers(queryResult);
- break;
-
- }
- return TRUE;
- case WM_SETFOCUS:
- SetFocus(GetDlgItem(hwndDlg, IDC_EDIT));
- return TRUE;
- case WM_GETMINMAXINFO:
- MINMAXINFO *mmi;
- mmi = (MINMAXINFO *) lParam;
- mmi->ptMinTrackSize.x = 370;
- mmi->ptMinTrackSize.y = 130;
- return FALSE;
- case WM_SIZE:
- if (wParam!=SIZE_MINIMIZED) {
- int dlgWidth, dlgHeight;
- RECT rc;
- HDWP hdwp;
- GetClientRect(hwndDlg, &rc);
- dlgWidth = rc.right-rc.left;
- dlgHeight = rc.bottom-rc.top;
- if (dlgHeight-chatWindow->hSplitterPos < chatWindow->hSplitterMinTop) {
- chatWindow->hSplitterPos = dlgHeight-chatWindow->hSplitterMinTop;
- }
- if (chatWindow->hSplitterPos < chatWindow->hSplitterMinBottom) {
- chatWindow->hSplitterPos = chatWindow->hSplitterMinBottom;
- }
- if (dlgWidth-chatWindow->vSplitterPos < chatWindow->vSplitterMinLeft) {
- chatWindow->vSplitterPos = dlgWidth-chatWindow->vSplitterMinLeft;
- }
- if (chatWindow->vSplitterPos < chatWindow->vSplitterMinRight) {
- chatWindow->vSplitterPos = chatWindow->vSplitterMinRight;
- }
-
- hdwp = BeginDeferWindowPos(15);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TOPIC), 0, 70, 7, dlgWidth-140, 18, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 0, 30, dlgWidth-(chatWindow->vSplitterPos)-2, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TREELIST), 0, dlgWidth-(chatWindow->vSplitterPos)+2, 30, (chatWindow->vSplitterPos)-2, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_EDIT), 0, 0, dlgHeight-(chatWindow->hSplitterPos)+2, dlgWidth, (chatWindow->hSplitterPos)-5, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_INVITE), 0, dlgWidth-31, dlgHeight-(chatWindow->hSplitterPos)-26, 31, 24, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_BOLD), 0, 0, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER );
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_ITALIC), 0, 24, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER );
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_UNDERLINE), 0, 48, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER );
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_COLOR), 0, 73, dlgHeight-(chatWindow->hSplitterPos)-25, 22, 22, SWP_NOZORDER );
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_FONT), 0, 98, dlgHeight-(chatWindow->hSplitterPos)-24, 110, 13, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_FONTSIZE), 0, 213, dlgHeight-(chatWindow->hSplitterPos)-24, 38, 13, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SMILEYBTN), 0, 265, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_OPTIONS), 0, dlgWidth-79, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_VSPLIT), 0, dlgWidth-(chatWindow->vSplitterPos)-2, 30, 4, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_HSPLIT), 0, 0, dlgHeight-(chatWindow->hSplitterPos)-2, dlgWidth-8, 4, SWP_NOZORDER);
- EndDeferWindowPos(hdwp);
- if (chatWindow->getHWNDLog()!=NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = hwndDlg;
- ieWindow.hwnd = chatWindow->getHWNDLog();
- ieWindow.x = 0;
- ieWindow.y = 30;
- ieWindow.cx = dlgWidth-(chatWindow->vSplitterPos)-2;
- ieWindow.cy = dlgHeight-(chatWindow->hSplitterPos)-30-26-2;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
- }
- break;
- /*
- case WM_SYSCOMMAND:
- if (wParam == SC_CLOSE) {
- SendMessage(hwndDlg, WM_CLOSE, 1, 0);
-// muce.iType = MUCC_EVENT_LEAVE;
-// muce.pszModule = chatWindow->getModule();
-// muce.pszID = chatWindow->getRoomId();
-// NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
-// delete chatWindow;
- return TRUE;
- }
- break;
- */
- case WM_CLOSE:
- //if (wParam != 1) { // esc
- //return FALSE;
- //}
- DestroyWindow(hwndDlg);
- return TRUE;
- case WM_DESTROY:
- {
- MUCCEVENT muce;
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_LEAVE;
- muce.pszModule = chatWindow->getModule();
- muce.pszID = chatWindow->getRoomId();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- if (chatWindow->getHWNDLog()!=NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = chatWindow->getHWNDLog();
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) NULL);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HSPLIT), GWLP_WNDPROC, (LONG_PTR) oldSplitterWndProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_VSPLIT), GWLP_WNDPROC, (LONG_PTR) oldSplitterWndProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_WNDPROC, (LONG_PTR) oldEditWndProc);
- delete chatWindow;
- break;
- }
- case WM_TLEN_SMILEY:
- if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
- SMADD_RICHEDIT2 smre;
- smre.cbSize = sizeof(SMADD_RICHEDIT2);
- smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
- smre.Protocolname = (char *)chatWindow->getModule();
- smre.rangeToReplace = NULL;
- smre.useSounds = FALSE;
- smre.disableRedraw = FALSE;
- CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM) &smre);
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_OPTIONS:
- {
- MUCCEVENT muce;
- HMENU hMenu;
- RECT rc;
- int iSelection;
- hMenu=GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)),0);
- CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_OPTIONS), &rc);
- CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWNICKNAMES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_NICKNAMES ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_MSGINNEWLINE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_MSGINNEWLINE ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWDATE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_DATE ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWTIMESTAMP, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_TIMESTAMP ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWSECONDS, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_SECONDS ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_USELONGDATE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LONG_DATE ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATFONT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_FONT ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATSIZE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_SIZE ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATCOLOR, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_COLOR ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATSTYLE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_STYLE ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_LOGMESSAGES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_MESSAGES ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_LOGJOINED, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_JOINED ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_LOGLEFT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_LEFT ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_LOGTOPIC, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_TOPIC ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHMESSAGES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_MESSAGES ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHJOINED, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_JOINED ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHLEFT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_LEFT ? MF_CHECKED : MF_UNCHECKED);
- CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHTOPIC, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_TOPIC ? MF_CHECKED : MF_UNCHECKED);
- if (chatWindow->getMe()!=NULL) {
- if (chatWindow->getMe()->getFlags() & (MUCC_EF_USER_OWNER | MUCC_EF_USER_ADMIN)) {
- EnableMenuItem(hMenu, ID_ADMINMENU_ADMIN, MF_BYCOMMAND | MF_ENABLED);
- EnableMenuItem(hMenu, ID_ADMINMENU_BROWSE, MF_BYCOMMAND | MF_ENABLED);
- }
- if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_OWNER) {
- EnableMenuItem(hMenu, ID_ADMINMENU_DESTROY, MF_BYCOMMAND | MF_ENABLED);
- }
- }
- iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, rc.left, rc.bottom, 0, hwndDlg, NULL);
- DestroyMenu(hMenu);
- switch (iSelection) {
- case ID_OPTIONMENU_SHOWNICKNAMES:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_NICKNAMES);
- break;
- case ID_OPTIONMENU_MSGINNEWLINE:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_MSGINNEWLINE);
- break;
- case ID_OPTIONMENU_SHOWDATE:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_DATE);
- break;
- case ID_OPTIONMENU_SHOWTIMESTAMP:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_TIMESTAMP);
- break;
- case ID_OPTIONMENU_SHOWSECONDS:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_SECONDS);
- break;
- case ID_OPTIONMENU_USELONGDATE:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LONG_DATE);
- break;
- case ID_OPTIONMENU_FORMATFONT:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_FONT);
- break;
- case ID_OPTIONMENU_FORMATSIZE:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_SIZE);
- break;
- case ID_OPTIONMENU_FORMATCOLOR:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_COLOR);
- break;
- case ID_OPTIONMENU_FORMATSTYLE:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_STYLE);
- break;
- case ID_OPTIONMENU_LOGMESSAGES:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_MESSAGES);
- break;
- case ID_OPTIONMENU_LOGJOINED:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_JOINED);
- break;
- case ID_OPTIONMENU_LOGLEFT:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_LEFT);
- break;
- case ID_OPTIONMENU_LOGTOPIC:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_TOPIC);
- break;
- case ID_OPTIONMENU_FLASHMESSAGES:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_MESSAGES);
- break;
- case ID_OPTIONMENU_FLASHJOINED:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_JOINED);
- break;
- case ID_OPTIONMENU_FLASHLEFT:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_LEFT);
- break;
- case ID_OPTIONMENU_FLASHTOPIC:
- chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_TOPIC);
- break;
- case ID_OPTIONMENU_SAVEDEFAULT:
- Options::setChatWindowOptions(chatWindow->getOptions());
- Options::setChatWindowFont((int)SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0));
- Options::setChatWindowFontSize((int)SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0));
- Options::setChatWindowFontStyle(
- (IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? Font::BOLD : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_ITALIC) ? Font::ITALIC : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE) ? Font::UNDERLINE : 0)
- );
- Options::setChatWindowFontColor((COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0));
- Options::saveSettings();
- break;
- case ID_ADMINMENU_DESTROY:
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_REMOVE_ROOM;
- muce.pszModule = chatWindow->getModule();
- muce.pszID = chatWindow->getRoomId();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- DestroyWindow(hwndDlg);
- break;
- case ID_ADMINMENU_ADMIN:
- chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_KICK);
- break;
- case ID_ADMINMENU_BROWSE:
- chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_ROLE);
- break;
- case ID_ADMINMENU_SAVELOG:
- if (chatWindow->getHWNDLog()!=NULL) {
- IEVIEWEVENT iee;
- ZeroMemory(&iee, sizeof(iee));
- iee.cbSize = sizeof(iee);
- iee.dwFlags = 0;
- iee.hwnd = chatWindow->getHWNDLog();
- iee.hContact = NULL;
- iee.iType = IEE_SAVE_DOCUMENT;
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
- } else {
- char szFilename[MAX_PATH];
- strcpy(szFilename, "");
- OPENFILENAMEA ofn={0};
- ofn.lStructSize=sizeof(OPENFILENAME);
- ofn.hwndOwner=hwndDlg;
- ofn.lpstrFile = szFilename;
- ofn.lpstrFilter = "Rich Text File\0*.rtf\0\0";
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY;
- ofn.lpstrDefExt = "rtf";
- if (GetSaveFileNameA(&ofn)) {
- //remove(szFilename);
- EDITSTREAM stream = { 0 };
- stream.dwCookie = (DWORD_PTR)szFilename;
- stream.dwError = 0;
- stream.pfnCallback = EditStreamCallback;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM) & stream);
- }
- }
- break;
- }
- }
- break;
- case IDC_SMILEYBTN:
- SMADD_SHOWSEL smaddInfo;
- RECT rc;
- smaddInfo.cbSize = sizeof(SMADD_SHOWSEL);
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_EDIT);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = chatWindow->getModule();
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.top + 24;
- if (chatWindow->getHWNDLog() != NULL) {
- CallService(MS_IEVIEW_SHOWSMILEYSELECTION, 0, (LPARAM) &smaddInfo);
- } else {
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo);
- }
- break;
- case IDC_INVITE:
- {
- MUCCEVENT muce;
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_CONTACTS;
- muce.pszModule = chatWindow->getModule();
- muce.pszID = chatWindow->getRoomId();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- break;
- case IDC_TOPIC_BUTTON:
- HelperDialog::topicDlg(chatWindow);
- break;
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- return TRUE;
- case IDOK:
- {
- MUCCEVENT muce;
- char text[2048];
- GetDlgItemTextA(hwndDlg, IDC_EDIT, text, sizeof(text));
- SetDlgItemTextA(hwndDlg, IDC_EDIT, "");
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_MESSAGE;
- muce.pszModule = chatWindow->getModule();
- muce.pszID = chatWindow->getRoomId();
- muce.pszText = text;
- muce.iFont = chatWindow->getFont();
- muce.iFontSize = chatWindow->getFontSize();
- muce.dwFlags = chatWindow->getFontStyle();
- muce.color = chatWindow->getFontColor();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- break;
- case IDC_BOLD:
- case IDC_ITALIC:
- case IDC_UNDERLINE:
- if (HIWORD(wParam)==BN_CLICKED) {
- chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0),
- (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0),
- IsDlgButtonChecked(hwndDlg, IDC_BOLD),
- IsDlgButtonChecked(hwndDlg, IDC_ITALIC),
- IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE),
- (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0));
- }
- case IDC_FONT:
- case IDC_FONTSIZE:
- if (HIWORD(wParam)==CBN_SELCHANGE) {
- chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0),
- (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0),
- IsDlgButtonChecked(hwndDlg, IDC_BOLD),
- IsDlgButtonChecked(hwndDlg, IDC_ITALIC),
- IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE),
- (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0));
- }
- break;
- case IDC_COLOR:
- if (HIWORD(wParam)==CPN_COLOURCHANGED) {
- InvalidateRect(GetDlgItem(hwndDlg, IDC_EDIT), NULL, FALSE);
- chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0),
- (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0),
- IsDlgButtonChecked(hwndDlg, IDC_BOLD),
- IsDlgButtonChecked(hwndDlg, IDC_ITALIC),
- IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE),
- (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0));
- }
- break;
-
- }
- break;
- case WM_CTLCOLOREDIT:
- if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_EDIT)) {
- SetTextColor((HDC) wParam, (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0));
- SetBkColor((HDC) wParam, Options::getInputBgColor());
- //SelectObject((HDC) wParam, Options::getInputBgBrush());
- return (BOOL) Options::getInputBgBrush();
- }
-
- break;
- case WM_NOTIFY:
- LPNMHDR pNmhdr;
- pNmhdr = (LPNMHDR)lParam;
- if (pNmhdr->idFrom == IDC_TREELIST) {
- switch (pNmhdr->code) {
- case TVN_ITEMEXPANDING:
- {
- LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam;
- if (pnmtv->action==TVE_COLLAPSE) {
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- break;
- case NM_RCLICK:
- {
- TVHITTESTINFO hti;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(pNmhdr->hwndFrom,&hti.pt);
- if(TreeView_HitTest(pNmhdr->hwndFrom, &hti) && hti.flags&TVHT_ONITEM) {
- TVITEM tvi = {0};
- tvi.mask = TVIF_PARAM|TVIF_HANDLE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(pNmhdr->hwndFrom, &tvi);
- ChatUser *user = (ChatUser *) tvi.lParam;
- if (user!=NULL) {
- TreeView_Select(pNmhdr->hwndFrom, tvi.hItem, TVGN_CARET);
- if (!user->isMe()) {
- HMENU hMenu;
- int iSelection;
- hMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)),1);
- CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0);
- if (chatWindow->getMe()!=NULL) {
- if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_OWNER) {
- EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_ENABLED);
- EnableMenuItem(hMenu, 3, MF_BYPOSITION | MF_ENABLED);
- EnableMenuItem(hMenu, ID_USERMENU_ADMINISTRATION, MF_BYCOMMAND | MF_ENABLED);
-
- } else if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_ADMIN) {
- if (!(user->getFlags() & (MUCC_EF_USER_OWNER | MUCC_EF_USER_OWNER))) {
- EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_ENABLED);
- //EnableMenuItem(hMenu, 3, MF_BYPOSITION | MF_ENABLED);
- EnableMenuItem(hMenu, ID_USERMENU_ADMINISTRATION, MF_BYCOMMAND | MF_ENABLED);
- }
- }
- }
- //CheckMenuItem(hMenu, ID_USERMENU_MESSAGE, MF_BYCOMMAND | MF_CHECKED : MF_UNCHECKED);
- //EnableMenuItem(hMenu, ID_USERMENU_MESSAGE, MF_BYCOMMAND | MF_GRAYED);
- iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, NULL);
- DestroyMenu(hMenu);
- if (iSelection == ID_USERMENU_MESSAGE) {
- chatWindow->startPriv();
- } else if (iSelection >= ID_USERMENU_KICK_NO_BAN && iSelection <= ID_USERMENU_KICK_BAN_4_W) {
- int banTime[] = {0, 1, 5, 15, 30, 60, 360, 1440, 4320, 10080, 20160, 40320};
- chatWindow->kickAndBan(banTime[iSelection-ID_USERMENU_KICK_NO_BAN] *60);
- } else if (iSelection == ID_USERMENU_RIGHTS_MEMBER) {
- chatWindow->setRights(MUCC_EF_USER_MEMBER);
- } else if (iSelection == ID_USERMENU_RIGHTS_ADMIN) {
- chatWindow->setRights(MUCC_EF_USER_ADMIN);
- } else if (iSelection == ID_USERMENU_RIGHTS_NO) {
- chatWindow->setRights(0);
- } else if (iSelection == ID_USERMENU_ADMINISTRATION) {
- chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_KICK);
- }
- }
- }
- }
-
- }
- break;
- case NM_CUSTOMDRAW:
- LPNMTVCUSTOMDRAW pCustomDraw = (LPNMTVCUSTOMDRAW)lParam;
- switch (pCustomDraw->nmcd.dwDrawStage) {
- case CDDS_PREPAINT:
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYITEMDRAW);
- return TRUE;
- case CDDS_ITEMPREPAINT:
- {
- TVITEM tvi;;
- HICON hIcon;
- TCHAR str[200];
- RECT rc = pCustomDraw->nmcd.rc;
- tvi.mask = TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_PARAM;
- tvi.pszText = str;
- tvi.cchTextMax = sizeof(str)/sizeof(TCHAR);
- tvi.hItem = (HTREEITEM)pCustomDraw->nmcd.dwItemSpec;
- TreeView_GetItem(pCustomDraw->nmcd.hdr.hwndFrom, &tvi);
- ChatUser * user= (ChatUser *)pCustomDraw->nmcd.lItemlParam;
- hIcon = NULL;
- pCustomDraw->clrTextBk = Options::getListBgColor();
- switch (pCustomDraw->iLevel) {
- case 0:
- pCustomDraw->clrText = ChatWindow::getListGroupTextColor();
- SelectObject(pCustomDraw->nmcd.hdc, ChatWindow::getListGroupFont());
- break;
- case 1:
- pCustomDraw->clrText = ChatWindow::getListTextColor();
- if (pCustomDraw->nmcd.uItemState & CDIS_SELECTED) { // selected (CDIS_FOCUS |
- pCustomDraw->clrTextBk = 0xDAC8C2;
- } else {
- pCustomDraw->clrTextBk = Options::getListBgColor();
- }
- if (user!=NULL) {
- if (user->getFlags()&MUCC_EF_USER_GLOBALOWNER) {
- hIcon = muccIcon[MUCC_IDI_U_GLOBALOWNER];
- } else if (user->getFlags()&MUCC_EF_USER_OWNER) {
- hIcon = muccIcon[MUCC_IDI_U_OWNER];
- } else if (user->getFlags()&MUCC_EF_USER_ADMIN) {
- hIcon = muccIcon[MUCC_IDI_U_ADMIN];
- } else if (user->getFlags()&MUCC_EF_USER_REGISTERED) {
- hIcon = muccIcon[MUCC_IDI_U_REGISTERED];
- }
- }
- SelectObject(pCustomDraw->nmcd.hdc, ChatWindow::getListFont());
- break;
- }
- if (rc.bottom-rc.top!=0 && rc.right-rc.left!=0) {
- HBRUSH hBr;
- hBr = CreateSolidBrush(pCustomDraw->clrTextBk);
- FillRect(pCustomDraw->nmcd.hdc, &rc, hBr);
- DeleteObject(hBr);
- if (hIcon!=NULL) {
- DrawIconEx(pCustomDraw->nmcd.hdc, rc.left, rc.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- }
- SetBkMode(pCustomDraw->nmcd.hdc, TRANSPARENT);
- SetTextColor(pCustomDraw->nmcd.hdc, pCustomDraw->clrText);
- TextOut(pCustomDraw->nmcd.hdc,
- rc.left+pCustomDraw->iLevel*GetSystemMetrics(SM_CXSMICON)+2,
- rc.top, tvi.pszText, (int)_tcslen(tvi.pszText));
- }
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
- return TRUE;
- }
- }
- break;
- }
- } else if (pNmhdr->idFrom == IDC_LOG) {
- switch (((NMHDR *) lParam)->code) {
- case EN_MSGFILTER:
- switch (((MSGFILTER *) lParam)->msg) {
- /*
- case WM_LBUTTONDOWN:
- {
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
- SetWindowLong(hwndDlg, DWL_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- }
- case WM_MOUSEMOVE:
- {
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- break;
- }
- */
- case WM_RBUTTONUP:
- {
- HMENU hMenu, hSubMenu;
- POINT pt;
- CHARRANGE sel, all = { 0, -1 };
-
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- hSubMenu = GetSubMenu(hMenu, 0);
- CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hSubMenu, 0);
- SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
- if (sel.cpMin == sel.cpMax)
- EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
- pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
- ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case IDM_COPY:
- SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0);
- break;
- case IDM_COPYALL:
- SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
- SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0);
- SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
- break;
- case IDM_SELECTALL:
- SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
- break;
- case IDM_CLEAR:
- chatWindow->clearLog();
- break;
- }
- DestroyMenu(hMenu);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- break;
- case EN_LINK:
- switch (((ENLINK *) lParam)->msg) {
- case WM_SETCURSOR:
- SetCursor(hCurHyperlinkHand);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- {
- TEXTRANGEA tr;
- CHARRANGE sel;
-
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM) & sel);
- if (sel.cpMin != sel.cpMax)
- break;
- tr.chrg = ((ENLINK *) lParam)->chrg;
- tr.lpstrText = (char *)malloc(tr.chrg.cpMax - tr.chrg.cpMin + 8);
- SendDlgItemMessageA(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
- if (strchr(tr.lpstrText, '@') != NULL && strchr(tr.lpstrText, ':') == NULL && strchr(tr.lpstrText, '/') == NULL) {
- MoveMemory(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1);
- CopyMemory(tr.lpstrText, "mailto:", 7);
- }
- if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN) {
- HMENU hMenu, hSubMenu;
- POINT pt;
-
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- hSubMenu = GetSubMenu(hMenu, 1);
- CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hSubMenu, 0);
- pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
- pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
- ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
- case IDM_OPENNEW:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM) tr.lpstrText);
- break;
- case IDM_OPENEXISTING:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) tr.lpstrText);
- break;
- case IDM_COPYLINK:
- {
- HGLOBAL hData;
- if (!OpenClipboard(hwndDlg))
- break;
- EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(tr.lpstrText) + 1);
- lstrcpyA((char *)GlobalLock(hData), tr.lpstrText);
- GlobalUnlock(hData);
- SetClipboardData(CF_TEXT, hData);
- CloseClipboard();
- break;
- }
- }
- free(tr.lpstrText);
- DestroyMenu(hMenu);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- else {
- CallService(MS_UTILS_OPENURL, 1, (LPARAM) tr.lpstrText);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDIT));
- }
- free(tr.lpstrText);
- break;
- }
- }
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static char *JabberRtfEscape(char *str) {
- char *escapedStr;
- int size;
- char *p, *q;
-
- if (str == NULL)
- return NULL;
-
- for (p=str,size=0; *p!='\0'; p++) {
- if (*p=='\\' || *p=='{' || *p=='}')
- size += 2;
- else if (*p=='\n' || *p=='\t')
- size += 5;
- else
- size++;
- }
-
- if ((escapedStr=(char *)malloc(size+1)) == NULL)
- return NULL;
-
- for (p=str,q=escapedStr; *p!='\0'; p++) {
- if (strchr("\\{}", *p) != NULL) {
- *q++ = '\\';
- *q++ = *p;
- }
- else if (*p == '\n') {
- strcpy(q, "\\par ");
- q += 5;
- }
- else if (*p == '\t') {
- strcpy(q, "\\tab ");
- q += 5;
- }
- else {
- *q++ = *p;
- }
- }
- *q = '\0';
-
- return escapedStr;
-}
-
-static void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) {
- va_list vararg;
- char *p;
- int size, len;
-
- if (str == NULL) return;
-
- if (*str==NULL || *sizeAlloced<=0) {
- *sizeAlloced = size = 2048;
- *str = (char *) malloc(size);
- len = 0;
- }
- else {
- len = (int)strlen(*str);
- size = *sizeAlloced - (int)strlen(*str);
- }
-
- p = *str + len;
- va_start(vararg, fmt);
- while (_vsnprintf(p, size, fmt, vararg) == -1) {
- size += 2048;
- (*sizeAlloced) += 2048;
- *str = (char *) realloc(*str, *sizeAlloced);
- p = *str + len;
- }
- va_end(vararg);
-}
-
-
-//static DWORD CALLBACK Log_StreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
-//{
-// StreamData *stream = (StreamData *) dwCookie;
-/*
- if (lstrdat->buffer == NULL)
- {
- lstrdat->iColCount = 4;
- lstrdat->bufferOffset = 0;
- lstrdat->buffer = Log_CreateBody(lstrdat);
- lstrdat->bufferLen = lstrlen(lstrdat->buffer);
- }
- *pcb = min(cb, lstrdat->bufferLen - lstrdat->bufferOffset);
- CopyMemory(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb);
- lstrdat->bufferOffset += *pcb;
- if (lstrdat->bufferOffset == lstrdat->bufferLen)
- {
- free(lstrdat->buffer);
- lstrdat->buffer = NULL;
- }
-*/
-// return 0;
-//}
diff --git a/protocols/Tlen/tlen_czaty/ChatWindow.h b/protocols/Tlen/tlen_czaty/ChatWindow.h
deleted file mode 100644
index 37b0b29d6e..0000000000
--- a/protocols/Tlen/tlen_czaty/ChatWindow.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-class ChatWindow;
-
-#ifndef CHATWINDOW_INCLUDED
-#define CHATWINDOW_INCLUDED
-#include "mucc.h"
-#include "ChatEvent.h"
-#include "ChatUser.h"
-#include "AdminWindow.h"
-#include "ChatContainer.h"
-
-#define DM_CHAT_EVENT (WM_USER+1)
-#define DM_CHAT_QUERY (WM_USER+2)
-#define WM_TLEN_SMILEY (WM_USER+200)
-
-
-class StreamData {
-public:
- ChatWindow *chat;
- MUCCEVENT *event;
-};
-
-class ChatWindow{
-private:
- static ChatWindow * list;
- static CRITICAL_SECTION mutex;
- static bool released;
- static HFONT hListGroupFont, hListFont;
- static COLORREF colorListBg, colorListText, colorListGroupText;
- static COLORREF colorInputBg, colorLogBg;
- ChatContainer * container;
- HANDLE hEvent;
- HWND hWnd;
- HWND hWndLog;
- HFONT hEditFont;
- HTREEITEM hUserGroups[5];
- char * module;
- char * roomId;
- char * roomName;
- char * topic;
- int options;
- int roomFlags;
- int font, fontSize;
- int bBold, bItalic, bUnderline;
- int wasFirstMessage;
- bool isEmpty;
- COLORREF fontColor;
- int isStarted;
- ChatWindow * prev;
- ChatWindow * next;
- int adminDialogMode;
- AdminWindow * adminWindow;
- ChatUser * users;
- ChatUser * userMe;
- void addUser(ChatUser *);
- void removeUser(ChatUser *);
- ChatUser * findUser(const char *);
- int getUserGroup(ChatUser *);
- ChatUser * getSelectedUser();
- ChatEventList eventList;
- void createRTFHeader();
- int appendMessage(const MUCCEVENT *event);
- int logMessage(const MUCCEVENT *event);
-public:
- enum LOGFLAGS {
- FLAG_SHOW_NICKNAMES = 0x00000001,
- FLAG_MSGINNEWLINE = 0x00000002,
- FLAG_OPT_SENDONENTER= 0x00000004,
- FLAG_OPT_ENABLEIEVIEW=0x00000008,
-
- FLAG_SHOW_DATE = 0x00000010,
- FLAG_SHOW_TIMESTAMP = 0x00000020,
- FLAG_SHOW_SECONDS = 0x00000040,
- FLAG_LONG_DATE = 0x00000080,
-
- FLAG_FORMAT_FONT = 0x00000100,
- FLAG_FORMAT_SIZE = 0x00000200,
- FLAG_FORMAT_COLOR = 0x00000400,
- FLAG_FORMAT_STYLE = 0x00000800,
- FLAG_FORMAT_ALL = 0x00000F00,
-
- FLAG_LOG_MESSAGES = 0x00001000,
- FLAG_LOG_JOINED = 0x00002000,
- FLAG_LOG_LEFT = 0x00004000,
- FLAG_LOG_TOPIC = 0x00008000,
- FLAG_LOG_ALL = 0x0000F000,
-
- FLAG_FLASH_MESSAGES = 0x00010000,
- FLAG_FLASH_JOINED = 0x00020000,
- FLAG_FLASH_LEFT = 0x00040000,
- FLAG_FLASH_TOPIC = 0x00080000,
- FLAG_FLASH_ALL = 0x000F0000,
-
-
- };
-
- enum ADMINMODES {
- ADMIN_MODE_KICK = 1,
- ADMIN_MODE_ROLE = 2,
- ADMIN_MODE_BROWSER = 3
- };
- int hSplitterPos;
- int vSplitterPos;
- int hSplitterMinBottom;
- int hSplitterMinTop;
- int vSplitterMinLeft;
- int vSplitterMinRight;
- ChatWindow (MUCCWINDOW *);
- ~ChatWindow ();
- ChatWindow * getNext();
- void setNext(ChatWindow *);
- ChatWindow * getPrev();
- ChatContainer* getContainer();
- void setPrev(ChatWindow *);
- void setHWND(HWND);
- HWND getHWND();
- void setHWNDLog(HWND);
- HWND getHWNDLog();
- HANDLE getEvent();
- const char * getModule();
- void setModule(const char *);
- const char * getRoomId();
- void setRoomId(const char *);
- const char * getRoomName();
- void setRoomName(const char *);
- void setOptions(int);
- int getOptions();
- void setRoomFlags(int);
- int getRoomFlags();
- int getFontSizeNum();
- int getFontSize(int);
- int getFontNameNum();
- const char * getFontName(int);
- void setFont(int font, int size, int bBold, int bItalic, int bUnderline, COLORREF color);
- int getFont();
- int getFontSize();
- int getFontStyle();
- COLORREF getFontColor();
- int start();
- int startPriv();
- void startAdminDialog(int mode);
- int kickAndBan(int time);
- int kickAndBan(const char *id, int time, const char *);
- int unban(const char *id);
- int setRights(int flags);
- int setRights(const char *id, int flags);
- void queryResultContacts(MUCCQUERYRESULT *queryResult);
- void queryResultUsers(MUCCQUERYRESULT *queryResult);
- void setTreeItem(int, HTREEITEM);
- HTREEITEM getTreeItem(int);
- ChatUser * findUserByNick(const char *);
- ChatUser * getMe();
- void refreshSettings();
- void setAdminWindow(AdminWindow *);
- AdminWindow * getAdminWindow();
- void rebuildLog();
- void clearLog();
- int logEvent(const MUCCEVENT *event);
- int changePresence(const MUCCEVENT *event);
- int changeTopic(const MUCCEVENT *event);
- int changeRoomInfo(const MUCCEVENT *event);
- int leave();
-
- static void refreshSettings(int force);
- static HFONT getListGroupFont();
- static HFONT getListFont();
- static COLORREF getListTextColor();
- static COLORREF getListGroupTextColor();
- static int getDefaultOptions();
-
- static void init();
- static void release();
- static ChatWindow * getWindow(const char *module, const char *roomId);
-
-};
-#endif
diff --git a/protocols/Tlen/tlen_czaty/FontList.cpp b/protocols/Tlen/tlen_czaty/FontList.cpp
deleted file mode 100644
index 4d57617013..0000000000
--- a/protocols/Tlen/tlen_czaty/FontList.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#include "FontList.h"
-#include "Utils.h"
-
-#define FONTCOUNT 12
-static Font defFonts[] = {
- Font("Timestamp","Verdana", DEFAULT_CHARSET, -9, Font::BOLD, 0x000000),
-// Font("Colon","Verdana", DEFAULT_CHARSET, -13, 0, 0x808080),
- Font("Others names","Verdana", DEFAULT_CHARSET, -13, 0, 0x723732),
- Font("Your name","Verdana", DEFAULT_CHARSET, -13, 0, 0x4453A4),
- Font("Incoming message","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000),
- Font("Outgoing message","Verdana", DEFAULT_CHARSET, -13, 0, 0x505080),
- Font("User has joined","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x0F880F),
- Font("User has left","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x1313B9),
- Font("The topic is ...","Verdana", DEFAULT_CHARSET, -13, Font::ITALIC, 0x991A53),
- Font("Error","Verdana", DEFAULT_CHARSET, -13, Font::BOLD, 0x1010D0),
- Font("Message typing area","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000),
- Font("User list","Tahoma", DEFAULT_CHARSET, -11, 0, 0x000000),
- Font("User list group","Tahoma", DEFAULT_CHARSET, -11, Font::BOLD, 0x000000)
-
-};
-
-Font::Font() {
- name = NULL;
- face = NULL;
- size = 0;
- style = 0;
- color = 0;
- charSet = DEFAULT_CHARSET;
-}
-
-Font::Font(const char *n, const char *f, int cs, int s, int st, COLORREF c) {
- name = NULL;
- face = NULL;
- size = 0;
- style = 0;
- color = 0;
- setName(n);
- setFace(f);
- setCharSet(cs);
- setSize(s);
- setStyle(st);
- setColor(c);
-}
-
-
-COLORREF Font::getColor() {
- return color;
-}
-
-void Font::setColor(COLORREF c) {
- color = c;
-}
-
-int Font::getSize() {
- return size;
-}
-
-void Font::setSize(int s) {
- size = s;
-}
-
-int Font::getStyle() {
- return style;
-}
-
-void Font::setStyle(int s) {
- style = s;
-}
-
-int Font::getCharSet() {
- return charSet;
-}
-
-void Font::setCharSet(int s) {
- charSet = s;
-}
-
-void Font::setName(const char *s) {
- Utils::copyString(&name, s);
-}
-
-const char *Font::getName() {
- return name;
-}
-
-void Font::setFace(const char *s) {
- Utils::copyString(&face, s);
-}
-
-const char *Font::getFace() {
- return face;
-}
-
-Font *FontList::fonts = NULL;
-Font *FontList::fontsSettings = NULL;
-
-Font *FontList::getFont(int index) {
- if (index < FONTCOUNT) return &fonts[index];
- else return NULL;
-}
-
-Font *FontList::getFontSettings(int index) {
- if (index < FONTCOUNT) return &fontsSettings[index];
- else return NULL;
-}
-
-void FontList::loadSettings() {
- char fontParam[512];
- for (int i=0;i<FONTCOUNT;i++) {
- DBVARIANT dbv;
- fontsSettings[i].setName(defFonts[i].getName());
- fontsSettings[i].setFace(defFonts[i].getFace());
- fontsSettings[i].setCharSet(defFonts[i].getCharSet());
- fontsSettings[i].setSize(defFonts[i].getSize());
- fontsSettings[i].setStyle(defFonts[i].getStyle());
- fontsSettings[i].setColor(defFonts[i].getColor());
- sprintf(fontParam, "Font%dFace", i);
- if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
- fontsSettings[i].setFace(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- sprintf(fontParam, "Font%dSet", i);
- if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
- fontsSettings[i].setCharSet(dbv.bVal);
- DBFreeVariant(&dbv);
- }
- sprintf(fontParam, "Font%dSize", i);
- if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
- fontsSettings[i].setSize(dbv.lVal);
- DBFreeVariant(&dbv);
- }
- sprintf(fontParam, "Font%dCol", i);
- if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
- fontsSettings[i].setColor(dbv.lVal);
- DBFreeVariant(&dbv);
- }
- sprintf(fontParam, "Font%dStyle", i);
- if (!DBGetContactSetting(NULL, muccModuleName, fontParam, &dbv)) {
- fontsSettings[i].setStyle(dbv.bVal);
- DBFreeVariant(&dbv);
- }
- fonts[i].setName(fontsSettings[i].getName());
- fonts[i].setFace(fontsSettings[i].getFace());
- fonts[i].setCharSet(fontsSettings[i].getCharSet());
- fonts[i].setSize(fontsSettings[i].getSize());
- fonts[i].setStyle(fontsSettings[i].getStyle());
- fonts[i].setColor(fontsSettings[i].getColor());
- }
-}
-
-void FontList::saveSettings() {
- char fontParam[512];
- for (int i=0;i<FONTCOUNT;i++) {
- sprintf(fontParam, "Font%dFace", i);
- DBWriteContactSettingString(NULL, muccModuleName, fontParam, fontsSettings[i].getFace());
- sprintf(fontParam, "Font%dSet", i);
- DBWriteContactSettingByte(NULL, muccModuleName, fontParam, fontsSettings[i].getCharSet());
- sprintf(fontParam, "Font%dSize", i);
- DBWriteContactSettingDword(NULL, muccModuleName, fontParam, fontsSettings[i].getSize());
- sprintf(fontParam, "Font%dCol", i);
- DBWriteContactSettingDword(NULL, muccModuleName, fontParam, fontsSettings[i].getColor());
- sprintf(fontParam, "Font%dStyle", i);
- DBWriteContactSettingByte(NULL, muccModuleName, fontParam, fontsSettings[i].getStyle());
- fonts[i].setName(fontsSettings[i].getName());
- fonts[i].setFace(fontsSettings[i].getFace());
- fonts[i].setCharSet(fontsSettings[i].getCharSet());
- fonts[i].setStyle(fontsSettings[i].getStyle());
- fonts[i].setSize(fontsSettings[i].getSize());
- fonts[i].setColor(fontsSettings[i].getColor());
- }
-}
-
-void FontList::init() {
- fonts = new Font[FONTCOUNT];
- fontsSettings = new Font[FONTCOUNT];
- loadSettings();
-}
-
-void FontList::release() {
- delete[] fonts;
- delete[] fontsSettings;
-}
-
-int FontList::getFontNum() {
- return FONTCOUNT;
-}
diff --git a/protocols/Tlen/tlen_czaty/FontList.h b/protocols/Tlen/tlen_czaty/FontList.h
deleted file mode 100644
index 2e0076e765..0000000000
--- a/protocols/Tlen/tlen_czaty/FontList.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef FONTLIST_INCLUDED
-#define FONTLIST_INCLUDED
-#include "mucc.h"
-
-
-class Font {
-private:
- COLORREF color;
- char * face;
- char * name;
- int size;
- int style;
- int charSet;
-public:
- enum STYLES {
- BOLD = 1,
- ITALIC = 2,
- UNDERLINE = 4,
- STROKE = 8,
- UNDERWAVE = 16
- };
- Font();
- Font(const char *name, const char *face, int charSet, int size, int style, COLORREF color);
- void setColor(COLORREF c);
- COLORREF getColor();
- void setSize(int s);
- int getSize();
- void setStyle(int s);
- int getStyle();
- void setFace(const char *s);
- const char *getFace();
- void setName(const char *s);
- const char *getName();
- void setCharSet(int s);
- int getCharSet();
-};
-
-class FontList {
-private:
- static Font *fonts;
- static Font *fontsSettings;
-public:
- enum FONTIDEX {
- FONT_TIMESTAMP = 0,
-// FONT_COLON = 1,
- FONT_OTHERSNAMES = 1,
- FONT_MYNAME = 2,
- FONT_INMESSAGE = 3,
- FONT_OUTMESSAGE = 4,
- FONT_JOINED = 5,
- FONT_LEFT = 6,
- FONT_TOPIC = 7,
-// FONT_NOTIFICATION = 9,
- FONT_ERROR = 8,
- FONT_TYPING = 9,
- FONT_USERLIST = 10,
- FONT_USERLISTGROUP = 11
- };
- static Font *getFont(int index);
- static Font *getFontSettings(int index);
- static void release();
- static void init();
- static int getFontNum();
- static void loadSettings();
- static void saveSettings();
-};
-
-#endif
-
-
diff --git a/protocols/Tlen/tlen_czaty/HelperDialog.cpp b/protocols/Tlen/tlen_czaty/HelperDialog.cpp
deleted file mode 100644
index 343d66b89d..0000000000
--- a/protocols/Tlen/tlen_czaty/HelperDialog.cpp
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "HelperDialog.h"
-#include "Utils.h"
-
-static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK AcceptInvitationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK JoinDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-//static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK TopicDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static void __cdecl InviteDlgThread(void *vDialog);
-static void __cdecl AcceptInvitationDlgThread(void *vDialog);
-static void __cdecl JoinDlgThread(void *vDialog);
-static void __cdecl ErrorDlgThread(void *vDialog);
-static void __cdecl TopicDlgThread(void *vDialog);
-
-HelperDialog * HelperDialog::list = NULL;
-CRITICAL_SECTION HelperDialog::mutex;
-
-HelperDialog::HelperContact::HelperContact(const char *id, const char *name) {
- this->id = NULL;
- this->name = NULL;
- next = NULL;
- Utils::copyString(&this->id, id);
- Utils::copyString(&this->name, name);
-}
-HelperDialog::HelperContact::~HelperContact() {
- if (id != NULL) delete id;
- if (name != NULL) delete name;
-}
-
-void HelperDialog::HelperContact::setNext(HelperContact *next) {
- this->next = next;
-}
-
-const char *HelperDialog::HelperContact::getId() {
- return id;
-}
-
-const char *HelperDialog::HelperContact::getName() {
- return name;
-}
-
-HelperDialog::HelperContact* HelperDialog::HelperContact::getNext() {
- return next;
-}
-
-void HelperDialog::init() {
- InitializeCriticalSection(&mutex);
-}
-
-void HelperDialog::release() {
- while (list!=NULL) {
- delete list;
- }
- DeleteCriticalSection(&mutex);
-}
-
-HelperDialog::HelperDialog() {
- module = nick = reason = roomId = roomName = NULL;
- prev = next = NULL;
- contactList = NULL;
- hWnd = NULL;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- EnterCriticalSection(&mutex);
- setNext(list);
- if (next!=NULL) {
- next->setPrev(this);
- }
- list = this;
- LeaveCriticalSection(&mutex);
-}
-
-HelperDialog::HelperDialog(ChatWindow *chat) {
- module = nick = reason = roomId = roomName = NULL;
- prev = next = NULL;
- contactList = NULL;
- hWnd = NULL;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- setModule(chat->getModule());
- setRoomId(chat->getRoomId());
- setRoomName(chat->getRoomName());
- setRoomFlags(chat->getRoomFlags());
- EnterCriticalSection(&mutex);
- setNext(list);
- if (next!=NULL) {
- next->setPrev(this);
- }
- list = this;
- LeaveCriticalSection(&mutex);
-}
-
-HelperDialog::~HelperDialog()
-{
- EnterCriticalSection(&mutex);
- if (getPrev()!=NULL) {
- getPrev()->setNext(next);
- } else {
- list = getNext();
- }
- if (getNext()!=NULL) {
- getNext()->setPrev(prev);
- }
- LeaveCriticalSection(&mutex);
- if (hEvent!=NULL) CloseHandle(hEvent);
- if (module!=NULL) delete module;
- if (roomId!=NULL) delete roomId;
- if (roomName!=NULL) delete roomName;
- if (nick!=NULL) delete nick;
- if (reason!=NULL) delete reason;
- for (HelperContact *ptr2, *ptr=contactList;ptr!=NULL;ptr=ptr2) {
- ptr2 = ptr->getNext();
- delete ptr;
- }
-}
-void HelperDialog::setHWND(HWND hWnd) {
- this->hWnd = hWnd;
-}
-HWND HelperDialog::getHWND() {
- return hWnd;
-}
-void HelperDialog::setPrev(HelperDialog *prev) {
- this->prev = prev;
-}
-void HelperDialog::setNext(HelperDialog *next) {
- this->next = next;
-}
-HelperDialog * HelperDialog::getPrev() {
- return prev;
-}
-HelperDialog * HelperDialog::getNext() {
- return next;
-}
-const char *HelperDialog::getModule()
-{
- return module;
-}
-const char *HelperDialog::getRoomId()
-{
- return roomId;
-}
-const char *HelperDialog::getRoomName()
-{
- return roomName;
-}
-const char *HelperDialog::getNick()
-{
- return nick;
-}
-const char *HelperDialog::getReason()
-{
- return reason;
-}
-void HelperDialog::setModule(const char *module)
-{
- Utils::copyString(&this->module, module);
-}
-void HelperDialog::setRoomId(const char *roomId)
-{
- Utils::copyString(&this->roomId, roomId);
-}
-void HelperDialog::setRoomName(const char *roomName)
-{
- Utils::copyString(&this->roomName, roomName);
-}
-void HelperDialog::setNick(const char *nick)
-{
- Utils::copyString(&this->nick, nick);
-}
-void HelperDialog::setReason(const char *reason)
-{
- Utils::copyString(&this->reason, reason);
-}
-void HelperDialog::setRoomFlags(DWORD flags)
-{
- this->roomFlags = flags;
-}
-void HelperDialog::setContactList(MUCCQUERYRESULT *queryResult) {
- HelperContact *ptr, *lastptr;
- for (ptr=contactList;ptr!=NULL;ptr=ptr->getNext()) {
- delete ptr;
- }
- contactList = NULL;
- lastptr = NULL;
- for (int i=0;i<queryResult->iItemsNum;i++) {
- ptr = new HelperContact(queryResult->pItems[i].pszID, queryResult->pItems[i].pszName);
- if (lastptr != NULL) {
- lastptr->setNext(ptr);
- } else {
- contactList = ptr;
- }
- lastptr = ptr;
- }
-}
-
-HelperDialog::HelperContact * HelperDialog::getContactList() {
- return contactList;
-}
-
-DWORD HelperDialog::getRoomFlags() {
- return roomFlags;
-}
-
-void HelperDialog::inviteDlg(ChatWindow *chat, MUCCQUERYRESULT *queryResult) {
- HelperDialog *dialog=new HelperDialog(chat);
- dialog->setContactList(queryResult);
- Utils::forkThread((void (__cdecl *)(void *))InviteDlgThread, 0, (void *) dialog);
- //WaitForSingleObject(dialog->getEvent(), INFINITE);
-}
-
-void HelperDialog::acceptDlg(MUCCEVENT *event) {
- HelperDialog *dialog=new HelperDialog();
- dialog->setModule(event->pszModule);
- dialog->setRoomId(event->pszID);
- dialog->setRoomName(event->pszName);
- dialog->setRoomFlags(event->dwFlags);
- dialog->setNick(event->pszNick);
- // dialog->setReason(event->pszText);
- Utils::forkThread((void (__cdecl *)(void *))AcceptInvitationDlgThread, 0, (void *) dialog);
-// WaitForSingleObject(hEvent, INFINITE);
-}
-
-void HelperDialog::joinDlg(MUCCEVENT *event) {
- HelperDialog *dialog=new HelperDialog();
- dialog->setModule(event->pszModule);
- dialog->setRoomId(event->pszID);
- dialog->setRoomName(event->pszName);
- dialog->setRoomFlags(event->dwFlags);
- dialog->setNick(event->pszNick);
- Utils::forkThread((void (__cdecl *)(void *))JoinDlgThread, 0, (void *) dialog);
- //WaitForSingleObject(dialog->getEvent(), INFINITE);
-}
-
-void HelperDialog::errorDlg(MUCCEVENT *event) {
- HelperDialog *dialog=new HelperDialog();
- dialog->setReason(event->pszText);
- Utils::forkThread((void (__cdecl *)(void *))ErrorDlgThread, 0, (void *) dialog);
- //WaitForSingleObject(dialog->getEvent(), INFINITE);
-}
-
-void HelperDialog::topicDlg(ChatWindow *chat)
-{
- HelperDialog *dialog=new HelperDialog();
- dialog->setModule(chat->getModule());
- dialog->setRoomId(chat->getRoomId());
- Utils::forkThread((void (__cdecl *)(void *))TopicDlgThread, 0, (void *) dialog);
-}
-
-static void __cdecl InviteDlgThread(void *vDialog)
-{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_INVITE), NULL, InviteDlgProc, (LPARAM) vDialog);
-}
-
-static void __cdecl AcceptInvitationDlgThread(void *vDialog)
-{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_INVITE_ACCEPT), NULL, AcceptInvitationDlgProc, (LPARAM) vDialog);
-}
-
-static void __cdecl JoinDlgThread(void *vDialog)
-{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_JOIN), NULL, JoinDlgProc, (LPARAM) vDialog);
-}
-
-static void __cdecl TopicDlgThread(void *vDialog)
-{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_TOPIC), NULL, TopicDlgProc, (LPARAM) vDialog);
-}
-
-static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char str[256];
- HelperDialog::HelperContact *contactList;
- HelperDialog *dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- dialog = (HelperDialog *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog);
- dialog->setHWND(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_REASON, EM_SETREADONLY, (WPARAM)TRUE, 0);
- for (contactList = dialog->getContactList();contactList!=NULL;contactList=contactList->getNext()) {
- SendDlgItemMessage(hwndDlg, IDC_USER, CB_ADDSTRING, 0, (LPARAM)contactList->getName());
- }
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_INVITE:
- MUCCEVENT muce;
- GetDlgItemTextA(hwndDlg, IDC_USER, str, 255);
- if (strlen(str)>0) {
- for (contactList = dialog->getContactList();contactList!=NULL;contactList=contactList->getNext()) {
- if (!strcmp(str, contactList->getName())) {
- dialog->setNick(contactList->getId());
- break;
- }
- }
- if (contactList==NULL) {
- dialog->setNick(str);
- }
- }
- muce.iType = MUCC_EVENT_INVITE;
- muce.pszModule = dialog->getModule();
- muce.pszID = dialog->getRoomId();
- muce.pszNick = dialog->getNick();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- case IDCANCEL:
- case IDCLOSE:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- delete dialog;
- break;
- }
- return FALSE;
-}
-
-
-
-
-static INT_PTR CALLBACK AcceptInvitationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char str[256];
- HelperDialog *dialog;
- dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- {
- dialog = (HelperDialog *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog);
- dialog->setHWND(hwndDlg);
- if (dialog->getNick() != NULL) {
- SetDlgItemTextA(hwndDlg, IDC_FROM, dialog->getNick());
- }
- if (dialog->getRoomName() != NULL) {
- SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName());
- }
- if (dialog->getReason() != NULL) {
- SetDlgItemTextA(hwndDlg, IDC_REASON, dialog->getReason());
- }
-
-// if (!DBGetContactSetting(NULL, jabberProtoName, "LoginName", &dbv)) {
-// SetDlgItemText(hwndDlg, IDC_NICK, dbv.pszVal);
-// DBFreeVariant(&dbv);
-// }
-
- /*
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_GROUP)));
-*/
- }
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ACCEPT:
- GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255);
- dialog->setNick(str);
- MUCCEVENT muce;
- muce.iType = MUCC_EVENT_JOIN;
- muce.pszModule = dialog->getModule();
- muce.pszID = dialog->getRoomId();
- muce.pszName = dialog->getRoomName();
- muce.dwFlags = dialog->getRoomFlags();
- muce.pszNick = NULL;
- if (strlen(dialog->getNick())>0) {
- muce.pszNick = dialog->getNick();
- } else {
- muce.pszNick = NULL;
- }
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- case IDCANCEL:
- case IDCLOSE:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- delete dialog;
- break;
- }
-
- return FALSE;
-}
-
-
-static INT_PTR CALLBACK JoinDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char str[256];
- HelperDialog *dialog;
- dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- dialog = (HelperDialog *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog);
- dialog->setHWND(hwndDlg);
- SetFocus(GetDlgItem(hwndDlg, IDOK));
- if (dialog->getRoomFlags() & MUCC_EF_ROOM_NAME) {
- SetFocus(GetDlgItem(hwndDlg, IDC_ROOM));
- } else {
- SendDlgItemMessage(hwndDlg, IDC_ROOM, EM_SETREADONLY, (WPARAM)TRUE, 0);
- }
- if (dialog->getRoomFlags() & MUCC_EF_ROOM_NICKNAMES) {
- SetFocus(GetDlgItem(hwndDlg, IDC_NICK));
- } else {
- SendDlgItemMessage(hwndDlg, IDC_NICK, EM_SETREADONLY, (WPARAM)TRUE, 0);
- }
- if (dialog->getRoomName()!=NULL) {
- SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName());
- }
- if (dialog->getNick()!=NULL) {
- SetDlgItemTextA(hwndDlg, IDC_NICK, dialog->getNick());
- }
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- MUCCEVENT muce;
- if (dialog->getRoomId()==NULL) {
- GetDlgItemTextA(hwndDlg, IDC_ROOM, str, 255);
- if (strlen(str)>0) {
- //dialog->setRoomId(str);
- dialog->setRoomName(str);
- }
- }
- GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255);
- if (strlen(str)>0) {
- dialog->setNick(str);
- } else {
- dialog->setNick(NULL);
- }
- muce.iType = MUCC_EVENT_JOIN;
- muce.pszModule = dialog->getModule();
- muce.pszID = dialog->getRoomId();
- muce.pszName = dialog->getRoomName();
- muce.pszNick = dialog->getNick();
- muce.dwFlags = dialog->getRoomFlags();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- delete dialog;
- break;
- }
- return FALSE;
-}
-
-static void __cdecl ErrorDlgThread(void *vDialog)
-{
- HelperDialog *dialog=(HelperDialog *)vDialog;
- MessageBoxA(NULL, dialog->getReason(), Translate("Error"), MB_OK | MB_ICONERROR);
- /*
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_JOIN), NULL, JoinDlgProc, (LPARAM) dialog);
- if (result!=0) {
- MUCCEVENT muce;
- muce.iType = MUCC_EVENT_JOIN;
- muce.pszModule = dialog->getModule();
- muce.pszID = dialog->getRoomId();
- muce.pszName = dialog->getRoomName();
- muce.pszNick = dialog->getNick();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- */
- delete dialog;
-}
-
-/*
-static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char str[256];
- HelperDialog *dialog;
- dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- dialog = (HelperDialog *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog);
- dialog->setHWND(hwndDlg);
- SetFocus(GetDlgItem(hwndDlg, IDOK));
- if (dialog->getRoomName()!=NULL) {
- SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName());
- }
- if (dialog->getNick()!=NULL) {
- SetDlgItemTextA(hwndDlg, IDC_NICK, dialog->getNick());
- }
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- if (dialog->getRoomId()==NULL) {
- GetDlgItemTextA(hwndDlg, IDC_ROOM, str, 255);
- if (strlen(str)>0) {
- //dialog->setRoomId(str);
- dialog->setRoomName(str);
- }
- }
- GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255);
- if (strlen(str)>0) {
- dialog->setNick(str);
- } else {
- dialog->setNick(NULL);
- }
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- delete dialog;
- break;
- }
- return FALSE;
-}
-*/
-
-static INT_PTR CALLBACK TopicDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- char str[256];
- HelperDialog *dialog;
- dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- dialog = (HelperDialog *) lParam;
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog);
- dialog->setHWND(hwndDlg);
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- MUCCEVENT muce;
- GetDlgItemTextA(hwndDlg, IDC_TOPIC, str, 255);
- dialog->setReason(str);
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_TOPIC;
- muce.pszID = dialog->getRoomId();
- muce.pszModule = dialog->getModule();
- muce.pszText = dialog->getReason();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- delete dialog;
- break;
- }
- return FALSE;
-}
-
diff --git a/protocols/Tlen/tlen_czaty/HelperDialog.h b/protocols/Tlen/tlen_czaty/HelperDialog.h
deleted file mode 100644
index 08f856c3a9..0000000000
--- a/protocols/Tlen/tlen_czaty/HelperDialog.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef DIALOGS_INCLUDED
-#define DIALOGS_INCLUDED
-
-#include "mucc.h"
-#include "m_mucc.h"
-#include "ChatWindow.h"
-
-
-class HelperDialog {
-public:
- class HelperContact {
- private:
- char *id;
- char *name;
- HelperContact *next;
- public:
- HelperContact(const char *id, const char *name);
- ~HelperContact();
- void setNext(HelperContact *);
- HelperContact* getNext();
- const char * getId();
- const char * getName();
- };
-
-private:
- static HelperDialog * list;
- static CRITICAL_SECTION mutex;
- char * module;
- char * roomId;
- char * roomName;
- DWORD roomFlags;
- HelperContact * contactList;
- HelperDialog * prev;
- HelperDialog * next;
- char * nick;
- char * reason;
- HANDLE hEvent;
- HWND hWnd;
-public:
- HelperDialog();
- HelperDialog(ChatWindow *);
- ~HelperDialog();
- void setModule(const char *);
- void setRoomId(const char *);
- void setRoomName(const char *);
- void setRoomFlags(DWORD);
- void setNick(const char *);
- void setReason(const char *);
- void setPrev(HelperDialog *);
- HelperDialog* getPrev();
- void setNext(HelperDialog *);
- HelperDialog* getNext();
- HWND getHWND();
- void setHWND(HWND hWnd);
- void setContactList(MUCCQUERYRESULT *queryResult);
- HelperContact* getContactList();
- const char * getModule();
- const char * getRoomId();
- const char * getRoomName();
- DWORD getRoomFlags();
- const char * getNick();
- const char * getReason();
- HANDLE getEvent();
- static void init();
- static void release();
- static void inviteDlg(ChatWindow *chat, MUCCQUERYRESULT *queryResult);
- static void acceptDlg(MUCCEVENT *event);
- static void joinDlg(MUCCEVENT *event);
- static void errorDlg(MUCCEVENT *event);
- static void topicDlg(ChatWindow *chat);
-};
-
-
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/ManagerWindow.cpp b/protocols/Tlen/tlen_czaty/ManagerWindow.cpp
deleted file mode 100644
index a01caebc15..0000000000
--- a/protocols/Tlen/tlen_czaty/ManagerWindow.cpp
+++ /dev/null
@@ -1,1067 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#include "ManagerWindow.h"
-#include "Utils.h"
-#include "HelperDialog.h"
-
-static INT_PTR CALLBACK ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK ChatRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK MyRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-ManagerWindow * ManagerWindow::list = NULL;
-bool ManagerWindow::released = false;
-CRITICAL_SECTION ManagerWindow::mutex;
-
-void ManagerWindow::init() {
- released = false;
- InitializeCriticalSection(&mutex);
-}
-
-void ManagerWindow::release() {
- released = true;
- for (ManagerWindow *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) {
- ptr2 = ptr->getNext();
- delete ptr;
-// SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0);
- }
- DeleteCriticalSection(&mutex);
-}
-
-ManagerWindow::ManagerWindow(const char *module)
-{
- next = prev = NULL;
- groups = NULL;
- rooms = NULL;
- myRooms = NULL;
- currentGroup = NULL;
- isStarted = 0;
- currentTab = 0;
- currentRoomsPage = 0;
- lastRoomsPage = 0;
- userNickList = userRoomList = 0;
- this->module = NULL;
- this->moduleName = NULL;
- Utils::copyString(&this->module, module);
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- EnterCriticalSection(&mutex);
- setNext(list);
- if (next!=NULL) {
- next->setPrev(this);
- }
- list = this;
- LeaveCriticalSection(&mutex);
-}
-
-ManagerWindow::~ManagerWindow()
-{
- if (!released) {
- EnterCriticalSection(&mutex);
- if (getPrev()!=NULL) {
- getPrev()->setNext(next);
- } else {
- list = getNext();
- }
- if (getNext()!=NULL) {
- getNext()->setPrev(prev);
- }
- LeaveCriticalSection(&mutex);
- }
- if (hWnd!=NULL) {
- EndDialog(hWnd, 0);
- }
- if (hEvent!=NULL) {
- CloseHandle(hEvent);
- }
- while (groups!=NULL) {
- ChatGroup *group = groups;
- groups = groups->getListNext();
- delete group;
- }
- while (rooms!=NULL) {
- ChatRoom *room = rooms;
- rooms = rooms->getNext();
- delete room;
- }
- while (myRooms!=NULL) {
- ChatRoom *room = myRooms;
- myRooms = myRooms->getNext();
- delete room;
- }
- if (module!=NULL) {
- delete module;
- }
- if (moduleName!=NULL) {
- delete moduleName;
- }
-}
-void ManagerWindow::setPrev(ManagerWindow *prev)
-{
- this->prev = prev;
-}
-ManagerWindow * ManagerWindow::getPrev()
-{
- return prev;
-}
-void ManagerWindow::setNext(ManagerWindow *next)
-{
- this->next = next;
-}
-ManagerWindow * ManagerWindow::getNext()
-{
- return next;
-}
-void ManagerWindow::setHWND(HWND h)
-{
- hWnd=h;
-}
-HWND ManagerWindow::getHWND()
-{
- return hWnd;
-}
-void ManagerWindow::setChatRoomsTabHWND(HWND h)
-{
- hChatRoomsTabWnd=h;
-}
-HWND ManagerWindow::getChatRoomsTabHWND()
-{
- return hChatRoomsTabWnd;
-}
-void ManagerWindow::setMyRoomsTabHWND(HWND h)
-{
- hMyRoomsTabWnd=h;
-}
-HWND ManagerWindow::getMyRoomsTabHWND()
-{
- return hMyRoomsTabWnd;
-}
-void ManagerWindow::setMyNicksTabHWND(HWND h)
-{
- hMyNicksTabWnd=h;
-}
-HWND ManagerWindow::getMyNicksTabHWND()
-{
- return hMyNicksTabWnd;
-}
-const char *ManagerWindow::getModule()
-{
- return module;
-}
-const char *ManagerWindow::getModuleName()
-{
- return moduleName;
-}
-void ManagerWindow::setModuleName(const char *moduleName)
-{
- Utils::copyString(&this->moduleName, moduleName);
-}
-ChatGroup *ManagerWindow::getCurrentGroup()
-{
- return currentGroup;
-}
-void ManagerWindow::setCurrentGroup(ChatGroup *group)
-{
- currentGroup = group;
-}
-HANDLE ManagerWindow::getEvent()
-{
- return hEvent;
-}
-int ManagerWindow::getCurrentTab()
-{
- return currentTab;
-}
-void ManagerWindow::setCurrentRoomsPage(int currentRoomsPage)
-{
- this->currentRoomsPage = currentRoomsPage;
-}
-int ManagerWindow::getCurrentRoomsPage()
-{
- return currentRoomsPage;
-}
-void ManagerWindow::setCurrentTab(int currentTab)
-{
- this->currentTab = currentTab;
-}
-void ManagerWindow::setLastRoomsPage(int lastRoomsPage)
-{
- this->lastRoomsPage = lastRoomsPage;
-}
-int ManagerWindow::isLastRoomsPage()
-{
- return lastRoomsPage;
-}
-int ManagerWindow::isUserNickListReceived()
-{
- return userNickList;
-}
-int ManagerWindow::isUserRoomListReceived()
-{
- return userRoomList;
-}
-static void __cdecl StartThread(void *vManager)
-{
- OleInitialize(NULL);
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATMANAGER), NULL, ManagerDlgProc, (LPARAM) vManager);
- OleUninitialize();
-}
-int ManagerWindow::start()
-{
- if (isStarted) {
- ShowWindow(hWnd, SW_SHOW);
- return 0;
- }
- isStarted = 1;
- Utils::forkThread((void (__cdecl *)(void *))StartThread, 0, (void *) this);
- WaitForSingleObject(hEvent, INFINITE);
- return 0;
-}
-void ManagerWindow::queryResultGroups(MUCCQUERYRESULT *queryResult)
-{
- TVINSERTSTRUCT tvis;
- ChatGroup * par = NULL;
- ChatGroup * group;
- if (queryResult->pszParent != NULL) {
- par = findGroup(queryResult->pszParent);
- if (par!=NULL) {
- if (par->getChild()!=NULL) return;
- }
- }
- for (int i=0; i<queryResult->iItemsNum; i++) {
- group = new ChatGroup();
- group->setId(queryResult->pItems[i].pszID);
- group->setName(queryResult->pItems[i].pszName);
- if (par!=NULL) {
- par->addChild(group);
- //group->setParent(par);
- tvis.hParent = par->getTreeItem();
- } else {
- tvis.hParent = NULL;
- }
- tvis.hInsertAfter = TVI_SORT;
- tvis.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM;
- LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName);
- tvis.item.pszText = lps1;
- tvis.item.cChildren = queryResult->pItems[i].iCount;
- tvis.item.lParam = (LPARAM) group;
- group->setTreeItem(TreeView_InsertItem(GetDlgItem(hWnd, IDC_GROUP), &tvis));
- group->setListNext(groups);
- groups = group;
- if (par != NULL) {
- TreeView_Expand(GetDlgItem(hWnd, IDC_GROUP), par->getTreeItem(), TVE_EXPAND);
- }
- Utils::mucc_mir_free(lps1);
- }
-}
-
-void ManagerWindow::queryResultRooms(MUCCQUERYRESULT *queryResult)
-{
- ChatRoom *room;
- while (rooms!=NULL) {
- room = rooms;
- rooms = rooms->getNext();
- delete room;
- }
- TCHAR str[100];
- if (getCurrentGroup()==NULL || strcmp(getCurrentGroup()->getId(), queryResult->pszParent) || queryResult->iPage!=getCurrentRoomsPage()) return;
- setLastRoomsPage(queryResult->iLastPage);
- if (queryResult->iLastPage) {
- EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_NEXT), FALSE);
- } else {
- EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_NEXT), TRUE);
- }
- if (queryResult->iPage>0) {
- EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_PREV), TRUE);
- } else {
- EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_PREV), FALSE);
- }
- for (int i=0; i<queryResult->iItemsNum; i++) {
- LVITEM lvItem;
- room = new ChatRoom();
- room->setId(queryResult->pItems[i].pszID);
- room->setName(queryResult->pItems[i].pszName);
- room->setFlags(queryResult->pItems[i].dwFlags);
- room->setNext(rooms);
- rooms=room;
- lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetItemCount(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM));
- LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName);
- lvItem.pszText = lps1;
- lvItem.lParam = (LPARAM) room;
- ListView_InsertItem(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), &lvItem);
- lvItem.iSubItem = 1;
- ListView_InsertItem(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), &lvItem);
- _stprintf(str, _TEXT("%d"), queryResult->pItems[i].iCount);
- ListView_SetItemText(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), lvItem.iItem, 1, str);
- Utils::mucc_mir_free(lps1);
- }
-}
-
-void ManagerWindow::queryResultUserRooms(MUCCQUERYRESULT *queryResult)
-{
- ChatRoom *room;
- ListView_DeleteAllItems(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST));
- while (myRooms!=NULL) {
- room = myRooms;
- myRooms = myRooms->getNext();
- delete room;
- }
- for (int i=0; i<queryResult->iItemsNum; i++) {
- LVITEM lvItem;
- room = new ChatRoom();
- room->setId(queryResult->pItems[i].pszID);
- room->setName(queryResult->pItems[i].pszName);
- room->setNext(myRooms);
- myRooms=room;
- lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetItemCount(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST));
- LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName);
- lvItem.pszText = lps1;
- lvItem.lParam = (LPARAM) room;
- ListView_InsertItem(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST), &lvItem);
- Utils::mucc_mir_free(lps1);
- }
- userRoomList = 1;
-}
-
-void ManagerWindow::queryResultUserNick(MUCCQUERYRESULT *queryResult)
-{
- ListView_DeleteAllItems(GetDlgItem(getMyNicksTabHWND(), IDC_LIST));
- for (int i=0; i<queryResult->iItemsNum; i++) {
- LVITEM lvItem;
- lvItem.mask = LVIF_TEXT;
- lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetItemCount(GetDlgItem(getMyNicksTabHWND(), IDC_LIST));
- LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName);
- lvItem.pszText = lps1;
- ListView_InsertItem(GetDlgItem(getMyNicksTabHWND(), IDC_LIST), &lvItem);
- Utils::mucc_mir_free(lps1);
- }
- userNickList = 1;
-}
-
-ChatGroup *ManagerWindow::findGroup(const char *id)
-{
- ChatGroup *group;
- for (group = groups;group!=NULL;group=group->getListNext()) {
- if (!strcmp(group->getId(), id)) break;
- }
- return group;
-}
-
-
-static INT_PTR CALLBACK ChatRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND lv;
- LVCOLUMN lvCol;
- ManagerWindow *manager;
- manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- manager = (ManagerWindow *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager);
- TranslateDialogDefault(hwndDlg);
- manager->setChatRoomsTabHWND(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_PREV, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_NEXT, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_SEARCH, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_PREV]);
- SendDlgItemMessage(hwndDlg, IDC_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_NEXT]);
- SendDlgItemMessage(hwndDlg, IDC_SEARCH, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_SEARCH]);
-
- lv = GetDlgItem(hwndDlg, IDC_ROOM);
- ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT);
- lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
- lvCol.pszText = TranslateT("Name");
- lvCol.cx = 270;
- lvCol.iSubItem = 0;
- ListView_InsertColumn(lv, 0, &lvCol);
- lvCol.pszText = TranslateT("Persons");
- lvCol.cx = 50;
- lvCol.iSubItem = 1;
- ListView_InsertColumn(lv, 1, &lvCol);
- lvCol.pszText = _TEXT("");//Translate("");
- lvCol.cx = 46;
- lvCol.iSubItem = 2;
- ListView_InsertColumn(lv, 2, &lvCol);
- return TRUE;
- case WM_NOTIFY:
- switch (wParam) {
- case IDC_ROOM:
- switch (((LPNMHDR)lParam)->code) {
- case LVN_COLUMNCLICK:
- {
- LPNMLISTVIEW pnmlv = (LPNMLISTVIEW) lParam;
- if (pnmlv->iSubItem>=0 && pnmlv->iSubItem<=1) {
- // if (pnmlv->iSubItem == sortColumn)
- // sortAscending = !sortAscending;
- // else {
- // sortAscending = TRUE;
- // sortColumn = pnmlv->iSubItem;
- // }
- // ListView_SortItems(GetDlgItem(hwndDlg, IDC_ROOM), GroupchatCompare, sortColumn);
- }
- }
- break;
- case NM_DBLCLK:
- {
- LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
- LVITEM item;
- item.iItem = lpnmitem->iItem;
- item.iSubItem = 0;
- item.mask = LVIF_PARAM;
- if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_ROOM), &item)) {
- MUCCEVENT event;
- ChatRoom *room = (ChatRoom *)item.lParam;
- Utils::log("entering room %s ", room->getId());
- event.cbSize = sizeof(MUCCEVENT);
- event.iType = MUCC_EVENT_JOIN;
- event.pszModule = manager->getModule();
- event.pszID = room->getId();
- event.pszName = room->getName();
- event.dwFlags = room->getFlags();
- event.pszNick = NULL;
- HelperDialog::joinDlg(&event);
- }
- }
- break;
- }
- break;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_NEXT:
- if (!manager->isLastRoomsPage()) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_PREV), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_NEXT), FALSE);
- manager->setCurrentRoomsPage(manager->getCurrentRoomsPage()+1);
- SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_ROOMS, 0, 0);
- }
- break;
- case IDC_PREV:
- if (manager->getCurrentRoomsPage()>0) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_PREV), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_NEXT), FALSE);
- manager->setCurrentRoomsPage(manager->getCurrentRoomsPage()-1);
- }
- SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_ROOMS, 0, 0);
- break;
- case IDC_SEARCH:
- {
- MUCCEVENT event;
- event.cbSize = sizeof(MUCCEVENT);
- event.iType = MUCC_EVENT_JOIN;
- event.dwFlags = MUCC_EF_ROOM_NAME;
- event.pszModule = manager->getModule();
- event.pszID = NULL;
- event.pszName = NULL;
- event.pszNick = NULL;
- HelperDialog::joinDlg(&event);
- break;
- }
- }
- break;
- case WM_MEASUREITEM:
- if (wParam == IDC_ROOM) {
- MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam;
- lpMis->itemHeight = GetSystemMetrics(SM_CYSMICON);
- return TRUE;
- }
- break;
- case WM_DRAWITEM:
- if (wParam == IDC_ROOM) {
- RECT rc;
- int w, x, col;
- DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam;
- ChatRoom *room = NULL;
-// if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_ROOM), &item)) {
- room = (ChatRoom *)lpDis->itemData;// (ChatRoom *)item.lParam;
-// }
- TCHAR text[256];
- switch (lpDis->itemAction) {
- default:
- case ODA_SELECT:
- case ODA_DRAWENTIRE:
- if (lpDis->itemState & ODS_SELECTED) {
- HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2);
- FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1));
- DeleteObject(hBrush);
- SetTextColor(lpDis->hDC, 0);
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- else {
-// HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2);
- FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1));
-// DeleteObject(hBrush);
- SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT));
-// SetBkColor(lpDis->hDC, GetSysColor(COLOR_WINDOW+1));
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- x = lpDis->rcItem.left;
- for (col=0;col<3;col++) {
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_ROOM), lpDis->itemID, col, text, sizeof(text)/sizeof(TCHAR));
- w = ListView_GetColumnWidth(GetDlgItem(hwndDlg, IDC_ROOM), col);
- rc.left = x;
- rc.top = lpDis->rcItem.top;
- rc.bottom = lpDis->rcItem.bottom;
- rc.right = x+w;
- if (col==0) {
- rc.left+=2;
- rc.right-=2;
- DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- }
- else if (col<2) {
- DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- } else {
- if (room->getFlags()&MUCC_EF_ROOM_MODERATED) {
- DrawIconEx(lpDis->hDC, x, rc.top, muccIcon[MUCC_IDI_R_MODERATED], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- }
- if (room->getFlags()&MUCC_EF_ROOM_MEMBERS_ONLY) {
- DrawIconEx(lpDis->hDC, x+12+0*GetSystemMetrics(SM_CXSMICON), rc.top, muccIcon[MUCC_IDI_R_MEMBERS], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- }
- if (!(room->getFlags()&MUCC_EF_ROOM_NICKNAMES)) {
- DrawIconEx(lpDis->hDC, x+24+0*GetSystemMetrics(SM_CXSMICON), rc.top, muccIcon[MUCC_IDI_R_ANONYMOUS], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- }
- }
- x += w;
- }
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK MyRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- RECT rc;
- HWND lv;
- LVCOLUMN lvCol;
- ManagerWindow *manager;
- manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- manager = (ManagerWindow *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager);
- TranslateDialogDefault(hwndDlg);
- manager->setMyRoomsTabHWND(hwndDlg);
- lv = GetDlgItem(hwndDlg, IDC_LIST);
- ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT);
- GetClientRect(lv, &rc);
- lvCol.mask = LVCF_WIDTH;
- lvCol.cx = rc.right - rc.left;
- ListView_InsertColumn(lv, 0, &lvCol);
- return TRUE;
- case WM_NOTIFY:
- switch (wParam) {
- case IDC_LIST:
- switch (((LPNMHDR)lParam)->code) {
- case NM_DBLCLK:
- {
- LVITEM item;
- item.iItem = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LIST));
- if (item.iItem >= 0) {
- item.iSubItem = 0;
- item.mask = LVIF_PARAM;
- if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_LIST), &item)) {
- ChatRoom *room = (ChatRoom *)item.lParam;
- Utils::log("entering room %s (%s)", room->getId(), room->getId());
- MUCCEVENT muce;
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_JOIN;
- muce.pszModule = manager->getModule();
- muce.pszID = room->getId();
- muce.pszName = room->getName();
- muce.dwFlags = MUCC_EF_ROOM_NICKNAMES;
- muce.pszNick = NULL;
- HelperDialog::joinDlg(&muce);
- }
- }
- }
- break;
- }
- break;
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_REFRESH:
- SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_USER_ROOMS, 0, 0);
- break;
- case IDC_REGISTER:
- {
- MUCCEVENT muce;
- if (manager->getCurrentGroup()!=NULL) {
- TCHAR name[256];
- GetDlgItemText(hwndDlg, IDC_NAME, name, 255);
- if (_tcslen(name)!=0) {
- int flags = 0;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_PUBLIC)) {
- flags |= MUCC_EF_ROOM_PUBLIC;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_PERMANENT)) {
- flags |= MUCC_EF_ROOM_PERMANENT;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_MEMBERS)) {
- flags |= MUCC_EF_ROOM_MEMBERS_ONLY;
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_NICKNAMES)) {
- flags |= MUCC_EF_ROOM_NICKNAMES;
- }
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_REGISTER_ROOM;
- muce.pszModule = manager->getModule();
- muce.pszID = manager->getCurrentGroup()->getId();
- char* lps1 = Utils::mucc_mir_t2a(name);
- muce.pszName = lps1;
- muce.pszNick = NULL;
- muce.dwFlags = flags;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- Utils::mucc_mir_free(lps1);
- }
- } else {
- muce.pszText = "Please select a group first.";
- HelperDialog::errorDlg(&muce);
- }
- }
- break;
- }
- break;
- case WM_MEASUREITEM:
- if (wParam == IDC_LIST) {
- MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam;
- lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON);
- return TRUE;
- }
- break;
- case WM_DRAWITEM:
- if (wParam == IDC_LIST) {
- TCHAR text[256];
- DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam;
- switch (lpDis->itemAction) {
- default:
- case ODA_SELECT:
- case ODA_DRAWENTIRE:
- if (lpDis->itemState & ODS_SELECTED) {
- HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2);
- FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1));
- DeleteObject(hBrush);
- SetTextColor(lpDis->hDC, 0);
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- else {
- FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1));
- SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT));
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, 0, text, sizeof(text)/sizeof(TCHAR));
- DrawText(lpDis->hDC, text, (int)_tcslen(text), &(lpDis->rcItem), DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- break;
- }
- }
- break;
-
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK MyNicksDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- RECT rc;
- HWND lv;
- LVCOLUMN lvCol;
- ManagerWindow *manager;
- manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- manager = (ManagerWindow *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager);
- TranslateDialogDefault(hwndDlg);
- manager->setMyNicksTabHWND(hwndDlg);
- lv = GetDlgItem(hwndDlg, IDC_LIST);
- ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT);
- GetClientRect(lv, &rc);
- lvCol.mask = LVCF_WIDTH;
- lvCol.cx = rc.right - rc.left;
- ListView_InsertColumn(lv, 0, &lvCol);
- return TRUE;
- case WM_NOTIFY:
- switch (wParam) {
- case IDC_LIST:
- break;
-
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_REFRESH:
- SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_USER_NICKS, 0, 0);
- break;
- case IDC_REGISTER:
- {
- char nick[256];
- GetDlgItemTextA(hwndDlg, IDC_NICK, nick, 255);
- if (strlen(nick)!=0) {
- MUCCEVENT muce;
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_REGISTER_NICK;
- muce.pszModule = manager->getModule();
- muce.pszNick = nick;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- }
- break;
- case IDC_REMOVE:
- {
- LVITEM item;
- item.iItem = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LIST));
- if (item.iItem >= 0) {
- TCHAR text[256];
- item.iSubItem = 0;
- item.mask = LVIF_TEXT;
- item.pszText = text;
- item.cchTextMax = sizeof(text);
- if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_LIST), &item)) {
- MUCCEVENT muce;
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_REMOVE_NICK;
- muce.pszModule = manager->getModule();
- char* lps2 = Utils::mucc_mir_t2a(text);
- muce.pszNick = lps2;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- Utils::mucc_mir_free(lps2);
- }
- }
- }
- }
- break;
- case WM_MEASUREITEM:
- if (wParam == IDC_LIST) {
- MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam;
- lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON);
- return TRUE;
- }
- break;
- case WM_DRAWITEM:
- if (wParam == IDC_LIST) {
- TCHAR text[256];
- DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam;
- switch (lpDis->itemAction) {
- default:
- case ODA_SELECT:
- case ODA_DRAWENTIRE:
- if (lpDis->itemState & ODS_SELECTED) {
- HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2);
- FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1));
- DeleteObject(hBrush);
- SetTextColor(lpDis->hDC, 0);
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- else {
- FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1));
- SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT));
- SetBkMode(lpDis->hDC, TRANSPARENT);
- }
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, 0, text, sizeof(text)/sizeof(TCHAR));
- DrawText(lpDis->hDC, text, (int)_tcslen(text), &(lpDis->rcItem), DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static INT_PTR CALLBACK ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwnd, tc;
- TCITEM tci;
- char text[128];
-// HIMAGELIST hImageList;
- ManagerWindow *manager;
- MUCCEVENT muce;
- int dlgWidth, dlgHeight, tabPos;
- RECT rc2;
-
- manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (manager==NULL && msg!=WM_INITDIALOG) return FALSE;
- switch (msg) {
- case WM_INITDIALOG:
- // lParam is the initial conference server (if any)
- manager = (ManagerWindow *)lParam;
- manager->setHWND(hwndDlg);
- sprintf(text, "%s Chats", manager->getModuleName());
- SetWindowTextA(hwndDlg, text);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]);
-
- TranslateDialogDefault(hwndDlg);
-// sortColumn = -1;
- manager->setCurrentTab(0);
- tc = GetDlgItem(hwndDlg, IDC_TABS);
- tci.mask = TCIF_TEXT;
- // Public rooms tab
- tci.pszText = TranslateT("Chat rooms");
- TabCtrl_InsertItem(tc, 0, &tci);
- // Create room tab
- tci.pszText = TranslateT("My rooms");
- TabCtrl_InsertItem(tc, 1, &tci);
- tci.pszText = TranslateT("My nicknames");
- TabCtrl_InsertItem(tc, 2, &tci);
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_CHATROOMS), hwndDlg, ChatRoomsDlgProc, (LPARAM) manager);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- ShowWindow(hwnd, SW_SHOW);
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_MYROOMS), hwndDlg, MyRoomsDlgProc, (LPARAM) manager);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_MYNICKNAMES), hwndDlg, MyNicksDlgProc, (LPARAM) manager);
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE);
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE);
-
- GetWindowRect(manager->getMyRoomsTabHWND(), &rc2);
- rc2.right-=rc2.left;
- rc2.bottom-=rc2.top;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc2.right+300, 118+rc2.bottom, SWP_NOMOVE | SWP_NOZORDER);
- TreeView_SetItemHeight(GetDlgItem(hwndDlg, IDC_GROUP), 16);
-// hImageList=ImageList_Create(100, 100, ILC_COLOR32, 0, 10);
-// ListView_SetImageList(GetDlgItem(hwndDlg, IDC_ROOM), hImageList, LVSIL_SMALL);
- SetEvent(manager->getEvent());
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_GROUPS;
- muce.pszModule = manager->getModule();
- muce.pszID = NULL;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- return TRUE;
- case WM_SIZING:
- RECT *rc, rc2;
- rc = (RECT *)lParam;
- GetWindowRect(manager->getMyRoomsTabHWND(), &rc2);
- rc2.right-=rc2.left;
- rc2.bottom-=rc2.top;
- if (rc->right-rc->left<(rc2.right+80)) {
- if (wParam == WMSZ_RIGHT || wParam == WMSZ_BOTTOMRIGHT || wParam == WMSZ_TOPRIGHT) {
- rc->right=rc->left+rc2.right+80;
- } else {
- rc->left=rc->right-rc2.right-80;
- }
- }
- if (rc->bottom-rc->top<118+rc2.bottom || rc->bottom-rc->top>118+rc2.bottom) {
- if (wParam == WMSZ_BOTTOM || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT) {
- rc->bottom=rc->top+118+rc2.bottom;
- } else {
- rc->top=rc->bottom-118-rc2.bottom;
- }
- }
- return TRUE;
- case WM_SIZE:
- if (wParam==SIZE_RESTORED || wParam==SIZE_MAXIMIZED) {
- HDWP hdwp;
- dlgWidth = LOWORD(lParam);
- dlgHeight = HIWORD(lParam);
- GetWindowRect(manager->getMyRoomsTabHWND(), &rc2);
- rc2.right-=rc2.left;
- rc2.bottom-=rc2.top;
- tabPos = dlgWidth - rc2.right - 15;
- hdwp = BeginDeferWindowPos(6);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TABS), 0, tabPos, 10, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- hdwp = DeferWindowPos(hdwp, manager->getChatRoomsTabHWND(), 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE);
- hdwp = DeferWindowPos(hdwp, manager->getMyRoomsTabHWND() , 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE);
- hdwp = DeferWindowPos(hdwp, manager->getMyNicksTabHWND() , 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_GROUP), 0, 0, 0, tabPos-16, dlgHeight-40, SWP_NOZORDER | SWP_NOMOVE);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDCLOSE), 0, dlgWidth-88, dlgHeight-34, 0, 0 , SWP_NOZORDER | SWP_NOSIZE);
- EndDeferWindowPos(hdwp);
- }
- break;
- case WM_NOTIFY:
- switch (wParam) {
- case IDC_GROUP:
- switch (((LPNMHDR)lParam)->code) {
- case TVN_ITEMEXPANDING:
- {
- LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam;
- if (pnmtv->action==TVE_EXPAND) {
- TVITEM item = (TVITEM) pnmtv->itemNew;
- ChatGroup *group = (ChatGroup *) item.lParam;// manager->findGroup(item.hItem);
- if (group!=NULL) {
- if (group->getChild()==NULL) {
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_GROUPS;
- muce.pszModule = manager->getModule();
- muce.pszID = group->getId();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- }
- }
- }
- break;
- case TVN_SELCHANGED:
- {
- LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam;
- TVITEM item = (TVITEM) pnmtv->itemNew;
- ChatGroup *group = (ChatGroup *) item.lParam;// manager->findGroup(item.hItem);
- if (group!=NULL) {
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE);
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE);
- ListView_DeleteAllItems(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_ROOM));
- manager->setCurrentGroup(group);
- manager->setCurrentRoomsPage(0);
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_ROOMS;
- muce.pszModule = manager->getModule();
- muce.pszID = (char *)group->getId();
- muce.dwData = 0;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- }
- break;
- case NM_CUSTOMDRAW:
- {
- if (((LPNMHDR)lParam)->idFrom == IDC_GROUP) {
- LPNMTVCUSTOMDRAW pCustomDraw = (LPNMTVCUSTOMDRAW)lParam;
- switch (pCustomDraw->nmcd.dwDrawStage) {
- case CDDS_PREPAINT:
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYITEMDRAW);
- return TRUE;
- case CDDS_ITEMPREPAINT:
- {
- if (pCustomDraw->nmcd.uItemState & CDIS_FOCUS) { // selected (CDIS_FOCUS | CDIS_SELECTED
- pCustomDraw->clrText = 0;
- pCustomDraw->clrTextBk = 0xDAC8C2;
- }
- else {
- pCustomDraw->clrText = 0;
- }
- // HBRUSH hBr;
- // hBr = CreateSolidBrush(pCustomDraw->clrTextBk);//g_LogOptions.crUserListBGColor ) ;
- // FillRect(pCustomDraw->nmcd.hdc, &rc, hBr);
- // DeleteObject(hBr);
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, CDRF_NEWFONT);
- return TRUE;
- }
- }
- }
- }
- break;
- }
- break;
- case IDC_TABS:
- switch (((LPNMHDR) lParam)->code) {
- case TCN_SELCHANGE:
- switch (manager->getCurrentTab()) {
- case 0:
- ShowWindow(manager->getChatRoomsTabHWND(), SW_HIDE);
- break;
- case 1:
- ShowWindow(manager->getMyRoomsTabHWND(), SW_HIDE);
- break;
- case 2:
- ShowWindow(manager->getMyNicksTabHWND(), SW_HIDE);
- break;
- }
- manager->setCurrentTab(TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)));
- switch (manager->getCurrentTab()) {
- case 0:
- ShowWindow(manager->getChatRoomsTabHWND(), SW_SHOW);
- break;
- case 1:
- ShowWindow(manager->getMyRoomsTabHWND(), SW_SHOW);
- if (!manager->isUserRoomListReceived()) {
- SendMessage(hwndDlg, WM_MUCC_REFRESH_USER_ROOMS, 0, 0);
- }
- break;
- case 2:
- ShowWindow(manager->getMyNicksTabHWND(), SW_SHOW);
- if (!manager->isUserNickListReceived()) {
- SendMessage(hwndDlg, WM_MUCC_REFRESH_USER_NICKS, 0, 0);
- }
- break;
- }
- break;
- }
- break;
- }
- break;
- case WM_MUCC_REFRESH_USER_ROOMS:
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_USER_ROOMS;
- muce.pszModule = manager->getModule();
- muce.pszID = NULL;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- break;
- case WM_MUCC_REFRESH_USER_NICKS:
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_USER_NICKS;
- muce.pszModule = manager->getModule();
- muce.pszID = NULL;
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- break;
- case WM_MUCC_REFRESH_ROOMS:
- {
- ChatGroup *group = manager->getCurrentGroup();
- if (manager->getCurrentGroup()!=NULL) {
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE);
- EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE);
- ListView_DeleteAllItems(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_ROOM));
- /*
- * TODO: delete rooms here !!!
- */
- muce.cbSize = sizeof(MUCCEVENT);
- muce.iType = MUCC_EVENT_QUERY_ROOMS;
- muce.pszModule = manager->getModule();
- muce.pszID = (char *)group->getId();
- muce.dwData = manager->getCurrentRoomsPage();
- NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce);
- }
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCLOSE:
- ShowWindow(hwndDlg, SW_HIDE);
- break;
- }
- break;
- case WM_CLOSE:
- ShowWindow(hwndDlg, SW_HIDE);
- break;
-
- }
- return FALSE;
-}
-
-ManagerWindow* ManagerWindow::getWindow(const char *module) {
- ManagerWindow *ptr;
- EnterCriticalSection(&mutex);
- for (ptr=list;ptr!=NULL;ptr=ptr->getNext()) {
- if (strcmp(ptr->getModule(), module)==0) {
- break;
- }
- }
- LeaveCriticalSection(&mutex);
- if (ptr==NULL) {
- ptr = new ManagerWindow(module);
- }
- return ptr;
-}
-
diff --git a/protocols/Tlen/tlen_czaty/ManagerWindow.h b/protocols/Tlen/tlen_czaty/ManagerWindow.h
deleted file mode 100644
index f57d1c1057..0000000000
--- a/protocols/Tlen/tlen_czaty/ManagerWindow.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef MANAGERWINDOW_INCLUDED
-#define MANAGERWINDOW_INCLUDED
-#include "mucc.h"
-#include "ChatGroup.h"
-#include "ChatRoom.h"
-
-class ManagerWindow{
-
-private:
- static CRITICAL_SECTION mutex;
- static bool released;
- static ManagerWindow * list;
- HWND hWnd;
- HWND hChatRoomsTabWnd;
- HWND hMyRoomsTabWnd;
- HWND hMyNicksTabWnd;
- HANDLE hEvent;
- ManagerWindow * prev;
- ManagerWindow * next;
- ChatGroup * groups;
- ChatRoom * rooms;
- ChatRoom * myRooms;
- char * module;
- char * moduleName;
- ChatGroup * currentGroup;
- int isStarted;
- int userNickList, userRoomList;
- int currentTab;
- int currentRoomsPage;
- int lastRoomsPage;
-public:
- ManagerWindow (const char *module);
- ~ManagerWindow ();
- int start();
- ChatGroup * findGroup(const char *id);
- void queryResultGroups(MUCCQUERYRESULT *queryResult);
- void queryResultRooms(MUCCQUERYRESULT *queryResult);
- void queryResultUserRooms(MUCCQUERYRESULT *queryResult);
- void queryResultUserNick(MUCCQUERYRESULT *queryResult);
- ManagerWindow * getNext();
- void setNext(ManagerWindow *);
- ManagerWindow * getPrev();
- void setPrev(ManagerWindow *);
- void setHWND(HWND);
- HWND getHWND();
- HANDLE getEvent();
- void setChatRoomsTabHWND(HWND);
- HWND getChatRoomsTabHWND();
- void setMyNicksTabHWND(HWND);
- HWND getMyNicksTabHWND();
- void setMyRoomsTabHWND(HWND);
- HWND getMyRoomsTabHWND();
- void setModuleName(const char *moduleName);
- void setCurrentTab(int);
- int getCurrentTab();
- const char * getModule();
- const char * getModuleName();
- void setCurrentGroup(ChatGroup *);
- ChatGroup * getCurrentGroup();
- void setCurrentRoomsPage(int);
- int getCurrentRoomsPage();
- void setLastRoomsPage(int);
- int isLastRoomsPage();
- int isUserRoomListReceived();
- int isUserNickListReceived();
-
- static ManagerWindow* getWindow(const char *module);
- static void release();
- static void init();
-
-};
-#endif
-
diff --git a/protocols/Tlen/tlen_czaty/Options.cpp b/protocols/Tlen/tlen_czaty/Options.cpp
deleted file mode 100644
index 8e0f093ddd..0000000000
--- a/protocols/Tlen/tlen_czaty/Options.cpp
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "mucc.h"
-#include "Options.h"
-#include "ChatWindow.h"
-#include "Utils.h"
-#include "resource.h"
-#include <commctrl.h>
-#include "m_ieview.h"
-
-static INT_PTR CALLBACK MUCCOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-//static INT_PTR CALLBACK MUCCLogOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-//static INT_PTR CALLBACK MUCCPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-
-COLORREF Options::colorListBg, Options::colorInputBg, Options::colorLogBg, Options::chatWindowFontColor;
-HBRUSH Options::brushListBg=NULL, Options::brushInputBg=NULL, Options::brushLogBg=NULL;
-int Options::logLimit, Options::chatWindowOptions, Options::chatContainerOptions;
-int Options::chatWindowFont, Options::chatWindowFontSize, Options::chatWindowFontStyle;
-
-void Options::setListBgColor(COLORREF c) {
- colorListBg = c;
- if (brushListBg != NULL) {
- DeleteObject(brushListBg);
- }
- brushListBg = CreateSolidBrush(colorListBg);
-}
-
-void Options::setInputBgColor(COLORREF c) {
- colorInputBg = c;
- if (brushInputBg!= NULL) {
- DeleteObject(brushInputBg);
- }
- brushInputBg = CreateSolidBrush(colorInputBg);
-}
-
-void Options::setLogBgColor(COLORREF c) {
- colorLogBg = c;
- if (brushLogBg!= NULL) {
- DeleteObject(brushLogBg);
- }
- brushLogBg = CreateSolidBrush(colorLogBg);
-}
-
-COLORREF Options::getListBgColor() {
- return colorListBg;
-}
-
-COLORREF Options::getInputBgColor() {
- return colorInputBg;
-}
-
-COLORREF Options::getLogBgColor() {
- return colorLogBg;
-}
-
-HBRUSH Options::getListBgBrush() {
- return brushListBg;
-}
-
-HBRUSH Options::getInputBgBrush() {
- return brushInputBg;
-}
-
-HBRUSH Options::getLogBgBrush() {
- return brushLogBg;
-}
-
-void Options::setLogLimit(int l) {
- logLimit = l;
-}
-
-int Options::getLogLimit() {
- return logLimit;
-}
-
-void Options::setChatWindowFont(int o) {
- chatWindowFont = o;
-}
-
-int Options::getChatWindowFont() {
- return chatWindowFont;
-}
-
-void Options::setChatWindowFontSize(int o) {
- chatWindowFontSize = o;
-}
-
-int Options::getChatWindowFontSize() {
- return chatWindowFontSize;
-}
-
-void Options::setChatWindowFontStyle(int o) {
- chatWindowFontStyle = o;
-}
-
-int Options::getChatWindowFontStyle() {
- return chatWindowFontStyle;
-}
-
-void Options::setChatWindowFontColor(COLORREF o) {
- chatWindowFontColor = o;
-}
-
-COLORREF Options::getChatWindowFontColor() {
- return chatWindowFontColor;
-}
-
-void Options::setChatWindowOptions(int o) {
- chatWindowOptions = o;
-}
-
-int Options::getChatWindowOptions() {
- return chatWindowOptions;
-}
-
-void Options::setChatContainerOptions(int o) {
- chatContainerOptions = o;
-}
-
-int Options::getChatContainerOptions() {
- return chatContainerOptions;
-}
-
-void Options::setExpandFlags(int o) {
- DBWriteContactSettingDword(NULL, muccModuleName, "ExpandFlags", o);
-}
-
-int Options::getExpandFlags() {
- return DBGetContactSettingDword(NULL, muccModuleName, "ExpandFlags", 0xFFFFFFFF);
-}
-
-void Options::loadSettings() {
- FontList::loadSettings();
- setLogBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundLog", 0xFFFFFF));
- setListBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundList", 0xFFFFFF));
- setInputBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundTyping", 0xFFFFFF));
- setLogLimit(DBGetContactSettingDword(NULL, muccModuleName, "LogSizeLimit", 100));
- setChatContainerOptions(DBGetContactSettingDword(NULL, muccModuleName, "ChatContainerOptions", ChatContainer::getDefaultOptions()));
- setChatWindowOptions(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowOptions", ChatWindow::getDefaultOptions()));
- setChatWindowFont(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFont", 0));
- setChatWindowFontSize(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontSize", 5));
- setChatWindowFontStyle(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontStyle", 0));
- setChatWindowFontColor(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontColor", 0));
-}
-
-void Options::saveSettings() {
- FontList::saveSettings();
- DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundLog", colorLogBg);
- DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundList", colorListBg);
- DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundTyping", colorInputBg);
- DBWriteContactSettingDword(NULL, muccModuleName, "LogSizeLimit", logLimit);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatContainerOptions", chatContainerOptions);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowOptions", chatWindowOptions);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFont", chatWindowFont);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontSize", chatWindowFontSize);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontStyle", chatWindowFontStyle);
- DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontColor", chatWindowFontColor);
-}
-
-void Options::init()
-{
- FontList::init();
- loadSettings();
-}
-
-int MUCCOptInit(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp;
-
- ZeroMemory(&odp, sizeof(odp));
- odp.cbSize = sizeof(odp);
- odp.position = 0;
- odp.hInstance = hInst;
- odp.pszGroup = Translate("Network");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
-// odp.pszTitle = muccModuleName;
- odp.pszTitle = "Tlen czaty";
- odp.flags = ODPF_BOLDGROUPS;
- odp.pfnDlgProc = MUCCOptDlgProc;
- odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
-
- /*
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS_LOG);
- _snprintf(str, sizeof(str), "%s %s", muccModuleName, Translate("Log"));
- str[sizeof(str)-1] = '\0';
- odp.pszTitle = str;
- odp.pfnDlgProc = MUCCLLogOptDlgProc;
- odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
- ZeroMemory(&odp,sizeof(odp));
- odp.cbSize = sizeof(odp);
- odp.position = 100000000;
- odp.hInstance = hInst;
- odp.pszGroup = Translate("PopUps");
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS_POPUPS);
- odp.pszTitle = jabberModuleName;
- odp.flags=ODPF_BOLDGROUPS;
- odp.pfnDlgProc = TlenPopupsDlgProc;
- odp.nIDBottomSimpleControl = 0;
- CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
- }
-
-*/
- return 0;
-}
-
-
-static int getOptions(HWND hTreeControl, HTREEITEM hItem, int flags) {
- TVITEM tvi = {0};
- tvi.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- tvi.hItem = hItem;
- TreeView_GetItem(hTreeControl, &tvi);
- if ((tvi.state>>12) == 2) {
- flags |= tvi.lParam;
- } else {
- flags &= ~tvi.lParam;
- }
- tvi.hItem = TreeView_GetChild(hTreeControl, hItem);
- if (tvi.hItem != NULL) {
- flags = getOptions(hTreeControl, tvi.hItem, flags);
- }
- tvi.hItem=TreeView_GetNextSibling(hTreeControl, hItem);
- if (tvi.hItem != NULL) {
- flags = getOptions(hTreeControl, tvi.hItem, flags);
- }
- return flags;
-
-}
-
-static int getExpandFlags(HWND hTreeControl) {
- TVITEM tvi = {0};
- int flags =0, mask = 1;
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.stateMask = TVIS_EXPANDED;
- tvi.hItem = TreeView_GetRoot(hTreeControl);
- while (tvi.hItem != NULL) {
- TreeView_GetItem(hTreeControl, &tvi);
- if (tvi.state & TVIS_EXPANDED) {
- flags |= mask;
- }
- mask <<= 1;
- tvi.hItem=TreeView_GetNextSibling(hTreeControl, tvi.hItem);
- }
- return flags;
-}
-
-
-static int addOption(HWND hTreeControl, HTREEITEM hParent, const char *text, int flag) {
- TVINSERTSTRUCT tvis;
- tvis.hInsertAfter = TVI_LAST;
- tvis.hParent = hParent;
- tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
- char* textA = Translate(text);
- LPTSTR textT = Utils::mucc_mir_a2t(textA);
- tvis.item.pszText = textT;
- tvis.item.lParam = flag;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = Options::getChatWindowOptions() & flag ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1);
- TreeView_InsertItem(hTreeControl, &tvis);
- Utils::mucc_mir_free(textT);
- return (Options::getChatWindowOptions() & flag) != 0;
-
-}
-
-static INT_PTR CALLBACK MUCCOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int i;
- char *pszText;
- switch (msg) {
- case WM_INITDIALOG:
- {
- TVINSERTSTRUCT tvis;
- TVITEM tvi;
- HWND hTreeControl;
- HTREEITEM hItem;
- int bCheckParent, expandFlags;
-
- TranslateDialogDefault(hwndDlg);
- Options::loadSettings();
- for (i=0;i<Options::getFontNum();i++) {
- SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, 0, i + 1);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETSEL, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, Options::getFontSettings(0)->getColor());
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, Options::getLogBgColor());
- SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_SETCOLOUR, 0, Options::getListBgColor());
- SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_SETCOLOUR, 0, Options::getInputBgColor());
- SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(1000,20));
- SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_SETPOS, 0, MAKELONG(Options::getLogLimit(), 0));
-
- SetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE,GetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
-
-
- hTreeControl = GetDlgItem(hwndDlg, IDC_TREELIST);
- expandFlags = Options::getExpandFlags();
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
- tvis.hParent = NULL;
- tvis.item.lParam = 0;
-
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.stateMask = TVIS_STATEIMAGEMASK;
-
- tvis.item.pszText = TranslateT("Default Log Appearence");
- hItem = TreeView_InsertItem(hTreeControl, &tvis);
- bCheckParent = 1;
- bCheckParent &= addOption(hTreeControl, hItem, "Show nicknames", ChatWindow::FLAG_SHOW_NICKNAMES);
- bCheckParent &= addOption(hTreeControl, hItem, "Show message on a new line", ChatWindow::FLAG_MSGINNEWLINE);
- tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1));
- tvi.hItem = hItem;
- TreeView_SetItem(hTreeControl, &tvi);
- if (expandFlags & 1) {
- TreeView_Expand(hTreeControl, hItem, TVE_EXPAND);
- }
-
- tvis.item.pszText = TranslateT("Default Timestamp Settings");
- hItem = TreeView_InsertItem(hTreeControl, &tvis);
- bCheckParent = 1;
- bCheckParent &= addOption(hTreeControl, hItem, "Show date", ChatWindow::FLAG_SHOW_DATE);
- bCheckParent &= addOption(hTreeControl, hItem, "Show timestamp", ChatWindow::FLAG_SHOW_TIMESTAMP);
- bCheckParent &= addOption(hTreeControl, hItem, "Show seconds", ChatWindow::FLAG_SHOW_SECONDS);
- bCheckParent &= addOption(hTreeControl, hItem, "Use long date format", ChatWindow::FLAG_LONG_DATE);
- tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1));
- tvi.hItem = hItem;
- TreeView_SetItem(hTreeControl, &tvi);
- if (expandFlags & 2) {
- TreeView_Expand(hTreeControl, hItem, TVE_EXPAND);
- }
-
- tvis.item.pszText = TranslateT("Default Text Formatting Filter");
- hItem = TreeView_InsertItem(hTreeControl, &tvis);
- bCheckParent = 1;
- bCheckParent &= addOption(hTreeControl, hItem, "Font name", ChatWindow::FLAG_FORMAT_FONT);
- bCheckParent &= addOption(hTreeControl, hItem, "Font size", ChatWindow::FLAG_FORMAT_SIZE);
- bCheckParent &= addOption(hTreeControl, hItem, "Font style", ChatWindow::FLAG_FORMAT_STYLE);
- bCheckParent &= addOption(hTreeControl, hItem, "Font color", ChatWindow::FLAG_FORMAT_COLOR);
- tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1));
- tvi.hItem = hItem;
- TreeView_SetItem(hTreeControl, &tvi);
- if (expandFlags & 4) {
- TreeView_Expand(hTreeControl, hItem, TVE_EXPAND);
- }
-
- tvis.item.pszText = TranslateT("Default Event Filter");
- hItem = TreeView_InsertItem(hTreeControl, &tvis);
- bCheckParent = 1;
- bCheckParent &= addOption(hTreeControl, hItem, "Messages", ChatWindow::FLAG_LOG_MESSAGES);
- bCheckParent &= addOption(hTreeControl, hItem, "User has joined", ChatWindow::FLAG_LOG_JOINED);
- bCheckParent &= addOption(hTreeControl, hItem, "User has left", ChatWindow::FLAG_LOG_LEFT);
- bCheckParent &= addOption(hTreeControl, hItem, "Topic changes", ChatWindow::FLAG_LOG_TOPIC);
- tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1));
- tvi.hItem = hItem;
- TreeView_SetItem(hTreeControl, &tvi);
- if (expandFlags & 8) {
- TreeView_Expand(hTreeControl, hItem, TVE_EXPAND);
- }
-
- tvis.item.pszText = TranslateT("Default Window Flashing");
- hItem = TreeView_InsertItem(hTreeControl, &tvis);
- bCheckParent = 1;
- bCheckParent &= addOption(hTreeControl, hItem, "Messages", ChatWindow::FLAG_FLASH_MESSAGES);
- bCheckParent &= addOption(hTreeControl, hItem, "User has joined", ChatWindow::FLAG_FLASH_JOINED);
- bCheckParent &= addOption(hTreeControl, hItem, "User has left", ChatWindow::FLAG_FLASH_LEFT);
- bCheckParent &= addOption(hTreeControl, hItem, "Topic changes", ChatWindow::FLAG_FLASH_TOPIC);
- tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1));
- tvi.hItem = hItem;
- TreeView_SetItem(hTreeControl, &tvi);
- if (expandFlags & 16) {
- TreeView_Expand(hTreeControl, hItem, TVE_EXPAND);
- }
-
- CheckDlgButton(hwndDlg, IDC_SENDONENTER, Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_SENDONENTER);
- CheckDlgButton(hwndDlg, IDC_ENABLEIEVIEW, Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_ENABLEIEVIEW);
- if (!ServiceExists(MS_IEVIEW_WINDOW)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLEIEVIEW), FALSE);
- }
- CheckDlgButton(hwndDlg, IDC_USETABS, Options::getChatContainerOptions() & ChatContainer::FLAG_USE_TABS);
-
- }
- case WM_MEASUREITEM:
- if (wParam == IDC_FONTLIST) {
- MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam;
- HFONT hFont, hoFont;
- HDC hDC;
- SIZE fontSize;
- int iItem = lpMis->itemData - 1;
- Font *font = Options::getFontSettings(iItem);
- if (font != NULL) {
-
- LPTSTR lps1 = Utils::mucc_mir_a2t(font->getFace());
- hFont = CreateFont(font->getSize(), 0, 0, 0,
- font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL,
- font->getStyle() & Font::ITALIC ? 1 : 0, 0, 0,
- font->getCharSet(),
- OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, lps1);
- Utils::mucc_mir_free(lps1);
-
- hDC = GetDC(GetDlgItem(hwndDlg, lpMis->CtlID));
- hoFont = (HFONT) SelectObject(hDC, hFont);
- pszText = Translate(Options::getFontSettings(iItem)->getName());
- LPTSTR pszTextT1 = Utils::mucc_mir_a2t(pszText);
- GetTextExtentPoint32(hDC, pszTextT1, lstrlen(pszTextT1), &fontSize);
- Utils::mucc_mir_free(pszTextT1);
- SelectObject(hDC, hoFont);
- ReleaseDC(GetDlgItem(hwndDlg, lpMis->CtlID), hDC);
- DeleteObject(hFont);
- lpMis->itemWidth = fontSize.cx;
- lpMis->itemHeight = fontSize.cy;
- return TRUE;
- }
- break;
- }
- case WM_DRAWITEM:
- if (wParam == IDC_FONTLIST) {
- DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam;
- HFONT hFont;
- HBRUSH hBrush;
- int iItem = lpDis->itemData - 1;
- Font *font = Options::getFontSettings(iItem);
- if (font != NULL) {
- COLORREF color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_GETCOLOUR, 0, 0);
- if (iItem == Options::FONT_USERLIST || iItem == Options::FONT_USERLISTGROUP) {
- color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_GETCOLOUR, 0, 0);
- } else if (iItem == Options::FONT_TYPING) {
- color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_GETCOLOUR, 0, 0);
- }
- hBrush = CreateSolidBrush(color);
-
- LPTSTR lps2 = Utils::mucc_mir_a2t(font->getFace());
- hFont = CreateFont(font->getSize(), 0, 0, 0,
- font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL,
- font->getStyle() & Font::ITALIC ? 1 : 0,
- font->getStyle() & Font::UNDERLINE ? 1 : 0, 0,
- font->getCharSet(),
- OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
- lps2);
- Utils::mucc_mir_free(lps2);
-
- hFont = (HFONT) SelectObject(lpDis->hDC, hFont);
- SetBkMode(lpDis->hDC, TRANSPARENT);
- FillRect(lpDis->hDC, &lpDis->rcItem, hBrush);
- if (lpDis->itemState & ODS_SELECTED) {
- FrameRect(lpDis->hDC, &lpDis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
- }
- SetTextColor(lpDis->hDC, font->getColor());
- pszText = Translate(font->getName());
- LPTSTR pszTextT2 = Utils::mucc_mir_a2t(pszText);
- TextOut(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.top, pszTextT2, lstrlen(pszTextT2));
- Utils::mucc_mir_free(pszTextT2);
- hFont = (HFONT) SelectObject(lpDis->hDC, hFont);
- DeleteObject(hBrush);
- DeleteObject(hFont);
- }
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_COLORTXT:
- {
- int totalCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCOUNT, 0, 0);
- int *selItems= new int[totalCount];
- int selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, totalCount, (LPARAM) selItems);
- COLORREF color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_GETCOLOUR, 0, 0);
- for (int i=0; i<selCount; i++) {
- int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0) - 1;
- Font *font = Options::getFontSettings(iItem);
- if (font != NULL) {
- font->setColor(color);
- }
- }
- delete selItems;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
- case IDC_LOGLIMIT:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam==GetFocus()) {
- i = GetDlgItemInt(hwndDlg, IDC_LOGLIMIT, NULL, FALSE);
- // if (i>1000) {
- // i = 1000;
- // SetDlgItemInt(hwndDlg, IDC_LOGLIMIT, i, FALSE);
- // }
- if (i!=Options::getLogLimit()) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_COLORBKG:
- case IDC_COLORLIST:
- case IDC_COLORINPUT:
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE);
- case IDC_SENDONENTER:
- case IDC_USETABS:
- case IDC_ENABLEIEVIEW:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_FONTLIST:
- if (HIWORD(wParam) == LBN_SELCHANGE) {
- if (SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0) > 1) {
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, GetSysColor(COLOR_3DFACE));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT));
- }
- else {
- int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA,
- SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1;
- Font *font = Options::getFontSettings(iItem);
- if (font != NULL) {
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, font->getColor());
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETDEFAULTCOLOUR, 0, font->getColor());
- }
- }
- }
- if (HIWORD(wParam) != LBN_DBLCLK) {
- return TRUE;
- }
- case IDC_CHOOSEFONT:
- {
- CHOOSEFONT cf;
- LOGFONT lf;
- int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1;
- ZeroMemory(&cf, sizeof(cf));
- ZeroMemory(&lf, sizeof(lf));
- Font *font = Options::getFontSettings(iItem);
- if (font != NULL) {
- lf.lfHeight = font->getSize();
- lf.lfWeight = font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL;
- lf.lfItalic = font->getStyle() & Font::ITALIC ? 1 : 0;
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf.lfQuality = DEFAULT_QUALITY;
- lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- LPTSTR lps3 = Utils::mucc_mir_a2t(font->getFace());
- lstrcpy(lf.lfFaceName, lps3);
- Utils::mucc_mir_free(lps3);
- cf.lStructSize = sizeof(cf);
- cf.hwndOwner = hwndDlg;
- cf.lpLogFont = &lf;
- cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
- if (ChooseFont(&cf)) {
- int totalCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCOUNT, 0, 0);
- int *selItems= new int[totalCount];
- int selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, totalCount, (LPARAM) selItems);
- for (int i=0; i<selCount; i++) {
- int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0) - 1;
- Font *font2 = Options::getFontSettings(iItem);
- if (font2 != NULL) {
- font2->setStyle((lf.lfWeight >= FW_BOLD ? Font::BOLD : 0) | (lf.lfItalic ? Font::ITALIC : 0));
- font2->setCharSet(lf.lfCharSet);
- font2->setSize(lf.lfHeight);
- char* lps4 = Utils::mucc_mir_t2a(lf.lfFaceName);
- font2->setFace(lps4);
- Utils::mucc_mir_free(lps4);
- MEASUREITEMSTRUCT mis;
- ZeroMemory(&mis, sizeof(mis));
- mis.CtlID = IDC_FONTLIST;
- mis.itemData = iItem + 1;
- SendMessage(hwndDlg, WM_MEASUREITEM, (WPARAM)IDC_FONTLIST, (LPARAM) & mis);
- SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight);
- }
- }
- delete selItems;
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- return TRUE;
- }
- break;
- }
- break;
- case WM_DESTROY:
- Options::setExpandFlags(getExpandFlags(GetDlgItem(hwndDlg, IDC_TREELIST)));
- break;
- case WM_NOTIFY:
- {
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- COLORREF color;
- color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_GETCOLOUR, 0, 0);
- Options::setListBgColor(color);
- color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_GETCOLOUR, 0, 0);
- Options::setInputBgColor(color);
- color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_GETCOLOUR, 0, 0);
- Options::setLogBgColor(color);
- Options::setLogLimit(SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_GETPOS, 0, 0));
- Options::setChatWindowOptions(getOptions(GetDlgItem(hwndDlg, IDC_TREELIST), TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREELIST)), 0));
- Options::setChatWindowOptions(Options::getChatWindowOptions() | (IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER) ? ChatWindow::FLAG_OPT_SENDONENTER : 0));
- Options::setChatWindowOptions(Options::getChatWindowOptions() | (IsDlgButtonChecked(hwndDlg, IDC_ENABLEIEVIEW) ? ChatWindow::FLAG_OPT_ENABLEIEVIEW : 0));
- Options::setChatContainerOptions(IsDlgButtonChecked(hwndDlg, IDC_USETABS) ? ChatContainer::FLAG_USE_TABS : 0);
- Options::saveSettings();
- ChatWindow::refreshSettings(1);
- break;
- case NM_CLICK:
- /* Handle checking/unchecking options here - update children and parent appropriately */
- if(((LPNMHDR)lParam)->idFrom == IDC_TREELIST) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if(TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- if(hti.flags&TVHT_ONITEMSTATEICON) {
- TVITEM tvi = {0};
- tvi.mask = TVIF_HANDLE | TVIF_STATE;
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- tvi.state ^= INDEXTOSTATEIMAGEMASK(3);
- tvi.hItem = TreeView_GetChild(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
- if (tvi.hItem!=NULL) {
- while(tvi.hItem != NULL) {
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- tvi.hItem=TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
- }
- } else {
- HTREEITEM hParent = TreeView_GetParent(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
- if (hParent != NULL) {
- if ((tvi.state>>12) == 2) {
- tvi.hItem = TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
- while(tvi.hItem != NULL) {
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- if ((tvi.state>>12) != 2) {
- break;
- }
- tvi.hItem = TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
- }
- if ((tvi.state>>12) == 2) {
- tvi.hItem = TreeView_GetPrevSibling(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
- while(tvi.hItem != NULL) {
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- if ((tvi.state>>12) != 2) {
- break;
- }
- tvi.hItem = TreeView_GetPrevSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
- }
- }
- }
- tvi.hItem = hParent;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- }
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- }
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-/*
-#define POPUP_DEFAULT_COLORBKG 0xDCBDA5
-#define POPUP_DEFAULT_COLORTXT 0x000000
-static void MailPopupPreview(DWORD colorBack, DWORD colorText, char *title, char *emailInfo, int delay)
-{
- POPUPDATAEX ppd;
- char * lpzContactName;
- char * lpzText;
-
- lpzContactName = title;
- lpzText = emailInfo;
- ZeroMemory(&ppd, sizeof(ppd));
- ppd.lchContact = NULL;
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
- lstrcpy(ppd.lpzContactName, lpzContactName);
- lstrcpy(ppd.lpzText, lpzText);
- ppd.colorBack = colorBack;
- ppd.colorText = colorText;
- ppd.PluginWindowProc = NULL;
- ppd.PluginData=NULL;
- if ( ServiceExists( MS_POPUP_ADDPOPUPEX )) {
- ppd.iSeconds = delay;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
-
- }
- else if ( ServiceExists( MS_POPUP_ADDPOPUP )) {
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
- }
-}
-*/
-//static INT_PTR CALLBACK MUCCPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-//{
- /*
- switch (msg) {
- case WM_INITDIALOG:
- {
- BYTE delayMode;
- CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, jabberProtoName, "MailPopupEnabled", TRUE));
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
- SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupDelay", 4), FALSE);
- delayMode = DBGetContactSettingByte(NULL, jabberProtoName, "MailPopupDelayMode", 0);
- if (delayMode==1) {
- CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE);
- } else if (delayMode==2) {
- CheckDlgButton(hwndDlg, IDC_DELAY_PERMANENT, TRUE);
- } else {
- CheckDlgButton(hwndDlg, IDC_DELAY_POPUP, TRUE);
- }
- return TRUE;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_COLORTXT:
- case IDC_COLORBKG:
- case IDC_ENABLEPOPUP:
- case IDC_DELAY:
- case IDC_DELAY_POPUP:
- case IDC_DELAY_CUSTOM:
- case IDC_DELAY_PERMANENT:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_PREVIEW:
- {
- int delay;
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_POPUP)) {
- delay=0;
- } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) {
- delay=-1;
- } else {
- delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
- }
- MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0),
- (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0),
- "New mail",
- "From: test@test.test\nSubject: test",
- delay);
- }
-
- }
- break;
-
-
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- BYTE delayMode;
- DBWriteContactSettingByte(NULL, jabberProtoName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
- DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
- delayMode=0;
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) {
- delayMode=1;
- } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) {
- delayMode=2;
-
- }
- DBWriteContactSettingByte(NULL, jabberProtoName, "MailPopupDelayMode", delayMode);
- return TRUE;
- }
- }
- break;
-
- }*/
-// return FALSE;
-//}
-
diff --git a/protocols/Tlen/tlen_czaty/Options.h b/protocols/Tlen/tlen_czaty/Options.h
deleted file mode 100644
index 90c57099d0..0000000000
--- a/protocols/Tlen/tlen_czaty/Options.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef OPTIONS_INCLUDED
-#define OPTIONS_INCLUDED
-#include "FontList.h"
-#include "mucc.h"
-
-extern int MUCCOptInit(WPARAM wParam, LPARAM lParam);
-
-class Options:public FontList {
-private:
- static COLORREF colorInputBg;
- static COLORREF colorLogBg;
- static COLORREF colorListBg;
- static HBRUSH brushInputBg;
- static HBRUSH brushLogBg;
- static HBRUSH brushListBg;
- static int logLimit;
- static int chatContainerOptions;
- static int chatWindowOptions;
- static COLORREF chatWindowFontColor;
- static int chatWindowFont;
- static int chatWindowFontSize;
- static int chatWindowFontStyle;
-public:
- static void setListBgColor(COLORREF c);
- static void setLogBgColor(COLORREF c);
- static void setInputBgColor(COLORREF c);
- static COLORREF getListBgColor();
- static COLORREF getLogBgColor();
- static COLORREF getInputBgColor();
- static HBRUSH getListBgBrush();
- static HBRUSH getInputBgBrush();
- static HBRUSH getLogBgBrush();
- static void setLogLimit(int l);
- static int getLogLimit();
- static void setChatContainerOptions(int o);
- static int getChatContainerOptions();
- static void setChatWindowOptions(int o);
- static int getChatWindowOptions();
- static void setChatWindowFontColor(COLORREF o);
- static COLORREF getChatWindowFontColor();
- static void setChatWindowFont(int o);
- static int getChatWindowFont();
- static void setChatWindowFontSize(int o);
- static int getChatWindowFontSize();
- static void setChatWindowFontStyle(int o);
- static int getChatWindowFontStyle();
- static void setExpandFlags(int l);
- static int getExpandFlags();
- static void init();
- static void loadSettings();
- static void saveSettings();
-
-};
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/Utils.cpp b/protocols/Tlen/tlen_czaty/Utils.cpp
deleted file mode 100644
index 53bddf4488..0000000000
--- a/protocols/Tlen/tlen_czaty/Utils.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#include "Utils.h"
-
-struct FORK_ARG {
- HANDLE hEvent;
- void (__cdecl *threadcode)(void*);
- void *arg;
-};
-
-static void __cdecl forkthread_r(struct FORK_ARG *fa)
-{
- void (*callercode)(void*) = fa->threadcode;
- void *arg = fa->arg;
- CallService(MS_SYSTEM_THREAD_PUSH, 0, 0);
- SetEvent(fa->hEvent);
- callercode(arg);
- CallService(MS_SYSTEM_THREAD_POP, 0, 0);
- return;
-}
-
-unsigned long Utils::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((void (__cdecl *)(void*))forkthread_r, stacksize, &fa);
- if ((unsigned long) -1L != rc) {
- WaitForSingleObject(fa.hEvent, INFINITE);
- }
- CloseHandle(fa.hEvent);
- return rc;
-}
-
-void Utils::copyString(char **a, const char *b) {
- char *oldA;
- char *newA;
- oldA = *a;
- if (b!=NULL) {
- newA = new char[strlen(b)+1];
- strcpy(newA, b);
- } else {
- newA = NULL;
- }
- *a = newA;
- if (oldA!=NULL) {
- delete oldA;
- }
-
-}
-
-
-
-MM_INTERFACE Utils::mmi;
-
-void Utils::mucc_mir_free(void* ptr)
-{
- mir_free(ptr);
-}
-
-char* Utils::mucc_mir_t2a(LPCTSTR src)
-{
- return mir_t2a(src);
-}
-
-LPTSTR Utils::mucc_mir_a2t(const char* src)
-{
- return mir_a2t(src);
-}
-
-
-
-void Utils::log(const char *fmt, ...)
-{
-#ifdef ENABLE_LOGGING
- char *str;
- va_list vararg;
- int strsize;
- char *text;
- char *p, *q;
- int extra;
-
- va_start(vararg, fmt);
- str = (char *) malloc(strsize=2048);
- while (_vsnprintf(str, strsize, fmt, vararg) == -1)
- str = (char *) realloc(str, strsize+=2048);
- va_end(vararg);
-
- extra = 0;
- for (p=str; *p!='\0'; p++)
- if (*p=='\n' || *p=='\r')
- extra++;
- text = (char *) malloc(strlen(muccModuleName)+2+strlen(str)+2+extra);
- wsprintf(text, "[%s]", muccModuleName);
- for (p=str,q=text+strlen(text); *p!='\0'; p++,q++) {
- if (*p == '\r') {
- *q = '\\';
- *(q+1) = 'r';
- q++;
- }
- else if (*p == '\n') {
- *q = '\\';
- *(q+1) = 'n';
- q++;
- }
- else
- *q = *p;
- }
- *q = '\n';
- *(q+1) = '\0';
-// CallService(MS_NETLIB_LOG, (WPARAM) NULL, (LPARAM) text);
- //OutputDebugString(text);
- free(text);
- free(str);
-#endif
-}
-
diff --git a/protocols/Tlen/tlen_czaty/Utils.h b/protocols/Tlen/tlen_czaty/Utils.h
deleted file mode 100644
index 6ae4e2a44c..0000000000
--- a/protocols/Tlen/tlen_czaty/Utils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef UTILS_INCLUDED
-#define UTILS_INCLUDED
-#include "mucc.h"
-
-class Utils {
-public:
- static unsigned long forkThread(void (__cdecl *threadcode)(void*),unsigned long stacksize,void *arg);
- static void copyString(char **, const char *b);
- static void log(const char *fmt, ...);
-
- static MM_INTERFACE mmi;
- static void mucc_mir_free(void*);
- static char* mucc_mir_t2a(LPCTSTR);
- static LPTSTR mucc_mir_a2t(const char* );
-
-};
-
-#endif
diff --git a/protocols/Tlen/tlen_czaty/icos/admin.ico b/protocols/Tlen/tlen_czaty/icos/admin.ico
deleted file mode 100644
index 9699f55d6f..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/admin.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/administration.ico b/protocols/Tlen/tlen_czaty/icos/administration.ico
deleted file mode 100644
index e57884857e..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/administration.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/blank.ico b/protocols/Tlen/tlen_czaty/icos/blank.ico
deleted file mode 100644
index 7845f62fed..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/blank.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/bold.ico b/protocols/Tlen/tlen_czaty/icos/bold.ico
deleted file mode 100644
index 01d5adda1d..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/bold.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/chat.ico b/protocols/Tlen/tlen_czaty/icos/chat.ico
deleted file mode 100644
index 0b388d8f9d..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/chat.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/delete.ico b/protocols/Tlen/tlen_czaty/icos/delete.ico
deleted file mode 100644
index 59408c5337..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/delete.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/glowner.ico b/protocols/Tlen/tlen_czaty/icos/glowner.ico
deleted file mode 100644
index 86fdf534e9..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/glowner.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/invite.ico b/protocols/Tlen/tlen_czaty/icos/invite.ico
deleted file mode 100644
index bf7dbc4d7a..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/invite.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/italic.ico b/protocols/Tlen/tlen_czaty/icos/italic.ico
deleted file mode 100644
index d34418be24..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/italic.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/message.ico b/protocols/Tlen/tlen_czaty/icos/message.ico
deleted file mode 100644
index 40d183b7b3..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/message.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/next.ico b/protocols/Tlen/tlen_czaty/icos/next.ico
deleted file mode 100644
index d817b06cc6..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/next.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/options.ico b/protocols/Tlen/tlen_czaty/icos/options.ico
deleted file mode 100644
index 2fd2d902d9..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/options.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/owner.ico b/protocols/Tlen/tlen_czaty/icos/owner.ico
deleted file mode 100644
index 27bea391f0..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/owner.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/prev.ico b/protocols/Tlen/tlen_czaty/icos/prev.ico
deleted file mode 100644
index 2f171e5783..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/prev.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/r_anon.ico b/protocols/Tlen/tlen_czaty/icos/r_anon.ico
deleted file mode 100644
index b5ebd0289e..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/r_anon.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/r_memb.ico b/protocols/Tlen/tlen_czaty/icos/r_memb.ico
deleted file mode 100644
index 418fd9abf5..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/r_memb.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/r_mod.ico b/protocols/Tlen/tlen_czaty/icos/r_mod.ico
deleted file mode 100644
index 3b9fa47f60..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/r_mod.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/registered.ico b/protocols/Tlen/tlen_czaty/icos/registered.ico
deleted file mode 100644
index 3a5182b5d6..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/registered.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/save.ico b/protocols/Tlen/tlen_czaty/icos/save.ico
deleted file mode 100644
index 48b0581fd5..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/save.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/search.ico b/protocols/Tlen/tlen_czaty/icos/search.ico
deleted file mode 100644
index 065468e272..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/search.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/sendmail.ico b/protocols/Tlen/tlen_czaty/icos/sendmail.ico
deleted file mode 100644
index 0b60bf950e..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/sendmail.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/smile.ico b/protocols/Tlen/tlen_czaty/icos/smile.ico
deleted file mode 100644
index d4aea87249..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/smile.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/tlenbig.ico b/protocols/Tlen/tlen_czaty/icos/tlenbig.ico
deleted file mode 100644
index 4d09293560..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/tlenbig.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/tlensmall.ico b/protocols/Tlen/tlen_czaty/icos/tlensmall.ico
deleted file mode 100644
index 5204d39d21..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/tlensmall.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/icos/underline.ico b/protocols/Tlen/tlen_czaty/icos/underline.ico
deleted file mode 100644
index 7709f5f7f4..0000000000
--- a/protocols/Tlen/tlen_czaty/icos/underline.ico
+++ /dev/null
Binary files differ
diff --git a/protocols/Tlen/tlen_czaty/mucc.cpp b/protocols/Tlen/tlen_czaty/mucc.cpp
deleted file mode 100644
index e5c35c070a..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-
-#include "../commons.h"
-#include "mucc.h"
-#include "mucc_services.h"
-#include "HelperDialog.h"
-#include "Options.h"
-#include "Utils.h"
-
-char *muccModuleName;
-HINSTANCE hInst;
-PLUGINLINK *pluginLink;
-HANDLE hHookEvent = NULL;
-HIMAGELIST hImageList = NULL;
-HICON muccIcon[MUCC_ICON_TOTAL];
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-static int PreShutdown(WPARAM wParam, LPARAM lParam);
-
-PLUGININFOEX pluginInfoEx = {
- sizeof(PLUGININFOEX),
-#ifdef _UNICODE
-#ifdef _X64
- "Tlen Czaty (x64, Unicode)",
-#else
- "Tlen Czaty (Unicode)",
-#endif
-#else
- "Tlen Czaty",
-#endif
- PLUGIN_MAKE_VERSION(MUCC_MAJOR_VERSION,MUCC_MINOR_VERSION,MUCC_RELEASE_NUM,MUCC_BUILD_NUM),
- "Group chats GUI plugin for Miranda IM (formerly known as mucc.dll) (version: "MUCC_VERSION_STRING" ; compiled: "__DATE__" "__TIME__")",
- "Piotr Piastucki",
- "the_leech@users.berlios.de",
- "(c) 2004-2012 Piotr Piastucki",
- "http://mtlen.berlios.de",
- 0,
- 0,
-#if defined( _UNICODE )
-#ifdef _X64
- {0x9061ae31, 0x3d33, 0x49ce, { 0xaf, 0x00, 0x78, 0x9c, 0xbc, 0x25, 0xd9, 0xba }}
-#else
- {0xadd9390c, 0x1dd4, 0x4c0d, { 0x9b, 0xa9, 0xcc, 0x76, 0x5d, 0x3d, 0xe5, 0x97 }}
-#endif
-#else
- {0x5cf4792c, 0xa050, 0x46b6, { 0xaf, 0xd0, 0x03, 0x2d, 0x6e, 0xfc, 0xd3, 0x9c }}
-#endif
-};
-
-extern "C" BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved)
-{
- hInst = hModule;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- if (mirandaVersion < PLUGIN_MAKE_VERSION(0,8,0,15)) {
- MessageBox(NULL, _TEXT("The Tlen Czaty plugin cannot be loaded. It requires Miranda IM 0.8.15 or later."), _TEXT("Tlen Czaty plugin (MUCC)"), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
- return NULL;
- }
- return &pluginInfoEx;
-}
-
-#ifndef MIID_TLEN_MUCC
-#define MIID_TLEN_MUCC { 0xba658997, 0x0bce, 0x4f96, { 0xba, 0x48, 0x54, 0x55, 0x34, 0x16, 0x73, 0xea } }
-#endif
-
-extern "C" __declspec(dllexport) const MUUID interfaces[] = {
- MIID_TLEN_MUCC,
- MIID_LAST
- };
-
-extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
-{
- return interfaces;
-}
-
-
-static void LoadIcons() {
- int i;
- static int iconList[] = {
- IDI_CHAT,
- IDI_GLOBALOWNER,
- IDI_OWNER,
- IDI_ADMIN,
- IDI_REGISTERED,
- IDI_R_MODERATED,
- IDI_R_MEMBERS,
- IDI_R_ANONYMOUS,
- IDI_PREV,
- IDI_NEXT,
- IDI_SEARCH,
- IDI_BOLD,
- IDI_ITALIC,
- IDI_UNDERLINE,
- IDI_OPTIONS,
- IDI_INVITE,
- IDI_ADMINISTRATION,
- IDI_SMILEY,
- IDI_MESSAGE
-
- };
- for (i=0; i<MUCC_ICON_TOTAL; i++) {
- muccIcon[i] = (HICON) LoadImage(hInst, MAKEINTRESOURCE(iconList[i]), IMAGE_ICON, 0, 0, 0);
- }
- if (hImageList != NULL) {
- ImageList_Destroy(hImageList);
- }
- hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,0,3);
-// ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_BLANK)));
-// ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_BLANK)));
- ImageList_AddIcon(hImageList, muccIcon[MUCC_IDI_MESSAGE]);
-
-}
-
-extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
-{
-// char text[_MAX_PATH];
-// char *p, *q;
-// GetModuleFileNameA(hInst, text, sizeof(text));
-// p = strrchr(text, '\\');
-// p++;
-// q = strrchr(p, '.');
-// *q = '\0';
-// muccModuleName = _strdup(p);
-// _strupr(muccModuleName);
-
- muccModuleName = "MUCC";
-
- pluginLink = link;
- HookEvent(ME_OPT_INITIALISE, MUCCOptInit);
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
- CreateServiceFunction(MS_MUCC_QUERY_RESULT, MUCCQueryResult);
- CreateServiceFunction(MS_MUCC_NEW_WINDOW, MUCCNewWindow);
- CreateServiceFunction(MS_MUCC_EVENT, MUCCEvent);
- hHookEvent = CreateHookableEvent(ME_MUCC_EVENT);
-
- mir_getMMI(&(Utils::mmi));
-
- LoadIcons();
- return 0;
-}
-
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
- Options::init();
- HelperDialog::init();
- ManagerWindow::init();
- ChatWindow::init();
- ChatContainer::init();
- return 0;
-}
-
-static int PreShutdown(WPARAM wParam, LPARAM lParam)
-{
- ChatContainer::release();
- ChatWindow::release();
- ManagerWindow::release();
- HelperDialog::release();
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Unload(void)
-{
- return 0;
-}
-
diff --git a/protocols/Tlen/tlen_czaty/mucc.h b/protocols/Tlen/tlen_czaty/mucc.h
deleted file mode 100644
index 8dc845aa92..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef MUCC_INCLUDED
-#define MUCC_INCLUDED
-
-//#define ENABLE_LOGGING
-
-#define _WIN32_WINNT 0x0501
-#define _WIN32_IE 0x0500
-
-#include <windows.h>
-#include <commctrl.h>
-#include <richedit.h>
-#include <process.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-#include <limits.h>
-
-#ifdef __MINGW32__
-#define EM_SETTEXTEX (WM_USER + 97)
-#define ST_DEFAULT 0
-#define ST_KEEPUNDO 1
-#define ST_SELECTION 2
-#define ST_NEWCHARS 4
-#else
-#include <win2k.h>
-#endif
-
-#define MIRANDA_VER 0x0700
-
-#include <newpluginapi.h>
-#include <m_system.h>
-#include <m_protomod.h>
-#include <m_protosvc.h>
-#include <m_clist.h>
-#include <m_clui.h>
-#include <m_options.h>
-#include <m_userinfo.h>
-#include <m_database.h>
-#include <m_langpack.h>
-#include <m_utils.h>
-#include <m_message.h>
-#include <m_skin.h>
-#include <m_popup.h>
-#include <m_button.h>
-
-#include "resource.h"
-
-enum {
- MUCC_IDI_CHAT = 0,
- MUCC_IDI_U_GLOBALOWNER,
- MUCC_IDI_U_OWNER,
- MUCC_IDI_U_ADMIN,
- MUCC_IDI_U_REGISTERED,
- MUCC_IDI_R_MODERATED,
- MUCC_IDI_R_MEMBERS,
- MUCC_IDI_R_ANONYMOUS,
- MUCC_IDI_PREV,
- MUCC_IDI_NEXT,
- MUCC_IDI_SEARCH,
- MUCC_IDI_BOLD,
- MUCC_IDI_ITALIC,
- MUCC_IDI_UNDERLINE,
- MUCC_IDI_OPTIONS,
- MUCC_IDI_INVITE,
- MUCC_IDI_ADMINISTRATION,
- MUCC_IDI_SMILEY,
- MUCC_IDI_MESSAGE,
- MUCC_ICON_TOTAL
-
-};
-
-extern PLUGINLINK * pluginLink;
-extern char *muccModuleName;
-extern HINSTANCE hInst;
-extern HANDLE hHookEvent;
-extern HIMAGELIST hImageList;
-extern HICON muccIcon[MUCC_ICON_TOTAL];
-
-#include "m_mucc.h"
-
-#define WM_MUCC_REFRESH_ROOMS (WM_USER+101)
-#define WM_MUCC_REFRESH_USER_ROOMS (WM_USER+102)
-#define WM_MUCC_REFRESH_USER_NICKS (WM_USER+103)
-
-#endif
-
diff --git a/protocols/Tlen/tlen_czaty/mucc.rc b/protocols/Tlen/tlen_czaty/mucc.rc
deleted file mode 100644
index d50a834649..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc.rc
+++ /dev/null
@@ -1,579 +0,0 @@
-#include "resource.h"
-#include "../commons.h"
-#ifdef __MINGW32__
- #define WINVER 0x500
- #define _WIN32_IE 0x500
- #include <windows.h>
- #ifndef IDC_STATIC
- #define IDC_STATIC (-1)
-#endif
-#else
-// #define APSTUDIO_READONLY_SYMBOLS
-// #include "winres.h"
-// #undef APSTUDIO_READONLY_SYMBOLS
- #include <windows.h>
- #ifndef IDC_STATIC
- #define IDC_STATIC (-1)
- #endif
-#endif
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif
-#ifdef APSTUDIO_INVOKED
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""winres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-IDR_CHATOPTIONS MENU DISCARDABLE
-BEGIN
- POPUP "", MENUBREAK
- BEGIN
- POPUP "Log Appearance"
- BEGIN
- MENUITEM "Show Nicknames", ID_OPTIONMENU_SHOWNICKNAMES
- MENUITEM "Show Message On A New Line", ID_OPTIONMENU_MSGINNEWLINE
- END
- POPUP "Timestamp Settings"
- BEGIN
- MENUITEM "Show Date", ID_OPTIONMENU_SHOWDATE
- MENUITEM "Show Timestamp", ID_OPTIONMENU_SHOWTIMESTAMP
- MENUITEM "Show Seconds", ID_OPTIONMENU_SHOWSECONDS
- MENUITEM "Use Long Date Format", ID_OPTIONMENU_USELONGDATE
-
- END
- POPUP "Text Formatting Filter"
- BEGIN
- MENUITEM "Font Name", ID_OPTIONMENU_FORMATFONT
- MENUITEM "Font Size", ID_OPTIONMENU_FORMATSIZE
- MENUITEM "Font Style", ID_OPTIONMENU_FORMATSTYLE
- MENUITEM "Font Color", ID_OPTIONMENU_FORMATCOLOR
- END
- POPUP "Event Filter"
- BEGIN
- MENUITEM "Messages", ID_OPTIONMENU_LOGMESSAGES
- MENUITEM "User Has Joined", ID_OPTIONMENU_LOGJOINED
- MENUITEM "User Has Left", ID_OPTIONMENU_LOGLEFT
- MENUITEM "Topic Changes", ID_OPTIONMENU_LOGTOPIC
- END
- POPUP "Window Flashing"
- BEGIN
- MENUITEM "Messages", ID_OPTIONMENU_FLASHMESSAGES
- MENUITEM "User Has Joined", ID_OPTIONMENU_FLASHJOINED
- MENUITEM "User Has Left", ID_OPTIONMENU_FLASHLEFT
- MENUITEM "Topic Changes", ID_OPTIONMENU_FLASHTOPIC
- END
- MENUITEM SEPARATOR
- MENUITEM "Save Settings As Default", ID_OPTIONMENU_SAVEDEFAULT
- MENUITEM SEPARATOR
- MENUITEM "User Administration", ID_ADMINMENU_ADMIN, GRAYED
- MENUITEM "Destroy Chat Room", ID_ADMINMENU_DESTROY, GRAYED
- MENUITEM SEPARATOR
- MENUITEM "Save Log", ID_ADMINMENU_SAVELOG
- END
- POPUP "", MENUBREAK
- BEGIN
- MENUITEM "Message", ID_USERMENU_MESSAGE
- MENUITEM SEPARATOR
- POPUP "Kick && Ban", GRAYED
- BEGIN
- MENUITEM "No Ban", ID_USERMENU_KICK_NO_BAN
- MENUITEM "Ban For 1 Minute", ID_USERMENU_KICK_BAN_1_MIN
- MENUITEM "Ban For 5 Minutes", ID_USERMENU_KICK_BAN_5_MIN
- MENUITEM "Ban For 15 Minutes", ID_USERMENU_KICK_BAN_15_MIN
- MENUITEM "Ban For 30 Minutes", ID_USERMENU_KICK_BAN_15_MIN
- MENUITEM "Ban For 1 Hour", ID_USERMENU_KICK_BAN_1_H
- MENUITEM "Ban For 6 Hours", ID_USERMENU_KICK_BAN_6_H
- MENUITEM "Ban For 1 Day", ID_USERMENU_KICK_BAN_1_D
- MENUITEM "Ban For 3 Days", ID_USERMENU_KICK_BAN_3_D
- MENUITEM "Ban For 1 Week", ID_USERMENU_KICK_BAN_1_W
- MENUITEM "Ban For 2 Weeks", ID_USERMENU_KICK_BAN_2_W
- MENUITEM "Ban For 4 Weeks", ID_USERMENU_KICK_BAN_4_W
- END
- POPUP "Change User Role", GRAYED
- BEGIN
- MENUITEM "No Role", ID_USERMENU_RIGHTS_NO
- MENUITEM "Member", ID_USERMENU_RIGHTS_MEMBER
-
- MENUITEM "Admin", ID_USERMENU_RIGHTS_ADMIN
- END
- MENUITEM "User Administration", ID_USERMENU_ADMINISTRATION, GRAYED
- END
- POPUP "", MENUBREAK
- BEGIN
- MENUITEM "Unban", ID_USERMENU_UNBAN
- END
-END
-
-IDR_CONTEXT MENU DISCARDABLE
-BEGIN
- POPUP "Log"
- BEGIN
- MENUITEM "&Copy", IDM_COPY
- MENUITEM "Co&py All", IDM_COPYALL
- MENUITEM SEPARATOR
- MENUITEM "Select &All", IDM_SELECTALL
- MENUITEM SEPARATOR
- MENUITEM "C&lear Log", IDM_CLEAR
- END
- POPUP "LogLink"
- BEGIN
- MENUITEM "Open in &new window", IDM_OPENNEW
- MENUITEM "&Open in existing window", IDM_OPENEXISTING
- MENUITEM "&Copy link", IDM_COPYLINK
- END
- POPUP "Message"
- BEGIN
- MENUITEM "Undo", IDM_UNDO
- MENUITEM "Redo", IDM_REDO
- MENUITEM SEPARATOR
- MENUITEM "Cut", IDM_CUT
- MENUITEM "Copy", IDM_COPY
- MENUITEM "Paste", IDM_PASTE
- MENUITEM "Delete", IDM_DELETE
- MENUITEM SEPARATOR
- MENUITEM "Select &All", IDM_SELECTALL
- END
-END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_OPTIONS DIALOGEX 0, 0, 320, 260
-STYLE DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Fonts",IDC_FONTSGB,169,10,143,182
- LTEXT "Background color",IDC_STATIC,175,23,100,8
- CONTROL "",IDC_COLORBKG,"ColourPicker",WS_TABSTOP,277,21,29,12
- LTEXT "Input area background",IDC_STATIC,175,38,100,8
- CONTROL "",IDC_COLORINPUT,"ColourPicker",WS_TABSTOP,277,36,29,12
- LTEXT "User list background",IDC_STATIC,175,53,100,8
- CONTROL "",IDC_COLORLIST,"ColourPicker",WS_TABSTOP,277,51,29,12
- LISTBOX IDC_FONTLIST,175,69,131,95,LBS_OWNERDRAWVARIABLE |
- LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "",IDC_COLORTXT,"ColourPicker",WS_TABSTOP,175,170,55,15
- PUSHBUTTON "Choose font",IDC_CHOOSEFONT,251,170,55,15
- GROUPBOX "Options",IDC_OPTIONSGB,5,10,158,182
- CONTROL "",IDC_TREELIST,"SysTreeView32",TVS_HASBUTTONS |
- TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP,11,
- 23,146,162,WS_EX_STATICEDGE
- GROUPBOX "Other",IDC_SIMPLE,5,193,310,57
- CONTROL "Use tabbed mode",IDC_USETABS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,206,140,10
- CONTROL "Enable IEView",IDC_ENABLEIEVIEW,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,219,140,10
- CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,232,140,10
- LTEXT "Limit log history to (events):",IDC_STATIC,153,234,110,8
- EDITTEXT IDC_LOGLIMIT,263,232,40,14,ES_RIGHT | ES_NUMBER
- CONTROL "",IDC_LOGLIMITSPIN,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
- UDS_NOTHOUSANDS | UDS_HOTTRACK,390,218,11,14
-END
-
-IDD_CHATMANAGER DIALOGEX 0, 0, 473, 234
-STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
- WS_THICKFRAME
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Chats"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_BUTTONS |
- TCS_FIXEDWIDTH | 0x8,214,7,252,20
- PUSHBUTTON "Close",IDCLOSE,416,215,50,14
- CONTROL "Tree1",IDC_GROUP,"SysTreeView32",TVS_HASBUTTONS |
- TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP |
- TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS,5,20,203,209,
- WS_EX_STATICEDGE
- LTEXT "Groups",IDC_STATIC,7,9,24,8
-END
-
-IDD_GROUPCHAT_CONTAINER DIALOGEX 0, 0, 300, 200
-STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
- WS_THICKFRAME
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Tlen Group Chat"
-FONT 8, "MS Shell Dlg"
-BEGIN
- CONTROL "",IDC_TABS,"SysTabControl32", WS_CLIPSIBLINGS | TCS_MULTILINE | TCS_FOCUSNEVER | 0x8,0,0,300,200
-END
-
-IDD_GROUPCHAT_LOG DIALOGEX 0, 0, 294, 178
-STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
-/*
-STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
- WS_THICKFRAME
- */
-//EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "",IDC_VSPLIT,"Static",SS_ENHMETAFILE,237,20,3,117
- CONTROL "",IDC_HSPLIT,"Static",SS_ENHMETAFILE,156,285,2,0
- CONTROL "",IDC_LOG,"RichEdit20A",WS_VSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | 0x844,
- 3,21,233,117,WS_EX_STATICEDGE
- CONTROL "",IDC_TREELIST,"SysTreeView32",TVS_DISABLEDRAGDROP |
- TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT,5,
- 20,203,209,WS_EX_STATICEDGE
- EDITTEXT IDC_EDIT,3,158,285,13,ES_MULTILINE | ES_AUTOVSCROLL |
- NOT WS_BORDER | WS_VSCROLL | ES_WANTRETURN,WS_EX_STATICEDGE
- CONTROL "Topic",IDC_TOPIC_BUTTON,"MButtonClass",WS_DISABLED |
- WS_TABSTOP,3,3,34,12,0x18000000L
- CONTROL "",IDC_BOLD,"MButtonClass",WS_TABSTOP,3,140,16,16,
- 0x18000000L
- CONTROL "",IDC_ITALIC,"MButtonClass",WS_TABSTOP,21,140,16,16,
- 0x18000000L
- CONTROL "",IDC_UNDERLINE,"MButtonClass",WS_TABSTOP,39,140,16,16,
- 0x18000000L
- CONTROL "",IDC_COLOR,"ColourPicker",WS_TABSTOP,57,140,16,16
- COMBOBOX IDC_FONTSIZE,154,142,27,80,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "",IDC_SMILEYBTN,"MButtonClass", WS_TABSTOP,185,140,16,16,
- 0x18000000L
- CONTROL "Invite",IDC_INVITE,"MButtonClass",WS_TABSTOP,259,141,16,
- 16,0x18000000L
- EDITTEXT IDC_TOPIC,70,19,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT
- WS_BORDER
- CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,208,140,16,16,
- 0x18000000L
- COMBOBOX IDC_FONT,77,142,74,90,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- PUSHBUTTON "Close",IDCANCEL,0,0,20,20,NOT WS_VISIBLE
- //,NOT WS_VISIBLE
-END
-
-IDD_HELPER_JOIN DIALOGEX 0, 0, 186, 79
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_POPUP | WS_VISIBLE | WS_CAPTION
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Join Tlen Multi-User Conference Room"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Room:",IDC_ROOM_LABEL,10,13,43,8
- EDITTEXT IDC_ROOM,54,12,119,12,ES_AUTOHSCROLL
- LTEXT "Nickname:",IDC_NICK_LABEL,10,30,40,8
- EDITTEXT IDC_NICK,54,29,119,12,ES_AUTOHSCROLL
- DEFPUSHBUTTON "&Join",IDOK,75,59,50,14
- PUSHBUTTON "Cancel",IDCANCEL,129,59,50,14
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,50,172,4
-END
-
-IDD_HELPER_INVITE DIALOG DISCARDABLE 0, 0, 186, 79
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Invite a User"
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "User:",IDC_STATIC,10,13,43,8
- COMBOBOX IDC_USER,54,10,119,120,CBS_DROPDOWN | CBS_AUTOHSCROLL |
- CBS_SORT | WS_VSCROLL | WS_TABSTOP
- LTEXT "Reason:",IDC_STATIC,10,30,40,8
- EDITTEXT IDC_REASON,54,29,119,12,ES_AUTOHSCROLL
- DEFPUSHBUTTON "&Invite",IDC_INVITE,75,59,50,14
- PUSHBUTTON "Cancel",IDCANCEL,129,59,50,14
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,50,172,4
-END
-
-IDD_HELPER_INVITE_ACCEPT DIALOG DISCARDABLE 0, 0, 232, 112
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Multi-User Conference Invitation"
-FONT 8, "MS Shell Dlg"
-BEGIN
- DEFPUSHBUTTON "&Accept",IDC_ACCEPT,124,93,50,14
- PUSHBUTTON "Cancel",IDCANCEL,178,93,50,14
- LTEXT "From:",IDC_STATIC,33,24,63,8
- LTEXT "Room:",IDC_STATIC,33,38,63,8
- LTEXT "Reason:",IDC_STATIC,33,52,63,8
- LTEXT "Nickname:",IDC_STATIC,33,76,62,8
- LTEXT "The following invitation to join a multi-user conference is received.",
- IDC_STATIC,3,4,225,8
- EDITTEXT IDC_FROM,99,22,105,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_ROOM,99,36,105,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_REASON,99,50,105,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_NICK,99,74,105,12,ES_AUTOHSCROLL
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,3,65,225,4
-END
-
-IDD_HELPER_TOPIC DIALOGEX 0, 0, 223, 44
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Change Chat Room Topic"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "New topic:",IDC_STATIC,10,8,43,8
- EDITTEXT IDC_TOPIC,54,7,160,12,ES_AUTOHSCROLL
- DEFPUSHBUTTON "OK",IDOK,108,26,50,14
- PUSHBUTTON "Cancel",IDCANCEL,164,26,50,14
-END
-
-IDD_USER_ADMIN DIALOG DISCARDABLE 0, 0, 300, 180
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Chat Room Administration"
-FONT 8, "MS Sans Serif"
-BEGIN
- CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_BUTTONS |
- TCS_FIXEDWIDTH | 0x8,0,5,220,20
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,20,300,4
- PUSHBUTTON "Close",IDCANCEL,230,162,60,16
-
-END
-
-IDD_USER_KICK DIALOGEX 0, 30, 300, 130
-STYLE WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Nickname:",IDC_STATIC,30,6,70,10
- EDITTEXT IDC_NICK,100,6,100,12,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Ban for:",IDC_STATIC,30,35,70,10
- COMBOBOX IDC_KICK_OPTIONS,100,35,90,150,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- LTEXT "Reason:",IDC_STATIC,30,51,70,10
- EDITTEXT IDC_REASON,100,51,100,12,ES_AUTOHSCROLL | WS_TABSTOP
- CONTROL "Kick && Ban",IDOK,"MButtonClass",WS_TABSTOP,210,65,60,16
-
- LTEXT "User role:",IDC_STATIC,30,90,70,10
- COMBOBOX IDC_ROLE_OPTIONS,100,90,90,60,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "Set Role",IDC_SET_ROLE,"MButtonClass",WS_TABSTOP,210,104,60,16
-
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,128,300,4
-END
-
-IDD_USER_ROLE DIALOGEX 0, 30, 300, 130
-STYLE WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Nickname:",IDC_STATIC,30,25,70,10
- EDITTEXT IDC_NICK,100,25,100,12,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "User role:",IDC_STATIC,30,41,70,10
- COMBOBOX IDC_OPTIONS,100,41,90,60,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "Set Role",IDOK,"MButtonClass",WS_TABSTOP,120,90,60,16
- CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,128,300,4
-END
-
-IDD_USER_BROWSER DIALOGEX 0, 30, 300, 130
-STYLE WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- COMBOBOX IDC_OPTIONS,50,0,90,60,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP
- CONTROL "Show",IDC_SHOW,"MButtonClass",WS_TABSTOP,160,0,50,14
- CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
- LVS_OWNERDRAWFIXED | WS_TABSTOP,0,20,299,110,
- WS_EX_CLIENTEDGE
-END
-
-IDD_OPT_POPUPS DIALOG DISCARDABLE 0, 0, 317, 141
-STYLE WS_CHILD
-FONT 8, "MS Sans Serif"
-BEGIN
- GROUPBOX "Delay",IDC_STATIC,160,46,137,55
- CONTROL "&From PopUp plugin",IDC_DELAY_POPUP,"Button",
- BS_AUTORADIOBUTTON,167,60,125,10
- CONTROL "&Custom",IDC_DELAY_CUSTOM,"Button",BS_AUTORADIOBUTTON,
- 167,73,98,10
- CONTROL "P&ermanent",IDC_DELAY_PERMANENT,"Button",
- BS_AUTORADIOBUTTON,167,87,123,10
- EDITTEXT IDC_DELAY,270,71,21,14,ES_AUTOHSCROLL | ES_NUMBER
- GROUPBOX "Colours",IDC_STATIC,15,46,137,55
- LTEXT "Background",IDC_STATIC,53,63,95,8
- LTEXT "Text",IDC_STATIC,53,82,96,8
- CONTROL "",IDC_COLORBKG,"ColourPicker",WS_TABSTOP,23,61,24,12
- GROUPBOX "General Options",IDC_STATIC,15,15,282,26
- CONTROL "",IDC_COLORTXT,"ColourPicker",WS_TABSTOP,23,79,24,12
- PUSHBUTTON "Preview",IDC_PREVIEW,132,112,50,14
- CONTROL "Enable incoming mail notification",IDC_ENABLEPOPUP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,26,130,10
-END
-
-IDD_TAB_CHATROOMS DIALOGEX 216, 28, 247, 180
-STYLE WS_CHILD
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
- CONTROL "List1",IDC_ROOM,"SysListView32",LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
- LVS_OWNERDRAWFIXED | WS_TABSTOP,0,26,247,154,
- WS_EX_CLIENTEDGE
- CONTROL "prev",IDC_PREV,"MButtonClass",WS_TABSTOP,5,6,20,16
- CONTROL "next",IDC_NEXT,"MButtonClass",WS_TABSTOP,35,6,20,16
- CONTROL "find",IDC_SEARCH,"MButtonClass",WS_TABSTOP,65,6,20,16
-END
-
-IDD_TAB_MYROOMS DIALOGEX 216, 28, 244, 180
-STYLE WS_CHILD
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
- CONTROL "Create",IDC_REGISTER,"MButtonClass",WS_TABSTOP,186,62,
- 50,14,0x18000000L
- EDITTEXT IDC_NAME,84,20,149,14,ES_AUTOHSCROLL
- LTEXT "Room name:",IDC_STATIC,14,23,60,8
- CONTROL "Permanent",IDC_CHECK_PERMANENT,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,111,40,89,10
- CONTROL "Nicknames",IDC_CHECK_NICKNAMES,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,52,89,10
- CONTROL "Public",IDC_CHECK_PUBLIC,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,13,40,89,10
- CONTROL "Members only",IDC_CHECK_MEMBERS,"Button",
- BS_AUTOCHECKBOX,111,52,89,10
- LTEXT "Chat rooms:",IDC_STATIC,2,90,100,8
- /*
- CONTROL "Tree1",IDC_LIST,"SysTreeView32",TVS_DISABLEDRAGDROP |
- TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_FULLROWSELECT |
- TVS_NONEVENHEIGHT,0,100,177,80,WS_EX_STATICEDGE
- */
- CONTROL "Refresh",IDC_REFRESH,"MButtonClass",WS_TABSTOP,186,160,
- 50,14,0x18000000L
- GROUPBOX "New chat room",IDC_STATIC,0,5,244,78
- CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
- LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED | WS_TABSTOP,0,100,177,80,
- WS_EX_CLIENTEDGE
-END
-
-IDD_TAB_MYNICKNAMES DIALOG DISCARDABLE 216, 28, 244, 180
-STYLE WS_CHILD
-FONT 8, "MS Sans Serif"
-BEGIN
- CONTROL "Register",IDC_REGISTER,"MButtonClass",WS_TABSTOP,186,62,
- 50,14,0x18000000L
- EDITTEXT IDC_NICK,84,20,149,14,ES_AUTOHSCROLL
- LTEXT "Nickname:",IDC_STATIC,14,23,60,8
- LTEXT "Nicknames:",IDC_STATIC,2,90,100,8
- CONTROL "Remove",IDC_REMOVE,"MButtonClass",WS_TABSTOP,186,110,50,
- 14,0x18000000L
- CONTROL "Refresh",IDC_REFRESH,"MButtonClass",WS_TABSTOP,186,160,
- 50,14,0x18000000L
- GROUPBOX "New nickname",IDC_STATIC,0,5,244,78
- CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
- LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED | WS_TABSTOP,0,100,177,80,
- WS_EX_CLIENTEDGE
- /*
- CONTROL "Tree1",IDC_LIST,"SysTreeView32",TVS_DISABLEDRAGDROP |
- TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_FULLROWSELECT |
- TVS_NONEVENHEIGHT,0,100,177,80,WS_EX_STATICEDGE
- */
-END
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MUCC_FILEVERSION_STRING
- PRODUCTVERSION MUCC_FILEVERSION_STRING
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "041504e3"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "http://mtlen.berlios.de\0"
- VALUE "FileDescription", "Group Chats GUI Plugin for Miranda IM\0"
- VALUE "FileVersion", MUCC_VERSION_STRING
- VALUE "InternalName", "tlen_chat\0"
- VALUE "LegalCopyright", "Copyright (c) 2004-2006 Piotr Piastucki\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "tlen_chat.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "Tlen Chat Plugin\0"
- VALUE "ProductVersion", MUCC_VERSION_STRING
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x415, 1251
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_CHAT ICON DISCARDABLE "icos\\chat.ico"
-IDI_BLANK ICON DISCARDABLE "icos\\blank.ico"
-IDI_ITALIC ICON DISCARDABLE "icos\\italic.ico"
-IDI_BOLD ICON DISCARDABLE "icos\\bold.ico"
-IDI_UNDERLINE ICON DISCARDABLE "icos\\underline.ico"
-IDI_OPTIONS ICON DISCARDABLE "icos\\options.ico"
-IDI_OWNER ICON DISCARDABLE "icos\\owner.ico"
-IDI_GLOBALOWNER ICON DISCARDABLE "icos\\glowner.ico"
-IDI_ADMIN ICON DISCARDABLE "icos\\admin.ico"
-IDI_REGISTERED ICON DISCARDABLE "icos\\registered.ico"
-IDI_R_MODERATED ICON DISCARDABLE "icos\\r_mod.ico"
-IDI_R_MEMBERS ICON DISCARDABLE "icos\\r_memb.ico"
-IDI_R_ANONYMOUS ICON DISCARDABLE "icos\\r_anon.ico"
-IDI_SEARCH ICON DISCARDABLE "icos\\search.ico"
-IDI_PREV ICON DISCARDABLE "icos\\prev.ico"
-IDI_NEXT ICON DISCARDABLE "icos\\next.ico"
-IDI_INVITE ICON DISCARDABLE "icos\\invite.ico"
-IDI_ADMINISTRATION ICON DISCARDABLE "icos\\administration.ico"
-IDI_SMILEY ICON DISCARDABLE "icos\\smile.ico"
-IDI_MESSAGE ICON DISCARDABLE "icos\\message.ico"
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/protocols/Tlen/tlen_czaty/mucc.vcxproj b/protocols/Tlen/tlen_czaty/mucc.vcxproj
deleted file mode 100644
index c2fe6e7b70..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc.vcxproj
+++ /dev/null
@@ -1,1245 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug Ansi|Win32">
- <Configuration>Debug Ansi</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Ansi|x64">
- <Configuration>Debug Ansi</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Unicode|Win32">
- <Configuration>Debug Unicode</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug Unicode|x64">
- <Configuration>Debug Unicode</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug x64|Win32">
- <Configuration>Debug x64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug x64|x64">
- <Configuration>Debug x64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Ansi|Win32">
- <Configuration>Release Ansi</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Ansi|x64">
- <Configuration>Release Ansi</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Unicode|Win32">
- <Configuration>Release Unicode</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release Unicode|x64">
- <Configuration>Release Unicode</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release x64|Win32">
- <Configuration>Release x64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release x64|x64">
- <Configuration>Release x64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{BD1D155A-7A47-4414-80A3-CCCC3C5C583B}</ProjectGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>Windows7.1SDK</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">$(Configuration)\Obj\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">true</IgnoreImportLibrary>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">$(Configuration)\Obj\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">$(Configuration)\Obj\</IntDir>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">true</IgnoreImportLibrary>
- <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">true</IgnoreImportLibrary>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">true</LinkIncremental>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">tlen_czaty</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">tlen_czaty</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;_X64;X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;_X64;X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">
- <Midl>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Release/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <BaseAddress>0x32600000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;X64;_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;X64;_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TargetEnvironment>Win32</TargetEnvironment>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">
- <Midl>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <TypeLibraryName>.\Debug/mucc.tlb</TypeLibraryName>
- <HeaderFileName>
- </HeaderFileName>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>
- </AssemblerListingLocation>
- <ObjectFileName>$(IntDir)</ObjectFileName>
- <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <Culture>0x0415</Culture>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(TargetDir)tlen_czaty.pdb</ProgramDatabaseFile>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- </Link>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
- </Bscmake>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="AdminWindow.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatContainer.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatEvent.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatGroup.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatRoom.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatUser.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ChatWindow.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="FontList.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="HelperDialog.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="ManagerWindow.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="mucc.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="mucc_services.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="Options.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="Utils.cpp">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="AdminWindow.h" />
- <ClInclude Include="ChatContainer.h" />
- <ClInclude Include="ChatEvent.h" />
- <ClInclude Include="ChatGroup.h" />
- <ClInclude Include="ChatRoom.h" />
- <ClInclude Include="ChatUser.h" />
- <ClInclude Include="ChatWindow.h" />
- <ClInclude Include="FontList.h" />
- <ClInclude Include="HelperDialog.h" />
- <ClInclude Include="ManagerWindow.h" />
- <ClInclude Include="mucc.h" />
- <ClInclude Include="mucc_services.h" />
- <ClInclude Include="Options.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="Utils.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="icos\admin.ico" />
- <None Include="icos\administration.ico" />
- <None Include="icos\blank.ico" />
- <None Include="icos\bold.ico" />
- <None Include="icos\chat.ico" />
- <None Include="icos\glowner.ico" />
- <None Include="icos\invite.ico" />
- <None Include="icos\italic.ico" />
- <None Include="icos\message.ico" />
- <None Include="icos\moderator.ico" />
- <None Include="icos\next.ico" />
- <None Include="icos\options.ico" />
- <None Include="icos\owner.ico" />
- <None Include="icos\prev.ico" />
- <None Include="icos\r_anon.ico" />
- <None Include="icos\r_memb.ico" />
- <None Include="icos\r_mod.ico" />
- <None Include="icos\registered.ico" />
- <None Include="icos\search.ico" />
- <None Include="icos\smile.ico" />
- <None Include="icos\tlensmall.ico" />
- <None Include="icos\underline.ico" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="mucc.rc">
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release x64|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Ansi|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/protocols/Tlen/tlen_czaty/mucc_services.cpp b/protocols/Tlen/tlen_czaty/mucc_services.cpp
deleted file mode 100644
index 0d4571a633..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc_services.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#include "mucc_services.h"
-#include "Utils.h"
-#include "HelperDialog.h"
-
-int MUCCQueryChatGroups(MUCCQUERYRESULT *queryResult)
-{
- ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule);
- if (managerWnd!=NULL) {
- managerWnd->queryResultGroups(queryResult);
- }
- return 1;
-}
-
-int MUCCQueryChatRooms(MUCCQUERYRESULT *queryResult)
-{
- ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule);
- if (managerWnd!=NULL) {
- managerWnd->queryResultRooms(queryResult);
- }
- return 1;
-}
-
-int MUCCQueryUserRooms(MUCCQUERYRESULT *queryResult)
-{
- ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule);
- if (managerWnd!=NULL) {
- managerWnd->queryResultUserRooms(queryResult);
- }
- return 1;
-}
-
-int MUCCQueryUserNicks(MUCCQUERYRESULT *queryResult)
-{
- ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule);
- if (managerWnd!=NULL) {
- managerWnd->queryResultUserNick(queryResult);
- }
- return 1;
-}
-
-INT_PTR MUCCQueryResult(WPARAM wParam, LPARAM lParam)
-{
- MUCCQUERYRESULT *queryResult=(MUCCQUERYRESULT *)lParam;
- ChatWindow * chatWindow = NULL;
- switch (queryResult->iType) {
- case MUCC_EVENT_QUERY_GROUPS:
- MUCCQueryChatGroups(queryResult);
- break;
- case MUCC_EVENT_QUERY_ROOMS:
- MUCCQueryChatRooms(queryResult);
- break;
- case MUCC_EVENT_QUERY_USER_ROOMS:
- MUCCQueryUserRooms(queryResult);
- break;
- case MUCC_EVENT_QUERY_USER_NICKS:
- MUCCQueryUserNicks(queryResult);
- break;
- case MUCC_EVENT_QUERY_CONTACTS:
- case MUCC_EVENT_QUERY_USERS:
- chatWindow=ChatWindow::getWindow(queryResult->pszModule, queryResult->pszParent);
- if (chatWindow!=NULL) {
- SendMessage(chatWindow->getHWND(), DM_CHAT_QUERY, (WPARAM) 0, (LPARAM) queryResult);
- }
- break;
- }
- return 0;
-}
-
-INT_PTR MUCCNewWindow(WPARAM wParam, LPARAM lParam)
-{
- MUCCWINDOW *mucWindow = (MUCCWINDOW *) lParam;
- if (mucWindow->iType == MUCC_WINDOW_CHATROOM) {
- ChatWindow *chat = ChatWindow::getWindow(mucWindow->pszModule, mucWindow->pszID);
- if (chat == NULL) {
- chat = new ChatWindow(mucWindow);
- }
- } else if (mucWindow->iType == MUCC_WINDOW_CHATLIST) {
- ManagerWindow *manager = ManagerWindow::getWindow(mucWindow->pszModule);
- if (manager == NULL) {
-
- }
- //Utils::log("setting name: %s", mucWindow->pszModuleName);
- manager->setModuleName(mucWindow->pszModuleName);
- manager->start();
- }
- return 0;
-}
-
-INT_PTR MUCCEvent(WPARAM wParam, LPARAM lParam)
-{
- MUCCEVENT* mucEvent = (MUCCEVENT *) lParam;
- ChatWindow * chatWindow = NULL;
- switch (mucEvent->iType) {
- case MUCC_EVENT_STATUS:
- case MUCC_EVENT_MESSAGE:
- case MUCC_EVENT_ROOM_INFO:
- case MUCC_EVENT_LEAVE:
- case MUCC_EVENT_TOPIC:
- chatWindow = ChatWindow::getWindow(mucEvent->pszModule, mucEvent->pszID);
- if (chatWindow!=NULL) {
- SendMessage(chatWindow->getHWND(), DM_CHAT_EVENT, (WPARAM) 0, (LPARAM) mucEvent);
- }
- break;
- case MUCC_EVENT_ERROR:
- chatWindow = ChatWindow::getWindow(mucEvent->pszModule, mucEvent->pszID);
- if (chatWindow!=NULL) {
- SendMessage(chatWindow->getHWND(), DM_CHAT_EVENT, (WPARAM) 0, (LPARAM) mucEvent);
- } else {
- HelperDialog::errorDlg(mucEvent);
- }
- break;
- case MUCC_EVENT_INVITATION:
- HelperDialog::acceptDlg(mucEvent);
- break;
- case MUCC_EVENT_JOIN:
- HelperDialog::joinDlg(mucEvent);
- break;
- }
- return 0;
-}
diff --git a/protocols/Tlen/tlen_czaty/mucc_services.h b/protocols/Tlen/tlen_czaty/mucc_services.h
deleted file mode 100644
index f1db38274b..0000000000
--- a/protocols/Tlen/tlen_czaty/mucc_services.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#ifndef MUCCSERVICES_INCLUDED
-#define MUCCSERVICES_INCLUDED
-
-#include "mucc.h"
-#include "ManagerWindow.h"
-#include "ChatWindow.h"
-
-extern int MUCCServicesInit(WPARAM wParam, LPARAM lParam);
-
-extern INT_PTR MUCCQueryResult(WPARAM wParam, LPARAM lParam) ;
-extern INT_PTR MUCCNewWindow(WPARAM wParam, LPARAM lParam) ;
-extern INT_PTR MUCCEvent(WPARAM wParam, LPARAM lParam) ;
-
-#endif
-
diff --git a/protocols/Tlen/tlen_czaty/resource.h b/protocols/Tlen/tlen_czaty/resource.h
deleted file mode 100644
index c4d2f1945c..0000000000
--- a/protocols/Tlen/tlen_czaty/resource.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
-
-MUCC Group Chat GUI Plugin for Miranda IM
-Copyright (C) 2004 Piotr Piastucki
-
-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.
-
-*/
-#define IDI_CHAT 100
-#define IDI_ITALIC 101
-#define IDI_BOLD 102
-#define IDI_UNDERLINE 103
-#define IDI_OPTIONS 104
-#define IDI_OWNER 105
-#define IDI_ADMIN 106
-#define IDI_REGISTERED 107
-#define IDI_R_MODERATED 108
-#define IDI_R_MEMBERS 109
-#define IDI_R_ANONYMOUS 110
-#define IDI_SEARCH 111
-#define IDI_PREV 112
-#define IDI_NEXT 113
-#define IDI_BLANK 114
-#define IDI_INVITE 115
-#define IDI_ADMINISTRATION 116
-#define IDI_GLOBALOWNER 117
-#define IDI_SMILEY 118
-#define IDI_MESSAGE 119
-
-#define IDD_CHATMANAGER 150
-#define IDD_GROUPCHAT_LOG 151
-#define IDD_HELPER_JOIN 152
-#define IDD_HELPER_INPUT 153
-#define IDD_HELPER_INVITE 154
-#define IDD_HELPER_INVITE_ACCEPT 155
-#define IDD_HELPER_TOPIC 156
-#define IDD_OPTIONS 157
-#define IDD_OPT_POPUPS 158
-#define IDD_TAB_CHATROOMS 159
-#define IDD_TAB_MYROOMS 160
-#define IDD_TAB_MYNICKNAMES 161
-#define IDD_USER_ADMIN 162
-#define IDD_USER_KICK 163
-#define IDD_USER_ROLE 164
-#define IDD_USER_BROWSER 165
-#define IDD_GROUPCHAT_CONTAINER 166
-
-#define IDR_CHATOPTIONS 200
-#define IDR_CONTEXT 201
-
-#define IDC_FONTLIST 1000
-#define IDC_COLORINPUT 1001
-#define IDC_COLORBKG 1002
-#define IDC_COLORLIST 1003
-#define IDC_COLORTXT 1004
-#define IDC_CHOOSEFONT 1005
-#define IDC_FONTSGB 1006
-#define IDC_OPTIONSGB 1007
-#define IDC_LOGLIMITSPIN 1008
-#define IDC_LOGLIMIT 1009
-#define IDC_SENDONENTER 1010
-#define IDC_USETABS 1011
-#define IDC_ENABLEIEVIEW 1012
-#define IDC_REGISTER 1020
-#define IDC_NAME 1021
-#define IDC_FRAME 1037
-#define IDC_SIMPLE 1041
-#define IDC_PASSWORD 1050
-#define IDC_JID 1051
-#define IDC_COUNTRY 1060
-#define IDC_NICKNAME 1062
-#define IDC_MSG 1084
-#define IDC_TITLE 1089
-#define IDC_DESC 1090
-#define IDC_DELETE 1092
-#define IDC_LOAD 1093
-#define IDC_JOIN 1123
-#define IDC_ROOM 1124
-#define IDC_ROOM_LABEL 1125
-#define IDC_BROWSE 1126
-#define IDC_VSCROLL 1128
-#define IDC_NICK 1129
-#define IDC_NICK_LABEL 1130
-#define IDC_EDIT 1131
-#define IDC_TREELIST 1132
-#define IDC_LIST 1133
-#define IDC_HSPLIT 1134
-#define IDC_LOG 1136
-#define IDC_VSPLIT 1137
-#define IDC_SET 1140
-#define IDC_TABS 1141
-#define IDC_TOPIC 1141
-#define IDC_TOPIC_BUTTON 1142
-#define IDC_FONT 1143
-#define IDC_ENTER 1144
-#define IDC_CTRLENTER 1145
-#define IDC_FLASH 1148
-#define IDC_TIME 1156
-#define IDC_DATE 1157
-#define IDC_REASON 1171
-#define IDC_USER 1172
-#define IDC_INVITE 1173
-#define IDC_ACCEPT 1174
-#define IDC_FROM 1175
-#define IDC_DELAY 1180
-#define IDC_PREVIEW 1183
-#define IDC_ENABLEPOPUP 1184
-#define IDC_DELAY_PERMANENT 1185
-#define IDC_DELAY_CUSTOM 1186
-#define IDC_DELAY_POPUP 1187
-#define IDC_GROUP 1203
-#define IDC_BOLD 1204
-#define IDC_SMILEY 1205
-#define IDC_UNDERLINE 1205
-#define IDC_ITALIC 1206
-#define IDC_COLOR 1207
-#define IDC_OPTIONS 1208
-#define IDC_SMILEYBTN 1209
-#define IDC_CHECK_PERMANENT 1210
-#define IDC_CHECK_PUBLIC 1211
-#define IDC_CHECK_NICKNAMES 1212
-#define IDC_CHECK_MEMBERS 1213
-#define IDC_NEXT 1214
-#define IDC_PREV 1215
-#define IDC_FONTSIZE 1215
-#define IDC_SEARCH 1216
-#define IDC_REFRESH 1216
-#define IDC_REMOVE 1217
-#define IDC_KICK_OPTIONS 1218
-#define IDC_ROLE_OPTIONS 1219
-#define IDC_KICK 1220
-#define IDC_SET_ROLE 1221
-#define IDC_UPDATE 1313
-#define IDC_STATUS 1414
-#define IDC_PLAN 1415
-#define IDC_SHOW 1416
-
-#define IDC_PERSONALGROUP 1434
-#define IDC_EXTRAGROUP 1436
-
-#define ID_OPTIONMENU_SHOWNICKNAMES 40001
-#define ID_OPTIONMENU_MSGINNEWLINE 40002
-#define ID_OPTIONMENU_SHOWTIMESTAMP 40011
-#define ID_OPTIONMENU_SHOWDATE 40012
-#define ID_OPTIONMENU_SHOWSECONDS 40013
-#define ID_OPTIONMENU_USELONGDATE 40014
-#define ID_OPTIONMENU_FORMATFONT 40021
-#define ID_OPTIONMENU_FORMATSIZE 40022
-#define ID_OPTIONMENU_FORMATCOLOR 40023
-#define ID_OPTIONMENU_FORMATSTYLE 40024
-#define ID_OPTIONMENU_LOGMESSAGES 40031
-#define ID_OPTIONMENU_LOGJOINED 40032
-#define ID_OPTIONMENU_LOGLEFT 40033
-#define ID_OPTIONMENU_LOGTOPIC 40034
-#define ID_OPTIONMENU_FLASHMESSAGES 40035
-#define ID_OPTIONMENU_FLASHJOINED 40036
-#define ID_OPTIONMENU_FLASHLEFT 40037
-#define ID_OPTIONMENU_FLASHTOPIC 40038
-#define ID_OPTIONMENU_SAVEDEFAULT 40040
-#define ID_USERMENU_MESSAGE 40050
-#define ID_USERMENU_KICK_POPUP 40051
-#define ID_USERMENU_KICK_NO_BAN 40052
-#define ID_USERMENU_KICK_BAN_1_MIN 40053
-#define ID_USERMENU_KICK_BAN_5_MIN 40054
-#define ID_USERMENU_KICK_BAN_15_MIN 40055
-#define ID_USERMENU_KICK_BAN_30_MIN 40056
-#define ID_USERMENU_KICK_BAN_1_H 40057
-#define ID_USERMENU_KICK_BAN_6_H 40058
-#define ID_USERMENU_KICK_BAN_1_D 40059
-#define ID_USERMENU_KICK_BAN_3_D 40060
-#define ID_USERMENU_KICK_BAN_1_W 40061
-#define ID_USERMENU_KICK_BAN_2_W 40062
-#define ID_USERMENU_KICK_BAN_4_W 40063
-#define ID_USERMENU_RIGHTS_NO 40065
-#define ID_USERMENU_RIGHTS_MEMBER 40066
-#define ID_USERMENU_RIGHTS_ADMIN 40067
-#define ID_USERMENU_ADMINISTRATION 40070
-#define ID_USERMENU_UNBAN 40071
-#define ID_ADMINMENU_DESTROY 40080
-#define ID_ADMINMENU_ADMIN 40081
-#define ID_ADMINMENU_BROWSE 40082
-#define ID_ADMINMENU_SAVELOG 40083
-
-#define IDM_CUT 40000
-#define IDM_COPY 40001
-#define IDM_PASTE 40002
-#define IDM_UNDO 40003
-#define IDM_DELETE 40004
-#define IDM_REDO 40005
-#define IDM_COPYALL 40011
-#define IDM_SELECTALL 40012
-#define IDM_CLEAR 40013
-#define IDM_OPENNEW 40014
-#define IDM_OPENEXISTING 40015
-#define IDM_COPYLINK 40016
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 205
-#define _APS_NEXT_COMMAND_VALUE 40090
-#define _APS_NEXT_CONTROL_VALUE 1217
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/Tlen/tlen_file.c b/protocols/Tlen/tlen_file.c
deleted file mode 100644
index 9926a09aa6..0000000000
--- a/protocols/Tlen/tlen_file.c
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "jabber_list.h"
-#include "tlen_p2p_old.h"
-
-extern int TlenFileCancel(PROTO_INTERFACE *ptr, HANDLE hContact, HANDLE hTransfer);
-
-
-static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft)
-{
- int i;
- char *p;
- TLEN_FILE_PACKET *rpacket, *packet;
-
- rpacket = NULL;
- if (ft->state == FT_CONNECTING) {
- rpacket = TlenP2PPacketReceive(ft->s);
- if (rpacket != NULL) {
- p = rpacket->packet;
- if (rpacket->type == TLEN_FILE_PACKET_FILE_LIST) { // list of files (length & name)
- ft->fileCount = (int)(*((DWORD*)p));
- ft->files = (char **) mir_alloc(sizeof(char *) * ft->fileCount);
- ft->filesSize = (long *) mir_alloc(sizeof(long) * ft->fileCount);
- ft->currentFile = 0;
- ft->allFileTotalSize = 0;
- ft->allFileReceivedBytes = 0;
- p += sizeof(DWORD);
- for (i=0;i<ft->fileCount;i++) {
- ft->filesSize[i] = (long)(*((DWORD*)p));
- ft->allFileTotalSize += ft->filesSize[i];
- p += sizeof(DWORD);
- ft->files[i] = (char *)mir_alloc(256);
- memcpy(ft->files[i], p, 256);
- p += 256;
- }
- if ((packet=TlenP2PPacketCreate(3*sizeof(DWORD))) == NULL) {
- ft->state = FT_ERROR;
- }
- else {
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_LIST_ACK);
- TlenP2PPacketSend(ft->s, packet);
- TlenP2PPacketFree(packet);
- ft->state = FT_INITIALIZING;
- JabberLog(ft->proto, "Change to FT_INITIALIZING");
- }
- }
- TlenP2PPacketFree(rpacket);
- }
- else {
- ft->state = FT_ERROR;
- }
- }
- else if (ft->state == FT_INITIALIZING) {
- char *fullFileName;
- if ((packet=TlenP2PPacketCreate(3*sizeof(DWORD))) != NULL) {
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_REQUEST); // file request
- TlenP2PPacketPackDword(packet, ft->currentFile);
- TlenP2PPacketPackDword(packet, 0);
- TlenP2PPacketPackDword(packet, 0);
- TlenP2PPacketSend(ft->s, packet);
- TlenP2PPacketFree(packet);
-
- fullFileName = (char *) mir_alloc(strlen(ft->szSavePath) + strlen(ft->files[ft->currentFile]) + 2);
- strcpy(fullFileName, ft->szSavePath);
- if (fullFileName[strlen(fullFileName)-1] != '\\')
- strcat(fullFileName, "\\");
- strcat(fullFileName, ft->files[ft->currentFile]);
- ft->fileId = _open(fullFileName, _O_BINARY|_O_WRONLY|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE);
- ft->fileReceivedBytes = 0;
- ft->fileTotalSize = ft->filesSize[ft->currentFile];
- JabberLog(ft->proto, "Saving to [%s] [%d]", fullFileName, ft->filesSize[ft->currentFile]);
- mir_free(fullFileName);
- ft->state = FT_RECEIVING;
- JabberLog(ft->proto, "Change to FT_RECEIVING");
- }
- else {
- ft->state = FT_ERROR;
- }
- }
- else if (ft->state == FT_RECEIVING) {
- PROTOFILETRANSFERSTATUS pfts;
- memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
- pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
- pfts.hContact = ft->hContact;
- pfts.sending = FALSE;
- pfts.files = ft->files;
- pfts.totalFiles = ft->fileCount;
- pfts.currentFileNumber = ft->currentFile;
- pfts.totalBytes = ft->allFileTotalSize;
- pfts.workingDir = NULL;
- pfts.currentFile = ft->files[ft->currentFile];
- pfts.currentFileSize = ft->filesSize[ft->currentFile];
- pfts.currentFileTime = 0;
- JabberLog(ft->proto, "Receiving data...");
- while (ft->state == FT_RECEIVING) {
- rpacket = TlenP2PPacketReceive(ft->s);
- if (rpacket != NULL) {
- p = rpacket->packet;
- if (rpacket->type == TLEN_FILE_PACKET_FILE_DATA) { // file data
- int writeSize;
- writeSize = rpacket->len - 2 * sizeof(DWORD) ; // skip file offset
- if (_write(ft->fileId, p + 2 * sizeof(DWORD), writeSize) != writeSize) {
- ft->state = FT_ERROR;
- }
- else {
- ft->fileReceivedBytes += writeSize;
- ft->allFileReceivedBytes += writeSize;
- pfts.totalProgress = ft->allFileReceivedBytes;
- pfts.currentFileProgress = ft->fileReceivedBytes;
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM) &pfts);
- }
- }
- else if (rpacket->type == TLEN_FILE_PACKET_END_OF_FILE) { // end of file
- _close(ft->fileId);
- JabberLog(ft->proto, "Finishing this file...");
- if (ft->currentFile >= ft->fileCount-1) {
- ft->state = FT_DONE;
- }
- else {
- ft->currentFile++;
- ft->state = FT_INITIALIZING;
- JabberLog(ft->proto, "File received, advancing to the next file...");
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
- }
- }
- TlenP2PPacketFree(rpacket);
- }
- else {
- ft->state = FT_ERROR;
- }
- }
- }
-}
-
-static void TlenFileReceivingConnection(JABBER_SOCKET hConnection, DWORD dwRemoteIP, void * pExtra)
-{
- JABBER_SOCKET slisten;
- TLEN_FILE_TRANSFER *ft;
-
- TlenProtocol *proto = (TlenProtocol *)pExtra;
- ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
- if (ft != NULL) {
- slisten = ft->s;
- ft->s = hConnection;
- JabberLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
- JabberLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenFileReceiveParse(ft);
- }
- if (ft->state==FT_DONE)
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- else
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- JabberLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
- ft->s = slisten;
- JabberLog(ft->proto, "ft->s is restored to %d", ft->s);
- if (ft->s != hConnection) {
- Netlib_CloseHandle(hConnection);
- }
- if (ft->hFileEvent != NULL)
- SetEvent(ft->hFileEvent);
- } else {
- Netlib_CloseHandle(hConnection);
- }
-}
-
-
-static void __cdecl TlenFileReceiveThread(TLEN_FILE_TRANSFER *ft)
-{
- NETLIBOPENCONNECTION nloc;
- JABBER_SOCKET s;
- JabberLog(ft->proto, "Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
- ft->mode = FT_RECV;
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = ft->hostName;
- nloc.wPort = ft->wPort;
- nloc.flags = 0;
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
- if (s != NULL) {
- ft->s = s;
- JabberLog(ft->proto, "Entering file receive loop");
- TlenP2PEstablishOutgoingConnection(ft, TRUE);
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenFileReceiveParse(ft);
- }
- if (ft->s) {
- Netlib_CloseHandle(s);
- }
- ft->s = NULL;
- } else {
- ft->pfnNewConnectionV2 = TlenFileReceivingConnection;
- JabberLog(ft->proto, "Connection failed - receiving as server");
- s = TlenP2PListen(ft);
- if (s != NULL) {
- HANDLE hEvent;
- char *nick;
- ft->s = s;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ft->hFileEvent = hEvent;
- ft->currentFile = 0;
- ft->state = FT_CONNECTING;
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<f t='%s' i='%s' e='7' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
- mir_free(nick);
- JabberLog(ft->proto, "Waiting for the file to be received...");
- WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
- CloseHandle(hEvent);
- JabberLog(ft->proto, "Finish all files");
- Netlib_CloseHandle(s);
- } else {
- ft->state = FT_ERROR;
- }
- }
- JabberListRemove(ft->proto, LIST_FILE, ft->iqId);
- if (ft->state==FT_DONE)
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- else {
- char *nick;
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<f t='%s' i='%s' e='8'/>", nick, ft->iqId);
- mir_free(nick);
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- }
-
- JabberLog(ft->proto, "Thread ended: type=file_receive server='%s'", ft->hostName);
- TlenP2PFreeFileTransfer(ft);
-}
-
-
-
-static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft)
-{
- int i;
- char *p, *t;
- int currentFile, numRead;
- char *fileBuffer;
- TLEN_FILE_PACKET *rpacket, *packet;
-
-
- if (ft->state == FT_CONNECTING) {
- char filename[256]; // Must be 256 (0x100)
- if ((packet=TlenP2PPacketCreate(sizeof(DWORD)+(ft->fileCount*(sizeof(filename)+sizeof(DWORD))))) != NULL) {
- // Must pause a bit, sending these two packets back to back
- // will break the session because the receiver cannot take it :)
- SleepEx(1000, TRUE);
- TlenP2PPacketSetLen(packet, 0); // Reuse packet
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_LIST);
- TlenP2PPacketPackDword(packet, (DWORD) ft->fileCount);
- for (i=0; i<ft->fileCount; i++) {
-// struct _stat statbuf;
-// _stat(ft->files[i], &statbuf);
-// TlenP2PPacketPackDword(packet, statbuf.st_size);
- TlenP2PPacketPackDword(packet, ft->filesSize[i]);
- memset(filename, 0, sizeof(filename));
- if ((t=strrchr(ft->files[i], '\\')) != NULL)
- t++;
- else
- t = ft->files[i];
- _snprintf(filename, sizeof(filename)-1, t);
- TlenP2PPacketPackBuffer(packet, filename, sizeof(filename));
- }
- TlenP2PPacketSend(ft->s, packet);
- TlenP2PPacketFree(packet);
-
- ft->allFileReceivedBytes = 0;
- ft->state = FT_INITIALIZING;
- JabberLog(ft->proto, "Change to FT_INITIALIZING");
- }
- else {
- ft->state = FT_ERROR;
- }
- }
- else if (ft->state == FT_INITIALIZING) { // FT_INITIALIZING
- rpacket = TlenP2PPacketReceive(ft->s);
- JabberLog(ft->proto, "FT_INITIALIZING: recv %d", rpacket);
- if (rpacket == NULL) {
- ft->state = FT_ERROR;
- return;
- }
- JabberLog(ft->proto, "FT_INITIALIZING: recv type %d", rpacket->type);
- p = rpacket->packet;
- // TYPE: TLEN_FILE_PACKET_FILE_LIST_ACK will be ignored
- // LEN: 0
- if (rpacket->type == TLEN_FILE_PACKET_FILE_LIST_ACK) {
-
- }
- // Then the receiver will request each file
- // TYPE: TLEN_FILE_PACKET_REQUEST
- // LEN:
- // (DWORD) file number
- // (DWORD) 0
- // (DWORD) 0
- else if (rpacket->type == TLEN_FILE_PACKET_FILE_REQUEST) {
- PROTOFILETRANSFERSTATUS pfts;
- //struct _stat statbuf;
-
- currentFile = *((DWORD*)p);
- if (currentFile != ft->currentFile) {
- JabberLog(ft->proto, "Requested file (#%d) is invalid (must be %d)", currentFile, ft->currentFile);
- ft->state = FT_ERROR;
- }
- else {
- // _stat(ft->files[currentFile], &statbuf); // file size in statbuf.st_size
- JabberLog(ft->proto, "Sending [%s] [%d]", ft->files[currentFile], ft->filesSize[currentFile]);
- if ((ft->fileId=_open(ft->files[currentFile], _O_BINARY|_O_RDONLY)) < 0) {
- JabberLog(ft->proto, "File cannot be opened");
- ft->state = FT_ERROR;
- }
- else {
- memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
- pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
- pfts.hContact = ft->hContact;
- pfts.sending = TRUE;
- pfts.files = ft->files;
- pfts.totalFiles = ft->fileCount;
- pfts.currentFileNumber = ft->currentFile;
- pfts.totalBytes = ft->allFileTotalSize;
- pfts.workingDir = NULL;
- pfts.currentFile = ft->files[ft->currentFile];
- pfts.currentFileSize = ft->filesSize[ft->currentFile]; //statbuf.st_size;
- pfts.currentFileTime = 0;
- ft->fileReceivedBytes = 0;
- if ((packet = TlenP2PPacketCreate(2*sizeof(DWORD)+2048)) == NULL) {
- ft->state = FT_ERROR;
- }
- else {
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_DATA);
- fileBuffer = (char *) mir_alloc(2048);
- JabberLog(ft->proto, "Sending file data...");
- while ((numRead=_read(ft->fileId, fileBuffer, 2048)) > 0) {
- TlenP2PPacketSetLen(packet, 0); // Reuse packet
- TlenP2PPacketPackDword(packet, (DWORD) ft->fileReceivedBytes);
- TlenP2PPacketPackDword(packet, 0);
- TlenP2PPacketPackBuffer(packet, fileBuffer, numRead);
- if (TlenP2PPacketSend(ft->s, packet)) {
- ft->fileReceivedBytes += numRead;
- ft->allFileReceivedBytes += numRead;
- pfts.totalProgress = ft->allFileReceivedBytes;
- pfts.currentFileProgress = ft->fileReceivedBytes;
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM) &pfts);
- }
- else {
- ft->state = FT_ERROR;
- break;
- }
- }
- mir_free(fileBuffer);
- _close(ft->fileId);
- if (ft->state != FT_ERROR) {
- if (ft->currentFile >= ft->fileCount-1)
- ft->state = FT_DONE;
- else {
- ft->currentFile++;
- ft->state = FT_INITIALIZING;
- JabberLog(ft->proto, "File sent, advancing to the next file...");
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
- }
- }
- JabberLog(ft->proto, "Finishing this file...");
- TlenP2PPacketSetLen(packet, 0); // Reuse packet
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_END_OF_FILE);
- TlenP2PPacketPackDword(packet, currentFile);
- TlenP2PPacketSend(ft->s, packet);
- TlenP2PPacketFree(packet);
- }
- }
- }
- TlenP2PPacketFree(rpacket);
- }
- else {
- ft->state = FT_ERROR;
- }
- }
-}
-
-static void TlenFileSendingConnection(JABBER_SOCKET hConnection, DWORD dwRemoteIP, void * pExtra)
-{
- JABBER_SOCKET slisten;
- TLEN_FILE_TRANSFER *ft;
- TlenProtocol *proto = (TlenProtocol *)pExtra;
-
- ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
- if (ft != NULL) {
- slisten = ft->s;
- ft->s = hConnection;
- JabberLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
-
- JabberLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenFileSendParse(ft);
- }
- if (ft->state==FT_DONE)
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- else
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- JabberLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
- ft->s = slisten;
- JabberLog(ft->proto, "ft->s is restored to %d", ft->s);
- if (ft->s != hConnection) {
- Netlib_CloseHandle(hConnection);
- }
- if (ft->hFileEvent != NULL)
- SetEvent(ft->hFileEvent);
- } else {
- Netlib_CloseHandle(hConnection);
- }
-}
-
-int TlenFileCancelAll(TlenProtocol *proto)
-{
- JABBER_LIST_ITEM *item;
- HANDLE hEvent;
- int i = 0;
-
- while ((i=JabberListFindNext(proto, LIST_FILE, 0)) >=0 ) {
- if ((item=JabberListGetItemPtrFromIndex(proto, i)) != NULL) {
- TLEN_FILE_TRANSFER *ft = item->ft;
- JabberListRemoveByIndex(proto, i);
- if (ft != NULL) {
- if (ft->s) {
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- JabberLog(ft->proto, "Closing ft->s = %d", ft->s);
- ft->state = FT_ERROR;
- Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
- hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
- SetEvent(hEvent);
- }
- } else {
- JabberLog(ft->proto, "freeing ft struct");
- TlenP2PFreeFileTransfer(ft);
- }
- }
- }
- }
- return 0;
-}
-
-static void __cdecl TlenFileSendingThread(TLEN_FILE_TRANSFER *ft)
-{
- JABBER_SOCKET s = NULL;
- HANDLE hEvent;
- char *nick;
-
- JabberLog(ft->proto, "Thread started: type=tlen_file_send");
- ft->mode = FT_SEND;
- ft->pfnNewConnectionV2 = TlenFileSendingConnection;
- s = TlenP2PListen(ft);
- if (s != NULL) {
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- ft->s = s;
- //JabberLog("ft->s = %d", s);
- //JabberLog("fileCount = %d", ft->fileCount);
-
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ft->hFileEvent = hEvent;
- ft->currentFile = 0;
- ft->state = FT_CONNECTING;
-
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<f t='%s' i='%s' e='6' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
- mir_free(nick);
- JabberLog(ft->proto, "Waiting for the file to be sent...");
- WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
- CloseHandle(hEvent);
- JabberLog(ft->proto, "Finish all files");
- Netlib_CloseHandle(s);
- ft->s = NULL;
- JabberLog(ft->proto, "ft->s is NULL");
-
- if (ft->state == FT_SWITCH) {
- NETLIBOPENCONNECTION nloc;
- JABBER_SOCKET s;
- JabberLog(ft->proto, "Sending as client...");
- ft->state = FT_CONNECTING;
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = ft->hostName;
- nloc.wPort = ft->wPort;
- nloc.flags = 0;
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
- if (s != NULL) {
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- ft->s = s;
- TlenP2PEstablishOutgoingConnection(ft, TRUE);
- JabberLog(ft->proto, "Entering send loop for this file connection...");
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenFileSendParse(ft);
- }
- if (ft->state==FT_DONE)
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- else
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- JabberLog(ft->proto, "Closing connection for this file transfer... ");
- Netlib_CloseHandle(s);
- } else {
- ft->state = FT_ERROR;
- }
- }
- } else {
- JabberLog(ft->proto, "Cannot allocate port to bind for file server thread, thread ended.");
- ft->state = FT_ERROR;
- }
- JabberListRemove(ft->proto, LIST_FILE, ft->iqId);
- switch (ft->state) {
- case FT_DONE:
- JabberLog(ft->proto, "Finish successfully");
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- break;
- case FT_DENIED:
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0);
- break;
- default: // FT_ERROR:
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<f t='%s' i='%s' e='8'/>", nick, ft->iqId);
- mir_free(nick);
- JabberLog(ft->proto, "Finish with errors");
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- break;
- }
- JabberLog(ft->proto, "Thread ended: type=file_send");
- TlenP2PFreeFileTransfer(ft);
-}
-
-
-TLEN_FILE_TRANSFER *TlenFileCreateFT(TlenProtocol *proto, const char *jid) {
- TLEN_FILE_TRANSFER *ft;
- ft = (TLEN_FILE_TRANSFER *) mir_alloc(sizeof(TLEN_FILE_TRANSFER));
- memset(ft, 0, sizeof(TLEN_FILE_TRANSFER));
- ft->proto = proto;
- ft->jid = mir_strdup(jid);
- return ft;
-}
-
-/*
- * File transfer
- */
-void TlenProcessF(XmlNode *node, ThreadData *info)
-{
- TLEN_FILE_TRANSFER *ft;
- CCSDATA ccs;
- PROTORECVEVENT pre;
- char *szBlob, *from, *p, *e;
- char jid[128], szFilename[MAX_PATH];
- int numFiles;
- JABBER_LIST_ITEM *item;
-
-// if (!node->name || strcmp(node->name, "f")) return;
- if (info == NULL) return;
-
- if ((from=JabberXmlGetAttrValue(node, "f")) != NULL) {
-
- if (strchr(from, '@') == NULL) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
- } else {
- _snprintf(jid, sizeof(jid), "%s", from);
- }
- if ((e=JabberXmlGetAttrValue(node, "e")) != NULL) {
-
- if (!strcmp(e, "1")) {
- // FILE_RECV : e='1' : File transfer request
- ft = TlenFileCreateFT(info->proto, jid);
- ft->hContact = JabberHContactFromJID(info->proto, jid);
-
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL)
- ft->iqId = mir_strdup(p);
-
- szFilename[0] = '\0';
- if ((p=JabberXmlGetAttrValue(node, "c")) != NULL) {
- numFiles = atoi(p);
- if (numFiles == 1) {
- if ((p=JabberXmlGetAttrValue(node, "n")) != NULL) {
- p = JabberTextDecode(p);
- strncpy(szFilename, p, sizeof(szFilename));
- mir_free(p);
- } else {
- strcpy(szFilename, Translate("1 File"));
- }
- }
- else if (numFiles > 1) {
- _snprintf(szFilename, sizeof(szFilename), Translate("%d Files"), numFiles);
- }
- }
-
- if (szFilename[0]!='\0' && ft->iqId!=NULL) {
- // blob is DWORD(*ft), ASCIIZ(filenames), ASCIIZ(description)
- szBlob = (char *) mir_alloc(sizeof(DWORD) + strlen(szFilename) + 2);
- *((PDWORD) szBlob) = (DWORD) ft;
- strcpy(szBlob + sizeof(DWORD), szFilename);
- szBlob[sizeof(DWORD) + strlen(szFilename) + 1] = '\0';
- pre.flags = 0;
- pre.timestamp = time(NULL);
- pre.szMessage = szBlob;
- pre.lParam = 0;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = ft->hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) &pre;
- JabberLog(ft->proto, "sending chainrecv");
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
- mir_free(szBlob);
- }
- else {
- // malformed <f/> request, reject
- if (ft->iqId)
- JabberSend(ft->proto, "<f i='%s' e='4' t='%s'/>", ft->iqId, from);
- else
- JabberSend(ft->proto, "<f e='4' t='%s'/>", from);
- TlenP2PFreeFileTransfer(ft);
- }
- }
- else if (!strcmp(e, "3")) {
- // FILE_RECV : e='3' : invalid transfer error
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if (item->ft != NULL) {
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, item->ft, 0);
- TlenFileCancel((PROTO_INTERFACE *)info->proto, NULL, item->ft);
- }
- JabberListRemove(info->proto, LIST_FILE, p);
- }
- }
- }
- else if (!strcmp(e, "4")) {
- // FILE_SEND : e='4' : File sending request was denied by the remote client
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if (!strcmp(item->ft->jid, jid)) {
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_DENIED, item->ft, 0);
- JabberListRemove(info->proto, LIST_FILE, p);
- }
- }
- }
- }
- else if (!strcmp(e, "5")) {
- // FILE_SEND : e='5' : File sending request was accepted
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if (!strcmp(item->ft->jid, jid))
- JabberForkThread((void (__cdecl *)(void*))TlenFileSendingThread, 0, item->ft);
- }
- }
- }
- else if (!strcmp(e, "6")) {
- // FILE_RECV : e='6' : IP and port information to connect to get file
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if ((p=JabberXmlGetAttrValue(node, "a")) != NULL) {
- item->ft->hostName = mir_strdup(p);
- if ((p=JabberXmlGetAttrValue(node, "p")) != NULL) {
- item->ft->wPort = atoi(p);
- JabberForkThread((void (__cdecl *)(void*))TlenFileReceiveThread, 0, item->ft);
- }
- }
- }
- }
- }
- else if (!strcmp(e, "7")) {
- // FILE_RECV : e='7' : IP and port information to connect to send file
- // in case the conection to the given server was not successful
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- if ((p=JabberXmlGetAttrValue(node, "a")) != NULL) {
- if (item->ft->hostName!=NULL) mir_free(item->ft->hostName);
- item->ft->hostName = mir_strdup(p);
- if ((p=JabberXmlGetAttrValue(node, "p")) != NULL) {
- item->ft->wPort = atoi(p);
- item->ft->state = FT_SWITCH;
- SetEvent(item->ft->hFileEvent);
- }
- }
- }
- }
- }
- else if (!strcmp(e, "8")) {
- // FILE_RECV : e='8' : transfer error
- if ((p=JabberXmlGetAttrValue(node, "i")) != NULL) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, p)) != NULL) {
- item->ft->state = FT_ERROR;
- if (item->ft->hFileEvent != NULL) {
- SetEvent(item->ft->hFileEvent);
- } else {
- ProtoBroadcastAck(info->proto->iface.m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, item->ft, 0);
- }
- }
- }
- }
- }
- }
-}
diff --git a/protocols/Tlen/tlen_file.h b/protocols/Tlen/tlen_file.h
deleted file mode 100644
index 40527a2bcb..0000000000
--- a/protocols/Tlen/tlen_file.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _TLEN_FILE_H_
-#define _TLEN_FILE_H_
-
-#include <windows.h>
-#include "jabber.h"
-
-extern int TlenFileCancelAll(TlenProtocol *proto);
-extern void TlenProcessF(XmlNode *node, ThreadData *userdata);
-extern TLEN_FILE_TRANSFER *TlenFileCreateFT(TlenProtocol *proto, const char *jid);
-#endif
-
diff --git a/protocols/Tlen/tlen_muc.c b/protocols/Tlen/tlen_muc.c
deleted file mode 100644
index 0b8e7534f5..0000000000
--- a/protocols/Tlen/tlen_muc.c
+++ /dev/null
@@ -1,1071 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-#include "jabber_iq.h"
-#include "resource.h"
-#include "tlen_muc.h"
-
-static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam);
-static int TlenMUCQueryContacts(TlenProtocol *proto, const char *roomId);
-static int TlenMUCSendInvitation(TlenProtocol *proto, const char *roomID, const char *user);
-static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const char *nick, int desiredStatus);
-static int TlenMUCSendMessage(TlenProtocol *proto, MUCCEVENT *event);
-static int TlenMUCSendTopic(TlenProtocol *proto, MUCCEVENT *event);
-static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, int page);
-
-static int isSelf(TlenProtocol *proto, const char *roomID, const char *nick)
-{
- JABBER_LIST_ITEM *item;
- int result;
- result=0;
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item!=NULL) {
- if (item->nick==NULL) {
- if (!strcmp(nick, proto->threadData->username)) result = 1;
- } else if (nick[0]=='~') {
- if (!strcmp(nick+1, item->nick)) {
- result = 1;
- }
- }
- }
- return result;
-}
-
-static int stringToHex(const char *str)
-{
- int i, val;
- val = 0;
- for (i=0;i<2;i++) {
- val <<= 4;
- if (str[i]>='A' && str[i]<='F') {
- val += 10 + str[i]-'A';
- } else if (str[i]>='0' && str[i]<='9') {
- val += str[i]-'0';
- }
- }
- return val;
-
-}
-static char *getDisplayName(TlenProtocol *proto, const char *id)
-{
- CONTACTINFO ci;
- char jid[256];
- HANDLE hContact;
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
- if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
- ZeroMemory(&ci, sizeof(ci));
- ci.cbSize = sizeof(ci);
- ci.hContact = hContact;
- ci.szProto = (char *)proto->iface.m_szModuleName;
- ci.dwFlag = CNF_DISPLAY;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
- if (ci.type == CNFT_ASCIIZ) {
- if (ci.pszVal) {
- char * str = mir_strdup((char *)ci.pszVal);
- miranda_sys_free(ci.pszVal);
- return str;
- }
- }
- }
- }
- }
- return mir_strdup(id);
-}
-
-BOOL TlenMUCInit(TlenProtocol *proto)
-{
- HookEventObj_Ex(ME_MUCC_EVENT, proto, TlenMUCHandleEvent);
- return 0;
-}
-static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- int id;
- MUCCEVENT *mucce=(MUCCEVENT *) lParam;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!strcmp(mucce->pszModule, proto->iface.m_szModuleName)) {
- switch (mucce->iType) {
- case MUCC_EVENT_INVITE:
- TlenMUCSendInvitation(proto, mucce->pszID, mucce->pszNick);
- break;
- case MUCC_EVENT_MESSAGE:
- TlenMUCSendMessage(proto, mucce);
- break;
- case MUCC_EVENT_TOPIC:
- TlenMUCSendTopic(proto, mucce);
- break;
- case MUCC_EVENT_LEAVE:
- TlenMUCSendPresence(proto, mucce->pszID, NULL, ID_STATUS_OFFLINE);
- break;
- case MUCC_EVENT_QUERY_GROUPS:
- TlenMUCSendQuery(proto, 1, mucce->pszID, 0);
- break;
- case MUCC_EVENT_QUERY_ROOMS:
- TlenMUCSendQuery(proto, 2, mucce->pszID, mucce->dwData);
- break;
- case MUCC_EVENT_QUERY_SEARCH:
- TlenMUCSendQuery(proto, 3, mucce->pszName, 0);
- break;
- case MUCC_EVENT_QUERY_USERS:
- switch (mucce->dwFlags) {
- case MUCC_EF_USER_OWNER:
- id = 1;
- break;
- case MUCC_EF_USER_ADMIN:
- id = 2;
- break;
- case MUCC_EF_USER_MEMBER:
- id = 3;
- break;
- case MUCC_EF_USER_BANNED:
- id = 4;
- break;
- case MUCC_EF_USER_MODERATOR:
- id = 6;
- break;
- default:
- id = 0;
- }
- TlenMUCSendQuery(proto, 4, mucce->pszID, id);
- break;
- case MUCC_EVENT_REGISTER_NICK:
- TlenMUCSendQuery(proto, 6, mucce->pszNick, 0);
- break;
- case MUCC_EVENT_REMOVE_NICK:
- TlenMUCSendQuery(proto, 6, mucce->pszNick, 1);
- break;
- case MUCC_EVENT_REGISTER_ROOM:
- id = JabberSerialNext(proto);
- if (proto->isOnline) {
- if (mucce->pszNick!=NULL) {
- JabberSend(proto, "<p to='c' tp='c' id='"JABBER_IQID"%d' x='%d' n='%s' p='%s' nick='%s'/>", id, mucce->dwFlags | 0x10, mucce->pszName, mucce->pszID);
- } else {
- JabberSend(proto, "<p to='c' tp='c' id='"JABBER_IQID"%d' x='%d' n='%s' p='%s'/>", id, mucce->dwFlags | 0x10, mucce->pszName, mucce->pszID);
- }
- }
- break;
- case MUCC_EVENT_REMOVE_ROOM:
- if (proto->isOnline) {
- JabberSend(proto, "<p to='%s' type='d'/>", mucce->pszID);
- JabberListRemove(proto, LIST_CHATROOM, mucce->pszID);
- // TlenMUCSendPresence(mucce->pszID, NULL, ID_STATUS_OFFLINE);
- }
- break;
- case MUCC_EVENT_KICK_BAN:
- if (proto->isOnline) {
- char *nick;
- nick = JabberResourceFromJID(mucce->pszUID);
- if (!isSelf(proto, mucce->pszID, nick)) {
- char *reason = JabberTextEncode(mucce->pszText);
- JabberSend(proto, "<p to='%s'><x><i i='%s' a='4' ex='%d' rs='%s'/></x></p>", mucce->pszID, nick, mucce->dwData, reason);
- mir_free(reason);
- }
- mir_free(nick);
- }
- break;
- case MUCC_EVENT_UNBAN:
- if (proto->isOnline) {
- char *nick;
- nick = JabberResourceFromJID(mucce->pszUID);
- if (!isSelf(proto, mucce->pszID, nick)) {
- JabberSend(proto, "<p to='%s'><x><i i='%s' a='0'/></x></p>", mucce->pszID, nick);
- }
- mir_free(nick);
- }
- break;
- case MUCC_EVENT_SET_USER_ROLE:
- if (proto->isOnline) {
- char *nick;
- nick = JabberResourceFromJID(mucce->pszUID);
- if (!isSelf(proto, mucce->pszID, nick)) {
- if (mucce->dwFlags == MUCC_EF_USER_ADMIN) {
- id = 2;
- } else if (mucce->dwFlags == MUCC_EF_USER_MEMBER) {
- id = 3;
- } else {
- id = 0;
- }
- JabberSend(proto, "<p to='%s'><x><i i='%s' a='%d' /></x></p>", mucce->pszID, nick, id);
- }
- mir_free(nick);
- }
- break;
- case MUCC_EVENT_QUERY_USER_NICKS:
- TlenMUCSendQuery(proto, 7, mucce->pszID, 0);
- break;
- case MUCC_EVENT_QUERY_USER_ROOMS:
- TlenMUCSendQuery(proto, 8, mucce->pszID, 0);
- break;
- case MUCC_EVENT_QUERY_CONTACTS:
- TlenMUCQueryContacts(proto, mucce->pszID);
- break;
- case MUCC_EVENT_JOIN:
- if (proto->isOnline) {
- if (mucce->pszID==NULL || strlen(mucce->pszID)==0) {
- if (mucce->pszName==NULL || strlen(mucce->pszName)==0) { // create a new chat room
- id = JabberSerialNext(proto);
- JabberSend(proto, "<p to='c' tp='c' id='"JABBER_IQID"%d'/>", id);
- } else { // find a chat room by name
- TlenMUCSendQuery(proto, 3, mucce->pszName, 0);
- }
- } else { // join existing chat room
- if (!TlenMUCCreateWindow(proto, mucce->pszID, mucce->pszName, mucce->dwFlags, mucce->pszNick, NULL)) {
- TlenMUCSendPresence(proto, mucce->pszID, mucce->pszNick, ID_STATUS_ONLINE);
- }
- }
- }
- break;
- case MUCC_EVENT_START_PRIV:
- if (proto->isOnline) {
- JABBER_LIST_ITEM *item;
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, mucce->pszID);
- if (item!=NULL) {
- char *nick;
- nick = JabberResourceFromJID(mucce->pszUID);
- if (!isSelf(proto, mucce->pszID, nick)) {
- if (nick[0]=='~' || item->nick!=NULL) {
- char str[256];
- sprintf(str, "%s/%s", mucce->pszID, nick);
- hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
- DBWriteContactSettingByte(hContact, proto->iface.m_szModuleName, "bChat", TRUE);
- CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
- } else {
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- char str[512];
- _snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
- DBFreeVariant(&dbv);
- hContact = JabberDBCreateContact(proto, str, nick, TRUE);
- CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
- }
- }
- }
- mir_free(nick);
- }
- }
- break;
- }
- }
- return 0;
-}
-
-int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *roomName, const char *from, const char *reason)
-{
- char *nick;
- int ignore, ask, groupChatPolicy;
- if (roomId == NULL) return 1;
- groupChatPolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "GroupChatPolicy", 0);
- ask = TRUE;
- ignore = FALSE;
- if (groupChatPolicy == TLEN_MUC_ASK) {
- ignore = FALSE;
- ask = TRUE;
- } else if (groupChatPolicy == TLEN_MUC_IGNORE_ALL) {
- ignore = TRUE;
- } else if (groupChatPolicy == TLEN_MUC_IGNORE_NIR) {
- char jid[256];
- JABBER_LIST_ITEM *item;
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- strcpy(jid, from);
- }
- ignore = !IsAuthorized(proto, jid);
- ask = TRUE;
- } else if (groupChatPolicy == TLEN_MUC_ACCEPT_IR) {
- char jid[256];
- JABBER_LIST_ITEM *item;
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- strcpy(jid, from);
- }
- item = JabberListGetItemPtr(proto, LIST_ROSTER, jid);
- ask = !IsAuthorized(proto, jid);
- ignore = FALSE;
- } else if (groupChatPolicy == TLEN_MUC_ACCEPT_ALL) {
- ask = FALSE;
- ignore = FALSE;
- }
- if (!ignore) {
- if (ask) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = roomId;
- mucce.pszName = roomName;
- mucce.iType = MUCC_EVENT_INVITATION;
- mucce.pszUID = from;
- nick = getDisplayName(proto, from);
- mucce.pszNick = nick;
- mucce.pszText = reason;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- mir_free(nick);
- } else {
- if (!TlenMUCCreateWindow(proto, roomId, roomName, 0, NULL, NULL)) {
- TlenMUCSendPresence(proto, roomId, NULL, ID_STATUS_ONLINE);
- }
- }
- }
- return 0;
-}
-
-int TlenMUCRecvPresence(TlenProtocol *proto, const char *from, int status, int flags, const char *kick)
-{
- char str[512];
-// if (JabberListExist(LIST_CHATROOM, from)) {
- char *nick, *roomId, *userId;
- MUCCEVENT mucce;
- roomId = JabberLoginFromJID(from);
- userId = JabberResourceFromJID(from);
- nick = getDisplayName(proto, userId);
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = roomId;
- mucce.iType = MUCC_EVENT_STATUS;
- mucce.pszUID = userId;//from;
- mucce.pszNick = nick;
- mucce.time = time(NULL);
- mucce.bIsMe = isSelf(proto, roomId, userId);
- mucce.dwData = status;
- mucce.dwFlags = 0;
- if (flags & USER_FLAGS_GLOBALOWNER) mucce.dwFlags |= MUCC_EF_USER_GLOBALOWNER;
- if (flags & USER_FLAGS_OWNER) mucce.dwFlags |= MUCC_EF_USER_OWNER;
- if (flags & USER_FLAGS_ADMIN) mucce.dwFlags |= MUCC_EF_USER_ADMIN;
- if (flags & USER_FLAGS_REGISTERED) mucce.dwFlags |= MUCC_EF_USER_REGISTERED;
- if (status == ID_STATUS_OFFLINE && mucce.bIsMe && kick!=NULL) {
- mucce.iType = MUCC_EVENT_ERROR;
- sprintf(str, Translate("You have been kicked. Reason: %s "), kick);
- mucce.pszText = str;
- }
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- mir_free(roomId);
- mir_free(userId);
- mir_free(nick);
-// }
- return 0;
-}
-
-int TlenMUCRecvMessage(TlenProtocol *proto, const char *from, long timestamp, XmlNode *bodyNode)
-{
-// if (JabberListExist(LIST_CHATROOM, from)) {
- char *localMessage;
- char *nick, *style, *roomId, *userId;
- int iStyle;
- MUCCEVENT mucce;
- roomId = JabberLoginFromJID(from);
- userId = JabberResourceFromJID(from);
- nick = getDisplayName(proto, userId);
- localMessage = JabberTextDecode(bodyNode->text);
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_MESSAGE;
- mucce.pszID = roomId;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszText = localMessage;
- mucce.pszUID = userId;//from;
- mucce.pszNick = nick;
- mucce.time = timestamp;
- mucce.bIsMe = isSelf(proto, roomId, userId);
- mucce.dwFlags = 0;
- mucce.iFontSize = 0;
- style = JabberXmlGetAttrValue(bodyNode, "f");
- if (style!=NULL) {
- iStyle = atoi(style);
- if (iStyle & 1) mucce.dwFlags |= MUCC_EF_FONT_BOLD;
- if (iStyle & 2) mucce.dwFlags |= MUCC_EF_FONT_ITALIC;
- if (iStyle & 4) mucce.dwFlags |= MUCC_EF_FONT_UNDERLINE;
- }
- style = JabberXmlGetAttrValue(bodyNode, "c");
- if (style!=NULL && strlen(style)>5) {
- iStyle = (stringToHex(style)<<16) | (stringToHex(style+2)<<8) | stringToHex(style+4);
- } else {
- iStyle = 0xFFFFFFFF;
- }
- mucce.color = (COLORREF) iStyle;
- style = JabberXmlGetAttrValue(bodyNode, "s");
- if (style!=NULL) {
- iStyle = atoi(style);
- } else {
- iStyle = 0;
- }
- mucce.iFontSize = iStyle;
- style = JabberXmlGetAttrValue(bodyNode, "n");
- if (style!=NULL) {
- iStyle = atoi(style)-1;
- } else {
- iStyle = 0;
- }
- mucce.iFont = iStyle;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- mir_free(roomId);
- mir_free(userId);
- mir_free(nick);
- mir_free(localMessage);
-// }
- return 0;
-}
-int TlenMUCRecvTopic(TlenProtocol *proto, const char *from, const char *subject)
-{
-// if (JabberListExist(LIST_CHATROOM, from)) {
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_TOPIC;
- mucce.pszID = from;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszText = subject;
- mucce.time = time(NULL);
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
-// }
- return 0;
-}
-
-int TlenMUCRecvError(TlenProtocol *proto, const char *from, XmlNode *errorNode)
-{
- int errCode;
- char str[512];
- JABBER_LIST_ITEM *item;
- MUCCEVENT mucce;
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_ERROR;
- mucce.pszID = from;
- mucce.pszModule = proto->iface.m_szModuleName;
- errCode = atoi(JabberXmlGetAttrValue(errorNode, "code"));
- switch (errCode) {
- case 403:
- sprintf(str, Translate("You cannot join this chat room, because you are banned."));
- break;
- case 404:
- sprintf(str, Translate("Chat room not found."));
- break;
- case 407:
- sprintf(str, Translate("This is a private chat room and you are not one of the members."));
- break;
- case 408:
- sprintf(str, Translate("You cannot send any message unless you join this chat room."));
- break;
- case 410:
- sprintf(str, Translate("Chat room with already created."));
- break;
- case 411:
- sprintf(str, Translate("Nickname '%s' is already registered."),
- JabberXmlGetAttrValue(errorNode, "n"));
- break;
- case 412:
- sprintf(str, Translate("Nickname already in use, please try another one. Hint: '%s' is free."),
- JabberXmlGetAttrValue(errorNode, "free"));
- break;
- case 413:
- sprintf(str, Translate("You cannot register more than %s nicknames."),
- JabberXmlGetAttrValue(errorNode, "num"));
- break;
- case 414:
- sprintf(str, Translate("You cannot create more than %s chat rooms."),
- JabberXmlGetAttrValue(errorNode, "num"));
- break;
- case 415:
- sprintf(str, Translate("You cannot join more than %s chat rooms."),
- JabberXmlGetAttrValue(errorNode, "num"));
- break;
- case 601:
- sprintf(str, Translate("Anonymous nicknames are not allowed in this chat room."));
- break;
- default:
- sprintf(str, Translate("Unknown error code : %d"), errCode);
- break;
- }
- mucce.pszText = str;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- if (proto->isOnline) {
- switch (errCode) {
- case 412:
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, from);
- if (item!=NULL) {
- mucce.iType = MUCC_EVENT_JOIN;
- mucce.dwFlags = MUCC_EF_ROOM_NICKNAMES;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = from;
- mucce.pszName = item->roomName;
- mucce.pszNick = JabberXmlGetAttrValue(errorNode, "free");
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- }
- break;
- case 601:
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, from);
- if (item!=NULL) {
- mucce.iType = MUCC_EVENT_JOIN;
- mucce.dwFlags = 0;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = from;
- mucce.pszName = item->roomName;
- mucce.pszNick = NULL;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- }
- break;
- }
- }
- return 1;
-}
-static int TlenMUCSendInvitation(TlenProtocol *proto, const char *roomID, const char *user)
-{
- if (!proto->isOnline) {
- return 1;
- }
- JabberSend(proto, "<m to='%s'><x><inv to='%s'><r></r></inv></x></m>", roomID, user);
- return 0;
-}
-
-static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const char *nick, int desiredStatus)
-{
- char str[512];
- char *jid;
- JABBER_LIST_ITEM *item;
- if (!proto->isOnline) {
- return 1;
- }
- if (nick!=NULL) {
- _snprintf(str, sizeof(str), "%s/%s", roomID, nick);
- } else {
- _snprintf(str, sizeof(str), "%s", roomID);
- }
- if ((jid = JabberTextEncode(str))!=NULL) {
- switch (desiredStatus) {
- case ID_STATUS_ONLINE:
- JabberSend(proto, "<p to='%s'/>", jid);
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item!=NULL) {
- if (item->nick!=NULL) mir_free(item->nick);
- item->nick = NULL;
- if (nick!=NULL) {
- item->nick = mir_strdup(nick);
- }
- }
- break;
- default:
- item = JabberListGetItemPtr(proto, LIST_CHATROOM, roomID);
- if (item!=NULL) {
- JabberSend(proto, "<p to='%s'><s>unavailable</s></p>", jid);
- JabberListRemove(proto, LIST_CHATROOM, roomID);
- }
- break;
- }
- mir_free(jid);
- }
- return 0;
-}
-
-static int TlenMUCSendMessage(TlenProtocol *proto, MUCCEVENT *event)
-{
- char *msg, *jid;
- int style;
-
- if (!proto->isOnline) {
- return 1;
- }
- if ((msg = JabberTextEncode(event->pszText))!=NULL) {
- if ((jid = JabberTextEncode(event->pszID))!=NULL) {
- style = 0;
- if (event->dwFlags & MUCC_EF_FONT_BOLD) style |=1;
- if (event->dwFlags & MUCC_EF_FONT_ITALIC) style |=2;
- if (event->dwFlags & MUCC_EF_FONT_UNDERLINE) style |=4;
- JabberSend(proto, "<m to='%s'><b n='%d' s='%d' f='%d' c='%06X'>%s</b></m>", jid, event->iFont+1, event->iFontSize, style, event->color, msg);
- mir_free(jid);
- }
- mir_free(msg);
- }
- return 0;
-}
-
-static int TlenMUCSendTopic(TlenProtocol *proto, MUCCEVENT *event)
-{
- char *msg, *jid;
- if (!proto->isOnline) {
- return 1;
- }
- if ((msg = JabberTextEncode(event->pszText))!=NULL) {
- if ((jid = JabberTextEncode(event->pszID))!=NULL) {
- JabberSend(proto, "<m to='%s'><subject>%s</subject></m>", jid, msg);
- mir_free(jid);
- }
- mir_free(msg);
- }
- return 0;
-}
-
-static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, int page)
-{
- if (!proto->isOnline) {
- return 1;
- }
- if (type==3) { // find chat room by name
- char serialId[32];
- JABBER_LIST_ITEM *item;
- sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
- item = JabberListAdd(proto, LIST_SEARCH, serialId);
- item->roomName = mir_strdup(parent);
- JabberSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
- } else {
- if (parent==NULL) {
- JabberSend(proto, "<iq to='c' type='%d'/>", type);
- } else { // 1 - groups, 2 - chat rooms, 7 - user nicks, 8 - user rooms
- if (type==1 || (type==2 && page==0) || type==7 || type==8) {
- JabberSend(proto, "<iq to='c' type='%d' p='%s'/>", type, parent);
- } else if (type==2) {
- JabberSend(proto, "<iq to='c' type='%d' p='%s' n='%d'/>", type, parent, page);
- } else if (type==6) {
- if (page) {
- JabberSend(proto, "<iq to='c' type='%d' n='%s' k='u'/>", type, parent);
- } else {
- JabberSend(proto, "<iq to='c' type='%d' n='%s'/>", type, parent);
- }
- } else if (type==4) { // list of users, admins etc.
- JabberSend(proto, "<iq to='%s' type='%d' k='%d'/>", parent, type, page);
- }
- }
- }
- return 0;
-}
-
-int TlenMUCCreateWindow(TlenProtocol *proto, const char *roomID, const char *roomName, int roomFlags, const char *nick, const char *iqId)
-{
- JABBER_LIST_ITEM *item;
- MUCCWINDOW mucw;
- if (!proto->isOnline || roomID==NULL) {
- return 1;
- }
- if (JabberListExist(proto, LIST_CHATROOM, roomID)) {
- return 0;
- }
- item = JabberListAdd(proto, LIST_CHATROOM, roomID);
- if (roomName!=NULL) {
- item->roomName = mir_strdup(roomName);
- }
- if (nick!=NULL) {
- item->nick = mir_strdup(nick);
- }
- mucw.cbSize = sizeof(MUCCWINDOW);
- mucw.iType = MUCC_WINDOW_CHATROOM;
- mucw.pszModule = proto->iface.m_szModuleName;
- mucw.pszModuleName = proto->iface.m_szProtoName;
- mucw.pszID = roomID;
- mucw.pszName = roomName;
- mucw.pszNick = nick;
- mucw.dwFlags = roomFlags;
- mucw.pszStatusbarText = "hello";
- CallService(MS_MUCC_NEW_WINDOW, 0, (LPARAM) &mucw);
- if (iqId != NULL) {
- item = JabberListGetItemPtr(proto, LIST_INVITATIONS, iqId);
- if (item !=NULL) {
- TlenMUCSendInvitation(proto, roomID, item->nick);
- }
- JabberListRemove(proto, LIST_INVITATIONS, iqId);
- }
- return 0;
-}
-
-static void TlenMUCFreeQueryResult(MUCCQUERYRESULT *result)
-{ int i;
- for (i=0; i<result->iItemsNum; i++) {
- if (result->pItems[i].pszID != NULL) {
- mir_free((char *) result->pItems[i].pszID);
- }
- if (result->pItems[i].pszName != NULL) {
- mir_free((char *) result->pItems[i].pszName);
- }
- if (result->pItems[i].pszNick != NULL) {
- mir_free((char *) result->pItems[i].pszNick);
- }
- if (result->pItems[i].pszText != NULL) {
- mir_free((char *) result->pItems[i].pszText);
- }
- }
- mir_free((MUCCQUERYITEM *)result->pItems);
-}
-
-void TlenIqResultChatGroups(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *lNode, *itemNode;
- char *p, *n, *id, *f;
- int i, j;
- MUCCQUERYRESULT queryResult;
-
- if ((lNode=JabberXmlGetChild(iqNode, "l")) == NULL) return;
- p = JabberXmlGetAttrValue(iqNode, "p");
- if (p==NULL) {
- p="";
- }
- p = JabberTextDecode(p);
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_GROUPS;
- queryResult.pszModule = proto->iface.m_szModuleName;
- queryResult.pszParent = p;
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * lNode->numChild);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * lNode->numChild);
- for (i=j=0; i<lNode->numChild; i++) {
- itemNode = lNode->child[i];
- if (!strcmp(itemNode->name, "i")) {
- queryResult.pItems[j].iCount = 0;
- if ((f = JabberXmlGetAttrValue(itemNode, "f")) != NULL) {
- queryResult.pItems[j].iCount = !strcmp(f, "3");
- }
- n = JabberXmlGetAttrValue(itemNode, "n");
- id = JabberXmlGetAttrValue(itemNode, "i");
- if (n != NULL && id != NULL) {
- queryResult.pItems[j].pszID = JabberTextDecode(id);
- queryResult.pItems[j].pszName = JabberTextDecode(n);
- j++;
- }
- }
- }
- queryResult.iItemsNum = j;
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
- mir_free(p);
-}
-
-void TlenIqResultChatRooms(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *lNode, *itemNode;
- char *id, *c, *n, *x, *p, *px, *pn;
- int i, j;
- MUCCQUERYRESULT queryResult;
-
- if ((lNode=JabberXmlGetChild(iqNode, "l")) == NULL) return;
- if ((p = JabberXmlGetAttrValue(iqNode, "p")) == NULL) return;
- pn = JabberXmlGetAttrValue(lNode, "n");
- if (pn == NULL) pn = "0";
- px = JabberXmlGetAttrValue(lNode, "x");
- if (px == NULL) px = "0";
- p = JabberTextDecode(p);
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_ROOMS;
- queryResult.pszModule = proto->iface.m_szModuleName;
- queryResult.pszParent = p;
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * lNode->numChild);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * lNode->numChild);
- queryResult.iPage = atoi(pn);
- queryResult.iLastPage = atoi(px)&2?1:0;
- for (i=j=0; i<lNode->numChild; i++) {
- itemNode = lNode->child[i];
- if (!strcmp(itemNode->name, "i")) {
- n = JabberXmlGetAttrValue(itemNode, "n");
- c = JabberXmlGetAttrValue(itemNode, "c");
- x = JabberXmlGetAttrValue(itemNode, "x");
- if ((id=JabberXmlGetAttrValue(itemNode, "i")) != NULL) {
- queryResult.pItems[j].pszID = JabberTextDecode(id);
- queryResult.pItems[j].pszName = JabberTextDecode(n);
- queryResult.pItems[j].iCount = atoi(c);
- queryResult.pItems[j].dwFlags = atoi(x);
- j++;
- }
- }
- }
- queryResult.iItemsNum = j;
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
- mir_free(p);
-}
-void TlenIqResultUserRooms(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *lNode, *itemNode;
- char *id, *n;
- int i, j;
- MUCCQUERYRESULT queryResult;
- if ((lNode=JabberXmlGetChild(iqNode, "l")) == NULL) return;
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_USER_ROOMS;
- queryResult.pszModule = proto->iface.m_szModuleName;
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * lNode->numChild);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * lNode->numChild);
- for (i=j=0; i<lNode->numChild; i++) {
- itemNode = lNode->child[i];
- if (!strcmp(itemNode->name, "i")) {
- n = JabberXmlGetAttrValue(itemNode, "n");
- id = JabberXmlGetAttrValue(itemNode, "i");
- if (n != NULL && id != NULL) {
- queryResult.pItems[j].pszID = JabberTextDecode(id);
- queryResult.pItems[j].pszName = JabberTextDecode(n);
- j++;
- }
- }
- }
- queryResult.iItemsNum = j;
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
-}
-void TlenIqResultUserNicks(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *lNode, *itemNode;
- char *n;
- int i, j;
- MUCCQUERYRESULT queryResult;
- if ((lNode=JabberXmlGetChild(iqNode, "l")) == NULL) return;
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_USER_NICKS;
- queryResult.pszModule = proto->iface.m_szModuleName;
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * lNode->numChild);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * lNode->numChild);
- for (i=j=0; i<lNode->numChild; i++) {
- itemNode = lNode->child[i];
- if (!strcmp(itemNode->name, "i")) {
- n = JabberXmlGetAttrValue(itemNode, "n");
- queryResult.pItems[j].pszID = NULL;//JabberTextDecode(n);
- queryResult.pItems[j].pszName = JabberTextDecode(n);
- j++;
- }
- }
- queryResult.iItemsNum = j;
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
-}
-void TlenIqResultChatRoomUsers(TlenProtocol *proto, XmlNode *iqNode)
-{
- XmlNode *lNode, *itemNode;
- char *id, *n;
- int i, j;
- MUCCQUERYRESULT queryResult;
- if ((lNode=JabberXmlGetChild(iqNode, "l")) == NULL) return;
- if ((id=JabberXmlGetAttrValue(iqNode, "from")) == NULL) return;
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_USERS;
- queryResult.pszModule = proto->iface.m_szModuleName;
- queryResult.pszParent = id;
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * lNode->numChild);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * lNode->numChild);
- for (i=j=0; i<lNode->numChild; i++) {
- itemNode = lNode->child[i];
- if (!strcmp(itemNode->name, "i")) {
- id = JabberXmlGetAttrValue(itemNode, "i");
- if (id != NULL) {
- queryResult.pItems[j].pszID = JabberTextDecode(id);
- n = JabberXmlGetAttrValue(itemNode, "n");
- if (n!=NULL) {
- queryResult.pItems[j].pszName = JabberTextDecode(n);
- }
- n = JabberXmlGetAttrValue(itemNode, "a");
- if (n!=NULL) {
- queryResult.pItems[j].pszNick = JabberTextDecode(n);
- }
- n = JabberXmlGetAttrValue(itemNode, "r");
- if (n!=NULL) {
- queryResult.pItems[j].pszText = JabberTextDecode(n);
- }
- n = JabberXmlGetAttrValue(itemNode, "e");
- if (n!=NULL) {
- queryResult.pItems[j].iCount = atoi(n);
- }
- n = JabberXmlGetAttrValue(itemNode, "s");
- if (n!=NULL) {
- queryResult.pItems[j].dwFlags = atoi(n);
- }
- j++;
- }
- }
- }
- queryResult.iItemsNum = j;
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
-}
-
-void TlenIqResultRoomSearch(TlenProtocol *proto, XmlNode *iqNode)
-{
- char *iqId, *id;
- JABBER_LIST_ITEM *item;
- iqId=JabberXmlGetAttrValue(iqNode, "id");
- item=JabberListGetItemPtr(proto, LIST_SEARCH, iqId);
- if ((id=JabberXmlGetAttrValue(iqNode, "i")) != NULL) {
- MUCCEVENT mucce;
- id = JabberTextDecode(id);
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_JOIN;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = id;
- mucce.pszName = id;
- if (item!=NULL) {
- mucce.pszName = item->roomName;
- }
- mucce.pszNick = NULL;
- mucce.dwFlags = MUCC_EF_ROOM_NICKNAMES;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- mir_free(id);
- }
- JabberListRemove(proto, LIST_SEARCH, iqId);
-}
-
-void TlenIqResultRoomInfo(TlenProtocol *proto, XmlNode *iqNode)
-{
- char *id, *name, *group, *flags;
- if ((id=JabberXmlGetAttrValue(iqNode, "from")) != NULL) {
- if ((name=JabberXmlGetAttrValue(iqNode, "n")) != NULL) {
- MUCCEVENT mucce;
- group = JabberXmlGetAttrValue(iqNode, "cn");
- flags = JabberXmlGetAttrValue(iqNode, "x");
- id = JabberTextDecode(id);
- name = JabberTextDecode(name);
- mucce.cbSize = sizeof(MUCCEVENT);
- mucce.iType = MUCC_EVENT_ROOM_INFO;
- mucce.pszModule = proto->iface.m_szModuleName;
- mucce.pszID = id;
- mucce.pszName = name;
- mucce.dwFlags = atoi(flags);
- CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
- mir_free(id);
- mir_free(name);
- }
- }
-}
-
-
-typedef struct {
- TlenProtocol *proto;
- char *roomId;
-} MUCSENDQUERYTHREADDATA;
-
-static void __cdecl TlenMUCCSendQueryResultThread(void *ptr)
-{
- HANDLE hContact;
- MUCCQUERYRESULT queryResult;
- DBVARIANT dbv;
- MUCSENDQUERYTHREADDATA* threadData = (MUCSENDQUERYTHREADDATA*)ptr;
- queryResult.cbSize = sizeof (MUCCQUERYRESULT);
- queryResult.iType = MUCC_EVENT_QUERY_CONTACTS;
- queryResult.pszModule = threadData->proto->iface.m_szModuleName;
- queryResult.pszParent = threadData->roomId;
- queryResult.iItemsNum = 0;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- char *str = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(str!=NULL && !strcmp(str, threadData->proto->iface.m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->iface.m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->iface.m_szModuleName, "jid", &dbv)) {
- if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
- queryResult.iItemsNum++;
- }
- DBFreeVariant(&dbv);
- }
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
- queryResult.pItems = mir_alloc(sizeof(MUCCQUERYITEM) * queryResult.iItemsNum);
- memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * queryResult.iItemsNum);
- queryResult.iItemsNum = 0;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- char *baseProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(baseProto!=NULL && !strcmp(baseProto, threadData->proto->iface.m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->iface.m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->iface.m_szModuleName, "jid", &dbv)) {
- if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
- queryResult.pItems[queryResult.iItemsNum].pszID = mir_strdup(dbv.pszVal);
- queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
- queryResult.iItemsNum++;
- }
- DBFreeVariant(&dbv);
- }
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
- CallService(MS_MUCC_QUERY_RESULT, 0, (LPARAM) &queryResult);
- TlenMUCFreeQueryResult(&queryResult);
- mir_free(threadData->roomId);
- mir_free(threadData);
-}
-
-
-static int TlenMUCQueryContacts(TlenProtocol *proto, const char *roomId) {
-
- MUCSENDQUERYTHREADDATA *threadData = (MUCSENDQUERYTHREADDATA *)mir_alloc(sizeof(MUCSENDQUERYTHREADDATA));
- threadData->proto = proto;
- threadData->roomId = mir_strdup(roomId);
- JabberForkThread(TlenMUCCSendQueryResultThread, 0, (void *)threadData);
- return 1;
-}
-
-
-INT_PTR TlenMUCMenuHandleMUC(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) {
- return 1;
- }
- JabberSend(proto, "<p to='c' tp='c' id='"JABBER_IQID"%d'/>", JabberSerialNext(proto));
- /*
- MUCCEVENT *mucce;
- mucce = (MUCCEVENT *) mir_alloc (sizeof(MUCCEVENT));
- mucce->cbSize = sizeof(MUCCEVENT);
- mucce->iType = MUCC_EVENT_JOIN;
- mucce->dwFlags = 0;
- mucce->pszModule = iface.m_szModuleName;
- mucce->pszID = NULL;
- mucce->pszName = NULL;
- mucce->pszNick = NULL;
- CallService(MS_MUCC_EVENT, 0, (LPARAM) mucce);
- mir_free(mucce);
- */
- return 0;
-}
-
-INT_PTR TlenMUCMenuHandleChats(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- MUCCWINDOW mucw;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) {
- return 1;
- }
- mucw.cbSize = sizeof(MUCCWINDOW);
- mucw.iType = MUCC_WINDOW_CHATLIST;
- mucw.pszModule = proto->iface.m_szModuleName;
- mucw.pszModuleName = proto->iface.m_szProtoName;
- CallService(MS_MUCC_NEW_WINDOW, 0, (LPARAM) &mucw);
- return 0;
-}
-
-INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- JABBER_LIST_ITEM *item;
- TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!proto->isOnline) {
- return 1;
- }
- if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- char serialId[32];
- sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
- item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
- item->nick = mir_strdup(dbv.pszVal);
- JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
- DBFreeVariant(&dbv);
- }
- }
- return 0;
-}
diff --git a/protocols/Tlen/tlen_muc.h b/protocols/Tlen/tlen_muc.h
deleted file mode 100644
index fc1713a837..0000000000
--- a/protocols/Tlen/tlen_muc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _TLEN_MUC_H_
-#define _TLEN_MUC_H_
-
-#include <windows.h>
-#include "m_mucc.h"
-
-#define USER_FLAGS_OWNER 0x01
-#define USER_FLAGS_ADMIN 0x02
-#define USER_FLAGS_REGISTERED 0x04
-#define USER_FLAGS_GLOBALOWNER 0x08
-#define USER_FLAGS_KICKED 0x80
-
-extern BOOL TlenMUCInit(TlenProtocol *proto);
-extern INT_PTR TlenMUCMenuHandleMUC(void *ptr, WPARAM wParam, LPARAM lParam);
-extern INT_PTR TlenMUCMenuHandleChats(void *ptr, WPARAM wParam, LPARAM lParam);
-extern INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, WPARAM wParam, LPARAM lParam);
-extern int TlenMUCCreateWindow(TlenProtocol *proto, const char *roomID, const char *roomName, int roomFlags, const char *nick, const char *iqId);
-extern int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomJid, const char *roomName, const char *from, const char *reason);
-extern int TlenMUCRecvPresence(TlenProtocol *proto, const char *from, int status, int flags, const char *kick);
-extern int TlenMUCRecvMessage(TlenProtocol *proto, const char *from, long timestamp, XmlNode *bodyNode);
-extern int TlenMUCRecvTopic(TlenProtocol *proto, const char *from, const char *subject);
-extern int TlenMUCRecvError(TlenProtocol *proto, const char *from, XmlNode *errorNode);
-
-#endif
diff --git a/protocols/Tlen/tlen_p2p_new.c b/protocols/Tlen/tlen_p2p_new.c
deleted file mode 100644
index 7d9c959a42..0000000000
--- a/protocols/Tlen/tlen_p2p_new.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "jabber_list.h"
-#include "tlen_p2p_old.h"
-
-
-static void logInfo(const char *filename, const char *fmt, ...) {
- SYSTEMTIME time;
- char *str;
- va_list vararg;
- int strsize;
- FILE *flog=fopen(filename,"at");
- if (flog!=NULL) {
- GetLocalTime(&time);
- va_start(vararg, fmt);
- str = (char *) mir_alloc(strsize=2048);
- while (_vsnprintf(str, strsize, fmt, vararg) == -1)
- str = (char *) realloc(str, strsize+=2048);
- va_end(vararg);
- fprintf(flog,"%04d-%02d-%02d %02d:%02d:%02d,%03d [%s]",time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond,time.wMilliseconds, "INFO");
- fprintf(flog," %s\n",str);
- mir_free(str);
- fclose(flog);
- }
-}
-
-void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft)
-{
- JabberLog(ft->proto, "P2P receive thread started");
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
-// ft->mode = FT_RECV;
-// ft->currentFile = 0;
-// ft->state = FT_CONNECTING;
- {
- FILE * fout = fopen("tlen_recv.dxx", "wt");
- SOCKADDR_IN toad;
- toad.sin_family = AF_INET;
- toad.sin_addr.s_addr = inet_addr(ft->hostName);
- toad.sin_port = htons(ft->wPort);
- if (fout != NULL) {
- fprintf(fout, "START:\n");
- }
- if (fout != NULL) {
- fclose(fout);
- }
- while (ft->udps != INVALID_SOCKET) {
- SOCKADDR_IN cad;
- int alen;
- int j, n;
- unsigned char buff[1024];
- alen = sizeof(struct sockaddr);
- n=recvfrom(ft->udps, (char*)buff,sizeof(buff),0, (struct sockaddr *) &cad, &alen);
- if (n<0) {
- break;
- }
- logInfo("tlen_recv.dxx", "UDP");
- fout = fopen("tlen_recv.dxx", "at");
- if (fout != NULL) {
- fprintf(fout, "\n|RECV %d bytes from %s:%d|",n, inet_ntoa(cad.sin_addr), cad.sin_port);
- for (j = 0; j < n; j++) {
- fprintf(fout, "%02X-", buff[j]);
- }
- }
- if (n == 1) {
- alen = sizeof(struct sockaddr);
- n = sendto(ft->udps, (char*)buff, n, 0,(struct sockaddr *) &toad, alen);
- if (fout != NULL) {
- fprintf(fout, "\n|SEND |");
- for (j = 0; j < n; j++) {
- fprintf(fout, "%02X-", buff[j]);
- }
- }
- }
- if (fout != NULL) {
- fprintf(fout, "\n");
- fclose(fout);
- }
- }
- }
- if (ft->udps != INVALID_SOCKET) {
- closesocket(ft->udps);
- }
-
- JabberListRemove(ft->proto, LIST_FILE, ft->iqId);
- if (ft->state==FT_DONE)
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- else {
- ProtoBroadcastAck(ft->proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- }
- JabberLog(ft->proto, "P2P receive thread ended");
- TlenP2PFreeFileTransfer(ft);
-}
-
-void __cdecl TlenNewFileSendThread(TLEN_FILE_TRANSFER *ft)
-{
- JabberLog(ft->proto, "P2P send thread started");
-// ft->mode = FT_RECV;
-// ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
-// ft->currentFile = 0;
-// ft->state = FT_CONNECTING;
- {
- FILE * fout = fopen("tlen_send.gxx", "wt");
- int step = 0;
- SOCKADDR_IN toad;
- toad.sin_family = AF_INET;
- toad.sin_addr.s_addr = inet_addr(ft->hostName);
- toad.sin_port = htons(ft->wPort);
-
- if (fout != NULL) {
- fprintf(fout, "START:");
- }
- if (fout != NULL) {
- fclose(fout);
- }
- for (step = 0; step < 10; step ++) {
-// while (ft->udps != INVALID_SOCKET) {
- int alen;
- int j, n;
- unsigned char buff[1024];
- alen = sizeof(struct sockaddr);
- if (step < 3 || step > 5) {
- buff[0] = 1;
- n = 1;
- } else {
- buff[0] = '$';
- buff[1] = '^';
- buff[2] = '&';
- buff[3] = '%';
- n = 4;
- }
- n=sendto(ft->udps, (char*)buff, n, 0, (struct sockaddr *)&toad, alen);
- logInfo("tlen_send.dxx", "UDP");
- if (fout != NULL) {
- fprintf(fout, "|send: %d %s %d|",n, inet_ntoa(toad.sin_addr), toad.sin_port);
- for (j = 0; j < n; j++) {
- fprintf(fout, "%02X-", buff[j]);
- }
- }
- if (fout != NULL) {
- fprintf(fout, "\n");
- fclose(fout);
- }
- SleepEx(1000, TRUE);
- }
- }
- JabberLog(ft->proto, "P2P send thread ended");
-}
-
-void TlenBindUDPSocket(TLEN_FILE_TRANSFER *ft)
-{
- JabberLog(ft->proto, "Binding UDP socket");
- ft->udps = socket(PF_INET, SOCK_DGRAM, 0);
- if (ft->udps != INVALID_SOCKET) {
- SOCKADDR_IN sin;
- int len = sizeof(struct sockaddr);
- memset((char *)&sin,0,sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = htonl(INADDR_ANY);;
- sin.sin_port = 0;
- if (bind(ft->udps, (struct sockaddr *)&sin, sizeof(sin)) >= 0) {
- if(!getsockname((SOCKET)ft->udps,(SOCKADDR *)&sin,&len)) {
- struct hostent *hp;
- char host_name[256];
- gethostname(host_name, sizeof(host_name));
- hp = gethostbyname(host_name);
- mir_snprintf(host_name, sizeof(host_name), "%u.%u.%u.%u", (unsigned char)hp->h_addr_list[0][0],
- (unsigned char)hp->h_addr_list[0][1],
- (unsigned char)hp->h_addr_list[0][2],
- (unsigned char)hp->h_addr_list[0][3]);
-
- ft->wLocalPort = ntohs(sin.sin_port);
- ft->localName= mir_strdup(host_name);
- JabberLog(ft->proto, "UDP socket bound to %s:%d", ft->localName, ft->wLocalPort);
- }
- }
- }
-}
-
-
-/*
-aaa sends a file to bbb:
-
-1) aaa wants to SEND bbb a file
-A SEND: <iq to='bbb@tlen.pl'><query xmlns='p2p'><fs t="bbb@tlen.pl" e="1" i="179610858" c="1" s="308278" v="2" /></query></iq>
-B RECV: <iq from='aaa@tlen.pl'><query xmlns='p2p'><fs t="bbb@tlen.pl" e="1" i="179610858" c="1" s="308278" v="2" /></query></iq>
-
-2) bbb ACCEPTs
-B SEND: <iq to='aaa@tlen.pl'><query xmlns='p2p'><fs t="aaa@tlen.pl" e="5" i="179610858" v="2" /></query></iq>
-A RECV: <iq from='bbb@tlen.pl'><query xmlns='p2p'><fs t="aaa@tlen.pl" e="5" i="179610858" v="2" /></query></iq>
-
-3) aaa tries to establish p2p connection:
-A SEND: <iq to='bbb@tlen.pl'><query xmlns='p2p'><dcng n='file_send' k='5' v='2' s='1' i='179610858' ck='rNbjnfRSQwJyaI+oRAXmfQ==' ks='16' iv='MAfaCCrqtuU2Ngw=rNbjnfRSQwJyaI+oRAXmfQ==' mi='24835584'/></query></iq>
-B SEND: <iq from='aaa@tlen.pl'><query xmlns='p2p'><dcng n='file_send' k='5' v='2' s='1' i='179610858' ck='rNbjnfRSQwJyaI+oRAXmfQ==' ks='16' iv='MAfaCCrqtuU2Ngw=rNbjnfRSQwJyaI+oRAXmfQ==' mi='24835584'/></query></iq>
-
-3) bbb sends IP/port details
-B SEND: <iq to='bbb@tlen.pl'><query xmlns='p2p'><dcng la='xx.xx.xx.xx' lp='nnn' pa='xx.xx.xx.xx' pp='nnn' i='179610858' v='2' k='5' s='2'/></query></iq>
-
-*/
-
-void TlenProcessP2P(XmlNode *node, ThreadData *info) {
- XmlNode *queryNode;
- JABBER_LIST_ITEM *item;
- char *from;
-
- if (info == NULL) return;
-
- queryNode = JabberXmlGetChild(node, "query");
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- XmlNode *fs , *vs, *dcng, *dc;
- /* file send */
- fs = JabberXmlGetChild(queryNode, "fs");
- /* voice send */
- vs = JabberXmlGetChild(queryNode, "vs");
- dcng = JabberXmlGetChild(queryNode, "dcng");
- dc = JabberXmlGetChild(queryNode, "dc");
- if (fs != NULL) {
- char *e, *id;
- /* e - step in the process (starting with 1)*/
- /* i - id of the file */
- /* s - size of the file */
- /* c - number of files */
- /* v - ??? */
- e = JabberXmlGetAttrValue(fs, "e");
- id = JabberXmlGetAttrValue(fs, "i");
- if (e != NULL) {
- if (!strcmp(e, "1")) {
- CCSDATA ccs;
- PROTORECVEVENT pre;
- char *c, *s;
- TLEN_FILE_TRANSFER * ft = (TLEN_FILE_TRANSFER *) mir_alloc(sizeof(TLEN_FILE_TRANSFER));
- memset(ft, 0, sizeof(TLEN_FILE_TRANSFER));
- c = JabberXmlGetAttrValue(fs, "c");
- s = JabberXmlGetAttrValue(fs, "s");
- ft->jid = mir_strdup(from);
- ft->proto = info->proto;
- ft->hContact = JabberHContactFromJID(info->proto, from);
- ft->iqId = mir_strdup(id);
- ft->fileTotalSize = atoi(s);
- ft->newP2P = TRUE;
- if ((item=JabberListAdd(ft->proto, LIST_FILE, ft->iqId)) != NULL) {
- char *szBlob;
- char fileInfo[128];
- item->ft = ft;
- mir_snprintf(fileInfo, sizeof(fileInfo), "%s file(s), %s bytes", c, s);
- // blob is DWORD(*ft), ASCIIZ(filenames), ASCIIZ(description)
- szBlob = (char *) mir_alloc(sizeof(DWORD) + strlen(fileInfo) + 2);
- *((PDWORD) szBlob) = (DWORD) ft;
- strcpy(szBlob + sizeof(DWORD), fileInfo);
- szBlob[sizeof(DWORD) + strlen(fileInfo) + 1] = '\0';
- pre.flags = 0;
- pre.timestamp = time(NULL);
- pre.szMessage = szBlob;
- pre.lParam = 0;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = ft->hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) &pre;
- JabberLog(ft->proto, "sending chainrecv");
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
- mir_free(szBlob);
- }
- } else if (!strcmp(e, "3")) {
- /* transfer error */
- } else if (!strcmp(e, "4")) {
- /* transfer denied */
- } else if (!strcmp(e, "5")) {
- /* transfer accepted */
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, id)) != NULL) {
- item->id2 = mir_strdup("84273372");
- item->ft->id2 = mir_strdup("84273372");
- JabberSend(info->proto, "<iq to='%s'><query xmlns='p2p'><dcng n='file_send' k='5' v='2' s='1' i='%s' ck='o7a32V9n2UZYCWpBUhSbFw==' ks='16' iv='MhjWEj9WTsovrQc=o7a32V9n2UZYCWpBUhSbFw==' mi='%s'/></query></iq>", from, item->id2, id);
- }
- }
- }
- } else if (vs != NULL) {
-
- } else if (dcng != NULL) {
- char *s, *id, *id2;
- JabberLog(info->proto, "DCNG");
- s = JabberXmlGetAttrValue(dcng, "s");
- id2 = JabberXmlGetAttrValue(dcng, "i");
- id = JabberXmlGetAttrValue(dcng, "mi");
- if (!strcmp(s, "1")) {
- /* Keys */
- /* n - name (file_send) */
- /* k - ??? */
- /* v - ??? */
- /* s - step */
- /* i - id of the file */
- /* ck - aes key */
- /* ks - key size (in bytes) */
- /* iv - aes initial vector */
- /* mi - p2p connection id */
- char *n, *k, *v, *ck, *ks, *iv;
- n = JabberXmlGetAttrValue(dcng, "n");
- k = JabberXmlGetAttrValue(dcng, "k");
- v = JabberXmlGetAttrValue(dcng, "v");
- ck = JabberXmlGetAttrValue(dcng, "ck");
- iv = JabberXmlGetAttrValue(dcng, "iv");
- if (!strcmp(n, "file_send")) {
- if ((item=JabberListGetItemPtr(info->proto, LIST_FILE, id)) != NULL) {
- item->id2 = mir_strdup(id2);
- item->ft->id2 = mir_strdup(id2);
- TlenBindUDPSocket(item->ft);
- JabberSend(info->proto, "<iq to='%s'><query xmlns='p2p'><dcng la='%s' lp='%d' pa='%s' pp='%d' i='%s' v='2' k='5' s='2'/></query></iq>",
- item->ft->jid, item->ft->localName, item->ft->wLocalPort, item->ft->localName, item->ft->wLocalPort, item->ft->id2);
- }
- }
- } else if (!strcmp(s, "2")) {
- JabberLog(info->proto, "step = 2");
- JabberLog(info->proto, "%s",from);
- JabberLog(info->proto, "%s",id2);
- /* IP and port */
- if ((item=JabberListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
- item->ft->hostName = mir_strdup(JabberXmlGetAttrValue(dcng, "pa"));
- item->ft->wPort = atoi(JabberXmlGetAttrValue(dcng, "pp"));
- TlenBindUDPSocket(item->ft);
- JabberSend(info->proto, "<iq to='%s'><query xmlns='p2p'><dcng la='%s' lp='%d' pa='%s' pp='%d' i='%s' k='5' s='4'/></query></iq>",
- item->ft->jid, item->ft->localName, item->ft->wLocalPort, item->ft->localName, item->ft->wLocalPort, item->ft->id2);
- JabberForkThread((void (__cdecl *)(void*))TlenNewFileReceiveThread, 0, item->ft);
- JabberForkThread((void (__cdecl *)(void*))TlenNewFileSendThread, 0, item->ft);
- }
- } else if (!strcmp(s, "4")) {
- /* IP and port */
- if ((item=JabberListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
- JabberLog(info->proto, "step = 4");
- item->ft->hostName = mir_strdup(JabberXmlGetAttrValue(dcng, "pa"));
- item->ft->wPort = atoi(JabberXmlGetAttrValue(dcng, "pp"));
- JabberForkThread((void (__cdecl *)(void*))TlenNewFileReceiveThread, 0, item->ft);
- }
- }
-
- } else if (dc != NULL) {
-
- }
- }
-}
diff --git a/protocols/Tlen/tlen_p2p_old.c b/protocols/Tlen/tlen_p2p_old.c
deleted file mode 100644
index 0d5c121535..0000000000
--- a/protocols/Tlen/tlen_p2p_old.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "jabber_list.h"
-#include "tlen_p2p_old.h"
-
-void TlenP2PFreeFileTransfer(TLEN_FILE_TRANSFER *ft)
-{
- int i;
- if (ft->jid) mir_free(ft->jid);
- if (ft->iqId) mir_free(ft->iqId);
- if (ft->id2) mir_free(ft->id2);
- if (ft->hostName) mir_free(ft->hostName);
- if (ft->localName) mir_free(ft->localName);
- if (ft->szSavePath) mir_free(ft->szSavePath);
- if (ft->szDescription) mir_free(ft->szDescription);
- if (ft->filesSize) mir_free(ft->filesSize);
- if (ft->files) {
- for (i=0; i<ft->fileCount; i++) {
- if (ft->files[i]) mir_free(ft->files[i]);
- }
- mir_free(ft->files);
- }
- mir_free(ft);
-}
-
-TLEN_FILE_PACKET *TlenP2PPacketCreate(int datalen)
-{
- TLEN_FILE_PACKET *packet;
-
- if ((packet=(TLEN_FILE_PACKET *) mir_alloc(sizeof(TLEN_FILE_PACKET))) == NULL)
- return NULL;
- packet->packet = NULL;
- if (datalen > 0) {
- if ((packet->packet=(char *) mir_alloc(datalen)) == NULL) {
- mir_free(packet);
- return NULL;
- }
- }
- packet->maxDataLen = datalen;
- packet->type=0;
- packet->len=0;
- return packet;
-}
-
-void TlenP2PPacketFree(TLEN_FILE_PACKET *packet)
-{
- if (packet != NULL) {
- if (packet->packet != NULL)
- mir_free(packet->packet);
- mir_free(packet);
- }
-}
-
-void TlenP2PPacketSetType(TLEN_FILE_PACKET *packet, DWORD type)
-{
- if (packet!=NULL) {
- packet->type = type;
- }
-}
-
-void TlenP2PPacketSetLen(TLEN_FILE_PACKET *packet, DWORD len)
-{
- if (packet!=NULL) {
- packet->len = len;
- }
-}
-
-void TlenP2PPacketPackDword(TLEN_FILE_PACKET *packet, DWORD data)
-{
- if (packet!=NULL && packet->packet!=NULL) {
- if (packet->len + sizeof(DWORD) <= packet->maxDataLen) {
- (*((DWORD*)((packet->packet)+(packet->len)))) = data;
- packet->len += sizeof(DWORD);
- }
- }
-}
-
-void TlenP2PPacketPackBuffer(TLEN_FILE_PACKET *packet, char *buffer, int len)
-{
- if (packet!=NULL && packet->packet!=NULL) {
- if (packet->len + len <= packet->maxDataLen) {
- memcpy((packet->packet)+(packet->len), buffer, len);
- packet->len += len;
- }
- }
-}
-
-void TlenP2PInit() {
-}
-
-void TlenP2PUninit() {
-}
-
-int TlenP2PPacketSend(JABBER_SOCKET s, TLEN_FILE_PACKET *packet)
-{
- DWORD sendResult;
- if (packet!=NULL && packet->packet!=NULL) {
- Netlib_Send(s, (char *)&packet->type, 4, MSG_NODUMP);
- Netlib_Send(s, (char *)&packet->len, 4, MSG_NODUMP);
- sendResult=Netlib_Send(s, packet->packet, packet->len, MSG_NODUMP);
- if (sendResult==SOCKET_ERROR || sendResult!=packet->len) return 0;
- }
- return 1;
-}
-
-TLEN_FILE_PACKET* TlenP2PPacketReceive(JABBER_SOCKET s)
-{
- TLEN_FILE_PACKET *packet;
- DWORD recvResult;
- DWORD type, len, pos;
- recvResult = Netlib_Recv(s, (char *)&type, 4, MSG_NODUMP);
- if (recvResult==0 || recvResult==SOCKET_ERROR) return NULL;
- recvResult = Netlib_Recv(s, (char *)&len, 4, MSG_NODUMP);
- if (recvResult==0 || recvResult==SOCKET_ERROR) return NULL;
- packet = TlenP2PPacketCreate(len);
- TlenP2PPacketSetType(packet, type);
- TlenP2PPacketSetLen(packet, len);
- pos = 0;
- while (len > 0) {
- recvResult = Netlib_Recv(s, packet->packet+pos, len, MSG_NODUMP);
- if (recvResult==0 || recvResult==SOCKET_ERROR) {
- TlenP2PPacketFree(packet);
- return NULL;
- }
- len -= recvResult;
- pos += recvResult;
- }
- return packet;
-}
-
-void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck)
-{
- char *hash;
- char str[300];
- TLEN_FILE_PACKET *packet;
- TlenProtocol *proto = ft->proto;
-
- JabberLog(proto, "Establishing outgoing connection.");
- ft->state = FT_ERROR;
- if ((packet = TlenP2PPacketCreate(2*sizeof(DWORD) + 20))!=NULL) {
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST);
- TlenP2PPacketPackDword(packet, 1);
- TlenP2PPacketPackDword(packet, (DWORD) atoi(ft->iqId));
- _snprintf(str, sizeof(str), "%08X%s%d", atoi(ft->iqId), proto->threadData->username, atoi(ft->iqId));
- hash = TlenSha1(str, (int)strlen(str));
- TlenP2PPacketPackBuffer(packet, hash, 20);
- mir_free(hash);
- TlenP2PPacketSend(ft->s, packet);
- TlenP2PPacketFree(packet);
- packet = TlenP2PPacketReceive(ft->s);
- if (packet != NULL) {
- if (packet->type == TLEN_FILE_PACKET_CONNECTION_REQUEST_ACK) { // acknowledge
- if ((int)(*((DWORD*)packet->packet)) == atoi(ft->iqId)) {
- ft->state = FT_CONNECTING;
- if (sendAck) {
- ProtoBroadcastAck(proto->iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, ft, 0);
- }
- }
- }
- TlenP2PPacketFree(packet);
- }
- }
-}
-
-TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, JABBER_SOCKET s, int list, BOOL sendAck)
-{
- JABBER_LIST_ITEM *item = NULL;
- TLEN_FILE_PACKET *packet;
- int i;
- char str[300];
- DWORD iqId;
- // TYPE: 0x1
- // LEN:
- // (DWORD) 0x1
- // (DWORD) id
- // (BYTE) hash[20]
- packet = TlenP2PPacketReceive(s);
- if (packet == NULL || packet->type != TLEN_FILE_PACKET_CONNECTION_REQUEST || packet->len<28) {
- if (packet!=NULL) {
- TlenP2PPacketFree(packet);
- }
- return NULL;
- }
- iqId = *((DWORD *)(packet->packet+sizeof(DWORD)));
- i = 0;
- while ((i=JabberListFindNext(proto, list, i)) >= 0) {
- if ((item=JabberListGetItemPtrFromIndex(proto, i))!=NULL) {
- _snprintf(str, sizeof(str), "%d", iqId);
- if (!strcmp(item->ft->iqId, str)) {
- char *hash, *nick;
- int j;
- nick = JabberNickFromJID(item->ft->jid);
- _snprintf(str, sizeof(str), "%08X%s%d", iqId, nick, iqId);
- mir_free(nick);
- hash = TlenSha1(str, (int)strlen(str));
- for (j=0;j<20;j++) {
- if (hash[j]!=packet->packet[2*sizeof(DWORD)+j]) break;
- }
- mir_free(hash);
- if (j==20) break;
- }
- }
- i++;
- }
- TlenP2PPacketFree(packet);
- if (i >=0) {
- if ((packet=TlenP2PPacketCreate(sizeof(DWORD))) != NULL) {
- // Send connection establishment acknowledgement
- TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST_ACK);
- TlenP2PPacketPackDword(packet, (DWORD) atoi(item->ft->iqId));
- TlenP2PPacketSend(s, packet);
- TlenP2PPacketFree(packet);
- item->ft->state = FT_CONNECTING;
- if (sendAck) {
- ProtoBroadcastAck(item->ft->proto->iface.m_szModuleName, item->ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, item->ft, 0);
- }
- return item->ft;
- }
- }
- return NULL;
-}
-
-static void __cdecl TlenFileBindSocks4Thread(TLEN_FILE_TRANSFER* ft)
-{
- BYTE buf[8];
- int status;
-
-// JabberLog("Waiting for the file to be sent via SOCKS...");
- status = Netlib_Recv(ft->s, (char*)buf, 8, MSG_NODUMP);
-// JabberLog("accepted connection !!!");
- if ( status == SOCKET_ERROR || status<8 || buf[1]!=90) {
- status = 1;
- } else {
- status = 0;
- }
- if (!status) {
- ft->pfnNewConnectionV2(ft->s, 0, NULL);
- } else {
- if (ft->state!=FT_SWITCH) {
- ft->state = FT_ERROR;
- }
- }
- JabberLog(ft->proto, "Closing connection for this file transfer...");
-// Netlib_CloseHandle(ft->s);
- if (ft->hFileEvent != NULL)
- SetEvent(ft->hFileEvent);
-
-}
-static void __cdecl TlenFileBindSocks5Thread(TLEN_FILE_TRANSFER* ft)
-{
- BYTE buf[256];
- int status;
-
-// JabberLog("Waiting for the file to be sent via SOCKS...");
- status = Netlib_Recv(ft->s, (char*)buf, sizeof(buf), MSG_NODUMP);
-// JabberLog("accepted connection !!!");
- if ( status == SOCKET_ERROR || status<7 || buf[1]!=0) {
- status = 1;
- } else {
- status = 0;
- }
- if (!status) {
- ft->pfnNewConnectionV2(ft->s, 0, NULL);
- } else {
- if (ft->state!=FT_SWITCH) {
- ft->state = FT_ERROR;
- }
- }
-// JabberLog("Closing connection for this file transfer...");
-// Netlib_CloseHandle(ft->s);
- if (ft->hFileEvent != NULL)
- SetEvent(ft->hFileEvent);
-
-}
-
-static JABBER_SOCKET TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
-{ //rfc1928
- int len;
- BYTE buf[256];
- int status;
- struct in_addr in;
- NETLIBOPENCONNECTION nloc;
- JABBER_SOCKET s;
-
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = sb->szHost;
- nloc.wPort = sb->wPort;
- nloc.flags = 0;
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hFileNetlibUser, (LPARAM) &nloc);
- if (s==NULL) {
-// JabberLog("Connection failed (%d), thread ended", WSAGetLastError());
- return NULL;
- }
- buf[0] = 4; //socks4
- buf[1] = 2; //2-bind, 1-connect
- *(PWORD)(buf+2) = htons(0); // port
- *(PDWORD)(buf+4) = INADDR_ANY;
- if (sb->useAuth) {
- strcpy((char*)buf+8, sb->szUser);
- len = (int)strlen(sb->szUser);
- } else {
- buf[8] = 0;
- len = 0;
- }
- len += 9;
- status = Netlib_Send(s, (char*)buf, len, MSG_NODUMP);
- if (status==SOCKET_ERROR || status<len) {
-// JabberLog("Send failed (%d), thread ended", WSAGetLastError());
- Netlib_CloseHandle(s);
- return NULL;
- }
- status = Netlib_Recv(s, (char*)buf, 8, MSG_NODUMP);
- if (status==SOCKET_ERROR || status<8 || buf[1]!=90) {
-// JabberLog("SOCKS4 negotiation failed");
- Netlib_CloseHandle(s);
- return NULL;
- }
- status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
- if ( status == SOCKET_ERROR || status<7 || buf[0]!=5 || buf[1]!=0) {
-// JabberLog("SOCKS5 request failed");
- Netlib_CloseHandle(s);
- return NULL;
- }
- in.S_un.S_addr = *(PDWORD)(buf+4);
- strcpy(sb->szHost, inet_ntoa(in));
- sb->wPort = htons(*(PWORD)(buf+2));
- ft->s = s;
- JabberForkThread((void (__cdecl *)(void*))TlenFileBindSocks4Thread, 0, ft);
- return s;
-}
-
-static JABBER_SOCKET TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
-{ //rfc1928
- BYTE buf[512];
- int len, status;
- NETLIBOPENCONNECTION nloc;
- struct in_addr in;
- JABBER_SOCKET s;
-
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = sb->szHost;
- nloc.wPort = sb->wPort;
- nloc.flags = 0;
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hFileNetlibUser, (LPARAM) &nloc);
- if (s==NULL) {
- JabberLog(ft->proto, "Connection failed (%d), thread ended", WSAGetLastError());
- return NULL;
- }
- buf[0] = 5; //yep, socks5
- buf[1] = 1; //one auth method
- buf[2] = sb->useAuth?2:0; // authorization
- status = Netlib_Send(s, (char*)buf, 3, MSG_NODUMP);
- if (status==SOCKET_ERROR || status<3) {
- JabberLog(ft->proto, "Send failed (%d), thread ended", WSAGetLastError());
- Netlib_CloseHandle(s);
- return NULL;
- }
- status = Netlib_Recv(s, (char*)buf, 2, MSG_NODUMP);
- if (status==SOCKET_ERROR || status<2 || (buf[1]!=0 && buf[1]!=2)) {
- JabberLog(ft->proto, "SOCKS5 negotiation failed");
- Netlib_CloseHandle(s);
- return NULL;
- }
- if(buf[1]==2) { //rfc1929
- int nUserLen, nPassLen;
- PBYTE pAuthBuf;
-
- nUserLen = (int)strlen(sb->szUser);
- nPassLen = (int)strlen(sb->szPassword);
- pAuthBuf = (PBYTE)mir_alloc(3+nUserLen+nPassLen);
- pAuthBuf[0] = 1; //auth version
- pAuthBuf[1] = nUserLen;
- memcpy(pAuthBuf+2, sb->szUser, nUserLen);
- pAuthBuf[2+nUserLen]=nPassLen;
- memcpy(pAuthBuf+3+nUserLen,sb->szPassword,nPassLen);
- status = Netlib_Send(s, (char*)pAuthBuf, 3+nUserLen+nPassLen, MSG_NODUMP);
- mir_free(pAuthBuf);
- if (status==SOCKET_ERROR || status<3+nUserLen+nPassLen) {
- JabberLog(ft->proto, "Send failed (%d), thread ended", WSAGetLastError());
- Netlib_CloseHandle(s);
- return NULL;
- }
- status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
- if (status==SOCKET_ERROR || status<2 || buf[1]!=0) {
- JabberLog(ft->proto, "SOCKS5 sub-negotiation failed");
- Netlib_CloseHandle(s);
- return NULL;
- }
- }
-
- { PBYTE pInit;
- int nHostLen=4;
- DWORD hostIP=INADDR_ANY;
- pInit=(PBYTE)mir_alloc(6+nHostLen);
- pInit[0]=5; //SOCKS5
- pInit[1]=2; //bind
- pInit[2]=0; //reserved
- pInit[3]=1;
- *(PDWORD)(pInit+4)=hostIP;
- *(PWORD)(pInit+4+nHostLen)=htons(0);
- status = Netlib_Send(s, (char*)pInit, 6+nHostLen, MSG_NODUMP);
- mir_free(pInit);
- if (status==SOCKET_ERROR || status<6+nHostLen) {
-// JabberLog("Send failed (%d), thread ended", WSAGetLastError());
- Netlib_CloseHandle(s);
- return NULL;
- }
- }
- status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
- if ( status == SOCKET_ERROR || status<7 || buf[0]!=5 || buf[1]!=0) {
-// JabberLog("SOCKS5 request failed");
- Netlib_CloseHandle(s);
- return NULL;
- }
- if (buf[2]==1) { // domain
- len = buf[4];
- memcpy(sb->szHost, buf+5, len);
- sb->szHost[len]=0;
- len += 4;
- } else { // ip address
- in.S_un.S_addr = *(PDWORD)(buf+4);
- strcpy(sb->szHost, inet_ntoa(in));
- len = 8;
- }
- sb->wPort = htons(*(PWORD)(buf+len));
- ft->s = s;
-
- JabberForkThread((void (__cdecl *)(void*))TlenFileBindSocks5Thread, 0, ft);
- return s;
-}
-
-
-JABBER_SOCKET TlenP2PListen(TLEN_FILE_TRANSFER *ft)
-{
- NETLIBBIND nlb = {0};
- JABBER_SOCKET s = NULL;
- int useProxy;
- DBVARIANT dbv;
- SOCKSBIND sb;
- struct in_addr in;
- TlenProtocol *proto = ft->proto;
- useProxy=0;
- if (ft->localName!= NULL) mir_free(ft->localName);
- ft->localName = NULL;
- ft->wPort = 0;
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "UseFileProxy", FALSE)) {
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "FileProxyHost", &dbv)) {
- strcpy(sb.szHost, dbv.pszVal);
- DBFreeVariant(&dbv);
- sb.wPort = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyPort", 0);
- sb.useAuth = FALSE;
- strcpy(sb.szUser, "");
- strcpy(sb.szPassword, "");
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "FileProxyAuth", FALSE)) {
- sb.useAuth = TRUE;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "FileProxyUsername", &dbv)) {
- strcpy(sb.szUser, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "FileProxyPassword", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- strcpy(sb.szPassword, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- }
- switch (DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "FileProxyType", 0)) {
- case 0: // forwarding
- useProxy = 1;
- break;
- case 1: // socks4
- s = TlenP2PBindSocks4(&sb, ft);
- useProxy = 2;
- break;
- case 2: // socks5
- s = TlenP2PBindSocks5(&sb, ft);
- useProxy = 2;
- break;
- }
- ft->localName = mir_strdup(sb.szHost);
- ft->wPort = sb.wPort;
- ft->wLocalPort = sb.wPort;
- }
- }
- if (useProxy<2) {
- nlb.cbSize = sizeof(NETLIBBIND);
- nlb.pfnNewConnectionV2 = ft->pfnNewConnectionV2;
- nlb.wPort = 0; // Use user-specified incoming port ranges, if available
- nlb.pExtra = proto;
- JabberLog(ft->proto, "Calling MS_NETLIB_BINDPORT");
- s = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nlb);
- JabberLog(ft->proto, "listening on %d",s);
- }
- if (useProxy==0) {
- in.S_un.S_addr = htonl(nlb.dwExternalIP);
- ft->localName = mir_strdup(inet_ntoa(in));
- ft->wPort = nlb.wPort;
- ft->wLocalPort = nlb.wExPort;
- }
- if (s != NULL) {
-// listenCount++;
- }
- return s;
-}
-
-void TlenP2PStopListening(JABBER_SOCKET s) {
- if (s != NULL) {
-// listenCount--;
-// if (listenCount <= 0) {
-// Netlib_CloseHandle(s);
-// }
- }
-}
diff --git a/protocols/Tlen/tlen_p2p_old.h b/protocols/Tlen/tlen_p2p_old.h
deleted file mode 100644
index d6405a378e..0000000000
--- a/protocols/Tlen/tlen_p2p_old.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-
-#ifndef _TLEN_P2P_OLD_H_
-#define _TLEN_P2P_OLD_H_
-
-enum {
- TLEN_FILE_PACKET_CONNECTION_REQUEST = 0x01,
- TLEN_FILE_PACKET_CONNECTION_REQUEST_ACK = 0x02,
- TLEN_FILE_PACKET_FILE_LIST = 0x32,
- TLEN_FILE_PACKET_FILE_LIST_ACK = 0x33,
- TLEN_FILE_PACKET_FILE_REQUEST = 0x34,
- TLEN_FILE_PACKET_FILE_DATA = 0x35,
- TLEN_FILE_PACKET_END_OF_FILE = 0x37,
- TLEN_VOICE_PACKET = 0x96
-};
-
-typedef struct {
- unsigned int maxDataLen;
- char *packet;
- DWORD type;
- DWORD len;
-} TLEN_FILE_PACKET;
-
-typedef struct {
- char szHost[256];
- int wPort;
- int useAuth;
- char szUser[256];
- char szPassword[256];
-}SOCKSBIND;
-
-extern void TlenP2PFreeFileTransfer(TLEN_FILE_TRANSFER *ft);
-extern TLEN_FILE_PACKET *TlenP2PPacketCreate(int datalen);
-extern void TlenP2PPacketFree(TLEN_FILE_PACKET *packet);
-extern void TlenP2PPacketSetType(TLEN_FILE_PACKET *packet, DWORD type);
-extern void TlenP2PPacketSetLen(TLEN_FILE_PACKET *packet, DWORD len);
-extern void TlenP2PPacketPackDword(TLEN_FILE_PACKET *packet, DWORD data);
-extern void TlenP2PPacketPackBuffer(TLEN_FILE_PACKET *packet, char *buffer, int len);
-extern int TlenP2PPacketSend(JABBER_SOCKET s, TLEN_FILE_PACKET *packet);
-extern TLEN_FILE_PACKET* TlenP2PPacketReceive(JABBER_SOCKET s);
-extern void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck);
-extern TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, JABBER_SOCKET s, int list, BOOL sendAck);
-extern JABBER_SOCKET TlenP2PListen(TLEN_FILE_TRANSFER *ft);
-extern void TlenP2PStopListening(JABBER_SOCKET s);
-#endif
diff --git a/protocols/Tlen/tlen_picture.c b/protocols/Tlen/tlen_picture.c
deleted file mode 100644
index c8f8d6f3e2..0000000000
--- a/protocols/Tlen/tlen_picture.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2009 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-#include "tlen_file.h"
-#include "tlen_p2p_old.h"
-
-typedef struct {
- TlenProtocol *proto;
- JABBER_LIST_ITEM *item;
-} TLENPSREQUESTTHREADDATA;
-
-static void LogPictureMessage(TlenProtocol *proto, const char *jid, const char *filename, BOOL isSent)
-{
- char message[1024];
- const char *msg = isSent ? "Image sent file://%s" : "Image received file://%s";
- _snprintf(message, sizeof(message), Translate(msg), filename);
- TlenLogMessage(proto, JabberHContactFromJID(proto, jid), isSent ? DBEF_SENT : 0, message);
-}
-
-static void TlenPsPostThread(void *ptr) {
- TLENPSREQUESTTHREADDATA *data = (TLENPSREQUESTTHREADDATA *)ptr;
- TlenProtocol *proto = data->proto;
- JABBER_LIST_ITEM *item = data->item;
- JABBER_SOCKET socket = JabberWsConnect(proto, "ps.tlen.pl", 443);
- BOOL bSent = FALSE;
- if (socket != NULL) {
- char header[512];
- DWORD ret;
- item->ft->s = socket;
- item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- _snprintf(header, sizeof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
- JabberWsSend(proto, socket, header, (int)strlen(header));
- ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
- if (ret == WAIT_OBJECT_0) {
- FILE *fp = fopen( item->ft->files[0], "rb" );
- if (fp) {
- int i;
- char header[512];
- char fileBuffer[2048];
- _snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
- JabberWsSend(proto, socket, header, (int)strlen(header));
- JabberLog(proto, "Sending picture data...");
- for (i = item->ft->filesSize[0]; i > 0; ) {
- int toread = min(2048, i);
- int readcount = (int)fread(fileBuffer, (size_t)1, (size_t)toread, fp);
- i -= readcount;
- if (readcount > 0) {
- JabberWsSend(proto, socket, fileBuffer, readcount);
- }
- if (toread != readcount) {
- break;
- }
- }
- fclose(fp);
- SleepEx(3000, TRUE);
- bSent = TRUE;
- } else {
- /* picture not found */
- }
- } else {
- /* 5 minutes passed */
- }
- Netlib_CloseHandle(socket);
- if (bSent) {
- JabberSend(proto, "<message to='%s' idt='%s' rt='%s' pid='1001' type='pic' />", item->ft->jid, item->jid, item->ft->id2);
- LogPictureMessage(proto, item->ft->jid, item->ft->files[0], TRUE);
- }
- TlenP2PFreeFileTransfer(item->ft);
- JabberListRemove(proto, LIST_PICTURE, item->jid);
- } else {
- /* cannot connect to ps server */
- }
- mir_free(data);
-}
-
-static void TlenPsPost(TlenProtocol *proto, JABBER_LIST_ITEM *item) {
- TLENPSREQUESTTHREADDATA *threadData = (TLENPSREQUESTTHREADDATA *)mir_alloc(sizeof(TLENPSREQUESTTHREADDATA));
- threadData->proto = proto;
- threadData->item = item;
- JabberForkThread(TlenPsPostThread, 0, threadData);
-}
-
-static void TlenPsGetThread(void *ptr) {
- TLENPSREQUESTTHREADDATA *data = (TLENPSREQUESTTHREADDATA *)ptr;
- TlenProtocol *proto = data->proto;
- JABBER_LIST_ITEM *item = data->item;
- FILE *fp;
- fp = fopen( item->ft->files[0], "wb" );
- if (fp) {
- JABBER_SOCKET socket = JabberWsConnect(proto, "ps.tlen.pl", 443);
- if (socket != NULL) {
- XmlState xmlState;
- char header[512];
- char fileBuffer[2048];
- JabberXmlInitState(&xmlState);
- _snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
- JabberWsSend(proto, socket, header, (int)strlen(header));
- JabberLog(proto, "Reveiving picture data...");
- {
- int totalcount = 0;
- int size = item->ft->filesSize[0];
- BOOL bHeader = TRUE;
- while (TRUE) {
- int readcount = JabberWsRecv(proto, socket, fileBuffer, 2048 - totalcount);
- if (readcount == 0) {
- break;
- }
- totalcount += readcount;
- if (bHeader) {
- char * tagend = memchr(fileBuffer, '/', totalcount);
- tagend = memchr(tagend + 1, '>', totalcount - (tagend - fileBuffer) - 1);
- if (tagend != NULL) {
- int parsed = JabberXmlParse(&xmlState, fileBuffer, tagend - fileBuffer + 1);
- if (parsed == 0) {
- continue;
- }
- bHeader = FALSE;
- totalcount -= parsed;
- memmove(fileBuffer, fileBuffer+parsed, totalcount);
- }
- }
- if (!bHeader) {
- if (totalcount > 0) {
- fwrite(fileBuffer, 1, totalcount, fp);
- size -= totalcount;
- totalcount = 0;
- }
- if (size == 0) {
- break;
- }
- }
- }
- }
- Netlib_CloseHandle(socket);
- JabberLog(proto, "Picture received...");
- LogPictureMessage(proto, item->ft->jid, item->ft->files[0], FALSE);
- } else {
- /* cannot connect to ps server */
- }
- fclose(fp);
- } else {
- /* cannot create file */
- }
- TlenP2PFreeFileTransfer(item->ft);
- JabberListRemove(proto, LIST_PICTURE, item->jid);
- mir_free(data);
-}
-
-static void TlenPsGet(TlenProtocol *proto, JABBER_LIST_ITEM *item) {
- TLENPSREQUESTTHREADDATA *threadData = (TLENPSREQUESTTHREADDATA *)mir_alloc(sizeof(TLENPSREQUESTTHREADDATA));
- threadData->proto = proto;
- threadData->item = item;
- JabberForkThread(TlenPsGetThread, 0, threadData);
-}
-
-void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
- JABBER_LIST_ITEM *item = NULL;
- char *crc, *crc_c, *idt, *size, *from, *fromRaw, *rt;
- from = JabberXmlGetAttrValue(node, "from");
- fromRaw = JabberLoginFromJID(from);
- idt = JabberXmlGetAttrValue(node, "idt");
- size = JabberXmlGetAttrValue(node, "size");
- crc_c = JabberXmlGetAttrValue(node, "crc_c");
- crc = JabberXmlGetAttrValue(node, "crc");
- rt = JabberXmlGetAttrValue(node, "rt");
- if (idt != NULL) {
- item = JabberListGetItemPtr(proto, LIST_PICTURE, idt);
- }
- if (item != NULL) {
- if (!strcmp(from, "ps")) {
- char *st = JabberXmlGetAttrValue(node, "st");
- if (st != NULL) {
- item->ft->iqId = mir_strdup(st);
- item->ft->id2 = mir_strdup(rt);
- if (item->ft->hFileEvent != NULL) {
- SetEvent(item->ft->hFileEvent);
- item->ft->hFileEvent = NULL;
- }
- }
- } else if (!strcmp(item->ft->jid, fromRaw)) {
- if (crc_c != NULL) {
- if (!strcmp(crc_c, "n")) {
- /* crc_c = n, picture transfer accepted */
- TlenPsPost(proto, item);
- } else if (!strcmp(crc_c, "f")) {
- /* crc_c = f, picture cached, no need to transfer again */
- LogPictureMessage(proto, item->ft->jid, item->ft->files[0], TRUE);
- TlenP2PFreeFileTransfer(item->ft);
- JabberListRemove(proto, LIST_PICTURE, idt);
- }
- } else if (rt != NULL) {
- item->ft->id2 = mir_strdup(rt);
- TlenPsGet(proto, item);
- }
- }
- } else if (crc != NULL) {
- BOOL bAccept = proto->tlenOptions.imagePolicy == TLEN_IMAGES_ACCEPT_ALL || (proto->tlenOptions.imagePolicy == TLEN_IMAGES_IGNORE_NIR && IsAuthorized(proto, from));
- if (bAccept) {
- FILE* fp;
- char fileName[MAX_PATH];
- char *ext = JabberXmlGetAttrValue(node, "ext");
- char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf( fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath );
- long oldSize = 0, lSize = atol(size);
- DWORD dwAttributes = GetFileAttributesA( fileName );
- if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) {
- CallService( MS_UTILS_CREATEDIRTREE, 0, ( LPARAM )fileName );
- }
- mir_free(tmpPath);
- fileName[ tPathLen++ ] = '\\';
- mir_snprintf( fileName + tPathLen, MAX_PATH - tPathLen, "%s.%s", crc, ext );
- fp = fopen( fileName, "rb" );
- if (fp) {
- fseek(fp, 0, SEEK_END);
- oldSize = ftell(fp);
- fclose(fp);
- }
- if (oldSize != lSize) {
- item = JabberListAdd(proto, LIST_PICTURE, idt);
- item->ft = TlenFileCreateFT(proto, from);
- item->ft->files = (char **) mir_alloc(sizeof(char *));
- item->ft->filesSize = (long *) mir_alloc(sizeof(long));
- item->ft->files[0] = mir_strdup(fileName);
- item->ft->filesSize[0] = lSize;
- item->ft->fileTotalSize = item->ft->filesSize[0];
- JabberSend(proto, "<message type='pic' to='%s' crc_c='n' idt='%s'/>", from, idt);
- } else {
- JabberSend(proto, "<message type='pic' to='%s' crc_c='f' idt='%s'/>", from, idt);
- LogPictureMessage(proto, from, fileName, FALSE);
- }
- }
- }
- mir_free(fromRaw);
-}
-
-BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {
- DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- char *jid = dbv.pszVal;
- char szFilter[512];
- char *szFileName = (char*) mir_alloc(_MAX_PATH);
- OPENFILENAMEA ofn = {0};
- CallService( MS_UTILS_GETBITMAPFILTERSTRINGS, ( WPARAM ) sizeof( szFilter ), ( LPARAM )szFilter );
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = NULL;
- ofn.lpstrFilter = szFilter;
- ofn.lpstrCustomFilter = NULL;
- ofn.lpstrFile = szFileName;
- ofn.nMaxFile = _MAX_PATH;
- ofn.Flags = OFN_FILEMUSTEXIST;
- szFileName[0] = '\0';
- if ( GetOpenFileNameA( &ofn )) {
- long size;
- FILE* fp = fopen( szFileName, "rb" );
- if (fp) {
- fseek(fp, 0, SEEK_END);
- size = ftell(fp);
- if (size > 0 && size < 256*1024) {
- JABBER_LIST_ITEM *item;
- mir_sha1_ctx sha;
- DWORD digest[5];
- int i;
- char idStr[10];
- char fileBuffer[2048];
- int id = JabberSerialNext(proto);
- _snprintf(idStr, sizeof(idStr), "%d", id);
- item = JabberListAdd(proto, LIST_PICTURE, idStr);
- item->ft = TlenFileCreateFT(proto, jid);
- item->ft->files = (char **) mir_alloc(sizeof(char *));
- item->ft->filesSize = (long *) mir_alloc(sizeof(long));
- item->ft->files[0] = szFileName;
- item->ft->filesSize[0] = size;
- item->ft->fileTotalSize = size;
- fseek(fp, 0, SEEK_SET);
- mir_sha1_init( &sha );
- for (i = item->ft->filesSize[0]; i > 0; ) {
- int toread = min(2048, i);
- int readcount = (int)fread(fileBuffer, (size_t)1, (size_t)toread, fp);
- i -= readcount;
- if (readcount > 0) {
- mir_sha1_append( &sha, (mir_sha1_byte_t* )fileBuffer, readcount);
- }
- if (toread != readcount) {
- break;
- }
- }
- mir_sha1_finish( &sha, (mir_sha1_byte_t* )digest );
- JabberSend(proto, "<message type='pic' to='%s' crc='%08x%08x%08x%08x%08x' idt='%s' size='%d' ext='%s'/>", jid,
- (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3]), (int)htonl(digest[4]), idStr, item->ft->filesSize[0], "jpg");
- } else {
- /* file too big */
- }
- fclose(fp);
- }
- }
- DBFreeVariant(&dbv);
- }
- return FALSE;
-}
diff --git a/protocols/Tlen/tlen_picture.h b/protocols/Tlen/tlen_picture.h
deleted file mode 100644
index e4836444ee..0000000000
--- a/protocols/Tlen/tlen_picture.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2009 Piotr Piastucki
-
-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.
-
-*/
-#ifndef _TLEN_PICTURE_H
-#define _TLEN_PICTURE_H
-
-#include <windows.h>
-#include "jabber.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void TlenProcessPic(XmlNode *node, TlenProtocol *proto);
-extern BOOL SendPicture(TlenProtocol *, HANDLE hContact);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TLEN_PICTURE_H */
-
diff --git a/protocols/Tlen/tlen_presence.c b/protocols/Tlen/tlen_presence.c
deleted file mode 100644
index ca1f14e23c..0000000000
--- a/protocols/Tlen/tlen_presence.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2009 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include "jabber_list.h"
-#include "tlen_avatar.h"
-
-void TlenProcessPresence(XmlNode *node, TlenProtocol *proto)
-{
- HANDLE hContact;
- XmlNode *showNode, *statusNode;
- JABBER_LIST_ITEM *item;
- char *from, *type, *nick, *show;
- int status, laststatus = ID_STATUS_OFFLINE;
- char *p;
-
- if ((from=JabberXmlGetAttrValue(node, "from")) != NULL) {
- if (JabberListExist(proto, LIST_CHATROOM, from)); //JabberGroupchatProcessPresence(node, userdata);
-
- else {
- type = JabberXmlGetAttrValue(node, "type");
- item = JabberListGetItemPtr(proto, LIST_ROSTER, from);
- if (item != NULL) {
- if (proto->tlenOptions.enableAvatars) {
- TlenProcessPresenceAvatar(proto, node, item);
- }
- }
- if (type==NULL || (!strcmp(type, "available"))) {
- if ((nick=JabberLocalNickFromJID(from)) != NULL) {
- if ((hContact=JabberHContactFromJID(proto, from)) == NULL)
- hContact = JabberDBCreateContact(proto, from, nick, FALSE);
- if (!JabberListExist(proto, LIST_ROSTER, from)) {
- JabberLog(proto, "Receive presence online from %s (who is not in my roster)", from);
- JabberListAdd(proto, LIST_ROSTER, from);
- }
- status = ID_STATUS_ONLINE;
- if ((showNode=JabberXmlGetChild(node, "show")) != NULL) {
- if ((show=showNode->text) != NULL) {
- if (!strcmp(show, "away")) status = ID_STATUS_AWAY;
- else if (!strcmp(show, "xa")) status = ID_STATUS_NA;
- else if (!strcmp(show, "dnd")) status = ID_STATUS_DND;
- else if (!strcmp(show, "chat")) status = ID_STATUS_FREECHAT;
- else if (!strcmp(show, "unavailable")) {
- // Always show invisible (on old Tlen client) as invisible (not offline)
- status = ID_STATUS_OFFLINE;
- }
- }
- }
-
- statusNode = JabberXmlGetChild(node, "status");
- if (statusNode)
- p = JabberTextDecode(statusNode->text);
- else
- p = NULL;
- JabberListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:NULL);
- if (p) {
- DBWriteContactSettingString(hContact, "CList", "StatusMsg", p);
- mir_free(p);
- } else {
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- }
- // Determine status to show for the contact and request version information
- if (item != NULL) {
- laststatus = item->status;
- item->status = status;
- }
- if (strchr(from, '@')!=NULL || DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "ShowTransport", TRUE)==TRUE) {
- if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", (WORD) status);
- }
- if (item != NULL) {
- if (!item->infoRequested) {
- int iqId = JabberSerialNext(proto);
- item->infoRequested = TRUE;
- JabberSend( proto, "<iq type='get' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:info' to='%s'></query></iq>", iqId, from);
- }
- if (proto->tlenOptions.enableVersion && !item->versionRequested) {
- item->versionRequested = TRUE;
- if (proto->iface.m_iStatus != ID_STATUS_INVISIBLE) {
- JabberSend( proto, "<message to='%s' type='iq'><iq type='get'><query xmlns='jabber:iq:version'/></iq></message>", from );
- }
- }
- }
- JabberLog(proto, "%s (%s) online, set contact status to %d", nick, from, status);
- mir_free(nick);
- }
- }
- else if (!strcmp(type, "unavailable")) {
- if (!JabberListExist(proto, LIST_ROSTER, from)) {
- JabberLog(proto, "Receive presence offline from %s (who is not in my roster)", from);
- JabberListAdd(proto, LIST_ROSTER, from);
- }
- else {
- JabberListRemoveResource(proto, LIST_ROSTER, from);
- }
- status = ID_STATUS_OFFLINE;
- statusNode = JabberXmlGetChild(node, "status");
- if (statusNode) {
- if (proto->tlenOptions.offlineAsInvisible) {
- status = ID_STATUS_INVISIBLE;
- }
- p = JabberTextDecode(statusNode->text);
- JabberListAddResource(proto, LIST_ROSTER, from, status, p);
- if ((hContact=JabberHContactFromJID(proto, from)) != NULL) {
- if (p) {
- DBWriteContactSettingString(hContact, "CList", "StatusMsg", p);
- } else {
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- }
- }
- if (p) mir_free(p);
- }
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, from)) != NULL) {
- // Determine status to show for the contact based on the remaining resources
- item->status = status;
- item->versionRequested = FALSE;
- item->infoRequested = FALSE;
- }
- if ((hContact=JabberHContactFromJID(proto, from)) != NULL) {
- if (strchr(from, '@')!=NULL || DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "ShowTransport", TRUE)==TRUE) {
- if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", (WORD) status);
- }
- if (item != NULL && item->isTyping) {
- item->isTyping = FALSE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
- }
- JabberLog(proto, "%s offline, set contact status to %d", from, status);
- }
- }
- else if (!strcmp(type, "subscribe")) {
- if (strchr(from, '@') == NULL) {
- // automatically send authorization allowed to agent/transport
- JabberSend(proto, "<presence to='%s' type='subscribed'/>", from);
- }
- else if ((nick=JabberNickFromJID(from)) != NULL) {
- JabberLog(proto, "%s (%s) requests authorization", nick, from);
- JabberDBAddAuthRequest(proto, from, nick);
- mir_free(nick);
- }
- }
- else if (!strcmp(type, "subscribed")) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, from)) != NULL) {
- if (item->subscription == SUB_FROM) item->subscription = SUB_BOTH;
- else if (item->subscription == SUB_NONE) {
- item->subscription = SUB_TO;
- }
- }
- }
- }
- }
-}
-
-static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to)
-{
- char *showBody, *statusMsg, *presenceType;
- char *ptr = NULL;
-
- if (!proto->isOnline) return;
-
- // Send <presence/> update for status (we won't handle ID_STATUS_OFFLINE here)
- // Note: jabberModeMsg is already encoded using JabberTextEncode()
- EnterCriticalSection(&proto->modeMsgMutex);
-
- showBody = NULL;
- statusMsg = NULL;
- presenceType = NULL;
- switch (status) {
- case ID_STATUS_ONLINE:
- showBody = "available";
- statusMsg = proto->modeMsgs.szOnline;
- break;
- case ID_STATUS_AWAY:
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- showBody = "away";
- statusMsg = proto->modeMsgs.szAway;
- break;
- case ID_STATUS_NA:
- showBody = "xa";
- statusMsg = proto->modeMsgs.szNa;
- break;
- case ID_STATUS_DND:
- case ID_STATUS_OCCUPIED:
- showBody = "dnd";
- statusMsg = proto->modeMsgs.szDnd;
- break;
- case ID_STATUS_FREECHAT:
- showBody = "chat";
- statusMsg = proto->modeMsgs.szFreechat;
- break;
- case ID_STATUS_INVISIBLE:
- presenceType = "invisible";
- statusMsg = proto->modeMsgs.szInvisible;
- break;
- case ID_STATUS_OFFLINE:
- presenceType = "unavailable";
- if (DBGetContactSettingByte(NULL, proto->iface.m_szModuleName, "LeaveOfflineMessage", FALSE)) {
- int offlineMessageOption = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "OfflineMessageOption", 0);
- if (offlineMessageOption == 0) {
- switch (proto->iface.m_iStatus) {
- case ID_STATUS_ONLINE:
- ptr = mir_strdup(proto->modeMsgs.szOnline);
- break;
- case ID_STATUS_AWAY:
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- ptr = mir_strdup(proto->modeMsgs.szAway);
- break;
- case ID_STATUS_NA:
- ptr = mir_strdup(proto->modeMsgs.szNa);
- break;
- case ID_STATUS_DND:
- case ID_STATUS_OCCUPIED:
- ptr = mir_strdup(proto->modeMsgs.szDnd);
- break;
- case ID_STATUS_FREECHAT:
- ptr = mir_strdup(proto->modeMsgs.szFreechat);
- break;
- case ID_STATUS_INVISIBLE:
- ptr = mir_strdup(proto->modeMsgs.szInvisible);
- break;
- }
- } else if (offlineMessageOption == 99) {
-
- } else if (offlineMessageOption < 7) {
- DBVARIANT dbv;
- const char *statusNames[] = {"OnDefault", "AwayDefault", "NaDefault", "DndDefault", "FreeChatDefault", "InvDefault"};
- if (!DBGetContactSetting(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) {
- int i;
- char substituteStr[128];
- ptr = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- for(i=0;ptr[i];i++) {
- if(ptr[i]!='%') continue;
- if(!_strnicmp(ptr+i,"%time%",6))
- GetTimeFormatA(LOCALE_USER_DEFAULT,TIME_NOSECONDS,NULL,NULL,substituteStr,sizeof(substituteStr));
- else if(!_strnicmp(ptr+i,"%date%",6))
- GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,substituteStr,sizeof(substituteStr));
- else continue;
- if(strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,strlen(ptr)+1+strlen(substituteStr)-6);
- MoveMemory(ptr+i+strlen(substituteStr),ptr+i+6,strlen(ptr)-i-5);
- CopyMemory(ptr+i,substituteStr,strlen(substituteStr));
- }
- }
- }
- }
- statusMsg = ptr;
- break;
- default:
- // Should not reach here
- break;
- }
- proto->iface.m_iStatus = status;
- if (presenceType) {
- if (statusMsg)
- JabberSend(proto, "<presence type='%s'><status>%s</status></presence>", presenceType, statusMsg);
- else
- JabberSend(proto, "<presence type='%s'></presence>", presenceType);
- } else {
- if (statusMsg)
- JabberSend(proto, "<presence><show>%s</show><status>%s</status></presence>", showBody, statusMsg);
- else
- JabberSend(proto, "<presence><show>%s</show></presence>", showBody);
- }
- if (ptr) {
- mir_free(ptr);
- }
- LeaveCriticalSection(&proto->modeMsgMutex);
-}
-
-void JabberSendPresence(TlenProtocol *proto, int statusIn)
-{
- int statusOut;
- switch (statusIn) {
- case ID_STATUS_ONLINE:
- case ID_STATUS_OFFLINE:
- case ID_STATUS_NA:
- case ID_STATUS_FREECHAT:
- case ID_STATUS_INVISIBLE:
- statusOut = statusIn;
- break;
- case ID_STATUS_AWAY:
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- default:
- statusOut = ID_STATUS_AWAY;
- break;
- case ID_STATUS_DND:
- case ID_STATUS_OCCUPIED:
- statusOut = ID_STATUS_DND;
- break;
- }
- JabberSendPresenceTo(proto, statusOut, NULL);
-}
diff --git a/protocols/Tlen/tlen_presence.h b/protocols/Tlen/tlen_presence.h
deleted file mode 100644
index fdc3ea642e..0000000000
--- a/protocols/Tlen/tlen_presence.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2009 Piotr Piastucki
-
-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.
-
-*/
-#ifndef _TLEN_PRESENCE_H
-#define _TLEN_PRESENCE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void TlenProcessPresence(XmlNode *node, TlenProtocol *proto);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TLEN_PRESENCE_H */
-
diff --git a/protocols/Tlen/tlen_userinfo.c b/protocols/Tlen/tlen_userinfo.c
deleted file mode 100644
index 50345282a9..0000000000
--- a/protocols/Tlen/tlen_userinfo.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
-
-Jabber Protocol Plugin for Miranda IM
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2002-2004 Santithorn Bunchua
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <commctrl.h>
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "jabber_list.h"
-#include "resource.h"
-#include "tlen_avatar.h"
-
-JABBER_FIELD_MAP tlenFieldGender[] = {
- { 1, _T("Male") },
- { 2, _T("Female") },
- { 0, NULL }
-};
-JABBER_FIELD_MAP tlenFieldLookfor[] = {
- { 1, _T("Somebody to talk") },
- { 2, _T("Friendship") },
- { 3, _T("Flirt/romance") },
- { 4, _T("Love") },
- { 5, _T("Nothing") },
- { 0, NULL }
-};
-JABBER_FIELD_MAP tlenFieldStatus[] = {
- { 1, _T("All") },
- { 2, _T("Available") },
- { 3, _T("Free for chat") },
- { 0, NULL }
-};
-JABBER_FIELD_MAP tlenFieldOccupation[] = {
- { 1, _T("Student") },
- { 2, _T("College student") },
- { 3, _T("Farmer") },
- { 4, _T("Manager") },
- { 5, _T("Specialist") },
- { 6, _T("Clerk") },
- { 7, _T("Unemployed") },
- { 8, _T("Pensioner") },
- { 9, _T("Housekeeper") },
- { 10, _T("Teacher") },
- { 11, _T("Doctor") },
- { 12, _T("Other") },
- { 0, NULL }
-};
-JABBER_FIELD_MAP tlenFieldPlan[] = {
- { 1, _T("I'd like to go downtown") },
- { 2, _T("I'd like to go to the cinema") },
- { 3, _T("I'd like to take a walk") },
- { 4, _T("I'd like to go to the disco") },
- { 5, _T("I'd like to go on a blind date") },
- { 6, _T("Waiting for suggestion") },
- { 0, NULL }
-};
-
-static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-static void InitComboBox(HWND hwndCombo, JABBER_FIELD_MAP *fieldMap)
-{
- int i, n;
-
- n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T(""));
- SendMessage(hwndCombo, CB_SETITEMDATA, n, 0);
- SendMessage(hwndCombo, CB_SETCURSEL, n, 0);
- for(i=0;;i++) {
- if (fieldMap[i].name == NULL)
- break;
- n = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TranslateTS(fieldMap[i].name));
- SendMessage(hwndCombo, CB_SETITEMDATA, n, fieldMap[i].id);
- }
-}
-
-static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
-{
- char text[512];
- char *localFieldName, *localText;
-
- if (hwndDlg==NULL || fieldName==NULL || str==NULL || strSize==NULL)
- return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text));
- if (text[0]) {
- if ((localFieldName=JabberTextEncode(fieldName)) != NULL) {
- if ((localText=JabberTextEncode(text)) != NULL) {
- JabberStringAppend(str, strSize, "<%s>%s</%s>", localFieldName, localText, localFieldName);
- mir_free(localText);
- }
- mir_free(localFieldName);
- }
- }
-}
-
-static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
-{
- int value;
- char *localFieldName;
-
- if (hwndDlg==NULL || fieldName==NULL || str==NULL || strSize==NULL)
- return;
- value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
- if (value > 0) {
- if ((localFieldName=JabberTextEncode(fieldName)) != NULL) {
- JabberStringAppend(str, strSize, "<%s>%d</%s>", localFieldName, value, localFieldName);
- mir_free(localFieldName);
- }
- }
-}
-
-
-int TlenUserInfoInit(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- char *szProto;
- HANDLE hContact;
- OPTIONSDIALOGPAGE odp = {0};
- TlenProtocol *proto = (TlenProtocol *)ptr;
-
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM) proto->iface.m_szModuleName))
- return 0;
- hContact = (HANDLE) lParam;
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if ((szProto!=NULL && !strcmp(szProto, proto->iface.m_szModuleName)) || !lParam) {
- odp.cbSize = sizeof(odp);
- odp.hInstance = hInst;
- odp.flags = ODPF_TCHAR;
- odp.pfnDlgProc = TlenUserInfoDlgProc;
- odp.position = -2000000000;
- odp.pszTemplate = ((HANDLE)lParam!=NULL) ? MAKEINTRESOURCEA(IDD_USER_INFO):MAKEINTRESOURCEA(IDD_USER_VCARD);
- odp.ptszTitle = (hContact != NULL) ? TranslateT("Account") : proto->iface.m_tszUserName;
- odp.dwInitParam = (LPARAM)proto;
- CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM) &odp);
-
- }
- if (!lParam && proto->isOnline) {
- CCSDATA ccs = {0};
- JabberGetInfo(ptr, 0, (LPARAM) &ccs);
- }
- return 0;
-}
-
-typedef struct {
- TlenProtocol *proto;
- HANDLE hContact;
-}TLENUSERINFODLGDATA;
-
-
-static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- TLENUSERINFODLGDATA *data = (TLENUSERINFODLGDATA *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
-
- data = (TLENUSERINFODLGDATA*)mir_alloc(sizeof(TLENUSERINFODLGDATA));
- data->hContact = (HANDLE) lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data);
- // lParam is hContact
- TranslateDialogDefault(hwndDlg);
- InitComboBox(GetDlgItem(hwndDlg, IDC_GENDER), tlenFieldGender);
- InitComboBox(GetDlgItem(hwndDlg, IDC_OCCUPATION), tlenFieldOccupation);
- InitComboBox(GetDlgItem(hwndDlg, IDC_LOOKFOR), tlenFieldLookfor);
-
- return TRUE;
- case WM_TLEN_REFRESH:
- {
- DBVARIANT dbv;
- char *jid;
- int i;
- JABBER_LIST_ITEM *item;
-
- SetDlgItemText(hwndDlg, IDC_INFO_JID, _T(""));
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, _T(""));
- SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
-
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "FirstName", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "LastName", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_LASTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "Nick", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_NICKNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "e-mail", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_EMAIL, _T(""));
- if (!DBGetContactSetting(data->hContact, data->proto->iface.m_szModuleName, "Age", &dbv)) {
- SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_AGE, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "City", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_CITY, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->iface.m_szModuleName, "School", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_SCHOOL, _T(""));
- switch (DBGetContactSettingByte(data->hContact, data->proto->iface.m_szModuleName, "Gender", '?')) {
- case 'M':
- SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
- SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[0].name));
- break;
- case 'F':
- SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 2, 0);
- SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[1].name));
- break;
- default:
- SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 0, 0);
- SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, _T(""));
- break;
- }
- i = DBGetContactSettingWord(data->hContact, data->proto->iface.m_szModuleName, "Occupation", 0);
- if (i>0 && i<13) {
- SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateTS(tlenFieldOccupation[i-1].name));
- SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
- } else {
- SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
- }
- i = DBGetContactSettingWord(data->hContact, data->proto->iface.m_szModuleName, "LookingFor", 0);
- if (i>0 && i<6) {
- SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateTS(tlenFieldLookfor[i-1].name));
- SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
- } else {
- SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, _T(""));
- SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
- }
- i = DBGetContactSettingWord(data->hContact, data->proto->iface.m_szModuleName, "VoiceChat", 0);
- CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
- i = DBGetContactSettingWord(data->hContact, data->proto->iface.m_szModuleName, "PublicStatus", 0);
- CheckDlgButton(hwndDlg, IDC_PUBLICSTATUS, i);
- if (!DBGetContactSetting(data->hContact, data->proto->iface.m_szModuleName, "jid", &dbv)) {
- jid = JabberTextDecode(dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_INFO_JID, jid);
- mir_free(jid);
- jid = dbv.pszVal;
- if (data->proto->isOnline) {
- if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, jid)) != NULL) {
- switch (item->subscription) {
- case SUB_BOTH:
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("both"));
- break;
- case SUB_TO:
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("to"));
- break;
- case SUB_FROM:
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("from"));
- break;
- default:
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("none"));
- break;
- }
- SetDlgItemTextA(hwndDlg, IDC_SOFTWARE, item->software);
- SetDlgItemTextA(hwndDlg, IDC_VERSION, item->version);
- SetDlgItemTextA(hwndDlg, IDC_SYSTEM, item->system);
- } else {
- SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("not on roster"));
- }
- }
- DBFreeVariant(&dbv);
- }
- }
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_INFOCHANGED:
- {
- HANDLE hContact = (HANDLE) ((LPPSHNOTIFY) lParam)->lParam;
- SendMessage(hwndDlg, WM_TLEN_REFRESH, 0, (LPARAM) hContact);
- }
- break;
- case PSN_PARAMCHANGED:
- {
- data->proto = ( TlenProtocol* )(( LPPSHNOTIFY )lParam )->lParam;
- SendMessage(hwndDlg, WM_TLEN_REFRESH, 0, 0);
- }
- }
- break;
- }
- break;
- case WM_COMMAND:
- if (LOWORD(wParam)==IDC_SAVE && HIWORD(wParam)==BN_CLICKED) {
- char *str = NULL;
- int strSize;
- JabberStringAppend(&str, &strSize, "<iq type='set' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:register'>", JabberSerialNext(data->proto));
- FetchField(hwndDlg, IDC_FIRSTNAME, "first", &str, &strSize);
- FetchField(hwndDlg, IDC_LASTNAME, "last", &str, &strSize);
- FetchField(hwndDlg, IDC_NICKNAME, "nick", &str, &strSize);
- FetchField(hwndDlg, IDC_EMAIL, "email", &str, &strSize);
- FetchCombo(hwndDlg, IDC_GENDER, "s", &str, &strSize);
- FetchField(hwndDlg, IDC_AGE, "b", &str, &strSize);
- FetchField(hwndDlg, IDC_CITY, "c", &str, &strSize);
- FetchCombo(hwndDlg, IDC_OCCUPATION, "j", &str, &strSize);
- FetchField(hwndDlg, IDC_SCHOOL, "e", &str, &strSize);
- FetchCombo(hwndDlg, IDC_LOOKFOR, "r", &str, &strSize);
- JabberStringAppend(&str, &strSize, "<g>%d</g>", IsDlgButtonChecked(hwndDlg, IDC_VOICECONVERSATIONS) ? 1 : 0);
- JabberStringAppend(&str, &strSize, "<v>%d</v>", IsDlgButtonChecked(hwndDlg, IDC_PUBLICSTATUS) ? 1 : 0);
- JabberStringAppend(&str, &strSize, "</query></iq>");
- JabberSend(data->proto, "%s", str);
- mir_free(str);
- JabberGetInfo((PROTO_INTERFACE *)data->proto, NULL, 0);
- }
- break;
- case WM_DESTROY:
- mir_free(data);
- break;
- }
- return FALSE;
-}
diff --git a/protocols/Tlen/tlen_voice.c b/protocols/Tlen/tlen_voice.c
deleted file mode 100644
index 4c4868152c..0000000000
--- a/protocols/Tlen/tlen_voice.c
+++ /dev/null
@@ -1,1122 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#include "jabber.h"
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <math.h>
-#include <m_button.h>
-//#include <win2k.h>
-#include "resource.h"
-#include "jabber_list.h"
-#include "tlen_voice.h"
-#include "tlen_p2p_old.h"
-#include "tlen_file.h"
-
-static int MODE_FREQUENCY[]= {0, 0, 8000, 11025, 22050, 44100};
-static int MODE_FRAME_SIZE[]= {0, 0, 5, 5, 10, 25};
-static int FRAMES_AVAILABLE_MAX_LIMIT = 2;
-static int VU_METER_HEIGHT = 64;
-static int VU_METER_WIDTH = 20;
-static int VU_METER_LEVELS = 16;
-static HBITMAP vuMeterBitmaps[100];
-
-static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft);
-static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft);
-static void TlenVoiceReceivingConnection(HANDLE hNewConnection, DWORD dwRemoteIP, void * pExtra);
-
-static void CALLBACK TlenVoicePlaybackCallback(HWAVEOUT hwo, UINT uMsg, DWORD* dwInstance, DWORD dwParam1, DWORD dwParam2)
-{
- if (uMsg == WOM_DONE) {
- TLEN_VOICE_CONTROL *control = (TLEN_VOICE_CONTROL *) dwInstance;
- waveOutUnprepareHeader(hwo, (WAVEHDR *) dwParam1, sizeof(WAVEHDR));
- if (control->proto->framesAvailableForPlayback > 0) {
- control->proto->framesAvailableForPlayback--;
- }
-// playbackControl->waveHeaders[playbackControl->waveHeadersPos].dwFlags = WHDR_DONE;
-// playbackControl->waveHeaders[playbackControl->waveHeadersPos].lpData = (char *) (playbackControl->waveData + playbackControl->waveHeadersPos * playbackControl->waveFrameSize);
-// playbackControl->waveHeaders[playbackControl->waveHeadersPos].dwBufferLength = playbackControl->waveFrameSize * 2;
-// waveOutPrepareHeader(playbackControl->hWaveOut, &playbackControl->waveHeaders[playbackControl->waveHeadersPos], sizeof(WAVEHDR));
-// waveOutWrite(playbackControl->hWaveOut, &playbackControl->waveHeaders[playbackControl->waveHeadersPos], sizeof(WAVEHDR));
-
- }
-}
-
-static DWORD WINAPI TlenVoiceRecordingThreadProc(TLEN_VOICE_CONTROL *control)
-{
- MSG msg;
- HWAVEIN hWaveIn;
- WAVEHDR *hWaveHdr;
- control->isRunning = 1;
- control->stopThread = 0;
- while (TRUE) {
- GetMessage(&msg,NULL,0,0);
- if (msg.message == MM_WIM_DATA) {
-// JabberLog("recording thread running...%d", msg.message);
- hWaveIn = (HWAVEIN) msg.wParam;
- hWaveHdr = (WAVEHDR *) msg.lParam;
- waveInUnprepareHeader(hWaveIn, hWaveHdr, sizeof(WAVEHDR));
- if (hWaveHdr->dwBytesRecorded>0 && !control->bDisable) {
- control->recordingData = (short *)hWaveHdr->lpData;
- TlenVoiceSendParse(control->ft);
- }
- if (!control->stopThread) {
- waveInPrepareHeader(hWaveIn, &control->waveHeaders[control->waveHeadersPos], sizeof(WAVEHDR));
- waveInAddBuffer(hWaveIn, &control->waveHeaders[control->waveHeadersPos], sizeof(WAVEHDR));
- control->waveHeadersPos = (control->waveHeadersPos +1) % control->waveHeadersNum;
- }
- }
- else if (msg.message == MM_WIM_CLOSE) {
- break;
- }
- }
- control->isRunning = 0;
- JabberLog(control->proto, "recording thread ended...");
- return 0;
-}
-
-
-/*static void CALLBACK TlenVoiceRecordingCallback(HWAVEIN hwi, UINT uMsg, DWORD* dwInstance, DWORD dwParam1, DWORD dwParam2)
-{
- if (uMsg == WIM_DATA) {
- TLEN_VOICE_CONTROL *control = (TLEN_VOICE_CONTROL *) dwInstance;
- if (control->waveHeaders[control->waveHeadersPos].dwBytesRecorded>0) {
- control->recordingData = (short *)control->waveHeaders[control->waveHeadersPos].lpData;
- TlenVoiceSendParse(control->ft);
- }
- waveInAddBuffer(control->hWaveIn, &control->waveHeaders[control->waveHeadersPos], sizeof(WAVEHDR));
- control->waveHeadersPos = (control->waveHeadersPos +1) % control->waveHeadersNum;
- }
-}*/
-
-static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control)
-{
- WAVEFORMATEX wfm;
- MMRESULT mmres;
- int i, j;
- int iNumDevs, iSelDev;
- WAVEOUTCAPS wic;
-
- memset(&wfm, 0, sizeof(wfm));
- wfm.cbSize = sizeof(WAVEFORMATEX);
- wfm.nChannels = 1;
- wfm.wBitsPerSample = 16;
- wfm.nSamplesPerSec = MODE_FREQUENCY[control->codec];
- wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nChannels * wfm.wBitsPerSample/8;
- wfm.nBlockAlign = 2 * wfm.nChannels;
- wfm.wFormatTag = WAVE_FORMAT_PCM;
-
- control->waveMode = 0;
- control->waveFrameSize = MODE_FRAME_SIZE[control->codec] * 160 * wfm.nChannels;// * wfm.wBitsPerSample / 8;
- control->waveHeadersPos = 0;
- control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2;
-
- j = DBGetContactSettingWord(NULL, control->proto->iface.m_szModuleName, "VoiceDeviceOut", 0);
- iSelDev = WAVE_MAPPER;
- if (j!=0) {
- iNumDevs = waveOutGetNumDevs();
- for (i = 0; i < iNumDevs; i++) {
- if (!waveOutGetDevCaps(i, &wic, sizeof(WAVEOUTCAPS))) {
- if (wic.dwFormats != 0) {
- j--;
- if (j == 0) {
- iSelDev = i;
- break;
- }
- }
- }
- }
- }
- if (!waveOutGetDevCaps(iSelDev, &wic, sizeof(WAVEOUTCAPS))) {
- JabberLog(control->proto, "Playback device ID #%u: %s\r\n", iSelDev, wic.szPname);
- }
-
- mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION);
- if (mmres!=MMSYSERR_NOERROR) {
- JabberLog(control->proto, "TlenVoiceStart FAILED!");
- return 1;
- }
- control->waveData = (short *)mir_alloc(control->waveHeadersNum * control->waveFrameSize * 2);
- memset(control->waveData, 0, control->waveHeadersNum * control->waveFrameSize * 2);
- control->waveHeaders = (WAVEHDR *)mir_alloc(control->waveHeadersNum * sizeof(WAVEHDR));
- JabberLog(control->proto, "TlenVoiceStart OK!");
- return 0;
-}
-
-
-static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control)
-{
- WAVEFORMATEX wfm;
- MMRESULT mmres;
- int i, j;
- int iNumDevs, iSelDev;
- WAVEINCAPS wic;
-
- memset(&wfm, 0, sizeof(wfm));
- wfm.cbSize = sizeof(WAVEFORMATEX);
- wfm.nChannels = 1;
- wfm.wBitsPerSample = 16;
- wfm.nSamplesPerSec = MODE_FREQUENCY[control->codec];
- wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nChannels * wfm.wBitsPerSample/8;
- wfm.nBlockAlign = 2 * wfm.nChannels;
- wfm.wFormatTag = WAVE_FORMAT_PCM;
-
-
- control->waveMode = 0;
-// control->isRunning = 1;
- control->waveFrameSize = MODE_FRAME_SIZE[control->codec] * 160 * wfm.nChannels;// * wfm.wBitsPerSample / 8;
- control->waveHeadersPos = 0;
- control->waveHeadersNum = 2;
-
- control->hThread = CreateThread( NULL,
- 0,
- (LPTHREAD_START_ROUTINE)TlenVoiceRecordingThreadProc,
- control,
- 0,
- (LPDWORD)&control->threadID);
-
-
- SetThreadPriority(control->hThread, THREAD_PRIORITY_ABOVE_NORMAL);
-
- j = DBGetContactSettingWord(NULL, control->proto->iface.m_szModuleName, "VoiceDeviceIn", 0);
- iSelDev = WAVE_MAPPER;
- if (j!=0) {
- iNumDevs = waveInGetNumDevs();
- for (i = 0; i < iNumDevs; i++) {
- if (!waveInGetDevCaps(i, &wic, sizeof(WAVEINCAPS))) {
- if (wic.dwFormats != 0) {
- j--;
- if (j == 0) {
- iSelDev = i;
- break;
- }
- }
- }
- }
- }
- if (!waveInGetDevCaps(iSelDev, &wic, sizeof(WAVEINCAPS))) {
- JabberLog(control->proto, "Recording device ID #%u: %s\r\n", iSelDev, wic.szPname);
- }
-
- mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, (DWORD) control->threadID, 0, CALLBACK_THREAD);
-// mmres = waveInOpen(&control->hWaveIn, 3, &wfm, (DWORD) &TlenVoiceRecordingCallback, (DWORD) control, CALLBACK_FUNCTION);
- if (mmres!=MMSYSERR_NOERROR) {
- PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0);
- JabberLog(control->proto, "TlenVoiceStart FAILED %d!", mmres);
- return 1;
- }
- control->waveData = (short *)mir_alloc(control->waveHeadersNum * control->waveFrameSize * 2);
- memset(control->waveData, 0, control->waveHeadersNum * control->waveFrameSize * 2);
- control->waveHeaders = (WAVEHDR *)mir_alloc(control->waveHeadersNum * sizeof(WAVEHDR));
- for (i=0;i<control->waveHeadersNum;i++) {
- control->waveHeaders[i].dwFlags = 0;//WHDR_DONE;
- control->waveHeaders[i].lpData = (char *) (control->waveData + i * control->waveFrameSize);
- control->waveHeaders[i].dwBufferLength = control->waveFrameSize *2;
- mmres = waveInPrepareHeader(control->hWaveIn, &control->waveHeaders[i], sizeof(WAVEHDR));
- if (mmres!=MMSYSERR_NOERROR) {
- waveInClose(control->hWaveIn);
-// PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0);
- JabberLog(control->proto, "TlenVoiceStart FAILED #2!");
- return 1;
- }
- }
- for (i=0;i<control->waveHeadersNum;i++) {
- waveInAddBuffer(control->hWaveIn, &control->waveHeaders[i], sizeof(WAVEHDR));
- }
- waveInStart(control->hWaveIn);
- JabberLog(control->proto, "TlenVoiceRStart OK!");
- return 0;
-}
-
-
-static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec)
-{
- TLEN_VOICE_CONTROL *vc;
- vc = (TLEN_VOICE_CONTROL *) mir_alloc(sizeof (TLEN_VOICE_CONTROL));
- memset(vc, 0, sizeof(TLEN_VOICE_CONTROL));
- vc->gsmstate = gsm_create();
- vc->codec = codec;
- vc->proto = proto;
- return vc;
-}
-static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc)
-{
- int i;
- JabberLog(vc->proto, "-> TlenVoiceFreeVc");
- vc->stopThread = 1;
- PostThreadMessage(vc->threadID, MM_WIM_CLOSE, 0, 0);
- while(vc->isRunning) {
- Sleep(50);
- }
- if (vc->hThread!=NULL) CloseHandle(vc->hThread);
- if (vc->hWaveIn) {
- for (i=0;i<vc->waveHeadersNum;i++) {
- while(waveInUnprepareHeader(vc->hWaveIn, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) {
- Sleep(50);
- }
- }
- while(waveInClose(vc->hWaveIn) == WAVERR_STILLPLAYING) {
- Sleep(50);
- }
- }
- if (vc->hWaveOut) {
- for (i=0;i<vc->waveHeadersNum;i++) {
- while(waveOutUnprepareHeader(vc->hWaveOut, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) {
- Sleep(50);
- }
- }
- while(waveOutClose(vc->hWaveOut) == WAVERR_STILLPLAYING) {
- Sleep(50);
- }
- }
- if (vc->waveData) mir_free(vc->waveData);
- if (vc->waveHeaders) mir_free(vc->waveHeaders);
- if (vc->gsmstate) gsm_release(vc->gsmstate);
- JabberLog(vc->proto, "<- TlenVoiceFreeVc");
- mir_free(vc);
-}
-
-static void TlenVoiceCrypt(char *buffer, int len)
-{
- int i, j, k;
- j = 0x71;
- for (i=0;i<len;i++) {
- k = j;
- j = j << 6;
- j += k;
- j = k + (j << 1);
- j += 0xBB;
- buffer[i]^=j;
- }
-}
-
-void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft)
-{
- NETLIBOPENCONNECTION nloc;
- JABBER_SOCKET s;
-
- JabberLog(ft->proto, "Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = ft->hostName;
- nloc.wPort = ft->wPort;
- nloc.flags = 0;
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
-// ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
- if (s != NULL) {
- ft->s = s;
- JabberLog(ft->proto, "Entering file receive loop");
- TlenP2PEstablishOutgoingConnection(ft, FALSE);
- if (ft->state!=FT_ERROR) {
- ft->proto->playbackControl = NULL;
- ft->proto->recordingControl = TlenVoiceCreateVC(ft->proto, 3);
- ft->proto->recordingControl->ft = ft;
- TlenVoiceRecordingStart(ft->proto->recordingControl);
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenVoiceReceiveParse(ft);
- }
- TlenVoiceFreeVc(ft->proto->recordingControl);
- ft->proto->playbackControl = NULL;
- ft->proto->recordingControl = NULL;
- }
- if (ft->s) {
- Netlib_CloseHandle(s);
- }
- ft->s = NULL;
- } else {
- JabberLog(ft->proto, "Connection failed - receiving as server");
- ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
- s = TlenP2PListen(ft);
- if (s != NULL) {
- HANDLE hEvent;
- char *nick;
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
- ft->s = s;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ft->hFileEvent = hEvent;
- ft->currentFile = 0;
- ft->state = FT_CONNECTING;
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<v t='%s' i='%s' e='7' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
- mir_free(nick);
- JabberLog(ft->proto, "Waiting for the file to be received...");
- WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
- CloseHandle(hEvent);
- JabberLog(ft->proto, "Finish all files");
- Netlib_CloseHandle(s);
- } else {
- ft->state = FT_ERROR;
- }
- }
- JabberListRemove(ft->proto, LIST_VOICE, ft->iqId);
- if (ft->state==FT_DONE) {
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Finished..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- } else {
- char *nick;
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<f t='%s' i='%s' e='8'/>", nick, ft->iqId);
- mir_free(nick);
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- }
- JabberLog(ft->proto, "Thread ended: type=file_receive server='%s'", ft->hostName);
-
- TlenP2PFreeFileTransfer(ft);
-}
-
-static void TlenVoiceReceivingConnection(JABBER_SOCKET hConnection, DWORD dwRemoteIP, void * pExtra)
-{
- JABBER_SOCKET slisten;
- TLEN_FILE_TRANSFER *ft;
- TlenProtocol *proto = (TlenProtocol *)pExtra;
-
- ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE);
- if (ft != NULL) {
- slisten = ft->s;
- ft->s = hConnection;
- JabberLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
- JabberLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
- proto->playbackControl = NULL;
- proto->recordingControl = TlenVoiceCreateVC(proto, 3);
- proto->recordingControl->ft = ft;
- TlenVoiceRecordingStart(proto->recordingControl);
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenVoiceReceiveParse(ft);
- }
- TlenVoiceFreeVc(proto->recordingControl);
- proto->playbackControl = NULL;
- proto->recordingControl = NULL;
- if (ft->state==FT_DONE) {
- SetDlgItemText(proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Finished..."));
-// ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- } else {
-// ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
- }
- JabberLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
- ft->s = slisten;
- JabberLog(ft->proto, "ft->s is restored to %d", ft->s);
- }
- Netlib_CloseHandle(hConnection);
- if (ft!=NULL && ft->hFileEvent != NULL)
- SetEvent(ft->hFileEvent);
-}
-
-static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft)
-{
- char *statusTxt;
- int i, j;
- char *p;
- float val;
- TLEN_FILE_PACKET *packet;
- packet = TlenP2PPacketReceive(ft->s);
- if (packet != NULL) {
- statusTxt = " Unknown packet ";
- p = packet->packet;
- if (packet->type == TLEN_VOICE_PACKET) {
- short *out;
- int codec, chunkNum;
- statusTxt = " OK ";
- TlenVoiceCrypt(packet->packet+4, packet->len-4);
- codec = *((int *)packet->packet);
- if (codec<2 || codec>5) {
- statusTxt = " Unknown codec ";
- } else {
- if (ft->proto->playbackControl == NULL) {
- ft->proto->playbackControl = TlenVoiceCreateVC(ft->proto, codec);
- TlenVoicePlaybackStart(ft->proto->playbackControl);
- ft->proto->framesAvailableForPlayback = 0;
- ft->proto->availOverrunValue = 0;
- } else if (ft->proto->playbackControl->codec != codec) {
- TlenVoiceFreeVc(ft->proto->playbackControl);
- ft->proto->playbackControl = TlenVoiceCreateVC(ft->proto, codec);
- TlenVoicePlaybackStart(ft->proto->playbackControl);
- ft->proto->framesAvailableForPlayback = 0;
- ft->proto->availOverrunValue = 0;
- }
- if (!ft->proto->playbackControl->bDisable) {
- ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos].dwFlags = WHDR_DONE;
- ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos].lpData = (char *) (ft->proto->playbackControl->waveData + ft->proto->playbackControl->waveHeadersPos * ft->proto->playbackControl->waveFrameSize);
- ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos].dwBufferLength = ft->proto->playbackControl->waveFrameSize * 2;
- /*
- if (availPlayback == 0) {
- statusTxt = "!! Buffer is empty !!";
- availPlayback++;
- waveOutPrepareHeader(playbackControl->hWaveOut, &playbackControl->waveHeaders[playbackControl->waveHeadersPos], sizeof(WAVEHDR));
- waveOutWrite(playbackControl->hWaveOut, &playbackControl->waveHeaders[playbackControl->waveHeadersPos], sizeof(WAVEHDR));
- playbackControl->waveHeadersPos = (playbackControl->waveHeadersPos +1) % playbackControl->waveHeadersNum;
- playbackControl->waveHeaders[playbackControl->waveHeadersPos].dwFlags = WHDR_DONE;
- playbackControl->waveHeaders[playbackControl->waveHeadersPos].lpData = (char *) (playbackControl->waveData + playbackControl->waveHeadersPos * playbackControl->waveFrameSize);
- playbackControl->waveHeaders[playbackControl->waveHeadersPos].dwBufferLength = playbackControl->waveFrameSize * 2;
- }
- */
- chunkNum = min(MODE_FRAME_SIZE[codec], (int)(packet->len - 4) / 33);
- out = (short *)ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos].lpData;
- for (i=0; i<chunkNum; i++) {
- for (j=0;j<33;j++) {
- ft->proto->playbackControl->gsmstate->gsmFrame[j] = packet->packet[i*33 +j +4];
- }
- gsm_decode(ft->proto->playbackControl->gsmstate, out);
- out += 160;
- }
- out = (short *)ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos].lpData;
- val = 0;
- for (i=0; i<MODE_FRAME_SIZE[codec] * 160; i+=MODE_FRAME_SIZE[codec]) {
- val += out[i]*out[i];
- }
- j = (int)((log10(val) - 4) * 2.35);
- if (j > VU_METER_LEVELS - 1 ) {
- j = VU_METER_LEVELS - 1;
- } else if (j<0) {
- j = 0;
- }
- ft->proto->playbackControl->vuMeter = j;
- ft->proto->playbackControl->bytesSum += 8 + packet->len;
- /* Simple logic to avoid huge delays. If a delay is detected a frame is not played */
- j = ft->proto->availOverrunValue > 0 ? -1 : 0;
- while (ft->proto->framesAvailableForPlayback > FRAMES_AVAILABLE_MAX_LIMIT) {
- j = 1;
- SleepEx(5, FALSE);
- }
- ft->proto->availOverrunValue += j;
- /* 40 frames - 800ms/8kHz */
- if (ft->proto->availOverrunValue < 40) {
- ft->proto->framesAvailableForPlayback++;
- waveOutPrepareHeader(ft->proto->playbackControl->hWaveOut, &ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos], sizeof(WAVEHDR));
- waveOutWrite(ft->proto->playbackControl->hWaveOut, &ft->proto->playbackControl->waveHeaders[ft->proto->playbackControl->waveHeadersPos], sizeof(WAVEHDR));
- ft->proto->playbackControl->waveHeadersPos = (ft->proto->playbackControl->waveHeadersPos +1) % ft->proto->playbackControl->waveHeadersNum;
- } else {
- ft->proto->availOverrunValue -= 10;
- statusTxt = "!! Skipping frame !!";
- }
- }
- }
- }
- {
- char ttt[2048];
- sprintf(ttt, "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
- SetDlgItemTextA(ft->proto->voiceDlgHWND, IDC_STATUS, ttt);
- }
- TlenP2PPacketFree(packet);
- }
- else {
- if (ft->proto->playbackControl!=NULL) {
- TlenVoiceFreeVc(ft->proto->playbackControl);
- ft->proto->playbackControl = NULL;
- }
- ft->state = FT_ERROR;
- }
-}
-
-
-void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft)
-{
- JABBER_SOCKET s = NULL;
- HANDLE hEvent;
- char *nick;
-
- JabberLog(ft->proto, "Thread started: type=voice_send");
- ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
- s = TlenP2PListen(ft);
- if (s != NULL) {
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- ft->s = s;
- //JabberLog("ft->s = %d", s);
- //JabberLog("fileCount = %d", ft->fileCount);
-
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ft->hFileEvent = hEvent;
- ft->currentFile = 0;
- ft->state = FT_CONNECTING;
-
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<v t='%s' i='%s' e='6' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
- mir_free(nick);
- JabberLog(ft->proto, "Waiting for the voice data to be sent...");
- WaitForSingleObject(hEvent, INFINITE);
- ft->hFileEvent = NULL;
- CloseHandle(hEvent);
- JabberLog(ft->proto, "Finish voice");
- Netlib_CloseHandle(s);
- ft->s = NULL;
- JabberLog(ft->proto, "ft->s is NULL");
-
- if (ft->state == FT_SWITCH) {
- NETLIBOPENCONNECTION nloc;
- JABBER_SOCKET s;
- JabberLog(ft->proto, "Sending as client...");
- ft->state = FT_CONNECTING;
- nloc.cbSize = NETLIBOPENCONNECTION_V1_SIZE;//sizeof(NETLIBOPENCONNECTION);
- nloc.szHost = ft->hostName;
- nloc.wPort = ft->wPort;
- nloc.flags = 0;
- s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
- if (s != NULL) {
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- ft->s = s;
- TlenP2PEstablishOutgoingConnection(ft, FALSE);
- if (ft->state!=FT_ERROR) {
- JabberLog(ft->proto, "Entering send loop for this file connection...");
- ft->proto->playbackControl = NULL;
- ft->proto->recordingControl = TlenVoiceCreateVC(ft->proto, 3);
- ft->proto->recordingControl->ft = ft;
- TlenVoiceRecordingStart(ft->proto->recordingControl);
- while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
- TlenVoiceReceiveParse(ft);
- }
- }
- JabberLog(ft->proto, "Closing connection for this file transfer... ");
- Netlib_CloseHandle(s);
- } else {
- ft->state = FT_ERROR;
- }
- }
- } else {
- JabberLog(ft->proto, "Cannot allocate port to bind for file server thread, thread ended.");
- ft->state = FT_ERROR;
- }
- JabberListRemove(ft->proto, LIST_VOICE, ft->iqId);
- switch (ft->state) {
- case FT_DONE:
- JabberLog(ft->proto, "Finish successfully");
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Finished..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
- break;
- case FT_DENIED:
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Denied..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0);
- break;
- default: // FT_ERROR:
- nick = JabberNickFromJID(ft->jid);
- JabberSend(ft->proto, "<v t='%s' i='%s' e='8'/>", nick, ft->iqId);
- mir_free(nick);
- JabberLog(ft->proto, "Finish with errors");
- SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- break;
- }
- JabberLog(ft->proto, "Thread ended: type=voice_send");
- TlenP2PFreeFileTransfer(ft);
-}
-
-static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft)
-{
- int codec, i;
- TLEN_FILE_PACKET *packet;
-
- codec = ft->proto->recordingControl->codec;
- if ((packet=TlenP2PPacketCreate(sizeof(DWORD)+MODE_FRAME_SIZE[codec]*33)) != NULL) {
- short *in;
- float val;
- in = ft->proto->recordingControl->recordingData;
- TlenP2PPacketSetType(packet, 0x96);
- packet->packet[0] = codec;
- TlenP2PPacketPackDword(packet, codec);
- val = 0;
- for (i=0; i<MODE_FRAME_SIZE[codec] * 160; i+=MODE_FRAME_SIZE[codec]) {
- val += in[i]*in[i];
- }
- i = (int)((log10(val) - 4) * 2.35);
- if (i > VU_METER_LEVELS - 1 ) {
- i = VU_METER_LEVELS - 1;
- } else if (i<0) {
- i = 0;
- }
- ft->proto->recordingControl->vuMeter = i;
- for (i=0; i<MODE_FRAME_SIZE[codec]; i++) {
- gsm_encode(ft->proto->recordingControl->gsmstate, in + i * 160);
- TlenP2PPacketPackBuffer(packet, (char*)ft->proto->recordingControl->gsmstate->gsmFrame, 33);
- }
- TlenVoiceCrypt(packet->packet+4, packet->len-4);
- if (!TlenP2PPacketSend(ft->s, packet)) {
- ft->state = FT_ERROR;
- }
- ft->proto->recordingControl->bytesSum += 8 + packet->len;
- TlenP2PPacketFree(packet);
- } else {
- ft->state = FT_ERROR;
- }
-}
-
-int TlenVoiceCancelAll(TlenProtocol *proto)
-{
- JABBER_LIST_ITEM *item;
- HANDLE hEvent;
- int i = 0;
-
- while ((i=JabberListFindNext(proto, LIST_VOICE, 0)) >=0 ) {
- if ((item=JabberListGetItemPtrFromIndex(proto, i)) != NULL) {
- TLEN_FILE_TRANSFER *ft = item->ft;
- JabberListRemoveByIndex(proto, i);
- if (ft != NULL) {
- if (ft->s) {
- //ProtoBroadcastAck(iface.m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- JabberLog(proto, "Closing ft->s = %d", ft->s);
- ft->state = FT_ERROR;
- Netlib_CloseHandle(ft->s);
- ft->s = NULL;
- if (ft->hFileEvent != NULL) {
- hEvent = ft->hFileEvent;
- ft->hFileEvent = NULL;
- SetEvent(hEvent);
- }
- } else {
- JabberLog(proto, "freeing (V) ft struct");
- TlenP2PFreeFileTransfer(ft);
- }
- }
- }
- }
- if (proto->voiceDlgHWND !=NULL) {
- EndDialog(proto->voiceDlgHWND, 0);
- }
- return 0;
-}
-
-INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
- DBVARIANT dbv;
- JABBER_LIST_ITEM *item;
- TLEN_FILE_TRANSFER *ft;
- TlenProtocol *proto =(TlenProtocol *)ptr;
- if (!proto->isOnline) {
- return 1;
- }
- if ((hContact=(HANDLE) wParam)!=NULL) {
- if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
- char serialId[32];
- sprintf(serialId, "%d", JabberSerialNext(proto));
- if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
- ft = TlenFileCreateFT(proto, dbv.pszVal);
- ft->iqId = mir_strdup(serialId);
- item->ft = ft;
-// JabberSend(ft->proto, "<iq to='%s'><query xmlns='voip'><voip k='1' s='1' v='1' i='51245604'/></query></iq>", ft->jid);
-// Sleep(5000);
- TlenVoiceStart(ft, 2);
- JabberSend(ft->proto, "<v t='%s' e='1' i='%s' v='1'/>", ft->jid, serialId);
- }
- DBFreeVariant(&dbv);
- }
- }
- return 0;
-}
-
-int TlenVoiceIsInUse(TlenProtocol *proto) {
- if (JabberListFindNext(proto, LIST_VOICE, 0) >= 0 || proto->voiceDlgHWND!=NULL) {
- JabberLog(proto, "voice in use ? %d", proto->voiceDlgHWND);
- return 1;
- }
- return 0;
-}
-
-static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr)
-{
- BITMAPINFO bmih;
- HBITMAP hbm;
- HDC hdc;
- bmih.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmih.bmiHeader.biWidth = w&0xFFFFFFFC;
- bmih.bmiHeader.biHeight = h;//&0xFFFFFFFC;
- bmih.bmiHeader.biPlanes = 1; // musi byc 1
- bmih.bmiHeader.biBitCount = bpp;
- bmih.bmiHeader.biCompression = BI_RGB;
- bmih.bmiHeader.biSizeImage = 0;
- bmih.bmiHeader.biXPelsPerMeter = 0;
- bmih.bmiHeader.biYPelsPerMeter = 0;
- bmih.bmiHeader.biClrUsed = 0;
- bmih.bmiHeader.biClrImportant = 0;
- hdc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
- hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER) &bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS);
- ReleaseDC(NULL,hdc);
- return hbm;
-}
-
-static void TlenVoiceInitVUMeters()
-{
- int i, v, y, x, x0, col, col0;
- unsigned char *pBits;
- int ledWidth, ledHeight;
- ledWidth = 9;
- ledHeight = 6;
- VU_METER_HEIGHT = ledHeight;
- VU_METER_WIDTH = (VU_METER_LEVELS-1) * ledWidth;
- VU_METER_WIDTH = (VU_METER_WIDTH + 3) & (~3);
- pBits = (unsigned char *)mir_alloc(3*VU_METER_WIDTH*VU_METER_HEIGHT);
- memset(pBits, 0x80, 3*VU_METER_WIDTH*VU_METER_HEIGHT);
- for (i=0;i<VU_METER_LEVELS;i++) {
- for (v=0;v<VU_METER_LEVELS-1;v++) {
- if (v>=i) {
- if (v < 10) col0 = 0x104010;
- else if (v<13) col0 = 0x404010;
- else col0 = 0x401010;
- } else {
- if (v < 10) col0 = 0x00f000;
- else if (v<13) col0 = 0xf0f000;
- else col0 = 0xf00000;
- }
- x0 = v * ledWidth;
- for (y=1;y<VU_METER_HEIGHT-1;y++) {
- col = col0;
- for (x=1;x<ledWidth;x++) {
- pBits[3*(x+x0+y*VU_METER_WIDTH)] = col &0xFF;
- pBits[3*(x+x0+y*VU_METER_WIDTH)+1] = (col>>8) &0xFF;
- pBits[3*(x+x0+y*VU_METER_WIDTH)+2] = (col>>16) &0xFF;
- }
- }
- }
- vuMeterBitmaps[i] = TlenVoiceMakeBitmap(VU_METER_WIDTH, VU_METER_HEIGHT, 24, pBits);
- }
- mir_free(pBits);
-}
-
-static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HDC hDC, hMemDC;
- int v;
- static int counter;
- TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg) {
- case WM_INITDIALOG:
- proto = (TlenProtocol *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
- proto->voiceDlgHWND = hwndDlg;
- TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_ADDSTRING, 0, (LPARAM) TranslateT("8000 Hz / 13.8 kbps"));
- SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_ADDSTRING, 0, (LPARAM) TranslateT("11025 Hz / 19.1 kbps"));
- SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_ADDSTRING, 0, (LPARAM) TranslateT("22050 Hz / 36.8 kbps"));
- SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_ADDSTRING, 0, (LPARAM) TranslateT("44100 Hz / 72 kbps"));
- SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_SETCURSEL, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_MICROPHONE, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_SPEAKER, BUTTONSETASFLATBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_MICROPHONE, BUTTONSETASPUSHBTN, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_SPEAKER, BUTTONSETASPUSHBTN, 0, 0);
- {
- HICON hIcon = GetIcolibIcon(IDI_MICROPHONE);
- SendDlgItemMessage(hwndDlg, IDC_MICROPHONE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon);
- ReleaseIcolibIcon(hIcon);
- hIcon = GetIcolibIcon(IDI_SPEAKER);
- SendDlgItemMessage(hwndDlg, IDC_SPEAKER, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon);
- ReleaseIcolibIcon(hIcon);
- }
- CheckDlgButton(hwndDlg, IDC_MICROPHONE, TRUE);
- CheckDlgButton(hwndDlg, IDC_SPEAKER, TRUE);
- TlenVoiceInitVUMeters();
- SetDlgItemText(hwndDlg, IDC_STATUS, TranslateT("...???..."));
- counter = 0;
- SetTimer(hwndDlg, 1, 100, NULL);
- return FALSE;
- case WM_TIMER:
- if (proto->recordingControl != NULL && !proto->recordingControl->bDisable) {
- v = proto->recordingControl->vuMeter % VU_METER_LEVELS;
- if (proto->recordingControl->vuMeter >0) {
- proto->recordingControl->vuMeter--;
- }
- } else {
- v = 0;
- }
- hDC = GetDC(GetDlgItem(hwndDlg, IDC_VUMETERIN));
- if (NULL != (hMemDC = CreateCompatibleDC( hDC ))) {
- SelectObject( hMemDC, vuMeterBitmaps[v]) ;
- BitBlt( hDC, 0, 0, VU_METER_WIDTH, VU_METER_HEIGHT, hMemDC, 0, 0, SRCCOPY ) ;
- DeleteDC(hMemDC);
- }
- ReleaseDC(GetDlgItem(hwndDlg, IDC_PLAN), hDC);
- if (proto->playbackControl != NULL && !proto->playbackControl->bDisable) {
- v = proto->playbackControl->vuMeter % VU_METER_LEVELS;
- if (proto->playbackControl->vuMeter >0) {
- proto->playbackControl->vuMeter--;
- }
- } else {
- v = 0;
- }
- hDC = GetDC(GetDlgItem(hwndDlg, IDC_VUMETEROUT));
- if (NULL != (hMemDC = CreateCompatibleDC( hDC ))) {
- SelectObject( hMemDC, vuMeterBitmaps[v]) ;
- BitBlt( hDC, 0, 0, VU_METER_WIDTH, VU_METER_HEIGHT, hMemDC, 0, 0, SRCCOPY ) ;
- DeleteDC(hMemDC);
- }
- ReleaseDC(GetDlgItem(hwndDlg, IDC_PLAN), hDC);
- counter ++;
- if (counter %10 == 0) {
- char str[50];
- float fv;
- if (proto->recordingControl != NULL) {
- fv = (float)proto->recordingControl->bytesSum;
- proto->recordingControl->bytesSum = 0;
- } else {
- fv = 0;
- }
- sprintf(str, "%.1f kB/s", fv / 1024);
- SetDlgItemTextA(hwndDlg, IDC_BYTESOUT, str);
- if (proto->playbackControl != NULL) {
- fv = (float)proto->playbackControl->bytesSum;
- proto->playbackControl->bytesSum = 0;
- } else {
- fv = 0;
- }
- sprintf(str, "%.1f kB/s", fv / 1024);
- SetDlgItemTextA(hwndDlg, IDC_BYTESIN, str);
- }
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
- case IDC_VCQUALITY:
- if (HIWORD(wParam)==CBN_SELCHANGE) {
- if (proto->recordingControl!=NULL) {
- int codec;
- codec = SendDlgItemMessage(hwndDlg, IDC_VCQUALITY, CB_GETCURSEL, 0, 0) + 2;
- if (codec!=proto->recordingControl->codec && codec>1 && codec<6) {
- TLEN_FILE_TRANSFER *ft = proto->recordingControl->ft;
- TlenVoiceFreeVc(proto->recordingControl);
- proto->recordingControl = TlenVoiceCreateVC(ft->proto, codec);
- proto->recordingControl->ft = ft;
- TlenVoiceRecordingStart(proto->recordingControl);
- }
- }
- }
- case IDC_MICROPHONE:
- if (proto->recordingControl!=NULL) {
- proto->recordingControl->bDisable = !IsDlgButtonChecked(hwndDlg, IDC_MICROPHONE);
- }
- break;
- case IDC_SPEAKER:
- if (proto->playbackControl!=NULL) {
- proto->playbackControl->bDisable = !IsDlgButtonChecked(hwndDlg, IDC_SPEAKER);
- }
- break;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- case WM_DESTROY:
- proto->voiceDlgHWND = NULL;
- break;
-
- }
- return FALSE;
-}
-
-static void __cdecl TlenVoiceDlgThread(void *ptr)
-{
-
- TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)ptr;
- TlenProtocol * proto = ft->proto;
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VOICE), NULL, TlenVoiceDlgProc, (LPARAM) proto);
- TlenVoiceCancelAll(proto);
-}
-
-int TlenVoiceStart(TLEN_FILE_TRANSFER *ft, int mode)
-{
-
- JabberLog(ft->proto, "starting voice %d", mode);
- if (mode==0) {
- JabberForkThread((void (__cdecl *)(void*))TlenVoiceReceiveThread, 0, ft);
- } else if (mode==1) {
- JabberForkThread((void (__cdecl *)(void*))TlenVoiceSendingThread, 0, ft);
- } else {
- JabberForkThread((void (__cdecl *)(void*))TlenVoiceDlgThread, 0, ft);
- }
- return 0;
-}
-
-static char *getDisplayName(TlenProtocol *proto, const char *id)
-{
- char jid[256];
- HANDLE hContact;
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
- if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
- return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
- }
- }
- return mir_strdup(id);
-}
-
-typedef struct {
- TlenProtocol *proto;
- JABBER_LIST_ITEM *item;
-}ACCEPTDIALOGDATA;
-
-static INT_PTR CALLBACK TlenVoiceAcceptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- ACCEPTDIALOGDATA * data;
- char *str;
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- data = (ACCEPTDIALOGDATA *) lParam;
- str = getDisplayName(data->proto, data->item->nick);
- SetDlgItemTextA(hwndDlg, IDC_FROM, str);
- mir_free(str);
- return FALSE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ACCEPT:
- EndDialog(hwndDlg, 1);
- return TRUE;
- case IDCANCEL:
- case IDCLOSE:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
- return FALSE;
-}
-
-static void __cdecl TlenVoiceAcceptDlgThread(void *ptr)
-{
-
- ACCEPTDIALOGDATA *data = (ACCEPTDIALOGDATA *)ptr;
- int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ACCEPT_VOICE), NULL, TlenVoiceAcceptDlgProc, (LPARAM) data);
- if (result && data->proto->isOnline) {
- data->item->ft = TlenFileCreateFT(data->proto, data->item->nick);
- data->item->ft->iqId = mir_strdup(data->item->jid);
- TlenVoiceStart(data->item->ft, 2);
- JabberSend(data->proto, "<v t='%s' i='%s' e='5' v='1'/>", data->item->nick, data->item->jid);
- } else {
- if (data->proto->isOnline) {
- JabberSend(data->proto, "<v t='%s' i='%s' e='4' />", data->item->nick, data->item->jid);
- }
- JabberListRemove(data->proto, LIST_VOICE, data->item->jid);
- }
- mir_free(data);
-}
-
-int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
-{
- JABBER_LIST_ITEM * item;
- if (!TlenVoiceIsInUse(proto)) {
- if ((item = JabberListAdd(proto, LIST_VOICE, id)) != NULL) {
- int ask, ignore, voiceChatPolicy;
- ask = TRUE;
- ignore = FALSE;
- voiceChatPolicy = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceChatPolicy", 0);
- if (voiceChatPolicy == TLEN_MUC_ASK) {
- ignore = FALSE;
- ask = TRUE;
- } else if (voiceChatPolicy == TLEN_MUC_IGNORE_ALL) {
- ignore = TRUE;
- } else if (voiceChatPolicy == TLEN_MUC_IGNORE_NIR) {
- char jid[256];
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- strcpy(jid, from);
- }
- ignore = !IsAuthorized(proto, jid);
- ask = TRUE;
- } else if (voiceChatPolicy == TLEN_MUC_ACCEPT_IR) {
- char jid[256];
- JABBER_LIST_ITEM *item;
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- strcpy(jid, from);
- }
- ask = !IsAuthorized(proto, jid);
- ignore = FALSE;
- } else if (voiceChatPolicy == TLEN_MUC_ACCEPT_ALL) {
- ask = FALSE;
- ignore = FALSE;
- }
- if (ignore) {
- if (proto->isOnline) {
- JabberSend(proto, "<v t='%s' i='%s' e='4' />", from, id);
- }
- JabberListRemove(proto, LIST_VOICE, id);
- } else {
- item->nick = mir_strdup(from);
- if (ask) {
- ACCEPTDIALOGDATA *data = (ACCEPTDIALOGDATA *)mir_alloc(sizeof(ACCEPTDIALOGDATA));
- data->proto = proto;
- data->item = item;
- JabberForkThread((void (__cdecl *)(void*))TlenVoiceAcceptDlgThread, 0, data);
- } else if (proto->isOnline) {
- item->ft = TlenFileCreateFT(proto, from);
- item->ft->iqId = mir_strdup(id);
- TlenVoiceStart(item->ft, 2);
- JabberSend(proto, "<v t='%s' i='%s' e='5' v='1'/>", item->nick, item->jid);
- }
- }
- return 1;
- }
- }
- return 0;
-}
-
-int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd)
-{ int i, j, iNumDevs;
- WAVEINCAPS wic;
- iNumDevs = waveInGetNumDevs();
- SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
- for (i = j = 0; i < iNumDevs; i++) {
- if (!waveInGetDevCaps(i, &wic, sizeof(WAVEINCAPS))) {
- if (wic.dwFormats != 0) {
- SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)wic.szPname);
- j++;
- }
- }
- }
- i = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceDeviceIn", 0);
- if (i>j) i = 0;
- SendMessage(hWnd, CB_SETCURSEL, i, 0);
- return 0;
-}
-
-int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd)
-{ int i, j, iNumDevs;
- WAVEOUTCAPS woc;
- iNumDevs = waveInGetNumDevs();
- SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
- for (i = j = 0; i < iNumDevs; i++) {
- if (!waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))) {
- if (woc.dwFormats != 0) {
- SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)woc.szPname);
- j++;
- }
- }
- }
- i = DBGetContactSettingWord(NULL, proto->iface.m_szModuleName, "VoiceDeviceOut", 0);
- if (i>j) i = 0;
- SendMessage(hWnd, CB_SETCURSEL, i, 0);
- return 0;
-}
diff --git a/protocols/Tlen/tlen_voice.h b/protocols/Tlen/tlen_voice.h
deleted file mode 100644
index cd38a23c1c..0000000000
--- a/protocols/Tlen/tlen_voice.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-
-Tlen Protocol Plugin for Miranda IM
-Copyright (C) 2004-2007 Piotr Piastucki
-
-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.
-
-*/
-
-#ifndef _TLEN_VOICE_H_
-#define _TLEN_VOICE_H_
-
-#include <windows.h>
-#include <mmsystem.h>
-
-#include "jabber.h"
-#include "codec/gsm.h"
-
-typedef struct TLEN_VOICE_CONTROL_STRUCT {
- int waveMode;
- int codec;
- int bDisable;
-
- short *recordingData;
- short *waveData;
- WAVEHDR *waveHeaders;
- int waveFrameSize;
- int waveHeadersPos;
- int waveHeadersNum;
-
-// HANDLE hEvent;
- HANDLE hThread;
- DWORD threadID;
- HWAVEOUT hWaveOut;
- HWAVEIN hWaveIn;
- int isRunning;
- int stopThread;
- gsm_state *gsmstate;
- TLEN_FILE_TRANSFER *ft;
- int vuMeter;
- int bytesSum;
- TlenProtocol *proto;
-} TLEN_VOICE_CONTROL;
-
-
-extern void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft);
-extern void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft);
-extern int TlenVoiceIsInUse(TlenProtocol *proto);
-extern INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, WPARAM wParam, LPARAM lParam);
-extern int TlenVoiceCancelAll(TlenProtocol *proto);
-extern int TlenVoiceStart(TLEN_FILE_TRANSFER *ft, int mode) ;
-extern int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from);
-extern int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd);
-extern int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd);
-#endif
-