diff options
Diffstat (limited to 'protocols/Skype/src')
52 files changed, 0 insertions, 10101 deletions
diff --git a/protocols/Skype/src/aes/aes.cpp b/protocols/Skype/src/aes/aes.cpp deleted file mode 100644 index e3dfa1261f..0000000000 --- a/protocols/Skype/src/aes/aes.cpp +++ /dev/null @@ -1,493 +0,0 @@ -/*
-* FIPS-197 compliant AES implementation
-*
-* Copyright (C) 2001-2004 Christophe Devine
-*
-* 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 "aes.h"
-
-/* forward S-box & tables */
-
-unsigned long int FSb[256];
-unsigned long int FT0[256];
-unsigned long int FT1[256];
-unsigned long int FT2[256];
-unsigned long int FT3[256];
-
-/* reverse S-box & tables */
-
-unsigned long int RSb[256];
-unsigned long int RT0[256];
-unsigned long int RT1[256];
-unsigned long int RT2[256];
-unsigned long int RT3[256];
-
-/* round constants */
-
-unsigned long int RCON[10];
-
-/* tables generation flag */
-
-int do_init = 1;
-
-/* tables generation routine */
-
-#define ROTR8(x) (((x << 24) & 0xFFFFFFFF) | ((x & 0xFFFFFFFF) >> 8))
-
-#define XTIME(x) ((x << 1) ^ ((x & 0x80) ? 0x1B : 0x00))
-#define MUL(x, y) ((x && y) ? pow[(log[x] + log[y]) % 255] : 0)
-
-void aes_gen_tables(void)
-{
- int i;
- unsigned char x, y;
- unsigned char pow[256];
- unsigned char log[256];
-
- /* compute pow and log tables over GF(2^8) */
-
- for (i = 0, x = 1; i < 256; i++, x ^= XTIME(x))
- {
- pow[i] = x;
- log[x] = i;
- }
-
- /* calculate the round constants */
-
- for (i = 0, x = 1; i < 10; i++, x = XTIME(x))
- {
- RCON[i] = (unsigned long int)x << 24;
- }
-
- /* 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);
- x ^= y;
- y = (y << 1) | (y >> 7);
- x ^= y;
- y = (y << 1) | (y >> 7);
- x ^= y;
- y = (y << 1) | (y >> 7);
- x ^= y ^ 0x63;
-
- FSb[i] = x;
- RSb[x] = i;
- }
-
- /* generate the forward and reverse tables */
-
- for (i = 0; i < 256; i++)
- {
- x = (unsigned char)FSb[i];
- y = XTIME(x);
-
- FT0[i] = (unsigned long int)(x ^ y) ^
- ((unsigned long int)x << 8) ^
- ((unsigned long int)x << 16) ^
- ((unsigned long int)y << 24);
-
- FT0[i] &= 0xFFFFFFFF;
-
- FT1[i] = ROTR8(FT0[i]);
- FT2[i] = ROTR8(FT1[i]);
- FT3[i] = ROTR8(FT2[i]);
-
- y = (unsigned char)RSb[i];
-
- RT0[i] = ((unsigned long int)MUL(0x0B, y)) ^
- ((unsigned long int)MUL(0x0D, y) << 8) ^
- ((unsigned long int)MUL(0x09, y) << 16) ^
- ((unsigned long int)MUL(0x0E, y) << 24);
-
- RT0[i] &= 0xFFFFFFFF;
-
- RT1[i] = ROTR8(RT0[i]);
- RT2[i] = ROTR8(RT1[i]);
- RT3[i] = ROTR8(RT2[i]);
- }
-}
-
-/* platform-independant 32-bit integer manipulation macros */
-
-#define GET_UINT32(n, b, i) \
-{ \
- (n) = ((unsigned long int)(b)[(i)] << 24) \
- | ((unsigned long int)(b)[(i) + 1] << 16) \
- | ((unsigned long int)(b)[(i) + 2] << 8) \
- | ((unsigned long int)(b)[(i) + 3]); \
-}
-
-#define PUT_UINT32(n, b, i) \
-{ \
- (b)[(i)] = (unsigned char)((n) >> 24); \
- (b)[(i) + 1] = (unsigned char)((n) >> 16); \
- (b)[(i) + 2] = (unsigned char)((n) >> 8); \
- (b)[(i) + 3] = (unsigned char)((n)); \
-}
-
-/* decryption key schedule tables */
-
-int KT_init = 1;
-
-unsigned long int KT0[256];
-unsigned long int KT1[256];
-unsigned long int KT2[256];
-unsigned long int KT3[256];
-
-/* AES key scheduling routine */
-
-int aes_set_key(aes_context *ctx, unsigned char *key, int nbits)
-{
- int i;
- unsigned long int *RK, *SK;
-
- if (do_init)
- {
- aes_gen_tables();
-
- do_init = 0;
- }
-
- switch (nbits)
- {
- case 128: ctx->nr = 10; break;
- case 192: ctx->nr = 12; break;
- case 256: ctx->nr = 14; break;
- default : return 1;
- }
-
- RK = ctx->erk;
-
- for (i = 0; i < (nbits >> 5); i++)
- {
- GET_UINT32(RK[i], key, i * 4);
- }
-
- /* setup encryption round keys */
-
- switch (nbits)
- {
- case 128:
- for (i = 0; i < 10; i++, RK += 4)
- {
- RK[4] = RK[0] ^ RCON[i] ^
- (FSb[(unsigned char)(RK[3] >> 16)] << 24) ^
- (FSb[(unsigned char)(RK[3] >> 8)] << 16) ^
- (FSb[(unsigned char)(RK[3])] << 8) ^
- (FSb[(unsigned char)(RK[3] >> 24)]);
-
- RK[5] = RK[1] ^ RK[4];
- RK[6] = RK[2] ^ RK[5];
- RK[7] = RK[3] ^ RK[6];
- }
- break;
-
- case 192:
- for (i = 0; i < 8; i++, RK += 6)
- {
- RK[6] = RK[0] ^ RCON[i] ^
- (FSb[(unsigned char)(RK[5] >> 16)] << 24) ^
- (FSb[(unsigned char)(RK[5] >> 8)] << 16) ^
- (FSb[(unsigned char)(RK[5])] << 8) ^
- (FSb[(unsigned char)(RK[5] >> 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 256:
- for (i = 0; i < 7; i++, RK += 8)
- {
- RK[8] = RK[0] ^ RCON[i] ^
- (FSb[(unsigned char)(RK[7] >> 16)] << 24) ^
- (FSb[(unsigned char)(RK[7] >> 8)] << 16) ^
- (FSb[(unsigned char)(RK[7])] << 8) ^
- (FSb[(unsigned char)(RK[7] >> 24)]);
-
- RK[9] = RK[1] ^ RK[8];
- RK[10] = RK[2] ^ RK[9];
- RK[11] = RK[3] ^ RK[10];
-
- RK[12] = RK[4] ^
- (FSb[(unsigned char)(RK[11] >> 24)] << 24) ^
- (FSb[(unsigned char)(RK[11] >> 16)] << 16) ^
- (FSb[(unsigned char)(RK[11] >> 8)] << 8) ^
- (FSb[(unsigned char)(RK[11])]);
-
- RK[13] = RK[5] ^ RK[12];
- RK[14] = RK[6] ^ RK[13];
- RK[15] = RK[7] ^ RK[14];
- }
- break;
- }
-
- /* setup decryption round keys */
-
- if (KT_init)
- {
- for (i = 0; i < 256; i++)
- {
- KT0[i] = RT0[FSb[i]];
- KT1[i] = RT1[FSb[i]];
- KT2[i] = RT2[FSb[i]];
- KT3[i] = RT3[FSb[i]];
- }
-
- KT_init = 0;
- }
-
- SK = ctx->drk;
-
- *SK++ = *RK++;
- *SK++ = *RK++;
- *SK++ = *RK++;
- *SK++ = *RK++;
-
- for (i = 1; i < ctx->nr; i++)
- {
- RK -= 8;
-
- *SK++ = KT0[(unsigned char)(*RK >> 24)] ^
- KT1[(unsigned char)(*RK >> 16)] ^
- KT2[(unsigned char)(*RK >> 8)] ^
- KT3[(unsigned char)(*RK)];
- RK++;
-
- *SK++ = KT0[(unsigned char)(*RK >> 24)] ^
- KT1[(unsigned char)(*RK >> 16)] ^
- KT2[(unsigned char)(*RK >> 8)] ^
- KT3[(unsigned char)(*RK)];
- RK++;
-
- *SK++ = KT0[(unsigned char)(*RK >> 24)] ^
- KT1[(unsigned char)(*RK >> 16)] ^
- KT2[(unsigned char)(*RK >> 8)] ^
- KT3[(unsigned char)(*RK)];
- RK++;
-
- *SK++ = KT0[(unsigned char)(*RK >> 24)] ^
- KT1[(unsigned char)(*RK >> 16)] ^
- KT2[(unsigned char)(*RK >> 8)] ^
- KT3[(unsigned char)(*RK)];
- RK++;
- }
-
- RK -= 8;
-
- *SK++ = *RK++;
- *SK++ = *RK++;
- *SK++ = *RK++;
- *SK++ = *RK++;
-
- return 0;
-}
-
-/* AES 128-bit block encryption routine */
-
-void aes_encrypt(aes_context *ctx, unsigned char input[16], unsigned char output[16])
-{
- unsigned long int *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
-
- RK = ctx->erk;
-
- GET_UINT32(X0, input, 0); X0 ^= RK[0];
- GET_UINT32(X1, input, 4); X1 ^= RK[1];
- GET_UINT32(X2, input, 8); X2 ^= RK[2];
- GET_UINT32(X3, input, 12); X3 ^= RK[3];
-
-#define AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \
-{ \
- RK += 4; \
- \
- X0 = RK[0] ^ FT0[(unsigned char)(Y0 >> 24)] ^ \
- FT1[(unsigned char)(Y1 >> 16)] ^ \
- FT2[(unsigned char)(Y2 >> 8)] ^ \
- FT3[(unsigned char)(Y3)]; \
- \
- X1 = RK[1] ^ FT0[(unsigned char)(Y1 >> 24)] ^ \
- FT1[(unsigned char)(Y2 >> 16)] ^ \
- FT2[(unsigned char)(Y3 >> 8)] ^ \
- FT3[(unsigned char)(Y0)]; \
- \
- X2 = RK[2] ^ FT0[(unsigned char)(Y2 >> 24)] ^ \
- FT1[(unsigned char)(Y3 >> 16)] ^ \
- FT2[(unsigned char)(Y0 >> 8)] ^ \
- FT3[(unsigned char)(Y1)]; \
- \
- X3 = RK[3] ^ FT0[(unsigned char)(Y3 >> 24)] ^ \
- FT1[(unsigned char)(Y0 >> 16)] ^ \
- FT2[(unsigned char)(Y1 >> 8)] ^ \
- FT3[(unsigned char)(Y2)]; \
-}
-
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 1 */
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 2 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 3 */
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 4 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 5 */
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 6 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 7 */
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 8 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 9 */
-
- if (ctx->nr > 10)
- {
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 10 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 11 */
- }
-
- if (ctx->nr > 12)
- {
- AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 12 */
- AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 13 */
- }
-
- /* last round */
-
- RK += 4;
-
- X0 = RK[0] ^ (FSb[(unsigned char)(Y0 >> 24)] << 24) ^
- (FSb[(unsigned char)(Y1 >> 16)] << 16) ^
- (FSb[(unsigned char)(Y2 >> 8)] << 8) ^
- (FSb[(unsigned char)(Y3)]);
-
- X1 = RK[1] ^ (FSb[(unsigned char)(Y1 >> 24)] << 24) ^
- (FSb[(unsigned char)(Y2 >> 16)] << 16) ^
- (FSb[(unsigned char)(Y3 >> 8)] << 8) ^
- (FSb[(unsigned char)(Y0)]);
-
- X2 = RK[2] ^ (FSb[(unsigned char)(Y2 >> 24)] << 24) ^
- (FSb[(unsigned char)(Y3 >> 16)] << 16) ^
- (FSb[(unsigned char)(Y0 >> 8)] << 8) ^
- (FSb[(unsigned char)(Y1)]);
-
- X3 = RK[3] ^ (FSb[(unsigned char)(Y3 >> 24)] << 24) ^
- (FSb[(unsigned char)(Y0 >> 16)] << 16) ^
- (FSb[(unsigned char)(Y1 >> 8)] << 8) ^
- (FSb[(unsigned char)(Y2)]);
-
- PUT_UINT32(X0, output, 0);
- PUT_UINT32(X1, output, 4);
- PUT_UINT32(X2, output, 8);
- PUT_UINT32(X3, output, 12);
-}
-
-/* AES 128-bit block decryption routine */
-
-void aes_decrypt(aes_context *ctx, unsigned char input[16], unsigned char output[16])
-{
- unsigned long int *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
-
- RK = ctx->drk;
-
- GET_UINT32(X0, input, 0);
- X0 ^= RK[0];
- GET_UINT32(X1, input, 4);
- X1 ^= RK[1];
- GET_UINT32(X2, input, 8);
- X2 ^= RK[2];
- GET_UINT32(X3, input, 12);
- X3 ^= RK[3];
-
-#define AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \
-{ \
- RK += 4; \
- \
- X0 = RK[0] ^ RT0[(unsigned char)(Y0 >> 24)] ^ \
- RT1[(unsigned char)(Y3 >> 16)] ^ \
- RT2[(unsigned char)(Y2 >> 8)] ^ \
- RT3[(unsigned char)(Y1)]; \
- \
- X1 = RK[1] ^ RT0[(unsigned char)(Y1 >> 24)] ^ \
- RT1[(unsigned char)(Y0 >> 16)] ^ \
- RT2[(unsigned char)(Y3 >> 8)] ^ \
- RT3[(unsigned char)(Y2)]; \
- \
- X2 = RK[2] ^ RT0[(unsigned char)(Y2 >> 24)] ^ \
- RT1[(unsigned char)(Y1 >> 16)] ^ \
- RT2[(unsigned char)(Y0 >> 8)] ^ \
- RT3[(unsigned char)(Y3)]; \
- \
- X3 = RK[3] ^ RT0[(unsigned char)(Y3 >> 24)] ^ \
- RT1[(unsigned char)(Y2 >> 16)] ^ \
- RT2[(unsigned char)(Y1 >> 8)] ^ \
- RT3[(unsigned char)(Y0)]; \
-}
-
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 1 */
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 2 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 3 */
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 4 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 5 */
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 6 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 7 */
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 8 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 9 */
-
- if (ctx->nr > 10)
- {
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 10 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 11 */
- }
-
- if (ctx->nr > 12)
- {
- AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 12 */
- AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 13 */
- }
-
- /* last round */
-
- RK += 4;
-
- X0 = RK[0] ^ (RSb[(unsigned char)(Y0 >> 24)] << 24) ^
- (RSb[(unsigned char)(Y3 >> 16)] << 16) ^
- (RSb[(unsigned char)(Y2 >> 8)] << 8) ^
- (RSb[(unsigned char)(Y1)]);
-
- X1 = RK[1] ^ (RSb[(unsigned char)(Y1 >> 24)] << 24) ^
- (RSb[(unsigned char)(Y0 >> 16)] << 16) ^
- (RSb[(unsigned char)(Y3 >> 8)] << 8) ^
- (RSb[(unsigned char)(Y2)]);
-
- X2 = RK[2] ^ (RSb[(unsigned char)(Y2 >> 24)] << 24) ^
- (RSb[(unsigned char)(Y1 >> 16)] << 16) ^
- (RSb[(unsigned char)(Y0 >> 8)] << 8) ^
- (RSb[(unsigned char)(Y3)]);
-
- X3 = RK[3] ^ (RSb[(unsigned char)(Y3 >> 24)] << 24) ^
- (RSb[(unsigned char)(Y2 >> 16)] << 16) ^
- (RSb[(unsigned char)(Y1 >> 8)] << 8) ^
- (RSb[(unsigned char)(Y0)]);
-
- PUT_UINT32(X0, output, 0);
- PUT_UINT32(X1, output, 4);
- PUT_UINT32(X2, output, 8);
- PUT_UINT32(X3, output, 12);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/aes/aes.h b/protocols/Skype/src/aes/aes.h deleted file mode 100644 index 8bc958b410..0000000000 --- a/protocols/Skype/src/aes/aes.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _AES_H
-#define _AES_H
-
-typedef struct
-{
- unsigned long int erk[64]; /* encryption round keys */
- unsigned long int drk[64]; /* decryption round keys */
- int nr; /* number of rounds */
-} aes_context;
-
-int aes_set_key(aes_context *ctx, unsigned char *key, int nbits);
-void aes_encrypt(aes_context *ctx, unsigned char input[16], unsigned char output[16]);
-void aes_decrypt(aes_context *ctx, unsigned char input[16], unsigned char output[16]);
-
-#endif /* aes.h */
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h deleted file mode 100644 index e155854f36..0000000000 --- a/protocols/Skype/src/resource.h +++ /dev/null @@ -1,123 +0,0 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by E:\Projects\C++\MirandaNG\protocols\Skype\res\Resource.rc
-//
-#define IDD_ACCMGR 9
-#define IDD_OPT_MAIN 10
-#define IDD_INFO_SKYPE 11
-#define IDD_OWNINFO_PERSONAL 12
-#define IDD_OWNINFO_HOME 13
-#define IDD_OWNINFO_CONTACT 14
-#define IDD_PASSWORD_CHANGE 15
-#define IDD_CHATROOM_INVITE 16
-#define IDD_PASSWORD_REQUEST 17
-#define IDD_CHATROOM_CREATE 18
-#define IDD_CHATROOM_CONFIG 19
-#define IDD_OPT_BLOCKED 20
-#define IDD_IGNORE_LIST 21
-#define IDD_BLOCK 22
-#define IDD_OWNINFO_ACCOUNT 23
-#define IDD_OPT_PRIVACY 24
-#define IDI_SKYPE 101
-#define IDR_RUNTIME 102
-#define IDR_KEY 107
-#define IDI_CALL 108
-#define IDI_ADD_CONTACTS 109
-#define IDI_SEND_CONTACTS 110
-#define IDI_DELETE 112
-#define IDI_BLOCK 115
-#define IDI_CONFERENCE 116
-#define IDI_CONTACT 117
-#define IDC_CCLIST 173
-#define IDC_EDITSCR 174
-#define IDC_ADDSCR 175
-#define IDC_SN 1001
-#define IDC_PW 1002
-#define IDC_SL 1003
-#define IDC_SAVEPASS 1004
-#define IDC_SAVEPASSWORD 1005
-#define IDC_PASSWORD 1006
-#define IDC_INSTRUCTION 1007
-#define IDC_INSTRUCTION2 1008
-#define IDC_INSTRUCTION3 1009
-#define IDC_SID 1010
-#define IDC_STATUSTEXT 1011
-#define IDC_ONLINESINCE 1012
-#define IDC_LASTEVENTDATE 1013
-#define IDC_PASSWORD3 1014
-#define IDC_LASTPROFILECHANGE 1015
-#define IDC_PORT 1016
-#define IDC_USE_ALT_PORTS 1017
-#define IDC_REGISTER 1018
-#define IDC_CHANGE_PWD 1019
-#define IDC_DEFAULT_GROUP 1020
-#define IDC_GROUP 1021
-#define IDC_PASSWORD2 1023
-#define IDC_FULLNAME 1025
-#define IDC_EMAIL1 1026
-#define IDC_EMAIL2 1027
-#define IDC_EMAIL3 1028
-#define IDC_BIRTH_DAY 1029
-#define IDC_BIRTH_MONTH 1030
-#define IDC_BIRTH_YEAR 1031
-#define IDC_MOBPHONE 1032
-#define IDC_GENDER 1033
-#define IDC_HOMEPHONE 1034
-#define IDC_HOMEPAGE 1035
-#define IDC_OFFICEPHONE 1036
-#define IDC_LANGUAGE 1037
-#define IDC_ABOUT 1038
-#define IDC_MOOD 1039
-#define IDC_CITY 1040
-#define IDC_STATE 1041
-#define IDC_COUNTRY 1042
-#define IDC_TIMEZONE 1043
-#define IDC_CHAT_TOPIC 1044
-#define IDC_CHAT_GUIDLINE 1045
-#define IDC_CHAT_JOINING 1046
-#define IDC_CHAT_GUIDLINE2 1047
-#define IDC_CHAT_ROLES 1048
-#define IDC_CHAT_GUIDLINE3 1049
-#define IDC_CONTACTS 1050
-#define IDC_CHAT_SECURED 1051
-#define IDC_CHAT_GUIDLINE4 1052
-#define IDC_CHAT_PASSWORD 1053
-#define IDC_CHAT_CONFIRMATION 1054
-#define IDC_CHAT_HINT 1055
-#define IDC_CHECK1 1056
-#define IDC_COMBO2 1057
-#define IDC_CHECK2 1058
-#define IDC_BLOCK 1059
-#define IDC_REPORT_ABUSE 1060
-#define IDC_REMOVE_FROM_CL 1061
-#define IDC_MESSAGE 1062
-#define IDC_HEADERBAR 1063
-#define IDC_BM_LIST 1064
-#define IDC_LIST 1065
-#define IDC_PRIVACY_IM_ANYONE 1066
-#define IDC_PRIVACY_IM_CONTACTLIST 1067
-#define IDC_PRIVACY_CALL_ANYONE 1068
-#define IDC_PRIVACY_CALL_CONTACTLIST 1069
-#define IDC_PRIVACY_SHARE_ANYONE 1070
-#define IDC_PRIVACY_SHARE_CONTACTLIST 1071
-#define IDC_PRIVACY_SHARE_NOONE 1072
-#define IDC_PRIVACY_WEB 1073
-#define IDC_CREDITVALUE 1074
-#define IDC_CREDITCURRENCY 1075
-#define IDC_PRIVACY_AVATAR_ANYONE 1076
-#define IDC_PRIVACY_AVATARS_CONTACTLIST 1077
-#define IDC_PRIVACY_COUNT_ANYONE 1078
-#define IDC_PRIVACY_COUNT_CONTACTLIST 1079
-#define IDC_PRIVACY_TIME_ANYONE 1080
-#define IDC_PRIVACY_TIME_CONTACTLIST 1081
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 118
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1082
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp deleted file mode 100644 index 0416d8f473..0000000000 --- a/protocols/Skype/src/skype.cpp +++ /dev/null @@ -1,213 +0,0 @@ -#include "skype.h"
-
-int hLangpack;
-HINSTANCE g_hInstance;
-
-TIME_API tmi = {0};
-
-int g_cbCountries;
-struct CountryListEntry* g_countries;
-
-PLUGININFOEX pluginInfo =
-{
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {9C448C61-FC3F-42F9-B9F0-4A30E1CF8671}
- {0x9c448c61, 0xfc3f, 0x42f9, {0xb9, 0xf0, 0x4a, 0x30, 0xe1, 0xcf, 0x86, 0x71}}
-};
-
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
-
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
-
-// ---
-
-BOOL IsRunAsAdmin()
-{
- BOOL fIsRunAsAdmin = FALSE;
- DWORD dwError = ERROR_SUCCESS;
- PSID pAdministratorsGroup = NULL;
-
- // Allocate and initialize a SID of the administrators group.
- SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
- if ( !AllocateAndInitializeSid(
- &NtAuthority,
- 2,
- SECURITY_BUILTIN_DOMAIN_RID,
- DOMAIN_ALIAS_RID_ADMINS,
- 0, 0, 0, 0, 0, 0,
- &pAdministratorsGroup))
- {
- dwError = GetLastError();
- goto Cleanup;
- }
-
- // Determine whether the SID of administrators group is enabled in
- // the primary access token of the process.
- if ( !CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
- {
- dwError = GetLastError();
- goto Cleanup;
- }
-
-Cleanup:
- // Centralized cleanup for all allocated resources.
- if (pAdministratorsGroup)
- {
- FreeSid(pAdministratorsGroup);
- pAdministratorsGroup = NULL;
- }
-
- // Throw the error if something failed in the function.
- if (ERROR_SUCCESS != dwError)
- {
- throw dwError;
- }
-
- return fIsRunAsAdmin;
-}
-
-int UnpackSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName)
-{
- wchar_t fileName[MAX_PATH];
- ::GetModuleFileName(hInstance, fileName, MAX_PATH);
-
- wchar_t *skypeKitPath = ::wcsrchr(fileName, '\\');
- if (skypeKitPath != NULL)
- *skypeKitPath = 0;
- ::mir_snwprintf(fileName, SIZEOF(fileName), L"%s\\%s", fileName, L"SkypeKit.exe");
- if ( ::GetFileAttributes(fileName) == DWORD(-1))
- {
- HRSRC hRes = ::FindResource(hInstance, MAKEINTRESOURCE(IDR_RUNTIME), L"BIN");
- if (hRes)
- {
- HGLOBAL hResource = ::LoadResource(hInstance, hRes);
- if (hResource)
- {
- HANDLE hFile;
- char *pData = (char *)LockResource(hResource);
- DWORD dwSize = SizeofResource(hInstance, hRes), written = 0;
- if ((hFile = ::CreateFile(
- fileName,
- GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- 0)) != INVALID_HANDLE_VALUE)
- {
- ::WriteFile(hFile, (void *)pData, dwSize, &written, NULL);
- ::CloseHandle(hFile);
- }
- else
- {
- // Check the current process's "run as administrator" status.
- // Elevate the process if it is not run as administrator.
- if (!IsRunAsAdmin())
- {
- wchar_t path[MAX_PATH], cmdLine[100];
- ::GetModuleFileName(NULL, path, ARRAYSIZE(path));
-
- if (profileName)
- ::mir_snwprintf(
- cmdLine,
- SIZEOF(cmdLine),
- L" /restart:%d /profile=%s",
- ::GetCurrentProcessId(),
- profileName);
- else
- ::mir_snwprintf(
- cmdLine,
- SIZEOF(cmdLine),
- L" /restart:%d",
- ::GetCurrentProcessId());
-
- // Launch itself as administrator.
- SHELLEXECUTEINFO sei = { sizeof(sei) };
- sei.lpVerb = L"runas";
- sei.lpFile = path;
- sei.lpParameters = cmdLine;
- //sei.hwnd = hDlg;
- sei.nShow = SW_NORMAL;
-
- if ( !::ShellExecuteEx(&sei))
- {
- DWORD dwError = ::GetLastError();
- if (dwError == ERROR_CANCELLED)
- {
- // The user refused to allow privileges elevation.
- // Do nothing ...
- }
- }
- }
- else
- return 0;
- }
- }
- else
- return 0;
- }
- else
- return 0;
- }
-
- return 1;
-}
-
-// ---
-
-extern "C" int __declspec(dllexport) Load(void)
-{
- VARST profilename( _T("%miranda_profilename%"));
-
- if ( !UnpackSkypeRuntime(g_hInstance, (TCHAR *)profilename))
- {
- ::MessageBox(NULL, TranslateT("Did not unpack SkypeKit.exe."), _T(MODULE), MB_OK | MB_ICONERROR);
- return 1;
- }
-
- mir_getTMI(&tmi);
- mir_getLP(&pluginInfo);
-
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = "SKYPE";
- pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)CSkypeProto::InitSkypeProto;
- pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitSkypeProto;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-
- CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
-
- CSkypeProto::InitIcons();
- CSkypeProto::InitMenus();
- CSkypeProto::InitHookList();
- CSkypeProto::InitLanguages();
- CSkypeProto::InitServiceList();
-
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Unload(void)
-{
- CSkypeProto::UninitIcons();
- CSkypeProto::UninitMenus();
- CSkypeProto::UninitInstances();
- return 0;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h deleted file mode 100644 index d27c7564ab..0000000000 --- a/protocols/Skype/src/skype.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once
-
-#include <windows.h>
-#include <shlwapi.h>
-#include <ShellAPI.h>
-#include <malloc.h>
-#include <tlhelp32.h>
-#include <string>
-#include <io.h>
-#include <fcntl.h>
-#include <time.h>
-
-#include <map>
-#include <string>
-
-#include <newpluginapi.h>
-#include <m_system_cpp.h>
-#include <m_assocmgr.h>
-#include <m_avatars.h>
-#include <m_clist.h>
-#include <m_clistint.h>
-#include <m_clui.h>
-#include <m_core.h>
-#include <m_database.h>
-#include <m_ignore.h>
-#include <m_langpack.h>
-#include <m_message.h>
-#include <m_netlib.h>
-#include <m_options.h>
-#include <m_popup.h>
-#include <m_protocols.h>
-#include <m_protomod.h>
-#include <m_protosvc.h>
-#include <m_protoint.h>
-#include <m_skin.h>
-#include <m_userinfo.h>
-#include <m_icolib.h>
-#include <m_utils.h>
-#include <m_history.h>
-#include <m_xml.h>
-#include <win2k.h>
-#include <m_timezones.h>
-
-#include <m_msg_buttonsbar.h>
-#include <m_folders.h>
-
-#include "resource.h"
-#include "version.h"
-
-#define MODULE "Skype"
-#define SKYPE_SID_LIMIT 128
-#define SKYPE_PASSWORD_LIMIT 128
-#define SKYPE_GROUP_NAME_LIMIT 100
-
-#define SKYPE_SETTINGS_STATUS "Status"
-#define SKYPE_SETTINGS_SID "sid"
-#define SKYPE_SETTINGS_PASSWORD "Password"
-#define SKYPE_SETTINGS_DEF_GROUP "DefaultGroup"
-
-#define SKYPE_SEARCH_BYSID 1001
-#define SKYPE_SEARCH_BYEMAIL 1002
-#define SKYPE_SEARCH_BYNAMES 1003
-
-#define BBB_ID_CONF_INVITE 2001
-#define BBB_ID_CONF_SPAWN 2002
-
-#define SKYPE_DB_EVENT_TYPE_EMOTE 10001
-#define SKYPE_DB_EVENT_TYPE_CONTACTS 10002
-#define SKYPE_DB_EVENT_TYPE_CALL 10010
-
-enum
-{
- CMI_AUTH_REQUEST,
- CMI_AUTH_GRANT,
- CMI_AUTH_REVOKE,
- CMI_BLOCK,
- CMI_HISTORY,
- CMI_MAX // this item shall be the last one
-};
-
-#define SMI_CHAT_CREATE 1
-#define SMI_IGNORE_LIST 2
-
-#include "string_list.h"
-
-#include "skypekit\common.h"
-#include "skypekit\group.h"
-#include "skypekit\search.h"
-#include "skypekit\account.h"
-#include "skypekit\contact.h"
-#include "skypekit\message.h"
-#include "skypekit\transfer.h"
-#include "skypekit\participant.h"
-#include "skypekit\conversation.h"
-
-#include "skype_proto.h"
-
-extern HINSTANCE g_hInstance;
-
-extern int g_cbCountries;
-extern struct CountryListEntry* g_countries;
\ No newline at end of file diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp deleted file mode 100644 index d3729f317a..0000000000 --- a/protocols/Skype/src/skype_account.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#include "skype.h"
-
-wchar_t *CSkypeProto::LogoutReasons[] =
-{
- LPGENW("") /* --- */,
- LPGENW("LOGOUT_CALLED") /* LOGOUT_CALLED */,
- LPGENW("HTTPS proxy authentication failed") /* HTTPS_PROXY_AUTH_FAILED */,
- LPGENW("SOCKS proxy authentication failed") /* SOCKS_PROXY_AUTH_FAILED */,
- LPGENW("P2P connection failed") /* P2P_CONNECT_FAILED */,
- LPGENW("Connection to server failed. SkypeKit has been deprecated by Microsoft.") /* SERVER_CONNECT_FAILED */,
- LPGENW("Server is overloaded") /* SERVER_OVERLOADED */,
- LPGENW("SkypeKit database already in use") /* DB_IN_USE */,
- LPGENW("Invalid Skype name") /* INVALID_SKYPENAME */,
- LPGENW("Invalid email") /* INVALID_EMAIL */,
- LPGENW("Unacceptable password") /* UNACCEPTABLE_PASSWORD */,
- LPGENW("Skype name is taken") /* SKYPENAME_TAKEN */,
- LPGENW("REJECTED_AS_UNDERAGE") /* REJECTED_AS_UNDERAGE */,
- LPGENW("NO_SUCH_IDENTITY") /* NO_SUCH_IDENTITY */,
- LPGENW("Incorrect password") /* INCORRECT_PASSWORD */,
- LPGENW("Too many login attempts") /* TOO_MANY_LOGIN_ATTEMPTS */,
- LPGENW("Password has changed") /* PASSWORD_HAS_CHANGED */,
- LPGENW("PERIODIC_UIC_UPDATE_FAILED") /* PERIODIC_UIC_UPDATE_FAILED */,
- LPGENW("DB_DISK_FULL") /* DB_DISK_FULL */,
- LPGENW("DB_IO_ERROR") /* DB_IO_ERROR */,
- LPGENW("SkypeKit database is corrupt") /* DB_CORRUPT */,
- LPGENW("DB_FAILURE") /* DB_FAILURE */,
- LPGENW("Invalid application ID") /* INVALID_APP_ID */,
- LPGENW("APP_ID_FAILURE") /* APP_ID_FAILURE */,
- LPGENW("Version is unsupported") /* UNSUPPORTED_VERSION */,
- LPGENW("Account blocked") /* ATO_BLOCKED */,
- LPGENW("Logout from another instance") /* REMOTE_LOGOUT */,
- LPGENW("ACCESS_TOKEN_RENEWAL_FAILED") /* ACCESS_TOKEN_RENEWAL_FAILED */
-};
-
-wchar_t *CSkypeProto::PasswordChangeReasons[] =
-{
- LPGENW("Password successfully changed") /* PWD_OK */,
- LPGENW("Password changing") /* PWD_CHANGING */,
- LPGENW("Old password was incorrect") /* PWD_INVALID_OLD_PASSWORD */,
- LPGENW("Failed to verify password. No connection to server") /* PWD_SERVER_CONNECT_FAILED */,
- LPGENW("Password was set but server didn't like it much") /* PWD_OK_BUT_CHANGE_SUGGESTED */,
- LPGENW("New password was exactly the same as old one") /* PWD_MUST_DIFFER_FROM_OLD */,
- LPGENW("The new password was unacceptable") /* PWD_INVALID_NEW_PWD */,
- LPGENW("Account was currently not logged in") /* PWD_MUST_LOG_IN_TO_CHANGE */,
-};
-
-bool CSkypeProto::IsOnline()
-{
- return this->m_iStatus > ID_STATUS_OFFLINE;
-}
-
-bool CSkypeProto::PrepareLogin()
-{
- this->login = ::db_get_wsa(NULL, this->m_szModuleName, SKYPE_SETTINGS_SID);
- if ( !this->login || !::wcslen(this->login))
- {
- this->m_iStatus = ID_STATUS_OFFLINE;
- this->SendBroadcast(ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
-
- wchar_t message[512];
- ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("You have not entered a Skype name.\nConfigure this in Options->Network->%s and try again."), this->m_tszUserName);
- this->ShowNotification(message);
- return false;
- }
-
- return true;
-}
-
-bool CSkypeProto::PreparePassword()
-{
- if ( !this->rememberPassword)
- {
- if (this->password)
- {
- ::mir_free(this->password);
- this->password = NULL;
- }
- this->password = ::db_get_sa(NULL, this->m_szModuleName, SKYPE_SETTINGS_PASSWORD);
- if ( !this->password || !::strlen(this->password))
- {
- if (this->password)
- {
- ::mir_free(this->password);
- this->password = NULL;
- }
- PasswordRequestBoxParam param(this->login);
- if ( !this->RequestPassword(param))
- {
- this->SetStatus(ID_STATUS_OFFLINE);
- return false;
- }
- else
- {
- this->password = ::mir_strdup(param.password);
- this->rememberPassword = param.rememberPassword;
- }
- }
- }
-
- return true;
-}
-
-bool CSkypeProto::LogIn()
-{
- if (this->IsOnline() || !this->PrepareLogin())
- return false;
-
- if (this->GetAccount((char*)_T2A(this->login), this->account))
- {
- if ( !this->PreparePassword())
- return false;
-
- this->account.fetch();
-
- this->InitProxy();
-
- this->SetAccountSettings();
-
- this->debugLogW(L"Login in an account");
- this->account->LoginWithPassword(this->password, false, false);
- }
-
- return true;
-}
-
-void CSkypeProto::LogOut()
-{
- if (this->IsOnline() || this->m_iStatus == ID_STATUS_CONNECTING)
- {
- this->account->SetAvailability(Contact::OFFLINE);
- this->debugLogW(L"Logout from account");
- this->account->Logout(true);
- }
-}
-
-void CSkypeProto::SetAccountSettings()
-{
- int port = this->getWord("Port", rand() % 10000 + 10000);
- this->debugLogW(L"Setting port number to %d", port);
- this->SetInt(SETUPKEY_PORT, port);
-
- bool useAlternativePorts = this->getByte("UseAlternativePorts", 1) > 0;
- if (useAlternativePorts)
- this->debugLogW(L"Setting listening of alternative ports (80, 443)");
- this->SetInt(SETUPKEY_DISABLE_PORT80, (int)!useAlternativePorts);
-
- // Create default group for new contacts
- DBVARIANT dbv = {0};
- if ( !getTString(SKYPE_SETTINGS_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
- {
- this->debugLogW(L"Setting default group for new contacts");
- ::Clist_CreateGroup(0, dbv.ptszVal);
- ::db_free(&dbv);
- }
-}
-
-void CSkypeProto::InitProxy()
-{
- if (this->m_hNetlibUser)
- {
- NETLIBUSERSETTINGS nlus = { sizeof(NETLIBUSERSETTINGS) };
- ::CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)this->m_hNetlibUser, (LPARAM)&nlus);
-
- if (nlus.useProxy)
- {
- char address[MAX_PATH];
- ::mir_snprintf(address, MAX_PATH, "%s:%d", nlus.szProxyServer, nlus.wProxyPort);
-
- switch (nlus.proxyType)
- {
- case PROXYTYPE_HTTP:
- case PROXYTYPE_HTTPS:
- this->debugLogW(L"Setting https user proxy config");
- this->SetInt(SETUPKEY_HTTPS_PROXY_ENABLE, 1);
- this->SetInt(SETUPKEY_SOCKS_PROXY_ENABLE, 0);
- this->SetStr(SETUPKEY_HTTPS_PROXY_ADDR, address);
- if (nlus.useProxyAuth)
- {
- this->SetStr(SETUPKEY_HTTPS_PROXY_USER, nlus.szProxyAuthUser);
- ptrA encodedPass(::mir_base64_encode((BYTE*)nlus.szProxyAuthPassword, ::lstrlenA(nlus.szProxyAuthPassword)));
- this->SetStr(SETUPKEY_HTTPS_PROXY_PWD, (char*)encodedPass);
- }
- break;
-
- case PROXYTYPE_SOCKS4:
- case PROXYTYPE_SOCKS5:
- this->debugLogW(L"Setting socks user proxy config");
- this->SetInt(SETUPKEY_HTTPS_PROXY_ENABLE, 0);
- this->SetInt(SETUPKEY_SOCKS_PROXY_ENABLE, 1);
- this->SetStr(SETUPKEY_SOCKS_PROXY_ADDR, address);
- if (nlus.useProxyAuth)
- {
- this->SetStr(SETUPKEY_SOCKS_PROXY_USER, nlus.szProxyAuthUser);
- ptrA encodedPass(::mir_base64_encode((BYTE*)nlus.szProxyAuthPassword, ::lstrlenA(nlus.szProxyAuthPassword)));
- this->SetStr(SETUPKEY_SOCKS_PROXY_PWD, (char*)encodedPass);
- }
- break;
-
- default:
- this->debugLogW(L"Setting automatic proxy detection");
- this->Delete(SETUPKEY_HTTPS_PROXY_ENABLE);
- this->Delete(SETUPKEY_HTTPS_PROXY_ADDR);
- this->Delete(SETUPKEY_HTTPS_PROXY_USER);
- this->Delete(SETUPKEY_HTTPS_PROXY_PWD);
- this->Delete(SETUPKEY_SOCKS_PROXY_ENABLE);
- this->Delete(SETUPKEY_SOCKS_PROXY_ADDR);
- this->Delete(SETUPKEY_SOCKS_PROXY_USER);
- this->Delete(SETUPKEY_SOCKS_PROXY_PWD);
- break;
- }
- }
- }
-}
-
-void CSkypeProto::OnLoggedIn()
-{
- if ( !this->rememberPassword)
- {
- ::mir_free(this->password);
- this->password = NULL;
- }
-
- this->SetServerStatus(this->m_iDesiredStatus);
-
- this->LoadOwnInfo(this);
- this->LoadChatList(this);
- this->LoadContactList(this);
- this->LoadAuthWaitList(this);
-
- fetch(this->transferList);
-}
-
-void CSkypeProto::SetServerStatus(int iNewStatus)
-{
- if (!this->account)
- return;
-
- // change status
- if (m_iStatus == iNewStatus)
- return;
-
- int oldStatus = m_iStatus;
- m_iStatus = iNewStatus;
-
- CContact::AVAILABILITY availability = CSkypeProto::MirandaToSkypeStatus(iNewStatus);
- if (availability != CContact::UNKNOWN)
- {
- this->debugLogW(L"Setting status to %d", iNewStatus);
- this->account->SetAvailability(availability);
- }
-
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, this->m_iStatus);
-}
-
-void CSkypeProto::OnCblUpdated()
-{
- // reload our CL after skype CL fully synced
- this->LoadContactList(NULL);
-}
-
-void CSkypeProto::OnLoggedOut(CAccount::LOGOUTREASON reason)
-{
- this->debugLogW(L"Failed to login: %s", CSkypeProto::LogoutReasons[reason]);
-
- if (this->m_iStatus == ID_STATUS_CONNECTING)
- this->SendBroadcast(
- ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL,
- CSkypeProto::SkypeToMirandaLoginError(reason));
-
- this->SetStatus(ID_STATUS_OFFLINE);
- this->ShowNotification(CSkypeProto::LogoutReasons[reason]);
-
- if (this->rememberPassword && reason == CAccount::INCORRECT_PASSWORD)
- {
- this->rememberPassword = false;
- if (this->password)
- {
- ::mir_free(this->password);
- this->password = NULL;
- }
- }
-}
-
-void CSkypeProto::OnAccountChanged(int prop)
-{
- switch(prop)
- {
- case CAccount::P_STATUS:
- CAccount::STATUS loginStatus;
- this->account->GetPropStatus(loginStatus);
-
- if (loginStatus == CAccount::LOGGED_IN)
- {
- //this->ForkThread(&CSkypeProto::SignInAsync, 0);
- this->OnLoggedIn();
- }
-
- if (loginStatus == CAccount::LOGGED_OUT)
- {
- CAccount::LOGOUTREASON reason;
- if (this->account->GetPropLogoutreason(reason))
- if (reason != CAccount::LOGOUT_CALLED)
- this->OnLoggedOut(reason);
- }
- break;
-
- case CAccount::P_CBLSYNCSTATUS:
- {
- CAccount::CBLSYNCSTATUS status;
- this->account->GetPropCblsyncstatus(status);
- if (status == CAccount::CBL_IN_SYNC)
- {
- this->OnCblUpdated();
- }
- }
- break;
-
- case CAccount::P_PWDCHANGESTATUS:
- {
- CAccount::PWDCHANGESTATUS status;
- this->account->GetPropPwdchangestatus(status);
- if (status != CAccount::PWD_CHANGING)
- {
- this->debugLogW(L"Failed to chage password: %s", CSkypeProto::PasswordChangeReasons[status]);
- this->ShowNotification(CSkypeProto::PasswordChangeReasons[status]);
- }
- }
- break;
-
- //case CAccount::P_AVATAR_IMAGE:
- case CAccount::P_AVATAR_TIMESTAMP:
- this->UpdateProfileAvatar(this->account.fetch());
- break;
-
- //case CAccount::P_MOOD_TEXT:
- case CAccount::P_MOOD_TIMESTAMP:
- this->UpdateProfileStatusMessage(this->account.fetch());
- break;
-
- case CAccount::P_PROFILE_TIMESTAMP:
- this->UpdateProfile(this->account.fetch());
- break;
-
-/* case Account::P_AVAILABILITY:
- {
- Contact::AVAILABILITY status;
- this->account->GetPropAvailability(status);
- int mir_status = this->SkypeToMirandaStatus(status);
- if (mir_status != this->m_iStatus && mir_status >= ID_STATUS_OFFLINE)
- this->SetStatus(mir_status);
- }
- break;*/
- }
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp deleted file mode 100644 index 25db2a32df..0000000000 --- a/protocols/Skype/src/skype_avatars.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include "skype.h"
-
-bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, MCONTACT hContact)
-{
- bool result = false;
-
- BYTE digest[16];
- ::mir_md5_hash((PBYTE)avatar.data(), (int)avatar.size(), digest);
-
- DBVARIANT dbv;
- ::db_get(hContact, this->m_szModuleName, "AvatarHash", &dbv);
- if (dbv.type == DBVT_BLOB && dbv.pbVal && dbv.cpbVal == 16)
- {
- if (::memcmp(digest, dbv.pbVal, 16) == 0)
- {
- result = true;
- }
- }
- ::db_free(&dbv);
-
- return result;
-}
-
-wchar_t * CSkypeProto::GetContactAvatarFilePath(MCONTACT hContact)
-{
- TCHAR path[MAX_PATH];
- ::mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), this->m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(path);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
-
- ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (hContact != NULL)
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%s.jpg"), path, sid);
- else if (sid != NULL)
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%s avatar.jpg"), path, sid);
- else
- return NULL;
-
- return mir_wstrdup(path);
-}
-
-INT_PTR __cdecl CSkypeProto::GetAvatarInfo(WPARAM, LPARAM lParam)
-{
- PROTO_AVATAR_INFORMATIONW *pai = (PROTO_AVATAR_INFORMATIONW *)lParam;
-
- if (this->getDword(pai->hContact, "AvatarTS", 0))
- return GAIR_NOAVATAR;
-
- ptrW sid( ::db_get_wsa(pai->hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (sid)
- {
- ptrW path( this->GetContactAvatarFilePath(pai->hContact));
- if (path && !_waccess(path, 0))
- {
- ::wcsncpy(pai->filename, path, SIZEOF(pai->filename));
- pai->format = PA_FORMAT_JPEG;
- return GAIR_SUCCESS;
- }
- }
-
- return GAIR_NOAVATAR;
-}
-
-INT_PTR __cdecl CSkypeProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam)
-{
- switch (wParam)
- {
- case AF_MAXSIZE:
- {
- POINT *size = (POINT *)lParam;
- if (size)
- {
- size->x = 96;
- size->y = 96;
- }
- }
- break;
-
- case AF_PROPORTION:
- return PIP_NONE;
-
- case AF_FORMATSUPPORTED:
- return lParam == PA_FORMAT_JPEG;
-
- case AF_ENABLED:
- return 1;
-
- case AF_DONTNEEDDELAYS:
- return 1;
-
- case AF_MAXFILESIZE:
- // server accepts images of 32000 bytees, not bigger
- return 32000;
-
- case AF_DELAYAFTERFAIL:
- // do not request avatar again if server gave an error
- return 1;// * 60 * 60 * 1000; // one hour
-
- case AF_FETCHIFPROTONOTVISIBLE:
- case AF_FETCHIFCONTACTOFFLINE:
- // avatars can be fetched all the time (server only operation)
- return 1;
- }
-
- return 0;
-}
-
-INT_PTR __cdecl CSkypeProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
-{
- if (!wParam)
- return -2;
-
- mir_ptr<wchar_t> path( this->GetContactAvatarFilePath(NULL));
- if (path && CSkypeProto::FileExists(path))
- {
- ::wcsncpy((wchar_t *)wParam, path, (int)lParam);
- return 0;
- }
-
- return -1;
-}
-
-INT_PTR __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam)
-{
- wchar_t *path = (wchar_t *)lParam;
- if (path)
- {
- ptrW avatarPath( this->GetContactAvatarFilePath(NULL));
- if ( !::wcscmp(path, avatarPath))
- {
- this->debugLogW(L"New avatar path are same with old.");
- return -1;
- }
-
- SEBinary avatar = this->GetAvatarBinary(path);
- if (avatar.size() == 0)
- {
- this->debugLogW(L"Failed to read avatar file.");
- return -1;
- }
-
- if (this->IsAvatarChanged(avatar))
- {
- this->debugLogW(L"New avatar are same with old.");
- return -1;
- }
-
- if ( !::CopyFile(path, avatarPath, FALSE))
- {
- this->debugLogW(L"Failed to copy new avatar to local storage.");
- return -1;
- }
-
- Skype::VALIDATERESULT result = Skype::NOT_VALIDATED;
- if (!this->account->SetAvatar(avatar, result))
- {
- this->debugLogW(CSkypeProto::ValidationReasons[result]);
- return -1;
- }
-
- uint newTS = this->account->GetUintProp(Account::P_AVATAR_IMAGE);
- this->setDword("AvatarTS", newTS);
- return 0;
- }
-
- this->account->SetBinProperty(Account::P_AVATAR_IMAGE, SEBinary());
- this->delSetting("AvatarTS");
- return 0;
-}
-
-SEBinary CSkypeProto::GetAvatarBinary(wchar_t *path)
-{
- SEBinary avatar;
-
- if (CSkypeProto::FileExists(path))
- {
- int len;
- char *buffer;
- FILE* fp = ::_wfopen(path, L"rb");
- if (fp)
- {
- ::fseek(fp, 0, SEEK_END);
- len = ::ftell(fp);
- ::fseek(fp, 0, SEEK_SET);
- buffer = new char[len + 1];
- ::fread(buffer, len, 1, fp);
- ::fclose(fp);
-
- avatar.set(buffer, len);
- }
- }
-
- return avatar;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_blocked.cpp b/protocols/Skype/src/skype_blocked.cpp deleted file mode 100644 index b1a25dc4db..0000000000 --- a/protocols/Skype/src/skype_blocked.cpp +++ /dev/null @@ -1,369 +0,0 @@ -#include "skype.h"
-#include "skype_chat.h"
-
-int CSkypeProto::BlockCommand(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if (hContact)
- {
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- ContactRef contact;
- if ( !this->GetContact(sid, contact) || !contact)
- return 0;
-
- bool isBlocked = false;
- if (contact->IsMemberOfHardwiredGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, isBlocked) && !isBlocked)
- {
- BlockParam param(hContact, this);
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BLOCK), NULL, CSkypeProto::SkypeBlockProc, (LPARAM)¶m) == IDOK)
- {
- if ( !contact->SetBlocked(true, param.abuse))
- return 0;
-
- if (param.remove)
- {
- contact->SetBuddyStatus(false);
- this->contactList.remove_val(contact);
- ::CallService(MS_DB_CONTACT_DELETE, wParam, 0);
- }
- else if (this->getByte(hContact, "IsSkypeOut", 0) > 0)
- this->setWord(hContact, "Status", ID_STATUS_OFFLINE);
- }
- }
- else
- {
- if (contact->SetBlocked(false))
- if (this->getByte(hContact, "IsSkypeOut", 0) > 0)
- this->setWord(hContact, "Status", ID_STATUS_ONTHEPHONE);
- }
- }
-
- return 0;
-}
-
-INT_PTR CSkypeProto::OpenBlockedListCommand(WPARAM, LPARAM)
-{
- char *title = ::mir_t2a(this->m_tszUserName);
- OPENOPTIONSDIALOG ood;
- ood.cbSize = sizeof(OPENOPTIONSDIALOG);
- ood.pszGroup = "Network";
- ood.pszPage = title;
- ood.pszTab = "Blocked contacts";
- return ::Options_Open(&ood);
- ::mir_free(title);
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypeBlockProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- BlockParam *param = (BlockParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- param = (BlockParam *)lParam;
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- ::TranslateDialogDefault(hwndDlg);
-
- wchar_t *nick = (wchar_t *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)param->hContact, GCDNF_TCHAR);
-
- TCHAR oldTitle[256], newTitle[256];
- ::GetDlgItemText(hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF(oldTitle));
- ::mir_sntprintf(newTitle, SIZEOF(newTitle), ::TranslateTS(oldTitle), nick);
- ::SetDlgItemText(hwndDlg, IDC_HEADERBAR, newTitle);
-
- ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)::Skin_GetIcon("Skype_block", ICON_BIG));
- ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)::Skin_GetIcon("Skype_block"));
-
- wchar_t text[1024];
- ::mir_sntprintf(
- text,
- SIZEOF(text),
- ::TranslateT("Are you sure you want to block \"%s\" (%s)? They won't be able to contact you and won't appear in your Contact List."),
- nick,
- ptrW(::db_get_wsa(param->hContact, param->ppro->m_szModuleName, SKYPE_SETTINGS_SID)));
- ::SetDlgItemText(hwndDlg, IDC_MESSAGE, text);
-
- ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "BlockWindow");
- }
- break;
-
- case WM_COMMAND:
- if (HIWORD( wParam ) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDOK:
- param->remove = ::IsDlgButtonChecked(hwndDlg, IDC_REMOVE_FROM_CL) > 0;
- param->abuse = ::IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) > 0;
-
- ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "BlockWindow");
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- ::EndDialog(hwndDlg, IDOK);
- break;
-
- case IDCANCEL:
- ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "BlockWindow");
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- ::EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-static WNDPROC oldWndProc = NULL;
-
-LRESULT CALLBACK CSkypeProto::SkypeBlockedOptionsSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (msg == WM_LBUTTONDOWN)
- {
- LVHITTESTINFO hi;
- hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
- ListView_SubItemHitTest(hwnd, &hi);
- if (hi.iSubItem == 1)
- {
- LVITEM lvi = {0};
- lvi.mask = LVIF_IMAGE | LVIF_PARAM;
- lvi.stateMask = -1;
- lvi.iItem = hi.iItem;
- if (ListView_GetItem(hwnd, &lvi))
- {
- ContactParam *param = (ContactParam *)lvi.lParam;
-
- if (param->contact->SetBlocked(false))
- {
- SEString data;
- param->contact->GetIdentity(data);
- ptrW sid(::mir_utf8decodeW(data));
-
- MCONTACT hContact = param->ppro->GetContactBySid(sid);
- if (::db_get_b(hContact, param->ppro->m_szModuleName, "IsSkypeOut", 0) > 0)
- ::db_set_w(hContact, param->ppro->m_szModuleName, "Status", ID_STATUS_ONTHEPHONE);
-
- ListView_DeleteItem(hwnd, lvi.iItem);
-
- int nItem = ::SendMessage(::GetDlgItem(GetParent(hwnd), IDC_CONTACTS), CB_ADDSTRING, 0, (LPARAM)sid);
- ::SendMessage(::GetDlgItem(GetParent(hwnd), IDC_CONTACTS), CB_SETITEMDATA, nItem, hContact);
- }
- }
- }
- }
-
- return ::CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
-}
-
-int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name)
-{
- HICON icon = ::Skin_GetIconByHandle(::Skin_GetIconHandle(name));
- int res = ImageList_AddIcon(hIml, icon);
- ::Skin_ReleaseIcon(icon);
- return res;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypeBlockedOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- ppro = (CSkypeProto *)lParam;
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- ::TranslateDialogDefault(hwndDlg);
-
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_LIST);
- { // IDC_BM_LIST setup
- oldWndProc = (WNDPROC)::SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)SkypeBlockedOptionsSubProc);
-
- HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
- ImageList_AddIconFromIconLib(hIml, "Skype_contact");
- ImageList_AddIconFromIconLib(hIml, "Skype_delete");
- ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
- ///
- LVCOLUMN lvc = {0};
- lvc.mask = LVCF_WIDTH | LVCF_TEXT;
- //lvc.fmt = LVCFMT_JUSTIFYMASK;
- lvc.pszText = TranslateT("Name");
- lvc.cx = 220; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
- //lvc.fmt = LVCFMT_RIGHT;
- lvc.pszText = L"";
- lvc.cx = 32 - GetSystemMetrics(SM_CXVSCROLL); // width of column in pixels
- ListView_InsertColumn(hwndList, 1, &lvc);
- ///
- ::SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
-
- if ( !ppro->IsOnline())
- {
- ::EnableWindow(hwndList, FALSE);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_CONTACTS), FALSE);
- }
- }
-
- if (ppro->IsOnline())
- {
- SEString data;
- ContactGroupRef blockedList;
- ppro->GetHardwiredContactGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, blockedList);
-
- CContact::Refs contacts;
- blockedList->GetContacts(contacts);
- for (size_t i = 0; i < contacts.size(); i++)
- {
- auto contact = contacts[i];
-
- ptrW sid(::mir_utf8decodeW(contact->GetSid()));
-
- LVITEM lvi = {0};
- lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- lvi.iItem = (int)i;
- lvi.iImage = 0;
- lvi.lParam = (LPARAM)new ContactParam(contact, ppro);
- lvi.pszText = sid;
- int iRow = ListView_InsertItem(hwndList, &lvi);
-
- if (iRow != -1)
- {
- lvi.iItem = iRow;
- lvi.mask = LVIF_IMAGE;
- lvi.iSubItem = 1;
- lvi.iImage = 1;
- ListView_SetItem(hwndList, &lvi);
- }
- }
- ///
- int nItem = 0;
- MCONTACT hContact = NULL;
-
- ::EnterCriticalSection(&ppro->contact_search_lock);
-
- for (hContact = ::db_find_first(ppro->m_szModuleName); hContact && !ppro->isChatRoom(hContact); hContact = ::db_find_next(hContact, ppro->m_szModuleName))
- {
- ptrW sid(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID));
-
- ContactRef contact;
- ppro->GetContact((char *)_T2A(sid), contact);
- if ( !contacts.contains(contact))
- {
- nItem = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_ADDSTRING, 0, (LPARAM)sid);
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_SETITEMDATA, nItem, hContact);
- }
- }
-
- ::LeaveCriticalSection(&ppro->contact_search_lock);
- }
-
- }
- break;
-
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_CONTACTS:
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_BLOCK), TRUE);
- break;
-
- case IDC_BLOCK:
- {
- int i = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETCURSEL, 0, 0);
-
- MCONTACT hContact = (MCONTACT)::SendMessage(GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETITEMDATA, i, 0);
- if ( !hContact)
- break;
-
- ptrW sid(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID));
-
- SEString data;
- ContactRef contact;
- if (!ppro->GetContact((char *)_T2A(sid), contact) || !contact)
- break;
-
- BlockParam param(hContact, ppro);
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BLOCK), NULL, CSkypeProto::SkypeBlockProc, (LPARAM)¶m) != IDOK)
- break;
-
- contact->SetBlocked(true, param.abuse);
- if (::db_get_b(hContact, ppro->m_szModuleName, "IsSkypeOut", 0) > 0)
- ::db_set_w(hContact, ppro->m_szModuleName, "Status", ID_STATUS_OFFLINE);
-
- if (param.remove)
- {
- contact->SetBuddyStatus(false);
- ppro->contactList.remove_val(contact);
- ::CallService(MS_DB_CONTACT_DELETE, wParam, 0);
- }
-
- if (contact->SetBlocked(true))
- {
- LVITEM lvi = {0};
- lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- lvi.iItem = (int)i;
- lvi.iImage = 0;
- lvi.lParam = (LPARAM)new ContactParam(contact, ppro);
- lvi.pszText = sid;
- int iRow = ListView_InsertItem(::GetDlgItem(hwndDlg, IDC_LIST), &lvi);
-
- if (iRow != -1)
- {
- lvi.iItem = iRow;
- lvi.mask = LVIF_IMAGE;
- lvi.iSubItem = 1;
- lvi.iImage = 1;
- ListView_SetItem(::GetDlgItem(hwndDlg, IDC_LIST), &lvi);
- }
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_DELETESTRING, i, 0);
- }
- }
- break;
- }
- }
- break;
-
- case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY && !ppro->IsOnline())
- {
- return TRUE;
- }
- break;
-
- switch(LOWORD(wParam))
- {
- case IDC_LIST:
- if (((LPNMHDR)lParam)->code == NM_DBLCLK)
- {
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
- int iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED);
- if (iItem < 0) break;
- LVITEM lvi = {0};
- lvi.mask = LVIF_PARAM | LVIF_GROUPID;
- lvi.stateMask = -1;
- lvi.iItem = iItem;
- if (ListView_GetItem(hwndList, &lvi))
- {
- SEString data;
- if (lvi.iGroupId == 1)
- {
- ContactParam *param = (ContactParam *)lvi.lParam;
-
- param->contact->GetIdentity(data);
- ptrW sid(::mir_utf8decodeW(data));
- ::CallService(MS_MSG_SENDMESSAGE, (WPARAM)ppro->GetContactBySid(sid), 0);
- }
- }
- }
- }
- break;
- }
- return FALSE;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_bookmarks.cpp b/protocols/Skype/src/skype_bookmarks.cpp deleted file mode 100644 index 29f3cc89d4..0000000000 --- a/protocols/Skype/src/skype_bookmarks.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include "skype.h"
-#include "skype_chat.h"
-
-int CSkypeProto::SetBookmarkCommand(WPARAM wParam, LPARAM)
-{
- HANDLE hContact = (HANDLE)wParam;
- if (this->IsOnline() && this->IsChatRoom(hContact))
- this->BookmarkChatRoom(hContact);
-
- return 0;
-}
-
-static WNDPROC oldWndProc = NULL;
-
-static LRESULT CALLBACK BookmarkListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (msg == WM_LBUTTONDOWN)
- {
- LVHITTESTINFO hi;
- hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
- ListView_SubItemHitTest(hwnd, &hi);
- if (hi.iSubItem == 1)
- {
- LVITEM lvi = {0};
- lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_GROUPID;
- lvi.stateMask = -1;
- lvi.iItem = hi.iItem;
- if (ListView_GetItem(hwnd, &lvi) && lvi.iGroupId == 1)
- {
- CConversation *convo = (CConversation *)lvi.lParam;
-
- if (convo->SetBookmark(false))
- ListView_DeleteItem(hwnd, lvi.iItem);
- }
- }
- }
-
- return ::CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
-}
-
-int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name)
-{
- HICON icon = ::Skin_GetIconByHandle(::Skin_GetIconHandle(name));
- int res = ImageList_AddIcon(hIml, icon);
- ::Skin_ReleaseIcon(icon);
- return res;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypeBookmarksProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)::Skin_GetIcon("Skype_bookmark", ICON_BIG));
- ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)::Skin_GetIcon("Skype_bookmark"));
-
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
- { // IDC_BM_LIST setup
- oldWndProc = (WNDPROC)::SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)BookmarkListWndProc);
-
- HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
- ImageList_AddIconFromIconLib(hIml, "Skype_bookmark");
- ImageList_AddIconFromIconLib(hIml, "Skype_delete");
- ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
-
- ///
- LVCOLUMN lvc = {0};
- lvc.mask = LVCF_WIDTH | LVCF_TEXT;
-
- //lvc.fmt = LVCFMT_JUSTIFYMASK;
- lvc.pszText = TranslateT("Name");
- lvc.cx = 220; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
-
- //lvc.fmt = LVCFMT_RIGHT;
- lvc.pszText = L"";
- lvc.cx = 32 - GetSystemMetrics(SM_CXVSCROLL); // width of column in pixels
- ListView_InsertColumn(hwndList, 1, &lvc);
-
- ///
- LVGROUP lvg;
- lvg.cbSize = sizeof(LVGROUP);
- lvg.mask = LVGF_HEADER | LVGF_GROUPID;
-
- lvg.pszHeader = ::TranslateT("Conferences");
- lvg.iGroupId = 1;
- ListView_InsertGroup(hwndList, 0, &lvg);
-
- /*lvg.pszHeader = ::TranslateT("Contacts");
- lvg.iGroupId = 2;
- ListView_InsertGroup(hwndList, 0, &lvg);*/
-
- ListView_EnableGroupView(hwndList, TRUE);
-
- ::SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
-
- if ( !ppro->IsOnline())
- ::EnableWindow(hwndList, FALSE);
- }
-
- SEString data;
- ConversationRefs conversations;
- ppro->GetConversationList(conversations, Conversation::BOOKMARKED_CONVERSATIONS);
- for (size_t i = 0; i < conversations.size(); i++)
- {
- auto conversation = conversations[i];
-
- uint type = conversation->GetUintProp(Conversation::P_TYPE);
- if (type != Conversation::CONFERENCE)
- continue;
-
- conversation->GetPropDisplayname(data);
- ptrW name = ::mir_utf8decodeW(data);
-
- LVITEM lvi = {0};
- lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- lvi.iItem = (int)i;
- lvi.iGroupId = 1;
- lvi.iImage = 0;
- lvi.lParam = (LPARAM)conversation.fetch();
- lvi.pszText = name;
- int iRow = ListView_InsertItem(hwndList, &lvi);
-
- if (iRow != -1)
- {
- lvi.iItem = iRow;
- lvi.mask = LVIF_IMAGE;
- lvi.iSubItem = 1;
- lvi.iImage = 1;
- ListView_SetItem(hwndList, &lvi);
- }
- };
-
- ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "BookmarksWindow");
- }
- break;
-
- case WM_NOTIFY:
- switch(LOWORD(wParam))
- {
- case IDC_BM_LIST:
- if (((LPNMHDR)lParam)->code == NM_DBLCLK)
- {
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
- int iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED);
- if (iItem < 0) break;
- LVITEM lvi = {0};
- lvi.mask = LVIF_PARAM;
- lvi.stateMask = -1;
- lvi.iItem = iItem;
- if (ListView_GetItem(hwndList, &lvi))
- {
- //ppro->FindChatRoom
-
- CConversation *conversation = (CConversation *)lvi.lParam;
-
- SEString data;
- conversation->GetPropIdentity(data);
- ptrW cid = ::mir_utf8decodeW(data);
- CSkypeProto::ReplaceSpecialChars(cid);
-
- ChatRoom *room = ppro->FindChatRoom(cid);
- if (room != NULL)
- ::CallProtoService(ppro->m_szModuleName, PS_JOINCHAT, (WPARAM)room->GetContactHandle(), 0);
- else
- {
- conversation->GetPropDisplayname(data);
- ptrW name = ::mir_utf8decodeW(data);
-
- ChatRoom *room = new ChatRoom(cid, name, ppro);
- room->Start(conversation->ref(), true);
- }
- }
- }
- }
- break;
-
- case WM_COMMAND:
- if (HIWORD( wParam ) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDCANCEL:
- ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "BookmarksWindow");
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- ::DestroyWindow(hwndDlg);
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp deleted file mode 100644 index 2f2f166566..0000000000 --- a/protocols/Skype/src/skype_chat.cpp +++ /dev/null @@ -1,1735 +0,0 @@ -#include "skype.h"
-#include "skype_chat.h"
-
-enum CHAT_LIST_MENU
-{
- ICM_CANCEL,
-
- ICM_DETAILS,
- ICM_AUTH_REQUEST,
- ICM_CONF_INVITE,
- ICM_ROLE, ICM_ROLE_ADMIN, ICM_ROLE_SPEAKER, ICM_ROLE_WRITER, ICM_ROLE_SPECTATOR,
- ICM_ADD, ICM_KICK, ICM_BAN,
- ICM_COPY_SID, ICM_COPY_URI
-};
-
-static struct gc_item crListItems[] =
-{
- { LPGENT("&User details"), ICM_DETAILS, MENU_ITEM },
- { LPGENT("&Request auth"), ICM_AUTH_REQUEST, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
- { LPGENT("Invite to conference"), ICM_CONF_INVITE, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
- { LPGENT("Set &role"), ICM_ROLE, MENU_NEWPOPUP },
- { LPGENT("&Master"), ICM_ROLE_ADMIN, MENU_POPUPITEM },
- { LPGENT("&Helper"), ICM_ROLE_SPEAKER, MENU_POPUPITEM },
- { LPGENT("&User"), ICM_ROLE_WRITER, MENU_POPUPITEM },
- { LPGENT("&Listener"), ICM_ROLE_SPECTATOR, MENU_POPUPITEM },
- { NULL, 0, MENU_SEPARATOR },
- { LPGENT("&Add"), ICM_ADD, MENU_ITEM },
- { LPGENT("&Kick"), ICM_KICK, MENU_ITEM },
- { LPGENT("Outlaw (&ban)"), ICM_BAN, MENU_ITEM },
- { NULL, 0, MENU_SEPARATOR },
- { LPGENT("Copy &Skype name"), ICM_COPY_SID, MENU_ITEM },
- { LPGENT("Copy room &URI"), ICM_COPY_URI, MENU_ITEM }
-};
-
-static void CheckChatMenuItem(CHAT_LIST_MENU checkedId)
-{
- for (int i = 0; i < SIZEOF(crListItems); i++)
- {
- if (crListItems[i].dwID == checkedId)
- {
- if (crListItems[i].uType == MENU_ITEM)
- crListItems[i].uType = MENU_CHECK;
- else if (crListItems[i].uType == MENU_POPUPITEM)
- crListItems[i].uType = MENU_POPUPCHECK;
- break;
- }
- }
-}
-
-static void DisableChatMenuItem(CHAT_LIST_MENU disabledId)
-{
- for (int i = 0; i < SIZEOF(crListItems); i++)
- {
- if (crListItems[i].dwID == disabledId)
- {
- crListItems[i].bDisabled = TRUE;
- break;
- }
- }
-}
-
-static void DisableChatMenuItems(CHAT_LIST_MENU disabledIds[])
-{
- for (int i = 0; i < SIZEOF(disabledIds); i++)
- DisableChatMenuItem(disabledIds[i]);
-}
-
-static void ResetChatMenuItem()
-{
- for (int i = 0; i < SIZEOF(crListItems); i++)
- {
- crListItems[i].bDisabled = FALSE;
- if (crListItems[i].uType == MENU_CHECK)
- crListItems[i].uType = MENU_ITEM;
- else if (crListItems[i].uType == MENU_POPUPCHECK)
- crListItems[i].uType = MENU_POPUPITEM;
- }
-}
-
-void CSkypeProto::InitChatModule()
-{
- GCREGISTER gcr = {0};
- gcr.cbSize = sizeof(gcr);
- gcr.iMaxText = 0;
- gcr.ptszDispName = this->m_tszUserName;
- gcr.pszModule = this->m_szModuleName;
- ::CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
-
- this->HookProtoEvent(ME_GC_EVENT, &CSkypeProto::OnGCEventHook);
- this->HookProtoEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGCMenuHook);
-}
-
-///
-
-TCHAR *ChatRoom::Roles[] =
-{
- _T(""), // ---
- LPGENT("Creator"), // CREATOR = 1
- LPGENT("Master"), // ADMIN = 2
- LPGENT("Helper"), // SPEAKER = 3
- LPGENT("User"), // WRITER = 4
- LPGENT("Listener"), // SPECTATOR= 5
- LPGENT("Applicant"), // APPLICANT= 6
- LPGENT("Retried"), // RETIRED = 7
- LPGENT("Outlaw"), // OUTLAW = 8
-};
-
-ChatRoom::ChatRoom(const wchar_t *cid) : members(1, CompareMembers)
-{
- this->cid = ::mir_wstrdup(cid);
- this->name = NULL;
- this->me = NULL;
-}
-
-ChatRoom::ChatRoom(const wchar_t *cid, const wchar_t *name, CSkypeProto *ppro) : members(1, CompareMembers)
-{
- this->cid = ::mir_wstrdup(cid);
- this->name = ::mir_wstrdup(name);
- this->ppro = ppro;
- //
- this->me = new ChatMember(ppro->login);
- this->me->SetNick(::TranslateT("me"));
- this->me->SetRank(0);
- this->me->SetStatus(ID_STATUS_OFFLINE);
- //
- this->sys = new ChatMember(L"sys");
- this->sys->SetNick(L"System");
- this->sys->SetRank(0);
- this->sys->SetStatus(ID_STATUS_OFFLINE);
-}
-
-ChatRoom::~ChatRoom()
-{
- ::mir_free(this->cid);
- ::mir_free(this->name);
- delete this->me;
- delete this->sys;
- this->members.destroy();
-}
-
-MCONTACT ChatRoom::GetContactHandle() const
-{
- return this->hContact;
-}
-
-void ChatRoom::CreateChatSession(bool showWindow)
-{
- SEString data;
-
- // start chat session
- GCSESSION gcw = {0};
- gcw.cbSize = sizeof(gcw);
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = ppro->m_szModuleName;
- gcw.ptszName = this->name;
- gcw.ptszID = this->cid;
- gcw.dwItemData = (DWORD)this;
- ::CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
-
- // load chat roles
- GCDEST gcd = { ppro->m_szModuleName, this->cid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = 1; i < SIZEOF(ChatRoom::Roles) - 2; i++) {
- gce.ptszStatus = ::TranslateTS(ChatRoom::Roles[i]);
- ::CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- }
-
- // init [and show window]
- gcd.iType = GC_EVENT_CONTROL;
- gce.ptszStatus = NULL;
- ::CallServiceSync(MS_GC_EVENT, showWindow ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
-
- this->ppro->debugLogW(L"Created new chat session %s", this->cid);
-}
-
-void ChatRoom::SetTopic(const wchar_t *topic)
-{
- if (this->conversation)
- this->conversation->SetTopic((char *)ptrA(::mir_utf8encodeW(topic)));
-}
-
-wchar_t *ChatRoom::GetUri()
-{
- SEString data;
- this->conversation->GetJoinBlob(data);
- ptrW blob( ::mir_utf8decodeW(data));
-
- wchar_t *uri = (wchar_t *)::mir_alloc(sizeof(wchar_t) * MAX_PATH);
- ::mir_sntprintf(uri, SIZEOF(uri), L"skype:?chat&blob=%s", blob);
-
- return uri;
-}
-
-void ChatRoom::ShowWindow()
-{
- // show window
- GCDEST gcd = { this->ppro->m_szModuleName, this->cid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
-}
-
-void ChatRoom::Invite(const StringList &contacts)
-{
- SEStringList needToAdd;
- for (size_t i = 0; i < contacts.size(); i++)
- {
- if ( !contacts.contains(contacts[i]))
- needToAdd.append((char *)_T2A(contacts[i]));
- }
- this->conversation->AddConsumers(needToAdd);
-}
-
-void ChatRoom::Create(const ChatRoomParam *param, CSkypeProto *ppro)
-{
- SEString data;
- ChatRoom *room = NULL;
-
- ConversationRef conversation;
- if (ppro->CreateConference(conversation))
- {
- conversation->SetOption(Conversation::P_OPT_JOINING_ENABLED, param->enableJoining);
- conversation->SetOption(Conversation::P_OPT_ENTRY_LEVEL_RANK, (Participant::RANK)param->joinRank);
- conversation->SetOption(Conversation::P_OPT_DISCLOSE_HISTORY, true);
- if (::wcslen(param->topic) > 0)
- conversation->SetTopic((char *)ptrA(::mir_utf8encodeW(param->topic)));
- if (::wcslen(param->guidline) > 0)
- conversation->SetGuidelines((char *)ptrA(::mir_utf8encodeW(param->guidline)));
- if (param->passwordProtection && ::wcslen(param->password) > 0)
- {
- conversation->SetPassword(
- (char *)ptrA(::mir_utf8encodeW(param->password)),
- (char *)ptrA(::mir_utf8encodeW(param->hint)));
- }
-
- SEStringList consumers;
- for (size_t i = 0; i < param->invitedContacts.size(); i++)
- {
- data = ::mir_utf8encodeW(param->invitedContacts[i]);
- consumers.append(data);
- }
- conversation->AddConsumers(consumers);
- }
-}
-
-void ChatRoom::Start(const ConversationRef &conversation, bool showWindow)
-{
- SEString data;
-
- this->CreateChatSession(showWindow);
-
- this->conversation = conversation;
- this->conversation.fetch();
- this->conversation->SetChatRoom(this);
-
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYID | GCF_HCONTACT;
- gci.pszModule = ppro->m_szModuleName;
- gci.pszID = this->cid;
-
- if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- this->hContact = gci.hContact;
- ptrW cid( ::db_get_wsa(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID));
- if (cid == NULL) {
- this->conversation->GetPropIdentity(data);
- cid = ::mir_utf8decodeW(data);
- ::db_set_ws(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID, cid);
- }
- }
-
- ParticipantRefs participants;
- this->conversation->GetParticipants(participants, Conversation::CONSUMERS_AND_APPLICANTS);
- for (uint i = 0; i < participants.size(); i++)
- {
- auto participant = participants[i];
-
- participant->GetPropIdentity(data);
- ptrW sid( ::mir_utf8decodeW(data));
-
- ChatMember member(sid);
- member.SetRank(participant->GetUintProp(Participant::P_RANK));
-
- Contact::Ref contact;
- this->ppro->GetContact(data, contact);
-
- Contact::AVAILABILITY status;
- contact->GetPropAvailability(status);
- member.SetStatus(CSkypeProto::SkypeToMirandaStatus(status));
-
- contact->GetPropFullname(data);
- if (data.length() != 0)
- {
- ptrW nick( ::mir_utf8decodeW(data));
- member.SetNick(nick);
- }
-
- member.SetPaticipant(participant);
- /*member.participant.fetch();
- member.participant->SetOnChangedCallback(&ChatRoom::OnParticipantChanged, this);*/
-
- this->AddMember(member, NULL, NULL);
- }
-}
-
-void ChatRoom::Join(const wchar_t *joinBlob, CSkypeProto *ppro)
-{
- SEString data;
- ConversationRef conversation;
- if (ppro->GetConversationByBlob(data, conversation))
- {
- conversation->GetPropIdentity(data);
- ptrW cid(::mir_utf8decodeW(data));
-
- conversation->GetPropDisplayname(data);
- ptrW name(::mir_utf8decodeW(data));
-
- CSkypeProto::ReplaceSpecialChars(cid);
- ChatRoom *room = new ChatRoom(cid, name, ppro);
- ppro->chatRooms.insert(room);
- room->Start(conversation, true);
- }
-}
-
-void ChatRoom::SendMessage(const wchar_t *text)
-{
- this->ppro->debugLogW(L"Sending chat message %s", this->cid);
-
- CMessage::Ref message;
- if (this->conversation->PostText((char *)ptrA(::mir_utf8encodeW(text)), message))
- this->ppro->debugLogW(L"Chat message sent %s", this->cid);
-}
-
-void ChatRoom::LeaveChat()
-{
- this->ppro->debugLogW(L"Leaving chat session %s", this->cid);
-
- if (this->conversation->RetireFrom())
- this->ppro->debugLogW(L"Retired from conversation %s", this->cid);
-
- GCDEST gcd = { ppro->m_szModuleName, this->cid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
-}
-
-void ChatRoom::LeaveChatAndDelete()
-{
- this->ppro->debugLogW(L"Leaving chat session %s", this->cid);
-
- if (this->conversation->RetireFrom())
- this->ppro->debugLogW(L"Retired from conversation %s", this->cid);
-
- if (this->conversation->Delete())
- this->ppro->debugLogW(L"Delete conversation %s", this->cid);
-
- GCDEST gcd = { ppro->m_szModuleName, this->cid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
-}
-
-void ChatRoom::SendEvent(const ChatMember &item, int eventType, DWORD timestamp, DWORD flags, DWORD itemData, const wchar_t *status, const wchar_t *message)
-{
- bool isMe = this->IsMe(item);
-
- GCDEST gcd = { ppro->m_szModuleName, this->cid, eventType };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = flags;
- gce.ptszUID = item.GetSid();
- gce.ptszNick = !isMe ? item.GetNick() : ::TranslateT("me");
- gce.bIsMe = isMe;
- gce.dwItemData = itemData;
- gce.ptszStatus = status;
- gce.ptszText = message;
- gce.time = timestamp;
-
- ::CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
-}
-
-void ChatRoom::SendEvent(const wchar_t *sid, int eventType, DWORD timestamp, DWORD flags, DWORD itemData, const wchar_t *status, const wchar_t *message)
-{
- if (this->IsMe(sid))
- this->SendEvent(*this->me, eventType, timestamp, flags, itemData, status, message);
- else if (this->IsSys(sid))
- this->SendEvent(*this->sys, eventType, timestamp, flags, itemData, status, message);
- else
- {
- ChatMember search(sid);
- ChatMember *member = this->members.find(&search);
- if (member != NULL)
- this->SendEvent(*member, eventType, timestamp, flags, itemData, status, message);
- }
-}
-
-bool ChatRoom::IsMe(const wchar_t *sid) const
-{
- return ::lstrcmpi(this->ppro->login, sid) == 0;
-}
-
-bool ChatRoom::IsMe(const ChatMember &item) const
-{
- return ::lstrcmpi(this->ppro->login, item.GetSid()) == 0;
-}
-
-bool ChatRoom::IsSys(const wchar_t *sid) const
-{
- return ::lstrcmpi(L"sys", sid) == 0;
-}
-
-bool ChatRoom::IsSys(const ChatMember &item) const
-{
- return ::lstrcmpi(L"sys", item.GetSid()) == 0;
-}
-
-ChatMember *ChatRoom::FindChatMember(const wchar_t *sid)
-{
- if ( !IsMe(sid))
- {
- ChatMember search(sid);
- return this->members.find(&search);
- }
- else
- return this->me;
-}
-
-void ChatRoom::AddMember(const ChatMember &item, const ChatMember &author, DWORD timestamp)
-{
- if ( !this->IsMe(item))
- {
- ChatMember *member = this->FindChatMember(item.GetSid());
- if (member != NULL)
- {
- this->UpdateMember(item, timestamp);
- }
- else
- {
- ChatMember *newMember = new ChatMember(item);
- newMember->participant.fetch();
- newMember->participant->SetChatRoom(this);
- //newMember->participant->SetOnChangedCallback(&ChatRoom::OnParticipantChanged, this);
- this->members.insert(newMember);
-
- if (newMember->GetRank() == CParticipant::APPLICANT)
- this->SendEvent(
- *this->sys,
- GC_EVENT_INFORMATION,
- time(NULL),
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("waits to join"));
- else
- this->SendEvent(item, GC_EVENT_JOIN, timestamp, GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[item.GetRank()]));
-
- int status = item.GetStatus();
- if (status == ID_STATUS_AWAY || status == ID_STATUS_DND)
- this->SendEvent(item, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED | GC_SSE_ONLINE, (const wchar_t*)0, item.GetSid());
- else if (status == ID_STATUS_OFFLINE)
- this->SendEvent(item, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED | GC_SSE_OFFLINE, (const wchar_t*)0, item.GetSid());
- else
- this->SendEvent(item, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED, (const wchar_t*)0, item.GetSid());
-
- this->SendEvent(item, GC_EVENT_SETCONTACTSTATUS, timestamp, 0, status);
- }
- }
- else
- {
- if (!this->me->participant)
- {
- this->me->participant = item.participant;
- this->me->participant.fetch();
- this->me->participant->SetChatRoom(this);
- //this->me->participant->SetOnChangedCallback(&ChatRoom::OnParticipantChanged, this);
- }
- if (this->me->GetRank() != item.GetRank())
- {
- this->SendEvent(*this->me, GC_EVENT_REMOVESTATUS, timestamp, 0, 0, ::TranslateW(ChatRoom::Roles[this->me->GetRank()]));
- this->SendEvent(*this->me, GC_EVENT_ADDSTATUS, timestamp, !this->me->GetRank() ? 0 : GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[item.GetRank()]), author == NULL ? this->sys->GetNick() : author.GetNick());
- this->me->SetRank(item.GetRank());
- }
- }
-}
-
-void ChatRoom::UpdateMemberNick(ChatMember *member, const wchar_t *nick, DWORD timestamp)
-{
- if (::lstrcmp(member->GetNick(), nick) != 0)
- {
- this->SendEvent(*member, GC_EVENT_NICK, timestamp, GCEF_ADDTOLOG, 0, nick);
- member->SetNick(nick);
- }
-}
-
-void ChatRoom::UpdateMemberRole(ChatMember *member, int role, const ChatMember &author, DWORD timestamp)
-{
- if (member->GetRank() != role)
- {
- this->SendEvent(*member, GC_EVENT_REMOVESTATUS, timestamp, 0, 0, ::TranslateW(ChatRoom::Roles[member->GetRank()]));
- this->SendEvent(*member, GC_EVENT_ADDSTATUS, timestamp, GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[role]), author == NULL ? this->sys->GetNick() : author.GetNick());
- member->SetRank(role);
- }
-}
-
-void ChatRoom::UpdateMemberStatus(ChatMember *member, int status, DWORD timestamp)
-{
- if (member->GetStatus() != status)
- {
- if (status == ID_STATUS_AWAY || status == ID_STATUS_DND)
- this->SendEvent(*member, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED | GC_SSE_ONLINE, (const wchar_t*)0, member->GetSid());
- else if (status == ID_STATUS_OFFLINE)
- this->SendEvent(*member, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED | GC_SSE_OFFLINE, (const wchar_t*)0, member->GetSid());
- else
- this->SendEvent(*member, GC_EVENT_SETSTATUSEX, timestamp, 0, GC_SSE_ONLYLISTED, (const wchar_t*)0, member->GetSid());
-
- this->SendEvent(*member, GC_EVENT_SETCONTACTSTATUS, timestamp, 0, status);
- member->SetStatus(status);
- }
-}
-
-void ChatRoom::UpdateMember(const wchar_t *sid, const wchar_t *nick, int role, int status, DWORD timestamp)
-{
- ChatMember search(sid);
- ChatMember *member = this->members.find(&search);
- if (member != NULL)
- {
- this->UpdateMemberNick(member, nick, timestamp);
- this->UpdateMemberRole(member, role, NULL, timestamp);
- this->UpdateMemberStatus(member, status, timestamp);
- }
-}
-
-void ChatRoom::UpdateMember(const ChatMember &item, DWORD timestamp)
-{
- ChatMember *member = this->FindChatMember(item.GetSid());
- if (member != NULL)
- {
- ptrW nick(item.GetNick());
- if (::lstrcmp(member->GetNick(), nick) != 0)
- {
- this->SendEvent(*member, GC_EVENT_NICK, timestamp, GCEF_ADDTOLOG, 0, nick);
- member->SetNick(nick);
- }
- if (member->GetRank() != item.GetRank())
- {
- this->SendEvent(*member, GC_EVENT_REMOVESTATUS, timestamp, 0, 0, ::TranslateW(ChatRoom::Roles[member->GetRank()]));
- this->SendEvent(*member, GC_EVENT_ADDSTATUS, timestamp, GCEF_ADDTOLOG, 0, ::TranslateW(ChatRoom::Roles[item.GetRank()]));
- member->SetRank(item.GetRank());
- }
- if (member->GetStatus() != item.GetStatus())
- {
- this->SendEvent(*member, GC_EVENT_SETCONTACTSTATUS, timestamp, 0, item.GetStatus());
- member->SetStatus(item.GetStatus());
- }
- }
-}
-
-void ChatRoom::AddApplicant(const ChatMember *member)
-{
- SEStringList consumers;
- consumers.append((char *)ptrA(::mir_utf8encodeW(member->GetSid())));
- this->conversation->AddConsumers(consumers);
-}
-
-void ChatRoom::KickMember(const ChatMember &item, const ChatMember *author, DWORD timestamp)
-{
- if ( !this->IsMe(item))
- {
- ChatMember *member = this->FindChatMember(item.GetSid());
- if (member != NULL)
- {
- this->SendEvent(*member, GC_EVENT_KICK, timestamp, GCEF_ADDTOLOG, 0, author->GetNick());
- this->members.remove(member);
- delete member;
- }
- }
- else
- {
- this->SendEvent(*this->me, GC_EVENT_KICK, timestamp, GCEF_ADDTOLOG, 0, author->GetNick());
- this->me->SetRank(/*RETIRED= */7);
- }
-}
-
-void ChatRoom::KickMember(const wchar_t *sid, const wchar_t *author, DWORD timestamp)
-{
- ChatMember member(sid);
- this->KickMember(member, this->FindChatMember(author), timestamp);
-}
-
-void ChatRoom::RemoveMember(const ChatMember &item, DWORD timestamp)
-{
- if ( !this->IsMe(item))
- {
- ChatMember *member = this->FindChatMember(item.GetSid());
- if (member != NULL)
- {
- this->SendEvent(*member, GC_EVENT_PART, timestamp);
- this->members.remove(member);
- delete member;
- }
- }
- else
- this->LeaveChat();
-}
-
-void ChatRoom::RemoveMember(const wchar_t *sid, DWORD timestamp)
-{
- ChatMember member(sid);
- this->RemoveMember(member, timestamp);
-}
-
-void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &message)
-{
- if ( !this->conversation)
- this->conversation = conversation;
-
- if ( this->conversation != conversation)
- return;
-
- uint messageType;
- messageType = message->GetUintProp(Message::P_TYPE);
-
- switch (messageType)
- {
- case CMessage::POSTED_EMOTE:
- case CMessage::POSTED_TEXT:
- {
- SEString data;
-
- message->GetPropAuthor(data);
- ptrW sid( ::mir_utf8decodeW(data));
-
- message->GetPropBodyXml(data);
- ptrW text( ::mir_utf8decodeW( ptrA(CSkypeProto::RemoveHtml(data))));
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- this->SendEvent(
- sid,
- messageType == CMessage::POSTED_TEXT ? GC_EVENT_MESSAGE : GC_EVENT_ACTION,
- timestamp,
- GCEF_ADDTOLOG,
- 0,
- NULL,
- text);
- }
- break;
-
- case Message::ADDED_CONSUMERS:
- case Message::ADDED_APPLICANTS:
- {
- SEString data;
-
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::CONSUMED)
- {
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- message->GetPropAuthor(data);
- ChatMember *author = this->FindChatMember((wchar_t *)ptrW(::mir_utf8decodeW(data)));
-
- ParticipantRefs participants;
- conversation->GetParticipants(participants);
- for (size_t i = 0; i < participants.size(); i++)
- {
- participants[i]->GetPropIdentity(data);
- ptrW sid(::mir_utf8decodeW(data));
- if (this->FindChatMember(sid) == NULL)
- {
- ChatMember member(sid);
- member.SetRank(participants[i]->GetUintProp(Participant::P_RANK));
-
- Contact::Ref contact;
- this->ppro->GetContact(data, contact);
-
- Contact::AVAILABILITY status;
- contact->GetPropAvailability(status);
- member.SetStatus(CSkypeProto::SkypeToMirandaStatus(status));
-
- contact->GetPropFullname(data);
- ptrW nick(::mir_utf8decodeW(data));
- if (data.length() != 0)
- {
- ptrW nick( ::mir_utf8decodeW(data));
- member.SetNick(nick);
- }
-
- member.participant = participants[i];
- /*member.participant.fetch();
- member.participant->SetOnChangedCallback(&ChatRoom::OnParticipantChanged, this);*/
-
- this->AddMember(member, *author, timestamp);
- }
- }
-
- // do not remove
- //message->GetPropIdentities(data);
- //char *identities = ::mir_strdup(data);
- //if (identities)
- //{
- // char *identity = ::strtok(identities, " ");
- // if (identity != NULL)
- // {
- // do
- // {
- // Contact::Ref contact;
- // this->ppro->GetContact(identity, contact);
-
- // contact->GetIdentity(data);
- // ptrW sid = ::mir_utf8decodeW(data);
-
- // ChatMember *member = new ChatMember(sid);
- // //todo: fix rank
- //
- // member->rank =
- // messageType == Message::ADDED_APPLICANTS ?
- // Participant::APPLICANT :
- // Participant::SPEAKER;
- // //conversation->GetUintProp(Conversation::P_OPT_ENTRY_LEVEL_RANK);
- // //participants[i]->GetUintProp(Participant::P_RANK);
-
- // Contact::AVAILABILITY status;
- // contact->GetPropAvailability(status);
- // member->status = CSkypeProto::SkypeToMirandaStatus(status);
-
- // contact->GetPropFullname(data);
- // member->nick = ::mir_utf8decodeW(data);
-
- // this->AddMember(member, timestamp);
-
- // identity = ::strtok(NULL, " ");
- // }
- // while (identity != NULL);
- // }
- // ::mir_free(identities);
- //}
- }
- }
- break;
-
- case Message::RETIRED_OTHERS:
- {
- SEString data;
-
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::CONSUMED)
- {
- this->ppro->debugLogW(L"Retired other event for conversation %s", this->cid);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- message->GetPropAuthor(data);
- ptrW author( ::mir_utf8decodeW(data));
-
- message->GetPropIdentities(data);
- char *identities = ::mir_strdup(data);
- if (identities)
- {
- char *identity = ::strtok(identities, " ");
- if (identity != NULL)
- {
- do
- {
- ptrW sid(::mir_utf8decodeW(identity));
- this->KickMember(sid, author, timestamp);
-
- identity = ::strtok(NULL, " ");
- }
- while (identity != NULL);
- }
- ::mir_free(identities);
- }
- }
- }
- break;
-
- case Message::RETIRED:
- {
- SEString data;
-
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::CONSUMED)
- {
- this->ppro->debugLogW(L"Retired event for conversation %s", this->cid);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- message->GetPropAuthor(data);
- ptrW sid( ::mir_utf8decodeW(data));
-
- this->RemoveMember(sid, timestamp);
- }
- }
- break;
-
- case Message::SET_RANK:
- {
- SEString data;
- }
- break;
- // message->GetPropBodyXml(data);
- // ptrA text = ::mir_strdup(data);
- // int i = 0;
-
- // /*Message::CONSUMPTION_STATUS status;
- // message->GetPropConsumptionStatus(status);
- // if (status == Message::UNCONSUMED_NORMAL)*/
- // {
- // message->GetPropAuthor(data);
- // ptrW sid = ::mir_utf8decodeW(data);
-
- // ChatMember search(sid);
- // ChatMember *member = this->FindChatMember(sid);
- // if (member != NULL)
- // {
- // uint timestamp;
- // message->GetPropTimestamp(timestamp);
-
- // message->GetPropBodyXml(data);
- // ptrW rank = ::mir_utf8decodeW(data);
-
- // member->SetRank(0);
- // }
- // }
- // }
- // break;
-
- /*case CMessage::STARTED_LIVESESSION:
- {
- SEString data;
-
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::UNCONSUMED_NORMAL)
- break;
-
- message->GetPropAuthor(data);
- ptrW sid = ::mir_utf8decodeW(data);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- this->SendEvent(
- sid,
- GC_EVENT_INFORMATION,
- timestamp,
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("Incoming group call received"));
- }
- break;*/
-
- case CMessage::ENDED_LIVESESSION:
- {
- SEString data;
-
- //Message::CONSUMPTION_STATUS status;
- //message->GetPropConsumptionStatus(status);
- //if (status != Message::UNCONSUMED_NORMAL)
- // break;
-
- message->GetPropAuthor(data);
- ptrW sid( ::mir_utf8decodeW(data));
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- this->SendEvent(
- *this->sys,
- GC_EVENT_INFORMATION,
- timestamp,
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("Incoming group call finished"));
- }
- break;
- }
-}
-
-void ChatRoom::OnChange(const ConversationRef &conversation, int prop)
-{
- if ( !this->conversation)
- this->conversation = conversation;
-
- if ( this->conversation != conversation)
- return;
-
- switch (prop)
- {
- case Conversation::P_MY_STATUS:
- {
- Conversation::MY_STATUS status;
- conversation->GetPropMyStatus(status);
- if (status == Conversation::INVALID_ACCESS_TOKEN)
- {
- PasswordRequestBoxParam param(this->name, false);
- if (this->ppro->RequestPassword(param))
- {
- if ( !this->conversation->EnterPassword(param.password))
- this->SendEvent(
- *this->sys,
- GC_EVENT_INFORMATION,
- time(NULL),
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("The password is incorrect"));
- }
- }
- else if (status == Conversation::APPLICATION_DENIED)
- {
- this->SendEvent(
- *this->sys,
- GC_EVENT_INFORMATION,
- time(NULL),
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("Your application to join the conference was denied"));
- }
- }
- break;
-
- case Conversation::P_LOCAL_LIVESTATUS:
- {
- Conversation::LOCAL_LIVESTATUS liveStatus;
- conversation->GetPropLocalLivestatus(liveStatus);
- if (liveStatus == Conversation::RINGING_FOR_ME)
- {
- SEString data;
-
- /*Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::UNCONSUMED_NORMAL)
- break;*/
-
- /*message->GetPropAuthor(data);
- ptrW sid = ::mir_utf8decodeW(data);*/
-
- /*uint timestamp;
- message->GetPropTimestamp(timestamp);*/
-
- this->SendEvent(
- *this->sys,
- GC_EVENT_INFORMATION,
- time(NULL),
- GCEF_ADDTOLOG,
- 0,
- NULL,
- ::TranslateT("Incoming group call started"));
- }
- }
- break;
- }
-}
-
-void ChatRoom::OnParticipantChanged(const ParticipantRef &participant, int prop)
-{
- if (prop == Participant::P_RANK)
- {
- Participant::RANK rank;
- participant->GetPropRank(rank);
-
- SEString identity;
- participant->GetPropIdentity(identity);
-
- ptrW sid(::mir_utf8decodeW(identity));
- ChatMember *member = this->FindChatMember(sid);
- if (member != NULL)
- this->UpdateMemberRole(member, rank);
- }
-}
-
-///
-
-void CSkypeProto::ChatValidateContact(MCONTACT hItem, HWND hwndList, const StringList &contacts)
-{
- if (this->IsProtoContact(hItem) && !this->isChatRoom(hItem))
- {
- ptrW sid( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (sid == NULL || contacts.contains(sid))
- ::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
- }
- else
- ::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
-}
-
-void CSkypeProto::ChatPrepare(MCONTACT hItem, HWND hwndList, const StringList &contacts)
-{
- if (hItem == NULL)
- hItem = (MCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
-
- while (hItem) {
- MCONTACT hItemN = (MCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
-
- if (IsHContactGroup(hItem)) {
- MCONTACT hItemT = (MCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItemT)
- this->ChatPrepare(hItemT, hwndList, contacts);
- }
- else if (IsHContactContact(hItem))
- this->ChatValidateContact(hItem, hwndList, contacts);
-
- hItem = hItemN;
- }
-}
-
-void CSkypeProto::GetInvitedContacts(MCONTACT hItem, HWND hwndList, StringList &chatTargets)
-{
- if (hItem == NULL)
- hItem = (MCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
-
- while (hItem) {
- if (IsHContactGroup(hItem)) {
- MCONTACT hItemT = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItemT)
- this->GetInvitedContacts(hItemT, hwndList, chatTargets);
- }
- else {
- int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
- if (chk) {
- if (IsHContactInfo(hItem)) {
- TCHAR buf[128] = _T("");
- SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf);
- if (buf[0])
- chatTargets.insert(buf);
- }
- else {
- ptrW login( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_SID));
- chatTargets.insert(login);
- }
- }
- }
- hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
- }
-}
-
-INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- ChatRoomParam *param = (ChatRoomParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- param = (ChatRoomParam *)lParam;
- {
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CCLIST);
- SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);
-
- if ( !param->ppro->IsOnline())
- {
- ::EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- ::EnableWindow(GetDlgItem(hwndDlg, IDC_ADDSCR), FALSE);
- ::EnableWindow(GetDlgItem(hwndDlg, IDC_CCLIST), FALSE);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_JOINING, BM_SETCHECK, param->enableJoining, 0);
- for (int i = 1; i < SIZEOF(ChatRoom::Roles) - 4; i++) {
- int nItem = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CHAT_ROLES), CB_ADDSTRING, 0, (LPARAM)::TranslateW(ChatRoom::Roles[i]));
-
- if (i == Participant::WRITER)
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_CHAT_ROLES), CB_SETCURSEL, nItem, 0);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SECURED, BM_SETCHECK, param->passwordProtection, 0);
- }
- break;
-
- case WM_CLOSE:
- ::EndDialog(hwndDlg, 0);
- break;
-
- case WM_NOTIFY:
- {
- NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lParam;
- if (nmc->hdr.idFrom == IDC_CCLIST) {
- switch (nmc->hdr.code) {
- case CLN_NEWCONTACT:
- if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
- param->ppro->ChatValidateContact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->invitedContacts);
- break;
-
- case CLN_LISTREBUILT:
- if (param)
- param->ppro->ChatPrepare(NULL, nmc->hdr.hwndFrom, param->invitedContacts);
- break;
- }
- }
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDC_ADDSCR:
- if (param->ppro->IsOnline())
- {
- wchar_t sid[SKYPE_SID_LIMIT];
- ::GetDlgItemText(hwndDlg, IDC_EDITSCR, sid, SIZEOF(sid));
-
- CLCINFOITEM cii = {0};
- cii.cbSize = sizeof(cii);
- cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
- cii.pszText = ::wcslwr(sid);
-
- HANDLE hItem = (HANDLE)::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- ::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
- }
- break;
-
- case IDC_CHAT_SECURED:
- {
- BOOL enable = (BOOL)::IsDlgButtonChecked(hwndDlg, IDC_CHAT_SECURED);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_CHAT_PASSWORD), enable);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_CHAT_CONFIRMATION), enable);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_CHAT_HINT), enable);
- }
- break;
-
- case IDC_CHAT_PASSWORD:
- case IDC_CHAT_CONFIRMATION:
- {
- wchar_t pwd[32], cfn[32];
- GetDlgItemText(hwndDlg, IDC_CHAT_PASSWORD, pwd, SIZEOF(pwd));
- GetDlgItemText(hwndDlg, IDC_CHAT_CONFIRMATION, cfn, SIZEOF(cfn));
-
- BOOL secured = ::IsDlgButtonChecked(hwndDlg, IDC_CHAT_SECURED);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDOK), secured && ::wcscmp(pwd, cfn) == 0);
- }
- break;
-
- case IDOK:
- {
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_CCLIST);
-
- param->invitedContacts.clear();
- param->ppro->GetInvitedContacts(NULL, hwndList, param->invitedContacts);
-
- if ( !param->invitedContacts.empty())
- {
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- ::EndDialog(hwndDlg, IDOK);
- }
- else
- param->ppro->ShowNotification(::TranslateT("You did not select any contact"));
-
- GetDlgItemText(hwndDlg, IDC_CHAT_TOPIC, param->topic, SIZEOF(param->topic));
- GetDlgItemText(hwndDlg, IDC_CHAT_GUIDLINE, param->guidline, SIZEOF(param->guidline));
-
- param->enableJoining = ::IsDlgButtonChecked(hwndDlg, IDC_CHAT_JOINING) != 0;
- param->joinRank = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CHAT_ROLES), CB_GETCURSEL, 0, 0) + 1;
-
- param->passwordProtection = ::IsDlgButtonChecked(hwndDlg, IDC_CHAT_SECURED) != 0;
- if (param->passwordProtection)
- {
- GetDlgItemText(hwndDlg, IDC_CHAT_PASSWORD, param->password, SIZEOF(param->password));
- GetDlgItemText(hwndDlg, IDC_CHAT_CONFIRMATION, param->confirmation, SIZEOF(param->confirmation));
- GetDlgItemText(hwndDlg, IDC_CHAT_HINT, param->hint, SIZEOF(param->hint));
- }
- }
- break;
-
- case IDCANCEL:
- ::EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CSkypeProto::CreateChatRoomCommand(WPARAM, LPARAM)
-{
- ChatRoomParam *param = new ChatRoomParam(NULL, NULL, this);
-
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_CREATE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- ChatRoom::Create(param, this);
-
- delete param;
-
- return 0;
-}
-
-void CSkypeProto::ChatRoomInvite(MCONTACT hContact)
-{
- ptrT chat_id(::db_get_tsa(hContact, this->m_szModuleName, "ChatRoomID"));
-
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYID | GCF_USERS | GCF_DATA;
- gci.pszModule = this->m_szModuleName;
- gci.pszID = chat_id;
- if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
- ChatRoom *room = (ChatRoom *)gci.dwItemData;
- if (room != NULL && gci.pszUsers != NULL) {
- StringList invitedContacts(_A2T(gci.pszUsers));
- ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
-
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- room->Invite(param->invitedContacts);
-
- delete param;
- }
- }
-}
-
-void CSkypeProto::CloseAllChatSessions()
-{
- GC_INFO gci = {0};
- gci.Flags = GCF_BYINDEX | GCF_ID | GCF_DATA;
- gci.pszModule = this->m_szModuleName;
-
- int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName);
- for (int i = 0; i < count ; i++)
- {
- gci.iItem = i;
- if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
- {
- GCDEST gcd = { this->m_szModuleName, gci.pszID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
- }
- }
-}
-
-ChatRoom *CSkypeProto::FindChatRoom(const wchar_t *cid)
-{
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYID | GCF_DATA;
- gci.pszModule = this->m_szModuleName;
- gci.pszID = (wchar_t*)cid;
-
- if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
- return (ChatRoom *)gci.dwItemData;
-
- return NULL;
-}
-
-int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
-{
- GCHOOK *gch = (GCHOOK *)lParam;
- if (!gch) return 1;
-
- if (::strcmp(gch->pDest->pszModule, this->m_szModuleName) != 0)
- return 0;
-
- ChatRoom *room = this->FindChatRoom(gch->pDest->ptszID);
- if (room == NULL)
- return 0;
-
- switch (gch->pDest->iType)
- {
- case GC_USER_MESSAGE:
- if (gch->ptszText && gch->ptszText[0])
- room->SendMessage(gch->ptszText);
- break;
-
- /*case GC_USER_CHANMGR:
- if (this->GetConversationByIdentity(::mir_utf8encodeW(cid), conversation, false))
- {
- StringList invitedContacts(this->GetChatUsers(cid));
- this->InviteConactsToChat(conversation, invitedContacts);
- }
- break;*/
-
- case GC_USER_PRIVMESS:
- ::CallService(MS_MSG_SENDMESSAGE, (WPARAM)this->GetContactBySid(gch->ptszUID), 0);
- break;
-
- case GC_USER_LOGMENU:
- case GC_USER_NICKLISTMENU:
- switch (gch->dwData)
- {
- case CHAT_LIST_MENU::ICM_ROLE_ADMIN:
- case CHAT_LIST_MENU::ICM_ROLE_SPEAKER:
- case CHAT_LIST_MENU::ICM_ROLE_WRITER:
- case CHAT_LIST_MENU::ICM_ROLE_SPECTATOR:
- {
- ChatMember *member = room->FindChatMember(gch->ptszUID);
- if (member != NULL)
- {
- Participant::RANK rank;
- switch (gch->dwData)
- {
- case CHAT_LIST_MENU::ICM_ROLE_ADMIN:
- rank = Participant::ADMIN;
- break;
-
- case CHAT_LIST_MENU::ICM_ROLE_SPEAKER:
- rank = Participant::SPEAKER;
- break;
-
- case CHAT_LIST_MENU::ICM_ROLE_WRITER:
- rank = Participant::WRITER;
- break;
-
- case CHAT_LIST_MENU::ICM_ROLE_SPECTATOR:
- rank = Participant::SPECTATOR;
- break;
- }
- if (member->participant && member->participant->SetRankTo(rank))
- room->UpdateMemberRole(member, rank, *room->me);
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_ADD:
- {
- ChatMember *member = room->FindChatMember(gch->ptszUID);
- if (member != NULL)
- room->AddApplicant(member);
- }
- break;
-
- case CHAT_LIST_MENU::ICM_KICK:
- {
- ChatMember *member = room->FindChatMember(gch->ptszUID);
- if (member != NULL)
- {
- if (member->participant && member->participant->Retire())
- room->KickMember(gch->ptszUID, room->me->GetSid());
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_BAN:
- {
- ChatMember *member = room->FindChatMember(gch->ptszUID);
- if (member != NULL && member->participant)
- {
- member->participant->SetRankTo(Participant::OUTLAW);
- if (member->participant->Retire())
- room->KickMember(gch->ptszUID, room->me->GetSid());
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_CONF_INVITE:
- {
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYID | GCF_USERS;
- gci.pszModule = this->m_szModuleName;
- gci.pszID = gch->pDest->ptszID;
- if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.pszUsers != NULL)
- {
- StringList invitedContacts(_A2T(gci.pszUsers));
- ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
-
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- room->Invite(param->invitedContacts);
-
- delete param;
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_AUTH_REQUEST:
- {
- CContact::Ref contact;
- SEString sid((char *)ptrA(::mir_utf8encodeW(gch->ptszUID)));
- if (this->GetContact(sid, contact))
- {
- this->AuthRequest(
- this->AddContact(contact),
- LPGENT("Hi! I'd like to add you to my contact list"));
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_DETAILS:
- ::CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)this->GetContactBySid(gch->ptszUID), 0);
- break;
-
- case CHAT_LIST_MENU::ICM_COPY_SID:
- {
- MCONTACT hContact = this->GetContactBySid(gch->ptszUID);
- if (!hContact)
- {
- ptrW sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (sid != NULL)
- CSkypeProto::CopyToClipboard(sid);
- }
- }
- break;
-
- case CHAT_LIST_MENU::ICM_COPY_URI:
- CSkypeProto::CopyToClipboard(ptrW(room->GetUri()));
- break;
- }
- break;
-
- //case GC_USER_TYPNOTIFY:
- //break;
- }
- return 0;
-}
-
-int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam)
-{
- GCMENUITEMS *gcmi = (GCMENUITEMS*) lParam;
-
- if (::stricmp(gcmi->pszModule, this->m_szModuleName) != 0)
- return 0;
-
- ChatRoom *room = this->FindChatRoom(gcmi->pszID);
- if (room == NULL)
- return 0;
-
- ResetChatMenuItem();
-
- if (room->me->GetRank() > Participant::ADMIN || room->me->GetRank() == 0)
- {
- DisableChatMenuItem(ICM_ROLE);
- DisableChatMenuItem(ICM_ADD);
- DisableChatMenuItem(ICM_KICK);
- DisableChatMenuItem(ICM_BAN);
- }
-
- //todo: add other case
- if (room->me->GetRank() >= Participant::APPLICANT)
- {
- DisableChatMenuItem(ICM_CONF_INVITE);
- }
-
- ChatMember *member = room->FindChatMember(gcmi->pszUID);
- if (member != NULL)
- {
- if (member->GetRank() == Participant::CREATOR)
- {
- DisableChatMenuItem(ICM_ROLE);
- DisableChatMenuItem(ICM_ADD);
- DisableChatMenuItem(ICM_KICK);
- DisableChatMenuItem(ICM_BAN);
- }
-
- if (member->GetRank() <= Participant::SPECTATOR)
- {
- CHAT_LIST_MENU type = (CHAT_LIST_MENU)(ICM_ROLE + member->GetRank() - 1);
- CheckChatMenuItem(type);
- DisableChatMenuItem(type);
-
- DisableChatMenuItem(ICM_ADD);
- }
-
- if (member->GetRank() > Participant::SPECTATOR)
- DisableChatMenuItem(ICM_ROLE);
-
- MCONTACT hContact = this->GetContactBySid(gcmi->pszUID);
- if (hContact == NULL)
- DisableChatMenuItem(ICM_DETAILS);
- else if(this->getByte(hContact, "Auth", 0) == 0)
- DisableChatMenuItem(ICM_AUTH_REQUEST);
- }
- else
- {
- DisableChatMenuItem(ICM_DETAILS);
- DisableChatMenuItem(ICM_AUTH_REQUEST);
- DisableChatMenuItem(ICM_ROLE);
- DisableChatMenuItem(ICM_ADD);
- DisableChatMenuItem(ICM_KICK);
- DisableChatMenuItem(ICM_BAN);
- DisableChatMenuItem(ICM_COPY_SID);
- }
-
- gcmi->nItems = SIZEOF(crListItems);
- gcmi->Item = crListItems;
-
- return 0;
-}
-
-void CSkypeProto::UpdateChatUserStatus(const ContactRef &contact)
-{
- CContact::AVAILABILITY availability;
- contact->GetPropAvailability(availability);
-
- SEString identity;
- contact->GetIdentity(identity);
- ptrW sid(::mir_utf8decodeW(identity));
-
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_DATA;
- gci.pszModule = this->m_szModuleName;
-
- int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName);
- for (int i = 0; i < count ; i++)
- {
- gci.iItem = i;
- ::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
-
- ChatRoom *room = (ChatRoom *)gci.dwItemData;
- if (room != NULL)
- {
- ChatMember *member = room->FindChatMember(sid);
- if (member != NULL)
- room->UpdateMemberStatus(member, CSkypeProto::SkypeToMirandaStatus(availability));
- }
- }
-}
-
-void CSkypeProto::UpdateChatUserNick(const ContactRef &contact)
-{
- SEString data;
-
- contact->GetIdentity(data);
- ptrW sid(::mir_utf8decodeW(data));
-
- ptrW nick(::mir_utf8decodeW(((CContact::Ref)contact)->GetNick()));
-
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_DATA;
- gci.pszModule = this->m_szModuleName;
-
- int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName);
- for (int i = 0; i < count ; i++)
- {
- gci.iItem = i;
- ::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
-
- ChatRoom *room = (ChatRoom *)gci.dwItemData;
- if (room != NULL)
- {
- ChatMember *member = room->FindChatMember(sid);
- if (member != NULL)
- room->UpdateMemberNick(member, nick);
- }
- }
-}
-
-INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if (hContact)
- {
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
-
- ChatRoom *room = this->FindChatRoom(cid);
- if ( !room)
- {
- ConversationRef conversation;
- if (this->GetConversationByIdentity(
- (char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)),
- conversation))
- {
- SEString data;
- conversation->GetJoinBlob(data);
- ptrW joinBlob(::mir_utf8decodeW(data));
- ChatRoom::Join(joinBlob, this);
- }
- }
- else
- room->ShowWindow();
- }
-
- return 0;
-}
-
-INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if (hContact) {
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
-
- ChatRoom *room = this->FindChatRoom(cid);
- if (room != NULL)
- room->LeaveChat();
- }
-
- return 0;
-}
-
-///
-
-void __cdecl CSkypeProto::LoadChatList(void*)
-{
- this->debugLogW(L"Updating group chats list");
- CConversation::Refs conversations;
- this->GetConversationList(conversations);
-
- SEString data;
- for (uint i = 0; i < conversations.size(); i++)
- {
- auto conversation = conversations[i];
-
- uint convoType = conversation->GetUintProp(Conversation::P_TYPE);
- if (convoType == CConversation::CONFERENCE)
- {
- CConversation::MY_STATUS status;
- conversation->GetPropMyStatus(status);
- if (status == Conversation::APPLICANT || status == Conversation::CONSUMER )
- {
- conversation->GetPropIdentity(data);
- ptrW cid( ::mir_utf8decodeW(data));
- CSkypeProto::ReplaceSpecialChars(cid);
-
- conversation->GetPropDisplayname(data);
- ptrW name( ::mir_utf8decodeW(data));
-
- ChatRoom *room = new ChatRoom(cid, name, this);
- chatRooms.insert(room);
- room->Start(conversation);
- }
- }
- }
-}
-
-///
-
-void CSkypeProto::OnChatEvent(const ConversationRef &conversation, const MessageRef &message)
-{
- uint messageType;
- messageType = message->GetUintProp(Message::P_TYPE);
-
- SEString data;
- conversation->GetPropIdentity(data);
- ptrW cid( ::mir_utf8decodeW(data));
- CSkypeProto::ReplaceSpecialChars(cid);
-
- ChatRoom *room = this->FindChatRoom(cid);
- if (room != NULL)
- {
- room->OnEvent(conversation, message);
- }
- else
- {
- Conversation::MY_STATUS status;
- conversation->GetPropMyStatus(status);
- if (status != Conversation::RETIRED_FORCEFULLY || status != Conversation::RETIRED_FORCEFULLY)
- {
- SEString data;
-
- conversation->GetPropDisplayname(data);
- ptrW name( ::mir_utf8decodeW(data));
-
- ChatRoom *room = new ChatRoom(cid, name, this);
- chatRooms.insert(room);
- room->Start(conversation, true);
- }
- }
-}
-
-void CSkypeProto::OnConversationListChange(
- const ConversationRef& conversation,
- const Conversation::LIST_TYPE& type,
- const bool& added)
-{
- uint convoType = conversation->GetUintProp(Conversation::P_TYPE);
- if (convoType == Conversation::CONFERENCE && type == Conversation::INBOX_CONVERSATIONS && added)
- {
- SEString data;
-
- conversation->GetPropIdentity(data);
- ptrW cid( ::mir_utf8decodeW(data));
- CSkypeProto::ReplaceSpecialChars(cid);
-
- if ( !this->FindChatRoom(cid))
- {
- conversation->GetPropDisplayname(data);
- ptrW name( ::mir_utf8decodeW(data));
-
- ChatRoom *room = new ChatRoom(cid, name, this);
- chatRooms.insert(room);
- room->Start(conversation, true);
- }
- }
-}
-
-void CSkypeProto::ChatRoomParseUriComands(const wchar_t *commands)
-{
-}
-
-static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tszValue, TCHAR* buf, size_t bufSize)
-{
- if (*buf) {
- const TCHAR *szSeparator = bIsTipper ? _T("\n") : _T("\r\n");
- _tcsncat(buf, szSeparator, bufSize);
- }
-
- size_t len = _tcslen(buf);
- buf += len;
- bufSize -= len;
-
- if (bIsTipper)
- mir_sntprintf(buf, bufSize, _T("%s%s%s%s"), _T("<b>"), TranslateTS(tszTitle), _T("</b>\t"), tszValue);
- else {
- TCHAR* p = TranslateTS(tszTitle);
- mir_sntprintf(buf, bufSize, _T("%s%s\t%s"), p, _tcslen(p)<=7 ? _T("\t") : _T(""), tszValue);
- }
-}
-
-INT_PTR __cdecl CSkypeProto::SkypeGCGetToolTipText(WPARAM wParam, LPARAM lParam)
-{
- if ( !wParam || !lParam)
- return 0; //room global tooltip not supported yet
-
- ChatRoom *room = this->FindChatRoom((TCHAR *)wParam);
- if (room == NULL)
- return 0; //no room found
-
- ChatMember *member = room->FindChatMember((TCHAR *)lParam);
- if (member == NULL)
- return 0; //no contact found
-
- // ok process info output will be:
- // Skype name: sid
- // Nick: Nickname
- // Status: StatusText
- // Role: Moderator
-
- TCHAR outBuf[2048];
- outBuf[0]=_T('\0');
-
- bool bIsTipper = db_get_b(NULL, "Tab_SRMsg", "adv_TipperTooltip", 0) && ServiceExists("mToolTip/HideTip");
-
- //sid
- appendString(bIsTipper, _T("Skype name:"), member->GetSid(), outBuf, SIZEOF(outBuf));
- //nick
- appendString(bIsTipper, _T("Nick:"), member->GetNick(), outBuf, SIZEOF(outBuf));
- //status
- appendString(bIsTipper, _T("Status:"), (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)member->GetStatus(),GSMDF_TCHAR), outBuf, SIZEOF(outBuf));
- //role
- appendString(bIsTipper, _T("Role:"), ::TranslateW(ChatRoom::Roles[member->GetRank()]), outBuf, SIZEOF(outBuf));
-
- return (INT_PTR)(outBuf[0] == 0 ? NULL : mir_tstrdup(outBuf));
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_chat.h b/protocols/Skype/src/skype_chat.h deleted file mode 100644 index d63d7c9da2..0000000000 --- a/protocols/Skype/src/skype_chat.h +++ /dev/null @@ -1,204 +0,0 @@ -#pragma once
-
-#include "skype.h"
-#include <m_chat.h>
-
-class ChatMember
-{
-private:
- wchar_t *sid;
- wchar_t *nick;
- int rank;
- WORD status;
-
-public:
- CParticipant::Ref participant;
-
- ChatMember()
- {
- this->sid = NULL;
- this->nick = NULL;
- }
-
- ChatMember(const wchar_t *sid)
- {
- this->sid = ::mir_wstrdup(sid);
- this->nick = NULL;
- }
-
- ChatMember(const ChatMember &other)
- {
- this->sid = NULL;
- this->nick = NULL;
- this->operator=(other);
- }
-
- ~ChatMember()
- {
- if (this->sid != NULL)
- ::mir_free(this->sid);
- if (this->nick != NULL)
- ::mir_free(this->nick);
- }
-
- void SetNick(const wchar_t *nick)
- {
- if (this->nick != NULL)
- ::mir_free(this->nick);
- this->nick = ::mir_wstrdup(nick);
- }
-
- wchar_t *GetSid() const
- {
- return this->sid;
- }
-
- wchar_t *GetNick() const
- {
- if (this->nick == NULL)
- return this->sid;
-
- return this->nick;
- }
-
- void SetRank(int rank)
- {
- this->rank = rank;
- }
-
- int GetRank() const
- {
- return this->rank;
- }
-
- void SetStatus(int status)
- {
- this->status = status;
- }
-
- int GetStatus() const
- {
- return this->status;
- }
-
- void SetPaticipant(const ParticipantRef &participant)
- {
- this->participant = participant;
- }
-
- static int Compare(const ChatMember *p1, const ChatMember *p2)
- {
- return ::lstrcmpi(p1->sid, p2->sid);
- }
-
- bool operator==(const ChatMember &other) const
- {
- return ::lstrcmp(this->sid, other.sid) == 0;
- }
-
- bool operator!=(const ChatMember &other) const
- {
- return !(*this == other);
- }
-
- ChatMember& operator=(const ChatMember &other)
- {
- if (this == &other)
- return *this;
-
- if (this->sid != NULL)
- ::mir_free(this->sid);
- this->sid = ::mir_wstrdup(other.sid);
-
- if (this->nick != NULL)
- ::mir_free(this->nick);
- this->nick = ::mir_wstrdup(other.nick);
-
- this->rank = other.rank;
- this->status = other.status;
- this->participant = other.participant;
- return *this;
- }
-};
-
-class ChatRoom
-{
-private:
- wchar_t *cid;
- wchar_t *name;
-
- CConversation::Ref conversation;
-
- MCONTACT hContact;
-
- OBJLIST<ChatMember> members;
-
- CSkypeProto *ppro;
-
- ChatRoom(const wchar_t *cid);
-
- inline static int CompareMembers(const ChatMember *p1, const ChatMember *p2) { return ChatMember::Compare(p1, p2); }
-
- void CreateChatSession(bool showWindow = false);
-
- bool IsMe(const ChatMember &item) const;
- bool IsSys(const ChatMember &item) const;
- void SendEvent(const ChatMember &item, int eventType, DWORD timestamp = time(NULL), DWORD flags = GCEF_ADDTOLOG, DWORD itemData = 0, const wchar_t *status = NULL, const wchar_t *message = NULL);
-
- void UpdateMember(const ChatMember &item, DWORD timestamp = time(NULL));
- void KickMember(const ChatMember &item, const ChatMember *author, DWORD timestamp = time(NULL));
- void RemoveMember(const ChatMember &item, DWORD timestamp = time(NULL));
-
-public:
- ChatMember *me;
- ChatMember *sys;
-
- static wchar_t *Roles[];
-
- ChatRoom(const wchar_t *cid, const wchar_t *name, CSkypeProto *ppro);
- ~ChatRoom();
-
- MCONTACT GetContactHandle() const;
-
- void SetTopic(const wchar_t *topic);
- wchar_t *GetUri();
- void ShowWindow();
-
- void Invite(const StringList &contacts);
- void Start(const ConversationRef &conversation, bool showWindow = false);
- //void Join(const wchar_t *joinBlob, bool showWindow = false);
-
- void SendMessage(const wchar_t *text);
-
- void LeaveChat();
- void LeaveChatAndDelete();
-
- void SendEvent(const wchar_t *sid, int eventType, DWORD timestamp = time(NULL), DWORD flags = GCEF_ADDTOLOG, DWORD itemData = 0, const wchar_t *status = NULL, const wchar_t *message = NULL);
-
- bool IsMe(const wchar_t *sid) const;
- bool IsSys(const wchar_t *sid) const;
-
- ChatMember *FindChatMember(const wchar_t *sid);
-
- void AddMember(const ChatMember &item, const ChatMember &author, DWORD timestamp = time(NULL));
-
- void UpdateMemberNick(ChatMember *member, const wchar_t *nick, DWORD timestamp = time(NULL));
- void UpdateMemberRole(ChatMember *member, int role, const ChatMember &author = NULL, DWORD timestamp = time(NULL));
- void UpdateMemberStatus(ChatMember *member, int status, DWORD timestamp = time(NULL));
-
- void UpdateMember(const wchar_t *sid, const wchar_t *nick, int role, int status, DWORD timestamp = time(NULL));
-
- //void GiveMember(const wchar_t *sid);
- void AddApplicant(const ChatMember *sid);
-
- void KickMember(const wchar_t *sid, const wchar_t *author, DWORD timestamp = time(NULL));
- void RemoveMember(const wchar_t *sid, DWORD timestamp = time(NULL));
-
- void OnEvent(const ConversationRef &conversation, const MessageRef &message);
- void OnChange(const ConversationRef &conversation, int prop);
-
- void OnParticipantChanged(const ParticipantRef &participant, int prop);
-
- static void Create(const ChatRoomParam *param, CSkypeProto *ppro);
- static void Join(const wchar_t *joinBlob, CSkypeProto *ppro);
-};
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp deleted file mode 100644 index 0561db0e04..0000000000 --- a/protocols/Skype/src/skype_contacts.cpp +++ /dev/null @@ -1,538 +0,0 @@ -#include "skype.h"
-
-void CSkypeProto::UpdateContactAuthState(MCONTACT hContact, const ContactRef &contact)
-{
- uint newTS = 0;
- contact->GetPropAuthreqTimestamp(newTS);
- DWORD oldTS = this->getDword("AuthTS", 0);
- if (newTS > oldTS)
- {
- bool result;
- if (contact->HasAuthorizedMe(result) && !result)
- this->setByte(hContact, "Auth", !result);
- else
- {
- this->delSetting(hContact, "Auth");
- if (contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result) && !result)
- this->setByte(hContact, "Grant", !result);
- else
- this->delSetting(hContact, "Grant");
- }
-
- this->setDword(hContact, "AuthTS", newTS);
- }
-}
-
-void CSkypeProto::UpdateContactStatus(MCONTACT hContact, const ContactRef &contact)
-{
- Contact::AVAILABILITY availability;
- contact->GetPropAvailability(availability);
- this->setWord(hContact, SKYPE_SETTINGS_STATUS, CSkypeProto::SkypeToMirandaStatus(availability));
-
- if (availability == Contact::SKYPEOUT)
- this->setWord(hContact, SKYPE_SETTINGS_STATUS, ID_STATUS_ONTHEPHONE);
- else
- {
- if (availability == Contact::PENDINGAUTH)
- this->setByte(hContact, "Auth", 1);
- else
- this->delSetting(hContact, "Auth");
- }
-}
-
-void CSkypeProto::UpdateContactClient(MCONTACT hContact, const ContactRef &contact)
-{
- bool isMobile = false;
- contact->HasCapability(Contact::CAPABILITY_MOBILE_DEVICE, isMobile/*, true*/);
-
- this->setTString(hContact, "MirVer", isMobile ? L"SkypeMobile" : L"Skype");
-}
-
-void CSkypeProto::UpdateContactOnlineSinceTime(MCONTACT hContact, const ContactRef &contact)
-{
- uint newTS = 0;
- contact->GetPropLastonlineTimestamp(newTS);
- DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "OnlineSinceTS", 0);
- if (newTS > oldTS)
- this->setDword(hContact, "OnlineSinceTS", newTS);
-}
-
-void CSkypeProto::UpdateContactLastEventDate(MCONTACT hContact, const ContactRef &contact)
-{
- uint newTS = 0;
- contact->GetPropLastusedTimestamp(newTS);
- DWORD oldTS = this->getDword(hContact, "LastEventDateTS", 0);
- if (newTS > oldTS)
- this->setDword(hContact, "LastEventDateTS", newTS);
-}
-
-void CSkypeProto::OnContactChanged(const ContactRef &contact, int prop)
-{
- SEString data;
- contact->GetPropSkypename(data);
- wchar_t *sid = ::mir_utf8decodeW(data);
- MCONTACT hContact = this->GetContactBySid(sid);
- ::mir_free(sid);
-
- SEObject *contactObj = contact.fetch();
-
- if (hContact)
- {
- switch(prop)
- {
- case Contact::P_AUTHREQ_TIMESTAMP:
- {
- uint newTS = 0;
- contact->GetPropAuthreqTimestamp(newTS);
- DWORD oldTS = this->getDword(hContact, "AuthTS", 0);
- if (newTS > oldTS)
- this->RaiseAuthRequestEvent(newTS, contact);
- }
- break;
-
- case Contact::P_AUTHREQUEST_COUNT:
- // todo: all authrequests after first should be catch here
- this->UpdateContactAuthState(hContact, contact);
- break;
-
- case Contact::P_AVAILABILITY:
- this->UpdateContactStatus(hContact, contact);
- this->UpdateChatUserStatus(contact);
- break;
-
- //case CContact::P_AVATAR_IMAGE:
- case Contact::P_AVATAR_TIMESTAMP:
- this->UpdateProfileAvatar(contactObj, hContact);
- break;
-
- //case CContact::P_MOOD_TEXT:
- case Contact::P_MOOD_TIMESTAMP:
- this->UpdateProfileStatusMessage(contactObj, hContact);
- break;
-
- case Contact::P_FULLNAME:
- this->UpdateChatUserNick(contact);
- break;
-
- case Contact::P_PROFILE_TIMESTAMP:
- this->UpdateProfile(contactObj, hContact);
- break;
- }
- }
-}
-
-void CSkypeProto::OnContactListChanged(const ContactRef &contact)
-{
- bool result;
-
- contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result);
- if (result)
- {
- if ( !this->contactList.contains(contact))
- {
- CContact::Ref newContact(contact);
- this->contactList.append(newContact);
- newContact.fetch();
- }
- }
-
- contact->IsMemberOfHardwiredGroup(CContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION, result);
- if (result)
- {
- SEString data;
-
- uint newTS = 0;
- contact->GetPropAuthreqTimestamp(newTS);
-
- this->RaiseAuthRequestEvent(newTS, contact);
- }
-}
-
-bool CSkypeProto::IsProtoContact(MCONTACT hContact)
-{
- return ::lstrcmpiA(::GetContactProto(hContact), this->m_szModuleName) == 0;
-}
-
-MCONTACT CSkypeProto::GetContactBySid(const wchar_t *sid)
-{
- MCONTACT hContact = NULL;
-
- ::EnterCriticalSection(&this->contact_search_lock);
-
- for (hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
- {
- ptrW contactSid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (::lstrcmpi(contactSid, sid) == 0)
- break;
- }
-
- ::LeaveCriticalSection(&this->contact_search_lock);
-
- return hContact;
-}
-
-MCONTACT CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent)
-{
- // db_event_getContact
- DWORD body[3];
- DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
- dbei.cbBlob = sizeof(DWORD) * 2;
- dbei.pBlob = (PBYTE)&body;
-
- if (::db_event_get(hEvent, &dbei))
- return INVALID_CONTACT_ID;
-
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
- return INVALID_CONTACT_ID;
-
- if (strcmp(dbei.szModule, this->m_szModuleName) != 0)
- return INVALID_CONTACT_ID;
-
- return ::DbGetAuthEventContact(&dbei);
-}
-
-MCONTACT CSkypeProto::AddContact(CContact::Ref contact, bool isTemporary)
-{
- ptrW sid(::mir_utf8decodeW(contact->GetSid()));
-
- CContact::AVAILABILITY availability;
- contact->GetPropAvailability(availability);
-
- MCONTACT hContact = this->GetContactBySid(sid);
- if ( !hContact)
- {
- hContact = (MCONTACT)::CallService(MS_DB_CONTACT_ADD, 0, 0);
- ::CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)this->m_szModuleName);
-
- ptrW nick(::mir_utf8decodeW(contact->GetNick()));
-
- switch(availability) {
- case CContact::SKYPEOUT:
- this->setByte(hContact, "IsSkypeOut", 1);
- break;
-
- case CContact::PENDINGAUTH:
- ::db_set_b(hContact, "CList", "NotOnList", 1);
- break;
-
- case CContact::BLOCKED:
- case CContact::BLOCKED_SKYPEOUT:
- ::db_set_b(hContact, "CList", "Hidden", 1);
- break;
-
- default:
- this->delSetting(hContact, "IsSkypeOut");
- ::db_unset(hContact, "CList", "Hidden");
- ::db_unset(hContact, "CList", "NotOnList");
- }
-
- this->setTString(hContact, SKYPE_SETTINGS_SID, sid);
- this->setTString(hContact, "Nick", nick);
-
- DBVARIANT dbv;
- if ( !this->getTString(SKYPE_SETTINGS_DEF_GROUP, &dbv))
- {
- ::db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
- ::db_free(&dbv);
- }
- }
-
- return hContact;
-}
-
-void __cdecl CSkypeProto::LoadContactList(void* data)
-{
- this->debugLogW(L"Updating contacts list");
-
- bool isFirstLoad = data != NULL;
-
- this->GetHardwiredContactGroup(CContactGroup::ALL_BUDDIES, this->commonList);
- this->commonList.fetch();
-
- this->commonList->GetContacts(this->contactList);
- fetch(this->contactList);
- for (uint i = 0; i < this->contactList.size(); i++)
- {
- CContact::Ref contact = this->contactList[i];
-
- MCONTACT hContact = this->AddContact(contact);
-
- if ( !isFirstLoad)
- {
- // todo: move to AddContact?
- this->UpdateContactAuthState(hContact, contact);
- this->UpdateContactStatus(hContact, contact);
-
- ptrW nick( ::db_get_wsa(hContact, "CList", "MyHandle"));
- if ( !nick || !::wcslen(nick))
- {
- nick = ::mir_utf8decodeW(contact->GetNick());
- ::db_set_ws(hContact, "CList", "MyHandle", nick);
- }
-
- this->UpdateProfile(contact.fetch(), hContact);
- }
- }
-}
-
-void __cdecl CSkypeProto::LoadAuthWaitList(void*)
-{
- CContact::Refs authContacts;
- this->GetHardwiredContactGroup(CContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION, this->authWaitList);
- this->authWaitList.fetch();
-
- this->authWaitList->GetContacts(authContacts);
- for (uint i = 0; i < authContacts.size(); i++)
- {
- CContact::Ref contact = authContacts[i];
-
- uint newTS = 0;
- contact->GetPropAuthreqTimestamp(newTS);
-
- this->RaiseAuthRequestEvent(newTS, contact);
- }
-}
-
-bool CSkypeProto::IsContactOnline(MCONTACT hContact)
-{
- return this->getWord(hContact, SKYPE_SETTINGS_STATUS, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE;
-}
-
-void CSkypeProto::SetAllContactStatus(int status)
-{
- ::EnterCriticalSection(&this->contact_search_lock);
-
- for (MCONTACT hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
- {
- if (this->getByte(hContact, "IsSkypeOut", 0) != 0)
- continue;
- if (this->isChatRoom(hContact))
- continue;
- if (this->IsContactOnline(hContact))
- ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, status);
- }
-
- ::LeaveCriticalSection(&this->contact_search_lock);
-}
-
-void CSkypeProto::OnSearchCompleted(HANDLE hSearch)
-{
- this->SendBroadcast(ACKTYPE_SEARCH, ACKRESULT_SUCCESS, hSearch, 0);
-}
-
-void CSkypeProto::OnContactFinded(CContact::Ref contact, HANDLE hSearch)
-{
- PROTOSEARCHRESULT psr = {0};
- psr.cbSize = sizeof(psr);
- psr.flags = PSR_TCHAR;
-
- SEString data;
- contact->GetPropSkypename(data);
- psr.id = ::mir_utf8decodeW(data);
- contact->GetPropDisplayname(data);
- psr.nick = ::mir_utf8decodeW(data);
-
- SEString firstName, lastName;
- contact->GetFullname(firstName, lastName);
- psr.firstName = ::mir_utf8decodeW(firstName);
- psr.lastName = ::mir_utf8decodeW(lastName);
-
- {
- contact->GetPropEmails(data);
- mir_ptr<wchar_t> emails( ::mir_utf8decodeW(data));
-
- wchar_t* main = ::wcstok(emails, L" ");
- if (main != NULL)
- {
- psr.email = main;
- }
- }
-
- this->SendBroadcast(ACKTYPE_SEARCH, ACKRESULT_DATA, hSearch, (LPARAM)&psr);
-}
-
-void __cdecl CSkypeProto::SearchBySidAsync(void* arg)
-{
- mir_ptr<wchar_t> sid((wchar_t*)arg);
-
- MCONTACT hContact = this->GetContactBySid(sid);
- if (hContact)
- {
- this->ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact);
- this->SendBroadcast(ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)SKYPE_SEARCH_BYSID, 0);
- return;
- }
-
- CContactSearch::Ref search;
- this->CreateIdentitySearch(::mir_u2a(sid), search);
- search.fetch();
- search->SetProtoInfo((HANDLE)SKYPE_SEARCH_BYSID);
-
- bool valid;
- if (!search->IsValid(valid) || !valid || !search->Submit())
- return;
-
- search->BlockWhileSearch();
- search->Release();
-}
-
-void __cdecl CSkypeProto::SearchByEmailAsync(void* arg)
-{
- mir_ptr<wchar_t> email((wchar_t *)arg);
-
- CContactSearch::Ref search;
- this->CreateContactSearch(search);
- search.fetch();
- search->SetProtoInfo((HANDLE)SKYPE_SEARCH_BYEMAIL);
-
- bool valid;
- if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit())
- return;
-
- search->BlockWhileSearch();
- search->Release();
-}
-
-void __cdecl CSkypeProto::SearchByNamesAsync(void* arg)
-{
- //todo: write me
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT *)arg;
-
- std::string nick = ::mir_utf8encodeW(psr->nick);
- std::string fName = ::mir_utf8encodeW(psr->firstName);
- std::string lName = " "; lName += ::mir_utf8encodeW(psr->lastName);
-
- CContactSearch::Ref search;
- this->CreateContactSearch(search);
- search.fetch();
- search->SetProtoInfo((HANDLE)SKYPE_SEARCH_BYNAMES);
-
- bool valid;
- if (nick.length() != 0)
- {
- search->AddStrTerm(
- Contact::P_FULLNAME,
- CContactSearch::CONTAINS_WORD_PREFIXES,
- nick.c_str(),
- valid,
- true);
- }
- if (fName.length() != 0)
- {
- search->AddOr();
- search->AddStrTerm(
- Contact::P_FULLNAME,
- CContactSearch::CONTAINS_WORD_PREFIXES,
- fName.c_str(),
- valid,
- true);
- }
- if (lName.length() != 0)
- {
- search->AddOr();
- search->AddStrTerm(
- Contact::P_FULLNAME,
- CContactSearch::CONTAINS_WORD_PREFIXES,
- lName.c_str(),
- valid,
- true);
- }
-
- if (!search->Submit())
- return;
-
- search->BlockWhileSearch();
- search->Release();
-}
-
-void CSkypeProto::OnContactsReceived(const ConversationRef &conversation, const MessageRef &message)
-{
- CContact::Refs contacts;
- message->GetContacts(contacts);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- SEString data;
- message->GetPropAuthor(data);
-
- CContact::Ref author;
- this->GetContact(data, author);
-
- MCONTACT hContact = this->AddContact(author);
-
- SEBinary guid;
- message->GetPropGuid(guid);
- ReadMessageParam param = { guid, messageType };
-
- PROTORECVEVENT pre = { 0 };
- pre.flags = PREF_UTF;
- pre.lParam = (LPARAM)¶m;
- pre.timestamp = timestamp;
-
- int msgSize = 1;
- pre.szMessage = (char *)::mir_alloc(msgSize);
- pre.szMessage[0] = 0;
-
- int len = 0;
- char* pCur = &pre.szMessage[0];
-
- for (size_t i = 0; i < contacts.size(); i ++)
- {
- contacts[i]->GetIdentity(data);
- if ( ::lstrcmpi(mir_ptr<wchar_t>(::mir_utf8decodeW(data)), this->login) != 0)
- this->AddContact(contacts[i]);
- }
-
- char *text = ::mir_utf8encode(::Translate("Contacts received"));
-
- this->AddDBEvent(
- hContact,
- SKYPE_DB_EVENT_TYPE_CONTACTS,
- timestamp,
- PREF_UTF,
- (DWORD)::strlen(text) + 1,
- (PBYTE)text);
-}
-
-void CSkypeProto::OnContactsSent(const ConversationRef &conversation, const MessageRef &message)
-{
- SEString data;
-
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- CMessage::SENDING_STATUS status;
- message->GetPropSendingStatus(status);
-
- CParticipant::Refs participants;
- conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
- participants[0]->GetPropIdentity(data);
-
- CContact::Ref receiver;
- this->GetContact(data, receiver);
-
- MCONTACT hContact = this->AddContact(receiver);
- this->SendBroadcast(
- hContact,
- ACKTYPE_CONTACTS,
- status == CMessage::FAILED_TO_SEND ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
- (HANDLE)message->getOID(), 0);
-}
-
-void CSkypeProto::OnContactsEvent(const ConversationRef &conversation, const MessageRef &message)
-{
- SEString author;
- message->GetPropAuthor(author);
-
- if (::wcsicmp(mir_ptr<wchar_t>(::mir_utf8decodeW(author)), this->login) == 0)
- this->OnContactsSent(conversation, message);
- else
- this->OnContactsReceived(conversation, message);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp deleted file mode 100644 index 6ad9166e11..0000000000 --- a/protocols/Skype/src/skype_database.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "skype.h"
-
-bool CSkypeProto::IsMessageInDB(MCONTACT hContact, DWORD timestamp, SEBinary &guid, int flag)
-{
- for (HANDLE hDbEvent = ::db_event_last(hContact); hDbEvent; hDbEvent = ::db_event_prev(hContact, hDbEvent))
- {
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.cbBlob = ::db_event_getBlobSize(hDbEvent);
- if (dbei.cbBlob < guid.size())
- continue;
-
- mir_ptr<BYTE> blob((PBYTE)::mir_alloc(dbei.cbBlob));
- dbei.pBlob = blob;
- ::db_event_get(hDbEvent, &dbei);
-
- if (dbei.timestamp < timestamp)
- break;
-
- int sendFlag = dbei.flags & DBEF_SENT;
- if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == SKYPE_DB_EVENT_TYPE_EMOTE) && sendFlag == flag)
- if (::memcmp(&dbei.pBlob[dbei.cbBlob - guid.size()], guid.data(), guid.size()) == 0)
- return true;
- }
-
- return false;
-}
-
-HANDLE CSkypeProto::AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob)
-{
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = this->m_szModuleName;
- dbei.timestamp = timestamp;
- dbei.eventType = type;
- dbei.cbBlob = cbBlob;
- dbei.pBlob = pBlob;
- dbei.flags = flags;
- return ::db_event_add(hContact, &dbei);
-}
-
-void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact)
-{
- char *sid = ::mir_strdup(contact->GetSid());
- char *nick = ::mir_strdup(contact->GetNick());
-
- SEString data;
-
- contact->GetPropReceivedAuthrequest(data);
- char *reason = ::mir_strdup(data);
-
- SEString last;
- contact->GetFullname(data, last);
- char *firstName = ::mir_strdup(data);
- char *lastName = ::mir_strdup(last);
-
- MCONTACT hContact = this->AddContact(contact);
-
- /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ)*/
- DWORD cbBlob = (DWORD)
- (sizeof(DWORD) * 2 +
- ::strlen(nick) +
- ::strlen(firstName) +
- ::strlen(lastName) +
- ::strlen(sid) +
- ::strlen(reason) +
- 5);
-
- PBYTE pBlob, pCurBlob;
- pCurBlob = pBlob = (PBYTE)::mir_alloc(cbBlob);
-
- *((PDWORD)pCurBlob) = 0;
- pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact;
- pCurBlob += sizeof(DWORD);
- ::strcpy((char *)pCurBlob, nick);
- pCurBlob += ::strlen(nick) + 1;
- ::strcpy((char *)pCurBlob, firstName);
- pCurBlob += ::strlen(firstName) + 1;
- ::strcpy((char *)pCurBlob, lastName);
- pCurBlob += ::strlen(lastName) + 1;
- ::strcpy((char *)pCurBlob, sid);
- pCurBlob += ::strlen(sid) + 1;
- ::strcpy((char *)pCurBlob, reason);
-
- this->AddDBEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), DBEF_UTF, cbBlob, pBlob);
-}
-
-void CSkypeProto::RaiseMessageSentEvent(MCONTACT hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnread)
-{
- if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT))
- return;
-
- int guidLen = (int)guid.size();
-
- int msgLen = (int)::strlen(message) + 1;
- ptrA msg((char *)::mir_alloc(msgLen + guidLen));
-
- ::strcpy(msg, message);
- msg[msgLen - 1] = 0;
- ::memcpy((char *)&msg[msgLen], guid.data(), guidLen);
-
- DWORD flags = DBEF_UTF | DBEF_SENT;
- if ( !isUnread)
- flags |= DBEF_READ;
-
- this->AddDBEvent(
- hContact,
- EVENTTYPE_MESSAGE,
- timestamp,
- flags,
- msgLen + guidLen,
- (PBYTE)(char*)msg);
-}
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp deleted file mode 100644 index a3aa8df4dc..0000000000 --- a/protocols/Skype/src/skype_dialogs.cpp +++ /dev/null @@ -1,859 +0,0 @@ -#include "skype.h"
-
-INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *proto = (CSkypeProto *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- switch (message)
- {
- case WM_INITDIALOG:
- {
- ::TranslateDialogDefault(hwnd);
-
- proto = (CSkypeProto *)lParam;
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- {
- ptrW sid( ::db_get_wsa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_SID));
- SetDlgItemText(hwnd, IDC_SL, sid);
- }
- {
- ptrA pwd( ::db_get_sa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_PASSWORD));
- SetDlgItemTextA(hwnd, IDC_PW, pwd);
- }
- {
- int port = rand() % 10000 + 10000;
- SetDlgItemInt(hwnd, IDC_PORT, ::db_get_w(NULL, proto->m_szModuleName, "Port", port), FALSE);
- SendMessage(GetDlgItem(hwnd, IDC_PORT), EM_SETLIMITTEXT, 5, 0);
- }
-
- CheckDlgButton(hwnd, IDC_USE_ALT_PORTS, ::db_get_b(NULL, proto->m_szModuleName, "UseAlternativePorts", 1));
-
- if (proto->IsOnline())
- {
- SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0);
- SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
- SendMessage(GetDlgItem(hwnd, IDC_PORT), EM_SETREADONLY, 1, 0);
- EnableWindow(GetDlgItem(hwnd, IDC_USE_ALT_PORTS), FALSE);
- EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), FALSE);
- EnableWindow(GetDlgItem(hwnd, IDC_CHANGE_PWD), TRUE);
- EnableWindow(GetDlgItem(hwnd, IDC_GROUP), FALSE);
- }
- else if (::db_get_w(NULL, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) > ID_STATUS_OFFLINE)
- {
- EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), FALSE);
- }
-
- SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, SKYPE_GROUP_NAME_LIMIT, 0);
-
- ptrW defgroup( db_get_wsa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP));
- SetDlgItemText(hwnd, IDC_GROUP, defgroup);
- }
- return TRUE;
-
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_SL:
- {
- if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
-
- if (!proto->IsOnline() && ::db_get_w(NULL, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) <= ID_STATUS_OFFLINE)
- {
- wchar_t sid[128];
- GetDlgItemText(hwnd, IDC_SL, sid, SIZEOF(sid));
- EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), ::wcslen(sid) != 0);
- }
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_PW:
- {
- if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
- if (proto->IsOnline())
- {
- char pwd[128];
- GetDlgItemTextA(hwnd, IDC_SL, pwd, SIZEOF(pwd));
- EnableWindow(GetDlgItem(hwnd, IDC_CHANGE_PWD), ::strlen(pwd) != 0);
- }
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_GROUP:
- {
- if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_PORT:
- {
- if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_USE_ALT_PORTS:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_REGISTER:
- {
- char sid[128], pwd[128];
- GetDlgItemTextA(hwnd, IDC_SL, sid, SIZEOF(sid));
- GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd));
-
- Skype::VALIDATERESULT reason;
- proto->ValidatePassword(sid, pwd, reason);
-
- if (reason == Skype::VALIDATED_OK)
- {
- CAccount::Ref account;
- proto->GetAccount(sid, proto->account);
- proto->account->SetStrProperty(CAccount::P_FULLNAME, sid);
- proto->account->Register(pwd, false, false);
- }
- else
- {
- proto->ShowNotification(CSkypeProto::ValidationReasons[reason]);
- }
- }
- return FALSE;
-
- case IDC_CHANGE_PWD:
- {
- char sid[128], pwd[128];
- GetDlgItemTextA(hwnd, IDC_SL, sid, SIZEOF(sid));
- GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd));
-
- PasswordChangeBoxParam param;
- param.password = ::mir_strdup(pwd);
-
- if (proto->ChangePassword(param))
- {
- proto->account->ChangePassword(param.password, param.password2);
- }
- }
- break;
- }
- }
- break;
-
- case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY && !proto->IsOnline())
- {
- wchar_t sid[128];
- GetDlgItemText(hwnd, IDC_SL, sid, SIZEOF(sid));
- ::db_set_ws(NULL, proto->m_szModuleName, SKYPE_SETTINGS_SID, sid);
- ::mir_free(proto->login);
- proto->login = ::mir_wstrdup(sid);
-
- char pwd[128];
- GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd));
- ::db_set_s(NULL, proto->m_szModuleName, SKYPE_SETTINGS_PASSWORD, pwd);
-
- HWND item = GetDlgItem(hwnd, IDC_PORT);
- if (item)
- {
- BOOL error;
- int port = GetDlgItemInt(hwnd, IDC_PORT, &error, FALSE);
- ::db_set_w(NULL, proto->m_szModuleName, "Port", port);
- ::db_set_b(NULL, proto->m_szModuleName, "UseAlternativePorts", (BYTE)IsDlgButtonChecked(hwnd, IDC_USE_ALT_PORTS));
- }
-
- wchar_t tstr[128];
- GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr));
- if (lstrlen(tstr) > 0)
- {
- ::db_set_ts(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, tstr);
- ::Clist_CreateGroup(0, tstr);
- }
- else
- ::db_unset(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP);
-
- return TRUE;
- }
- break;
- }
-
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypePrivacyOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- ppro = (CSkypeProto *)lParam;
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- ::TranslateDialogDefault(hwndDlg);
- }
- break;
-
- /*case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- }
- }
- break;*/
-
- case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY && !ppro->IsOnline())
- {
- return TRUE;
- }
- break;
-
- /*switch(LOWORD(wParam))
- {
- }
- break;*/
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypePasswordRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- PasswordRequestBoxParam *param = reinterpret_cast<PasswordRequestBoxParam *>(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
-
- switch (msg)
- {
- case WM_INITDIALOG:
- ::TranslateDialogDefault(hwndDlg);
-
- param = (PasswordRequestBoxParam *)lParam;
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- {
- ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)CSkypeProto::IconList[0].Handle);
- ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)CSkypeProto::IconList[0].Handle);
-
- wchar_t title[MAX_PATH];
- ::mir_sntprintf(
- title,
- MAX_PATH,
- ::TranslateT("Enter a password for %s:"),
- param->login);
- ::SetDlgItemText(hwndDlg, IDC_INSTRUCTION, title);
-
- ::SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 128 - 1, 0);
-
- ::CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, param->rememberPassword);
- ::ShowWindow(::GetDlgItem(hwndDlg, IDC_SAVEPASSWORD), param->showRememberPasswordBox);
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- {
- param->rememberPassword = ::IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD) > 0;
-
- char password[SKYPE_PASSWORD_LIMIT];
- ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
- param->password = ::mir_strdup(password);
-
- ::EndDialog(hwndDlg, IDOK);
- }
- break;
-
- case IDCANCEL:
- ::EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- }
- break;
- }
-
- return FALSE;
-}
-
-bool CSkypeProto::RequestPassword(PasswordRequestBoxParam ¶m)
-{
- int value = ::DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_PASSWORD_REQUEST),
- NULL,
- CSkypeProto::SkypePasswordRequestProc,
- (LPARAM)¶m);
- return value == 1;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- PasswordChangeBoxParam *param = reinterpret_cast<PasswordChangeBoxParam *>(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
-
- switch (msg)
- {
- case WM_INITDIALOG:
- ::TranslateDialogDefault(hwndDlg);
-
- SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0);
- SendDlgItemMessage(hwndDlg, IDC_PASSWORD2, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0);
- SendDlgItemMessage(hwndDlg, IDC_PASSWORD3, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0);
-
- param = (PasswordChangeBoxParam *)lParam;
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- {
- ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)CSkypeProto::IconList[0].Handle);
- ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)CSkypeProto::IconList[0].Handle);
- }
- break;
-
- case WM_CLOSE:
- ::EndDialog(hwndDlg, 0);
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- {
- char oldPwd[SKYPE_PASSWORD_LIMIT];
- char pwd1[SKYPE_PASSWORD_LIMIT];
- char pwd2[SKYPE_PASSWORD_LIMIT];
-
- ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD, oldPwd, SIZEOF(oldPwd));
- ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD2, pwd1, SIZEOF(pwd1));
- ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD3, pwd2, SIZEOF(pwd2));
-
- if (!::strlen(oldPwd) || !::strlen(pwd1)) {
- ::MessageBox(NULL, TranslateT("Password can't be empty."), TranslateT("Change password"), MB_OK | MB_ICONERROR);
- break;
- }
-
- if (::strcmp(param->password, oldPwd)) {
- ::MessageBox(NULL, TranslateT("Old password is not correct."), TranslateT("Change password"), MB_OK | MB_ICONERROR);
- break;
- }
-
- if (!::strcmp(oldPwd, pwd1)) {
- ::MessageBox(NULL, TranslateT("New password is same as old password."), TranslateT("Change password"), MB_OK | MB_ICONERROR);
- break;
- }
-
- if (::strcmp(pwd1, pwd2)) {
- ::MessageBox(NULL, TranslateT("New password and confirmation must be same."), TranslateT("Change password"), MB_OK | MB_ICONERROR);
- break;
- }
-
- param->password2 = ::mir_strdup(pwd1);
-
- ::EndDialog(hwndDlg, IDOK);
- }
- break;
-
- case IDCANCEL:
- ::EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- }
- break;
- }
-
- return FALSE;
-}
-
-bool CSkypeProto::ChangePassword(PasswordChangeBoxParam ¶m)
-{
- int value = ::DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_PASSWORD_CHANGE),
- NULL,
- CSkypeProto::SkypePasswordChangeProc,
- (LPARAM)¶m);
- return value == IDOK;
-}
-
-INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_PARAMCHANGED:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, ((PSHNOTIFY *)lParam )->lParam);
- break;
-
- case PSN_INFOCHANGED:
- {
- CSkypeProto *ppro = (CSkypeProto *)::GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (!ppro)
- break;
-
- char *szProto;
- MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
-
- if (hContact == NULL)
- szProto = ppro->m_szModuleName;
- else
- szProto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
-
- if (!szProto)
- break;
-
- ::SetDlgItemText(hwndDlg, IDC_SID, ptrW(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- DBVARIANT dbv;
- if ( !::db_get_ts(hContact, ppro->m_szModuleName, "XStatusMsg", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_STATUSTEXT, dbv.ptszVal);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_STATUSTEXT), TRUE);
- ::db_free(&dbv);
- } else {
- ::SetDlgItemText(hwndDlg, IDC_STATUSTEXT, TranslateT("<not specified>"));
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_STATUSTEXT), FALSE);
- }
-
- if (::db_get_dw(hContact, ppro->m_szModuleName, "OnlineSinceTS", 0)) {
- TCHAR date[64];
- DBTIMETOSTRINGT tts = {0};
- tts.szFormat = _T("d s");
- tts.szDest = date;
- tts.cbDest = sizeof(date);
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "OnlineSinceTS", 0), (LPARAM)&tts);
- ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, date);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_ONLINESINCE), TRUE);
- } else {
- ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, TranslateT("<not specified>"));
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_ONLINESINCE), FALSE);
- }
-
- if (::db_get_dw(hContact, ppro->m_szModuleName, "LastEventDateTS", 0)) {
- TCHAR date[64];
- DBTIMETOSTRINGT tts = {0};
- tts.szFormat = _T("d s");
- tts.szDest = date;
- tts.cbDest = sizeof(date);
- ::CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "LastEventDateTS", 0), (LPARAM)&tts);
- ::SetDlgItemText(hwndDlg, IDC_LASTEVENTDATE, date);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_LASTEVENTDATE), TRUE);
- } else {
- ::SetDlgItemText(hwndDlg, IDC_LASTEVENTDATE, TranslateT("<not specified>"));
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_LASTEVENTDATE), FALSE);
- }
-
- if (::db_get_dw(hContact, ppro->m_szModuleName, "ProfileTS", 0)) {
- TCHAR date[64];
- DBTIMETOSTRINGT tts = {0};
- tts.szFormat = _T("d s");
- tts.szDest = date;
- tts.cbDest = sizeof(date);
- ::CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "ProfileTS", 0), (LPARAM)&tts);
- ::SetDlgItemText(hwndDlg, IDC_LASTPROFILECHANGE, date);
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_LASTPROFILECHANGE), TRUE);
- } else {
- ::SetDlgItemText(hwndDlg, IDC_LASTPROFILECHANGE, TranslateT("<not specified>"));
- ::EnableWindow(::GetDlgItem(hwndDlg, IDC_LASTPROFILECHANGE), FALSE);
- }
- }
- break;
- }
- break;
- }
- break;
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDCANCEL:
- SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
- break;
- }
- break;
- }
-
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- const unsigned long iPageId = 0;
- CSkypeProto *ppro = (CSkypeProto *)::GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- // gender
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)L"");
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)::TranslateT("Male"));
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_GENDER), CB_ADDSTRING, 0, (LPARAM)::TranslateT("Female"));
-
- BYTE b = ::db_get_b(NULL, ppro->m_szModuleName, "Gender", 0);
- switch (b)
- {
- case 0:
- ::SetDlgItemText(hwndDlg, IDC_GENDER, _T(""));
- break;
- case 'M':
- ::SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Male"));
- break;
- case 'F':
- SetDlgItemText(hwndDlg, IDC_GENDER, TranslateT("Female"));
- break;
- }
-
- // birthday
- wchar_t date[5];
-
- for (int i = 1; i < 32; i++)
- {
- ::mir_sntprintf(date, 3, L"%02d", i);
- ::SendMessage(GetDlgItem(hwndDlg, IDC_BIRTH_DAY), CB_ADDSTRING, 0, (LPARAM)date);
- }
- BYTE bday = ::db_get_b(NULL, ppro->m_szModuleName, "BirthDay", 0);
- if (bday > 0 && bday < 32)
- {
- ::mir_sntprintf(date, 3, L"%02d", bday);
- ::SetDlgItemText(hwndDlg, IDC_BIRTH_DAY, date);
- }
-
- for (int i = 1; i < 13; i++)
- {
- ::mir_sntprintf(date, 3, L"%02d", i);
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_BIRTH_MONTH), CB_ADDSTRING, 0, (LPARAM)date);
- }
- BYTE bmon = ::db_get_b(NULL, ppro->m_szModuleName, "BirthMonth", 0);
- if (bmon > 0 && bmon < 13)
- {
- ::mir_sntprintf(date, 3, L"%02d", bmon);
- ::SetDlgItemText(hwndDlg, IDC_BIRTH_MONTH, date);
- }
- SYSTEMTIME sToday = {0};
- ::GetLocalTime(&sToday);
- // ages from 10 to 50 is need more?
- for (WORD i = sToday.wYear - 50; i < sToday.wYear - 10; i++)
- {
- ::_itow(i, date, 10);
- ::SendMessage(::GetDlgItem(hwndDlg, IDC_BIRTH_YEAR), CB_ADDSTRING, 0, (LPARAM)date);
- }
- WORD byear = ::db_get_w(NULL, ppro->m_szModuleName, "BirthYear", 0);
- if (byear > 1900 && bmon < 2214)
- ::SetDlgItemInt(hwndDlg, IDC_BIRTH_YEAR, byear, false);
-
- // language
- int i = 0;
- ptrW lang( ::db_get_wsa(NULL, ppro->m_szModuleName, "Language1"));
- for (auto it = CSkypeProto::languages.begin(); it != CSkypeProto::languages.end(); ++it)
- {
- ::SendMessage(
- ::GetDlgItem(hwndDlg, IDC_LANGUAGE),
- CB_ADDSTRING,
- 0,
- (LPARAM)::TranslateTS(it->second.c_str()));
-
- ::SendMessage(
- ::GetDlgItem(hwndDlg, IDC_LANGUAGE),
- CB_SETITEMDATA,
- i,
- (LPARAM)&it->first);
-
- if (lang && it->second.compare(lang) == 0)
- ::SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_SETCURSEL, i, 0);
- i++;
- }
-
- // nick
- DBVARIANT dbv;
- if ( !ppro->getTString("Nick", &dbv))
- {
- ::SetDlgItemText(hwndDlg, IDC_FULLNAME, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_FULLNAME, _T(""));
-
- // homepage
- if ( !ppro->getTString("Homepage", &dbv))
- {
- ::SetDlgItemText(hwndDlg, IDC_HOMEPAGE, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_HOMEPAGE, _T(""));
-
- // about
- if ( !ppro->getTString("About", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_ABOUT, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_ABOUT, _T(""));
-
- // mood
- if ( !ppro->getTString("XStatusMsg", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_MOOD, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_MOOD, _T(""));
- }
- break;
-
- case WM_COMMAND:
- if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
- (((HWND)lParam == GetDlgItem(hwndDlg, IDC_GENDER) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_DAY) ||
- (HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_MONTH) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_BIRTH_YEAR) ||
- (HWND)lParam == GetDlgItem(hwndDlg, IDC_LANGUAGE)) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
- {
- ppro->NeedUpdate = 1;
- ::SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0) {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_PARAMCHANGED:
- ::SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
- break;
- case PSN_APPLY:
- if (ppro->IsOnline() && ppro->NeedUpdate)
- ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
- else if ( !ppro->IsOnline())
- ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- const unsigned long iPageId = 1;
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- if (lParam) {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- DBVARIANT dbv;
- if ( !ppro->getTString("Cellular", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_MOBPHONE, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_MOBPHONE, _T(""));
-
- if ( !ppro->getTString("Phone", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_HOMEPHONE, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_HOMEPHONE, _T(""));
-
- if ( !ppro->getTString("CompanyPhone", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_OFFICEPHONE, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_OFFICEPHONE, _T(""));
-
- if ( !ppro->getTString("e-mail0", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_EMAIL1, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_EMAIL1, _T(""));
-
- if ( !ppro->getTString("e-mail1", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_EMAIL2, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_EMAIL2, _T(""));
-
- if ( !ppro->getTString("e-mail2", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_EMAIL3, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else
- ::SetDlgItemText(hwndDlg, IDC_EMAIL3, _T(""));
- }
- break;
-
- case WM_COMMAND:
- if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
- {
- ppro->NeedUpdate = 1;
- ::SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0) {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_PARAMCHANGED:
- ::SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
- break;
- case PSN_APPLY:
- if (ppro->IsOnline() && ppro->NeedUpdate)
- ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
- else if ( !ppro->IsOnline())
- ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- const unsigned long iPageId = 2;
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- if (lParam) {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- DBVARIANT dbv;
- if ( !ppro->getTString("City", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else ::SetDlgItemText(hwndDlg, IDC_CITY, _T(""));
-
- if ( !ppro->getTString("State", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_STATE, dbv.ptszVal);
- ::db_free(&dbv);
- }
- else ::SetDlgItemText(hwndDlg, IDC_STATE, _T(""));
-
- ptrW countr(::db_get_wsa(NULL, ppro->m_szModuleName, "Country"));
- for (int i = 0; i < g_cbCountries; i++)
- {
- if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0)
- {
- ptrT country( mir_a2t(g_countries[i].szName));
- int nItem = ::SendMessage(
- ::GetDlgItem(hwndDlg, IDC_COUNTRY),
- CB_ADDSTRING,
- 0,
- (LPARAM)::TranslateTS(country));
-
- ::SendMessage(
- ::GetDlgItem(hwndDlg, IDC_COUNTRY),
- CB_SETITEMDATA,
- nItem,
- (LPARAM)&g_countries[i].ISOcode);
-
- if (countr && ::wcscmp(country, countr) == 0)
- ::SendMessage(GetDlgItem(hwndDlg, IDC_COUNTRY), CB_SETCURSEL, nItem, 0);
- }
- }
-
- tmi.prepareList(lParam, NULL, ::GetDlgItem(hwndDlg, IDC_TIMEZONE), TZF_PLF_CB);
- HANDLE hTimeZone = tmi.createByContact(NULL, 0, 0);
- LPCTSTR TzDescr = tmi.getTzDescription(tmi.getTzName(hTimeZone));
- ::SetDlgItemText(hwndDlg, IDC_TIMEZONE, TzDescr);
- }
- break;
-
- case WM_COMMAND:
- if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
- (((HWND)lParam == GetDlgItem(hwndDlg, IDC_COUNTRY) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TIMEZONE)) &&
- (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
- {
- ppro->NeedUpdate = 1;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0) {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_PARAMCHANGED:
- SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
- break;
- case PSN_APPLY:
- if (ppro->IsOnline() && ppro->NeedUpdate)
- ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
- else if ( !ppro->IsOnline())
- ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK CSkypeProto::AccountSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- const unsigned long iPageId = 3;
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- if (lParam) {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- }
- break;
-
- case WM_COMMAND:
- if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE))
- {
- ppro->NeedUpdate = 1;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0) {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_PARAMCHANGED:
- SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY *)lParam)->lParam);
- break;
- case PSN_APPLY:
- if (ppro->IsOnline() && ppro->NeedUpdate)
- ppro->SaveOwnInfoToServer(hwndDlg, iPageId);
- else if ( !ppro->IsOnline())
- ppro->ShowNotification(::TranslateT("You are not currently connected to the Skype network. You must be online in order to update your information on the server."));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp deleted file mode 100644 index ba7ea1d311..0000000000 --- a/protocols/Skype/src/skype_events.cpp +++ /dev/null @@ -1,284 +0,0 @@ -#include "skype.h"
-
-int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
-{
- /*if (::ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- ::CreateServiceFunction(MODULE"/ParseSkypeURI", &CSkypeProto::ParseSkypeUri);
- ::AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype URI API"), g_hInstance, IDI_SKYPE, MODULE"/ParseSkypeURI", 0);
- }*/
-
- return 0;
-}
-
-int CSkypeProto::OnProtoModulesLoaded(WPARAM, LPARAM)
-{
- this->InitNetLib();
- this->InitChatModule();
- this->InitInstanceHookList();
-
- if (::ServiceExists(MS_BB_ADDBUTTON))
- {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
-
- bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.ptszTooltip = ::TranslateT("Invite contacts to conference");
- bbd.hIcon = CSkypeProto::GetSkinIconHandle("addContacts");
- bbd.dwButtonID = BBB_ID_CONF_INVITE;
- bbd.dwDefPos = 100 + bbd.dwButtonID;
- ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.ptszTooltip = ::TranslateT("Spawn conference");
- bbd.hIcon = CSkypeProto::GetSkinIconHandle("conference");
- bbd.dwButtonID = BBB_ID_CONF_SPAWN;
- bbd.dwDefPos = 100 + bbd.dwButtonID;
- ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
- this->HookProtoEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::OnSrmmWindowOpen);
- }
-
- return 0;
-}
-
-int CSkypeProto::OnPreShutdown(WPARAM, LPARAM)
-{
- if (::ServiceExists(MS_BB_REMOVEBUTTON))
- {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
-
- bbd.dwButtonID = BBB_ID_CONF_INVITE;
- ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
-
- bbd.dwButtonID = BBB_ID_CONF_SPAWN;
- ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
- }
-
- this->SetStatus(ID_STATUS_OFFLINE);
-
- this->UninitNetLib();
-
- return 0;
-}
-
-int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if (hContact)
- {
- if (this->isChatRoom(hContact))
- {
- this->OnLeaveChat(wParam, 0);
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (cid != NULL)
- {
- ConversationRef conversation;
- if (this->GetConversationByIdentity((char *)_T2A(cid), conversation))
- conversation->Delete();
- }
- }
- else
- this->RevokeAuth(wParam, lParam);
- }
-
- return 0;
-}
-
-INT_PTR __cdecl CSkypeProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam)
-{
- return (int)::CreateDialogParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_ACCMGR),
- (HWND)lParam,
- &CSkypeProto::SkypeMainOptionsProc,
- (LPARAM)this);
-}
-
-int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
-{
- char *title = ::mir_t2a(this->m_tszUserName);
-
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.hInstance = g_hInstance;
- odp.pszTitle = title;
- odp.dwInitParam = LPARAM(this);
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszGroup = LPGEN("Network");
-
- odp.pszTab = LPGEN("Account");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
- odp.pfnDlgProc = CSkypeProto::SkypeMainOptionsProc;
- ::Options_AddPage(wParam, &odp);
-
- odp.pszTab = LPGEN("Blocked contacts");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BLOCKED);
- odp.pfnDlgProc = CSkypeProto::SkypeBlockedOptionsProc;
- ::Options_AddPage(wParam, &odp);
-
- odp.pszTab = LPGEN("Privacy");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PRIVACY);
- odp.pfnDlgProc = CSkypeProto::SkypePrivacyOptionsProc;
- ::Options_AddPage(wParam, &odp);
-
- ::mir_free(title);
- return 0;
-}
-
-int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
-{
- if ((!this->IsProtoContact((MCONTACT)lParam)) && lParam)
- return 0;
-
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
- odp.dwInitParam = LPARAM(this);
- odp.position = -1900000000;
- odp.ptszTitle = this->m_tszUserName;
-
- MCONTACT hContact = (MCONTACT)lParam;
- if (hContact) {
- char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
- if (szProto != NULL && !strcmp(szProto, m_szModuleName)) {
- odp.pfnDlgProc = SkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SKYPE);
- UserInfo_AddPage(wParam, &odp);
- }
- }
- else {
- NeedUpdate = 0;
- odp.pfnDlgProc = ContactSkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_CONTACT);
- odp.ptszTab = LPGENT("Contacts");
- UserInfo_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = HomeSkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_HOME);
- odp.ptszTab = LPGENT("Home");
- UserInfo_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = PersonalSkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_PERSONAL);
- odp.ptszTab = LPGENT("General");
- UserInfo_AddPage(wParam, &odp);
-
- odp.pfnDlgProc = AccountSkypeDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_ACCOUNT);
- odp.ptszTab = LPGENT("Skype account");
- UserInfo_AddPage(wParam, &odp);
- }
- return 0;
-}
-
-int __cdecl CSkypeProto::OnSrmmWindowOpen(WPARAM, LPARAM lParam)
-{
- MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
- if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
- {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
- bbd.bbbFlags = (!::strcmp(::GetContactProto(ev->hContact), this->m_szModuleName)) ? 0 : BBSF_HIDDEN | BBSF_DISABLED;
-
- bbd.dwButtonID = BBB_ID_CONF_INVITE;
- ::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
-
- bbd.dwButtonID = BBB_ID_CONF_SPAWN;
- ::CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
- }
- return 0;
-}
-
-int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
-
- switch (cbcd->dwButtonId)
- {
- case BBB_ID_CONF_INVITE:
- if (this->IsOnline() && this->isChatRoom(hContact))
- this->ChatRoomInvite(hContact);
- break;
-
- case BBB_ID_CONF_SPAWN:
- if (this->IsOnline() && !this->isChatRoom(hContact))
- {
- SEStringList targets;
- ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- targets.append((char *)_T2A(sid));
-
- ConversationRef conversation, conference;
- this->GetConversationByParticipants(targets, conversation);
-
- StringList invitedContacts(sid);
- ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
-
- if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_CREATE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- {
- for (size_t i = 0; i < param->invitedContacts.size(); i++)
- {
- SEString contact(_T2A(param->invitedContacts[i]));
- if ( !targets.contains(contact))
- targets.append(contact);
- }
- conversation->SpawnConference(targets, conference);
- }
- }
- break;
- }
-
- return 1;
-}
-
-void CSkypeProto::OnMessage(
- const MessageRef & message,
- const bool & changesInboxTimestamp,
- const MessageRef & supersedesHistoryMessage,
- const ConversationRef & conversation)
-{
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- switch (messageType)
- {
- case CMessage::POSTED_EMOTE:
- case CMessage::POSTED_TEXT:
- case CMessage::STARTED_LIVESESSION:
- case CMessage::ENDED_LIVESESSION:
- {
- CConversation::TYPE type;
- conversation->GetPropType(type);
- if (type == 0 || type == CConversation::DIALOG)
- this->OnMessageEvent(conversation, message);
- else
- this->OnChatEvent(conversation, message);
- }
- break;
-
- case CMessage::ADDED_CONSUMERS:
- case CMessage::RETIRED:
- case CMessage::RETIRED_OTHERS:
- case CMessage::SPAWNED_CONFERENCE:
- this->OnChatEvent(conversation, message);
- break;
-
- case CMessage::POSTED_FILES:
- this->OnFileEvent(conversation, message);
- break;
-
- case CMessage::POSTED_CONTACTS:
- this->OnContactsEvent(conversation, message);
- break;
-
- //case CMessage::REQUESTED_AUTH:
- // break;
-
- //case CMessage::GRANTED_AUTH:
- // break;
-
- //case CMessage::BLOCKED:
- // break;
- }
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_hooks.cpp b/protocols/Skype/src/skype_hooks.cpp deleted file mode 100644 index 13dc08c95b..0000000000 --- a/protocols/Skype/src/skype_hooks.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "skype.h"
-
-void CSkypeProto::InitHookList()
-{
- ::HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded);
- ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
-}
-
-void CSkypeProto::InitInstanceHookList()
-{
- this->HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
- this->HookProtoEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit);
-
- this->HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnMessagePreCreate);
-
- this->HookProtoEvent(ME_MSG_BUTTONPRESSED, &CSkypeProto::OnTabSRMMButtonPressed);
-}
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp deleted file mode 100644 index 5822cf2b37..0000000000 --- a/protocols/Skype/src/skype_icons.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "skype.h"
-
-_tag_iconList CSkypeProto::IconList[] =
-{
- { LPGENT("Protocol icon"), "main", IDI_SKYPE },
-
- { LPGENT("Call"), "call", IDI_CALL },
- { LPGENT("Invite to conference"), "addContacts", IDI_ADD_CONTACTS },
- { LPGENT("Conference"), "conference", IDI_CONFERENCE },
- { LPGENT("Send contact"), "sendContacts", IDI_SEND_CONTACTS },
- { LPGENT("Contact"), "contact", IDI_CONTACT },
- { LPGENT("Delete"), "delete", IDI_DELETE },
- { LPGENT("Block"), "block", IDI_BLOCK },
-};
-
-void CSkypeProto::InitIcons()
-{
- wchar_t szFile[MAX_PATH];
- ::GetModuleFileName(g_hInstance, szFile, MAX_PATH);
-
- char szSettingName[100];
- wchar_t szSectionName[100];
-
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.ptszSection = szSectionName;
-
- ::mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
- for (int i = 0; i < SIZEOF(CSkypeProto::IconList); i++)
- {
- ::mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, CSkypeProto::IconList[i].Name);
-
- sid.ptszDescription = CSkypeProto::IconList[i].Description;
- sid.iDefaultIndex = -CSkypeProto::IconList[i].IconId;
- CSkypeProto::IconList[i].Handle = ::Skin_AddIcon(&sid);
- }
-}
-
-HANDLE CSkypeProto::GetIconHandle(const char* name)
-{
- for (size_t i = 0; i < SIZEOF(CSkypeProto::IconList); i++)
- {
- if (::stricmp(CSkypeProto::IconList[i].Name, name) == 0)
- return CSkypeProto::IconList[i].Handle;
- }
- return 0;
-}
-
-HANDLE CSkypeProto::GetSkinIconHandle(const char* name)
-{
- char iconName[100];
- ::mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name);
- HANDLE hIcon = ::Skin_GetIconHandle(iconName);
- if ( !hIcon)
- hIcon = CSkypeProto::GetIconHandle(name);
- return hIcon;
-}
-
-void CSkypeProto::UninitIcons()
-{
- for (size_t i = 0; i < SIZEOF(CSkypeProto::IconList); i++)
- ::Skin_RemoveIcon(CSkypeProto::IconList[i].Name);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_ignore_list.cpp b/protocols/Skype/src/skype_ignore_list.cpp deleted file mode 100644 index b37f6787e0..0000000000 --- a/protocols/Skype/src/skype_ignore_list.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#include "skype.h"
-#include "skype_chat.h"
-
-int CSkypeProto::IgnoreCommand(WPARAM wParam, LPARAM)
-{
- CContact::Ref contact;
- HANDLE hContact = (HANDLE)wParam;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- //bool state = ::CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_ALL);
- bool state = ::db_get_b(hContact, this->m_szModuleName, "Ignore", 0) > 0;
- if (contact->SetBlocked(!state))
- {
- //::CallService(!state ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, wParam, IGNOREEVENT_ALL);
- ::db_set_b(hContact, this->m_szModuleName, "Ignore", (int)!state);
- }
- }
-
- return 0;
-}
-
-int CSkypeProto::BlockCommand(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact = (HANDLE)wParam;
- if (hContact)
- {
- this->IgnoreCommand(wParam, lParam);
-
- ::db_set_b(hContact, "CList", "Hidden", 1);
- }
-
- return 0;
-}
-
-INT_PTR CSkypeProto::OpenIgnoreListCommand(WPARAM, LPARAM)
-{
- ::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_IGNORE_LIST), NULL, CSkypeProto::IgnoreListWndProc, (LPARAM)this);
-
- return 0;
-}
-
-static WNDPROC oldWndProc = NULL;
-
-static LRESULT CALLBACK IgnoreListSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (msg == WM_LBUTTONDOWN)
- {
- LVHITTESTINFO hi;
- hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
- ListView_SubItemHitTest(hwnd, &hi);
- if (hi.iSubItem == 1)
- {
- LVITEM lvi = {0};
- lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_GROUPID;
- lvi.stateMask = -1;
- lvi.iItem = hi.iItem;
- if (ListView_GetItem(hwnd, &lvi))
- {
- if (lvi.iGroupId == 1)
- {
- CContact *contact = (CContact *)lvi.lParam;
-
- if (contact->SetBlocked(false))
- ListView_DeleteItem(hwnd, lvi.iItem);
- }
- /*else if (lvi.iGroupId == 2)
- {
- CConversation *convo = (CConversation *)lvi.lParam;
-
- if (convo->SetBlocked(false))
- ListView_DeleteItem(hwnd, lvi.iItem);
- }*/
- }
- }
- }
-
- return ::CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
-}
-
-int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name)
-{
- HICON icon = ::Skin_GetIconByHandle(::Skin_GetIconHandle(name));
- int res = ImageList_AddIcon(hIml, icon);
- ::Skin_ReleaseIcon(icon);
- return res;
-}
-
-INT_PTR CALLBACK CSkypeProto::IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = (CSkypeProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- if (lParam)
- {
- ppro = (CSkypeProto *)lParam;
- ::TranslateDialogDefault(hwndDlg);
-
- ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)::Skin_GetIcon("Skype_block", ICON_BIG));
- ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)::Skin_GetIcon("Skype_block"));
-
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
- { // IDC_BM_LIST setup
- oldWndProc = (WNDPROC)::SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)IgnoreListSubProc);
-
- HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
- ImageList_AddIconFromIconLib(hIml, "Skype_contact");
- ImageList_AddIconFromIconLib(hIml, "Skype_delete");
- ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
-
- ///
- LVCOLUMN lvc = {0};
- lvc.mask = LVCF_WIDTH | LVCF_TEXT;
-
- //lvc.fmt = LVCFMT_JUSTIFYMASK;
- lvc.pszText = TranslateT("Name");
- lvc.cx = 220; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
-
- //lvc.fmt = LVCFMT_RIGHT;
- lvc.pszText = L"";
- lvc.cx = 32 - GetSystemMetrics(SM_CXVSCROLL); // width of column in pixels
- ListView_InsertColumn(hwndList, 1, &lvc);
-
- ///
- LVGROUP lvg;
- lvg.cbSize = sizeof(LVGROUP);
- lvg.mask = LVGF_HEADER | LVGF_GROUPID;
-
- lvg.pszHeader = ::TranslateT("Contacts");
- lvg.iGroupId = 1;
- ListView_InsertGroup(hwndList, 0, &lvg);
-
- lvg.pszHeader = ::TranslateT("Conferences");
- lvg.iGroupId = 2;
- ListView_InsertGroup(hwndList, 0, &lvg);
-
- ListView_EnableGroupView(hwndList, TRUE);
-
- ::SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
-
- if ( !ppro->IsOnline())
- ::EnableWindow(hwndList, FALSE);
- }
-
- SEString data;
- ContactGroupRef blockedList;
- ppro->GetHardwiredContactGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, blockedList);
-
- ContactRefs contacts;
- blockedList->GetContacts(contacts);
- for (size_t i = 0; i < contacts.size(); i++)
- {
- auto contact = contacts[i];
-
- contact->GetPropDisplayname(data);
- ptrW name = ::mir_utf8decodeW(data);
-
- LVITEM lvi = {0};
- lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- lvi.iItem = (int)i;
- lvi.iGroupId = 1;
- lvi.iImage = 0;
- lvi.lParam = (LPARAM)contact.fetch();
- lvi.pszText = name;
- int iRow = ListView_InsertItem(hwndList, &lvi);
-
- if (iRow != -1)
- {
- lvi.iItem = iRow;
- lvi.mask = LVIF_IMAGE;
- lvi.iSubItem = 1;
- lvi.iImage = 1;
- ListView_SetItem(hwndList, &lvi);
- }
- }
-
- ConversationRefs conversations;
- blockedList->GetConversations(conversations);
- for (size_t i = 0; i < conversations.size(); i++)
- {
- auto conversation = conversations[i];
-
- uint type = conversation->GetUintProp(Conversation::P_TYPE);
- if (type != Conversation::CONFERENCE)
- continue;
-
- conversation->GetPropDisplayname(data);
- ptrW name = ::mir_utf8decodeW(data);
-
- LVITEM lvi = {0};
- lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- lvi.iItem = (int)i;
- lvi.iGroupId = 2;
- lvi.iImage = 0;
- lvi.lParam = (LPARAM)conversation.fetch();
- lvi.pszText = name;
- int iRow = ListView_InsertItem(hwndList, &lvi);
-
- if (iRow != -1)
- {
- lvi.iItem = iRow;
- lvi.mask = LVIF_IMAGE;
- lvi.iSubItem = 1;
- lvi.iImage = 1;
- ListView_SetItem(hwndList, &lvi);
- }
- }
-
- ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "IgnoreListWindow");
- }
- break;
-
- case WM_NOTIFY:
- switch(LOWORD(wParam))
- {
- case IDC_BM_LIST:
- if (((LPNMHDR)lParam)->code == NM_DBLCLK)
- {
- HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
- int iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED);
- if (iItem < 0) break;
- LVITEM lvi = {0};
- lvi.mask = LVIF_PARAM | LVIF_GROUPID;
- lvi.stateMask = -1;
- lvi.iItem = iItem;
- if (ListView_GetItem(hwndList, &lvi))
- {
- SEString data;
- if (lvi.iGroupId == 1)
- {
- CContact *contact = (CContact *)lvi.lParam;
-
- contact->GetIdentity(data);
- ptrW sid(::mir_utf8decodeW(data));
- ::CallService(MS_MSG_SENDMESSAGE, (WPARAM)ppro->GetContactBySid(sid), 0);
- }
- /*else if (lvi.iGroupId == 2)
- {
- CConversation *conversation = (CConversation *)lvi.lParam;
-
- conversation->GetPropIdentity(data);
- ptrW cid(::mir_utf8decodeW(data));
- CSkypeProto::ReplaceSpecialChars(cid);
- }*/
- }
- }
- }
- break;
-
- case WM_COMMAND:
- if (HIWORD( wParam ) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDCANCEL:
- ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "IgnoreListWindow");
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- ::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- ::DestroyWindow(hwndDlg);
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp deleted file mode 100644 index 66b8447fbc..0000000000 --- a/protocols/Skype/src/skype_instances.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "skype.h"
-
-LIST<CSkypeProto> CSkypeProto::instanceList(1, CSkypeProto::CompareProtos);
-
-int CSkypeProto::CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2)
-{
- return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
-}
-
-CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* userName)
-{
- if (CSkypeProto::instanceList.getCount() > 0)
- {
- CSkypeProto::ShowNotification(
- ::TranslateT("Skype protocol plugin only permits you to login to one account at a time. Adding multiple accounts is prohibited in the license agreement and standard distribution terms of SkypeKit."),
- MB_ICONERROR);
- return NULL;
- }
-
- CSkypeProto *ppro = new CSkypeProto(protoName, userName);
-
- VARST profilename( _T("%miranda_profilename%"));
-
- if ( !ppro->StartSkypeRuntime((TCHAR *)profilename))
- {
- CSkypeProto::ShowNotification(::TranslateT("Did not unpack SkypeKit.exe."), MB_ICONERROR);
- return NULL;
- }
-
- char *keyPair = ppro->LoadKeyPair();
- if (keyPair == NULL)
- {
- CSkypeProto::ShowNotification(::TranslateT("Initialization key corrupted or not valid."), MB_ICONERROR);
- return NULL;
- }
-
- TransportInterface::Status status = ppro->init(keyPair, "127.0.0.1", ppro->skypeKitPort, 0, 1);
- if (status != TransportInterface::OK)
- {
- wchar_t message[256];
- ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("SkypeKit did not initialize (%d)."), status);
- CSkypeProto::ShowNotification(message, MB_ICONERROR);
- return NULL;
- }
-
- if ( !ppro->start())
- {
- CSkypeProto::ShowNotification(TranslateT("SkypeKit did not start."), MB_ICONERROR);
- return NULL;
- }
-
- ::mir_free(keyPair);
-
- CSkypeProto::instanceList.insert(ppro);
-
- return ppro;
-}
-
-int CSkypeProto::UninitSkypeProto(CSkypeProto* ppro)
-{
- ppro->stop();
-
- ppro->StopSkypeRuntime();
-
- CSkypeProto::instanceList.remove(ppro);
- delete ppro;
-
- return 0;
-}
-
-void CSkypeProto::UninitInstances()
-{
- instanceList.destroy();
-}
-
-CSkypeProto* CSkypeProto::GetContactInstance(MCONTACT hContact)
-{
- char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
-
- if (proto == NULL)
- return NULL;
-
- for (int i = 0; i < CSkypeProto::instanceList.getCount(); i++)
- if ( !::strcmp(proto, CSkypeProto::instanceList[i]->m_szModuleName))
- return CSkypeProto::instanceList[i];
-
- return NULL;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp deleted file mode 100644 index a051d24911..0000000000 --- a/protocols/Skype/src/skype_menus.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include "skype.h"
-
-HANDLE CSkypeProto::hChooserMenu;
-HGENMENU CSkypeProto::contactMenuItems[CMI_MAX];
-
-INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam)
-{
- if (lParam)
- *(void**)lParam = (void*)wParam;
-
- return 0;
-}
-
-int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if ( !hContact)
- return 0;
-
- if ( !this->IsOnline() || ::lstrcmpA(::GetContactProto(hContact), m_szModuleName))
- return 0;
-
- if ( !this->isChatRoom(hContact))
- {
- bool ctrlPressed = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
-
- bool authNeed = this->getByte(hContact, "Auth", 0) > 0;
- bool grantNeed = this->getByte(hContact, "Grant", 0) > 0;
-
- ::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed);
- ::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed);
- ::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || (!grantNeed && !authNeed));
- ::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_HISTORY], TRUE);
-
- {
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- ContactRef contact;
- this->GetContact(sid, contact);
-
- bool isBlocked = false;
- contact->IsMemberOfHardwiredGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, isBlocked);
-
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.cbSize = sizeof(CLISTMENUITEM);
- clmi.flags = CMIM_FLAGS;
- if (isBlocked)
- {
- clmi.flags |= CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- clmi.icolibItem = CSkypeProto::GetSkinIconHandle("contact");
- clmi.ptszName = LPGENT("Unblock this person...");
- }
- else
- {
- clmi.flags |= CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- clmi.icolibItem = CSkypeProto::GetSkinIconHandle("block");
- clmi.ptszName = LPGENT("Block this person...");
- }
- ::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)CSkypeProto::contactMenuItems[CMI_BLOCK], (LPARAM)&clmi);
- }
- }
-
- return 0;
-}
-
-template<int (__cdecl CSkypeProto::*Service)(WPARAM, LPARAM)>
-INT_PTR GlobalService(WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = CSkypeProto::GetContactInstance((MCONTACT)wParam);
- return ppro ? (ppro->*Service)(wParam, lParam) : 0;
-}
-
-int CSkypeProto::RequestAuth(WPARAM wParam, LPARAM lParam)
-{
- return this->AuthRequest((MCONTACT)wParam, LPGENT("Hi! I'd like to add you to my contact list"));
-}
-
-int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam)
-{
- CContact::Ref contact;
- MCONTACT hContact = (MCONTACT)wParam;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- if (contact->SetBuddyStatus(true))
- {
- this->delSetting(hContact, "Auth");
- this->delSetting(hContact, "Grant");
- }
- }
-
- return 0;
-}
-
-int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam)
-{
- CContact::Ref contact;
- MCONTACT hContact = (MCONTACT)wParam;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- if (contact->SetBuddyStatus(false))
- this->setByte(hContact, "Grant", 1);
- this->contactList.remove_val(contact);
- }
-
- return 0;
-}
-
-int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
-{
- for (int i = 0; i < SIZEOF(CSkypeProto::contactMenuItems); i++)
- ::Menu_ShowItem(CSkypeProto::contactMenuItems[i], false);
-
- CSkypeProto* ppro = CSkypeProto::GetContactInstance((MCONTACT)wParam);
- return (ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
-}
-
-void CSkypeProto::InitMenus()
-{
- hChooserMenu = MO_CreateMenuObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
-
- //////////////////////////////////////////////////////////////////////////////////////
- // Contact menu initialization
-
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(CLISTMENUITEM);
- mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE;
-
- // "Request authorization"
- mi.pszService = MODULE"/RequestAuth";
- mi.ptszName = LPGENT("Request authorization");
- mi.position = -201001000 + CMI_AUTH_REQUEST;
- mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
- CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST] = ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::RequestAuth>);
-
- // "Grant authorization"
- mi.pszService = MODULE"/GrantAuth";
- mi.ptszName = LPGENT("Grant authorization");
- mi.position = -201001000 + CMI_AUTH_GRANT;
- mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_GRANT);
- CSkypeProto::contactMenuItems[CMI_AUTH_GRANT] = ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GrantAuth>);
-
- // "Revoke authorization"
- mi.pszService = MODULE"/RevokeAuth";
- mi.ptszName = LPGENT("Revoke authorization");
- mi.position = -201001000 + CMI_AUTH_REVOKE;
- mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_REVOKE);
- CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE] = ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::RevokeAuth>);
-
- // "Block"
- mi.pszService = MODULE"/Block";
- mi.ptszName = LPGENT("Block this person...");
- mi.position = -200001000 + CMI_BLOCK;
- mi.icolibItem = CSkypeProto::GetSkinIconHandle("block");
- CSkypeProto::contactMenuItems[CMI_BLOCK] = ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockCommand>);
-
- mi.pszService = MODULE"/SyncHistory";
- mi.ptszName = LPGENT("View old messages...");
- mi.flags = CMIF_TCHAR | CMIF_ROOTPOPUP;
- mi.position = -200001000 + CMI_HISTORY;
- mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
- CSkypeProto::contactMenuItems[CMI_HISTORY] = ::Menu_AddContactMenuItem(&mi);
-
- mi.flags &= ~CMIF_ROOTPOPUP;
-
- mi.pszService = MODULE"/SyncHistoryDay";
- mi.ptszName = LPGENT("for last day");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 100;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastDayHistoryCommand>);
-
- mi.pszService = MODULE"/SyncHistoryWeek";
- mi.ptszName = LPGENT("for last week");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 1001;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastWeekHistoryCommand>);
-
- mi.pszService = MODULE"/SyncHistoryMonth";
- mi.ptszName = LPGENT("for last month");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 102;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastMonthHistoryCommand>);
-
- mi.pszService = MODULE"/SyncHistory3Month";
- mi.ptszName = LPGENT("for last 3 month");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 103;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLast3MonthHistoryCommand>);
-
- mi.pszService = MODULE"/SyncHistoryYear";
- mi.ptszName = LPGENT("for last year");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 104;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastYearHistoryCommand>);
-
- mi.pszService = MODULE"/SyncHistoryAllTime";
- mi.ptszName = LPGENT("for all time");
- mi.flags |= CMIF_CHILDPOPUP;
- mi.position = -200001000 + CMI_HISTORY + 105;
- mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
- ::Menu_AddContactMenuItem(&mi);
- ::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncAllTimeHistoryCommand>);
-}
-
-void CSkypeProto::UninitMenus()
-{
-}
-
-void CSkypeProto::OnInitStatusMenu()
-{
- char text[ 200 ];
- strcpy(text, m_szModuleName);
- char* tDest = text + strlen(text);
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.pszService = text;
-
- HGENMENU hSkypeRoot = ::MO_GetProtoRootMenu(m_szModuleName);
- if (!hSkypeRoot)
- {
- mi.ptszName = m_tszUserName;
- mi.position = -1999901006;
- mi.hParentMenu = HGENMENU_ROOT;
- mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.icolibItem = CSkypeProto::GetSkinIconHandle("main");
- hSkypeRoot = m_hMenuRoot = ::Menu_AddProtoMenuItem(&mi);
- }
- else
- {
- if (m_hMenuRoot)
- ::CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)m_hMenuRoot, 0);
- m_hMenuRoot = NULL;
- }
-
- mi.hParentMenu = hSkypeRoot;
- mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
-
- // Invite Command
- ::strcpy(tDest, "/CreateChatRoom");
- this->CreateProtoService(tDest, &CSkypeProto::CreateChatRoomCommand);
- mi.ptszName = LPGENT("Create conference");
- mi.position = 200000 + SMI_CHAT_CREATE;
- mi.icolibItem = CSkypeProto::GetSkinIconHandle("conference");
- ::Menu_AddProtoMenuItem(&mi);
-
- // Invite Command
- ::strcpy(tDest, "/BlockedeList");
- this->CreateProtoService(tDest, &CSkypeProto::OpenBlockedListCommand);
- mi.ptszName = LPGENT("Blocked contacts");
- mi.position = 200000 + SMI_IGNORE_LIST;
- mi.icolibItem = CSkypeProto::GetSkinIconHandle("block");
- ::Menu_AddProtoMenuItem(&mi);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp deleted file mode 100644 index b212959f98..0000000000 --- a/protocols/Skype/src/skype_messages.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include "skype.h"
-
-int CSkypeProto::OnMessagePreCreate(WPARAM, LPARAM lParam)
-{
- MessageWindowEvent *evt = (MessageWindowEvent *)lParam;
- if ( strcmp(GetContactProto(evt->hContact), this->m_szModuleName))
- return 0;
-
- MessageRef message(evt->seq);
- SEBinary guid;
- if (message->GetPropGuid(guid))
- {
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- if (messageType == CMessage::POSTED_TEXT)
- {
- evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, evt->dbei->cbBlob + guid.size());
- ::memcpy((char *)&evt->dbei->pBlob[evt->dbei->cbBlob], guid.data(), guid.size());
- evt->dbei->cbBlob += (DWORD)guid.size();
- }
- else if (messageType == CMessage::POSTED_EMOTE)
- {
- evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, evt->dbei->cbBlob + guid.size() - 4);
- ::memcpy((char *)&evt->dbei->pBlob[0], (char *)&evt->dbei->pBlob[4], evt->dbei->cbBlob - 4);
- ::memcpy((char *)&evt->dbei->pBlob[evt->dbei->cbBlob - 4], guid.data(), guid.size());
- evt->dbei->cbBlob += (DWORD)guid.size() - 4;
-
- evt->dbei->eventType = SKYPE_DB_EVENT_TYPE_EMOTE;
- }
- }
-
- return 1;
-}
-
-void CSkypeProto::OnMessageReceived(const ConversationRef &conversation, const MessageRef &message)
-{
- SEString data;
-
- Message::TYPE messageType;
- message->GetPropType(messageType);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
-
- message->GetPropBodyXml(data);
- ptrA text( CSkypeProto::RemoveHtml(data));
-
- ContactRef author;
- message->GetPropAuthor(data);
- this->GetContact(data, author);
-
- MCONTACT hContact = this->AddContact(author, true);
- this->UserIsTyping(hContact, PROTOTYPE_SELFTYPING_OFF);
-
- SEBinary guid;
- message->GetPropGuid(guid);
- ReadMessageParam param = { guid, messageType };
-
- //if (status != CMessage::UNCONSUMED_NORMAL)
- if (this->IsMessageInDB(hContact, timestamp, guid))
- return;
-
- DWORD flags = PREF_UTF;
- if (status != CMessage::UNCONSUMED_NORMAL)
- flags |= PREF_CREATEREAD;
-
- PROTORECVEVENT recv = { 0 };
- recv.flags = flags;
- recv.lParam = (LPARAM)¶m;
- recv.timestamp = timestamp;
- recv.szMessage = ::mir_strdup(text);
- ::ProtoChainRecvMsg(hContact, &recv);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CSkypeProto::OnMessageSent(const ConversationRef &conversation, const MessageRef &message)
-{
- SEString data;
-
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- CMessage::SENDING_STATUS sstatus;
- message->GetPropSendingStatus(sstatus);
-
- CMessage::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
-
- message->GetPropBodyXml(data);
- ptrA text( CSkypeProto::RemoveHtml(data));
-
- CParticipant::Refs participants;
- conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
- participants[0]->GetPropIdentity(data);
-
- ptrW sid(::mir_utf8decodeW(data));
-
- MCONTACT hContact = this->GetContactBySid(sid);
- this->SendBroadcast(
- hContact,
- ACKTYPE_MESSAGE,
- sstatus == CMessage::FAILED_TO_SEND ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
- (HANDLE)message->getOID(), 0);
-
- SEBinary guid;
- message->GetPropGuid(guid);
-
- this->RaiseMessageSentEvent(
- hContact,
- timestamp,
- guid,
- text,
- status == CMessage::UNCONSUMED_NORMAL);
-}
-
-void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const MessageRef &message)
-{
- CMessage::TYPE messageType;
- message->GetPropType(messageType);
-
- switch (messageType)
- {
- case CMessage::POSTED_EMOTE:
- case CMessage::POSTED_TEXT:
- {
- SEString author;
- message->GetPropAuthor(author);
-
- if (::wcsicmp(ptrW(::mir_utf8decodeW(author)), this->login) == 0)
- this->OnMessageSent(conversation, message);
- else
- this->OnMessageReceived(conversation, message);
- }
- break;
-
- case CMessage::STARTED_LIVESESSION:
- {
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::UNCONSUMED_NORMAL)
- break;
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- SEString identity;
- message->GetPropAuthor(identity);
-
- CContact::Ref author;
- this->GetContact(identity, author);
-
- MCONTACT hContact = this->AddContact(author);
-
- char *message = ::mir_utf8encode(::Translate("Incoming call started"));
-
- this->AddDBEvent(
- hContact,
- SKYPE_DB_EVENT_TYPE_CALL,
- timestamp,
- DBEF_UTF,
- (DWORD)::strlen(message) + 1,
- (PBYTE)message);
- //temp popup
- /*TCHAR popuptext[MAX_PATH];
- mir_sntprintf(popuptext, SIZEOF(popuptext), TranslateT("Incoming call from %s. Use offical skype for calling."), ptrW(::mir_utf8decodeW(identity)));
- this->ShowNotification(popuptext);*/
- }
- break;
-
- case CMessage::ENDED_LIVESESSION:
- {
- Message::CONSUMPTION_STATUS status;
- message->GetPropConsumptionStatus(status);
- if (status != Message::UNCONSUMED_NORMAL)
- break;
-
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- SEString identity;
- message->GetPropAuthor(identity);
-
- CContact::Ref author;
- this->GetContact(identity, author);
-
- MCONTACT hContact = this->AddContact(author);
-
- char *message = ::mir_utf8encode(::Translate("Incoming call finished"));
-
- this->AddDBEvent(
- hContact,
- SKYPE_DB_EVENT_TYPE_CALL,
- timestamp,
- DBEF_UTF,
- (DWORD)::strlen(message) + 1,
- (PBYTE)message);
- }
- break;
- }
-}
-
-void CSkypeProto::SyncMessageHystory(const ConversationRef &conversation, const time_t timestamp)
-{
- if (conversation)
- {
- conversation->SetConsumedHorizon(timestamp);
- MessageRefs oldMessages, newMessages;
- conversation->GetLastMessages(oldMessages, newMessages, timestamp);
- for (size_t i = 0; i < oldMessages.size(); i++)
- this->OnMessageEvent(conversation, oldMessages[i]);
- for (size_t i = 0; i < newMessages.size(); i++)
- this->OnMessageEvent(conversation, newMessages[i]);
- conversation->SetConsumedHorizon(time(NULL));
- }
-}
-
-void CSkypeProto::SyncHistoryCommand(MCONTACT hContact, time_t timestamp)
-{
- if (hContact)
- {
- ptrW sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
-
- ConversationRef conversation;
- if ( !this->isChatRoom(hContact))
- {
- SEStringList target;
- target.append((char *)ptrA(::mir_utf8encodeW(sid)));
- this->GetConversationByParticipants(target, conversation);
- }
- else
- this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
-
- if (conversation)
- {
- this->SyncMessageHystory(conversation, timestamp);
- CSkypeProto::ShowNotification(TranslateT("history synchronization"), TranslateT("Done!"), MB_ICONINFORMATION, hContact);
- }
- }
-}
-
-int CSkypeProto::SyncLastDayHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- time_t timestamp = time(NULL);
- timestamp -= 60*60*24;
- this->SyncHistoryCommand((MCONTACT)wParam, timestamp);
- return 0;
-}
-
-int CSkypeProto::SyncLastWeekHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- time_t timestamp = time(NULL);
- timestamp -= 60*60*24*7;
- this->SyncHistoryCommand((MCONTACT)wParam, timestamp);
- return 0;
-}
-
-int CSkypeProto::SyncLastMonthHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- time_t timestamp = time(NULL);
- timestamp -= 60*60*24*30;
- this->SyncHistoryCommand((MCONTACT)wParam, timestamp);
- return 0;
-}
-
-int CSkypeProto::SyncLast3MonthHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- time_t timestamp = time(NULL);
- timestamp -= 60*60*24*90;
- this->SyncHistoryCommand((MCONTACT)wParam, timestamp);
- return 0;
-}
-
-int CSkypeProto::SyncLastYearHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- time_t timestamp = time(NULL);
- timestamp -= 60*60*24*365;
- this->SyncHistoryCommand((MCONTACT)wParam, timestamp);
- return 0;
-}
-
-int CSkypeProto::SyncAllTimeHistoryCommand(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- if (hContact)
- {
- ptrW sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
-
- ConversationRef conversation;
- if ( !this->isChatRoom(hContact))
- {
- SEStringList target;
- target.append((char *)ptrA(::mir_utf8encodeW(sid)));
- this->GetConversationByParticipants(target, conversation);
- }
- else
- this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
-
- if (conversation)
- {
- uint timestamp;
- conversation->GetPropCreationTimestamp(timestamp);
- this->SyncMessageHystory(conversation, timestamp);
- CSkypeProto::ShowNotification(TranslateT("history synchronization"), TranslateT("Done!"), MB_ICONINFORMATION, hContact);
- }
- }
- return 0;
-}
diff --git a/protocols/Skype/src/skype_netlib.cpp b/protocols/Skype/src/skype_netlib.cpp deleted file mode 100644 index 6a958d0217..0000000000 --- a/protocols/Skype/src/skype_netlib.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "skype.h"
-
-void CSkypeProto::InitNetLib()
-{
- wchar_t name[128];
- ::mir_sntprintf(name, SIZEOF(name), ::TranslateT("%s connection"), this->m_tszUserName);
-
- NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
- nlu.ptszDescriptiveName = name;
- nlu.szSettingsModule = this->m_szModuleName;
- this->m_hNetlibUser = (HANDLE)::CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
-
- this->debugLogW(L"Setting protocol/module name to '%s'", (TCHAR*)_A2T(m_szModuleName));
-}
-
-void CSkypeProto::UninitNetLib()
-{
- ::Netlib_CloseHandle(this->m_hNetlibUser);
- this->m_hNetlibUser = NULL;
-}
diff --git a/protocols/Skype/src/skype_own_info.cpp b/protocols/Skype/src/skype_own_info.cpp deleted file mode 100644 index f56178229a..0000000000 --- a/protocols/Skype/src/skype_own_info.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "skype.h"
-
-void __cdecl CSkypeProto::LoadOwnInfo(void *)
-{
- /*ptrW nick( ::db_get_wsa(NULL, this->m_szModuleName, "Nick"));
- if ( !nick)
- {
- SEString data;
- this->account->GetPropFullname(data);
-
- if (data.length() == 0)
- {
- this->account->GetPropSkypename(data);
- }
-
- nick = ::mir_utf8decodeW(data);
- ::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
- }*/
-
- this->UpdateProfile(this->account.fetch());
-}
-
-INT_PTR __cdecl CSkypeProto::SetMyNickName(WPARAM wParam, LPARAM lParam)
-{
- wchar_t *nick = (wParam & SMNN_UNICODE) ? ::mir_wstrdup((wchar_t *)lParam) : ::mir_a2t((char*) lParam);
-
- //::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
-
- if ( !this->IsOnline())
- return 0;
-
- this->account->SetStrProperty(Account::P_FULLNAME, (char *)ptrA(::mir_utf8encodeW(nick)));
-
- return 0;
-}
-
-void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
-{
- wchar_t text[2048];
-
- switch (iPage)
- {
- // Page 0: Personal
- case 0:
- {
- ::GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
- if (this->account->SetStrProperty(Account::P_FULLNAME, (char *)ptrA(::mir_utf8encodeW(text))))
- this->setTString("Nick", text);
-
- ::GetDlgItemText(hwndPage, IDC_MOOD, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_MOOD_TEXT, (char *)ptrA(::mir_utf8encodeW(text)));
-
- ::GetDlgItemText(hwndPage, IDC_ABOUT, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_ABOUT, (char *)ptrA(::mir_utf8encodeW(text)));
-
- ::GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_HOMEPAGE, (char *)ptrA(::mir_utf8encodeW(text)));
-
- this->account->SetIntProperty(
- Account::P_GENDER,
- ::SendMessage(::GetDlgItem(hwndPage, IDC_GENDER), CB_GETCURSEL, 0, 0));
-
- char day[3], month[3], year[5], date[9];
- ::GetDlgItemTextA(hwndPage, IDC_BIRTH_DAY, day, 3);
- ::GetDlgItemTextA(hwndPage, IDC_BIRTH_MONTH, month, 3);
- ::GetDlgItemTextA(hwndPage, IDC_BIRTH_YEAR, year, 5);
- ::mir_snprintf(date, 9, "%s%s%s", year, month, day);
- int value = atoi(date);
- this->account->SetIntProperty(Account::P_BIRTHDAY, value);
-
- int lang = ::SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETCURSEL, 0, 0);
- if (lang != -1) {
- std::wstring key = *(std::wstring *)SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETITEMDATA, lang, 0);
- this->account->SetStrProperty(
- Account::P_LANGUAGES,
- (char *)ptrA(::mir_utf8encodeW(key.c_str())));
- }
- }
- break;
-
- // Page 1: Contacts
- case 1:
- wchar_t emails[2048];
- ::GetDlgItemText(hwndPage, IDC_EMAIL1, emails, SIZEOF(emails));
- ::GetDlgItemText(hwndPage, IDC_EMAIL2, text, SIZEOF(text));
- if (::wcslen(text) > 0)
- {
- ::wcscat(emails, L" ");
- ::wcscat(emails, text);
- }
- ::GetDlgItemText(hwndPage, IDC_EMAIL3, text, SIZEOF(text));
- if (::wcslen(text) > 0)
- {
- ::wcscat(emails, L" ");
- ::wcscat(emails, text);
- }
- this->account->SetStrProperty(Account::P_EMAILS, (char *)ptrA(::mir_utf8encodeW(emails)));
-
- ::GetDlgItemText(hwndPage, IDC_MOBPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_MOBILE, (char *)ptrA(::mir_utf8encodeW(text)));
-
- ::GetDlgItemText(hwndPage, IDC_HOMEPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_HOME, (char *)ptrA(::mir_utf8encodeW(text)));
-
- ::GetDlgItemText(hwndPage, IDC_OFFICEPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_OFFICE, (char *)ptrA(::mir_utf8encodeW(text)));
-
- break;
-
- // Page 2: Home
- case 2:
- ::GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_CITY, (char *)ptrA(::mir_utf8encodeW(text)));
-
- ::GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PROVINCE, (char *)ptrA(::mir_utf8encodeW(text)));
-
- int i = ::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
- char *iso = (char *)::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETITEMDATA, i, 0);
- this->account->SetStrProperty(Account::P_COUNTRY, iso);
-
- HWND ctrl = ::GetDlgItem(hwndPage, IDC_TIMEZONE);
- i = ::SendMessage(ctrl, CB_GETCURSEL, 0, 0);
- HANDLE hTimeZone = (HANDLE)::SendMessage(ctrl, CB_GETITEMDATA, i, 0);
-
- SYSTEMTIME my_st, utc_ts;
- tmi.getTimeZoneTime(hTimeZone, &my_st);
- tmi.getTimeZoneTime(UTC_TIME_HANDLE, &utc_ts);
-
- uint diff_to_UTC_in_seconds = (my_st.wHour - utc_ts.wHour) * 3600 + (my_st.wMinute - utc_ts.wMinute) * 60;
- uint timezone = 24*3600 + diff_to_UTC_in_seconds;
- this->account->SetIntProperty(Account::P_TIMEZONE, timezone);
-
- break;
- }
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp deleted file mode 100644 index 0a6686303d..0000000000 --- a/protocols/Skype/src/skype_profile.cpp +++ /dev/null @@ -1,321 +0,0 @@ -#include "skype.h"
-#include <sstream>
-
-void CSkypeProto::UpdateProfileAvatar(SEObject *obj, MCONTACT hContact)
-{
- uint newTS = obj->GetUintProp(/* *::P_AVATAR_TIMESTAMP */ 182);
- //if (!newTS) return; //uncomment when skypekit will be work correctly
-
- DWORD oldTS = this->getDword(hContact, "AvatarTS", 0);
-
- ptrW path( this->GetContactAvatarFilePath(hContact));
- bool isAvatarFileExists = CSkypeProto::FileExists(path);
- if (newTS > oldTS || !isAvatarFileExists)
- {
- SEBinary data = obj->GetBinProp(/* *::P_AVATAR_IMAGE */ 37);
- if (data.size() > 0)
- {
- FILE *fp = ::_wfopen(path, L"wb");
- if (fp)
- {
- ::fwrite(data.data(), sizeof(char), data.size(), fp);
- ::fclose(fp);
-
- this->setDword(hContact, "AvatarTS", newTS);
-
- if (hContact)
- {
- PROTO_AVATAR_INFORMATIONW pai = { sizeof(pai) };
- pai.format = PA_FORMAT_JPEG;
- pai.hContact = hContact;
- ::wcscpy(pai.filename, path);
-
- this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
- }
- else
- {
- BYTE digest[16];
- ::mir_md5_hash((BYTE*)data.data(), (int)data.size(), digest);
- ::db_set_blob(hContact, this->m_szModuleName, "AvatarHash", digest, 16);
-
- ::CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)path);
- }
- }
- }
- else if (isAvatarFileExists)
- {
- ::_wremove(path);
- this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
- }
- }
-}
-
-void CSkypeProto::UpdateProfileAboutText(SEObject *obj, MCONTACT hContact)
-{
- ptrW aboutText(::mir_utf8decodeW(obj->GetStrProp(/* *::P_ABOUT */ 18)));
- if ( !::wcslen(aboutText))
- this->delSetting(hContact, "About");
- else
- this->setTString(hContact, "About", aboutText);
-}
-
-void CSkypeProto::UpdateProfileBirthday(SEObject *obj, MCONTACT hContact)
-{
- uint data = obj->GetUintProp(/* *::P_BIRTHDAY */ 7);
- if (data > 0)
- {
- TCHAR date[20];
- _itot_s(data, date, 10);
-
- INT day, month, year;
- _stscanf(date, _T("%04d%02d%02d"), &year, &month, &day);
-
- SYSTEMTIME sToday = {0};
- GetLocalTime(&sToday);
-
- if (sToday.wYear > year) return;
- else if(sToday.wYear == year && sToday.wMonth > month) return;
- else if(sToday.wYear == year && sToday.wMonth == month && sToday.wDay >= day) return;
-
- this->setByte(hContact, "BirthDay", day);
- this->setByte(hContact, "BirthMonth", month);
- this->setWord(hContact, "BirthYear", year);
-
- int nAge = sToday.wYear - year;
- if (sToday.wMonth < month || (sToday.wMonth == month && sToday.wDay < day))
- nAge--;
- if (nAge)
- this->setWord(hContact, "Age", (WORD)nAge );
- }
- else
- {
- this->delSetting(hContact, "BirthDay");
- this->delSetting(hContact, "BirthMonth");
- this->delSetting(hContact, "BirthYear");
- this->delSetting(hContact, "Age");
- }
-}
-
-void CSkypeProto::UpdateProfileCity(SEObject *obj, MCONTACT hContact)
-{
- ptrW city(::mir_utf8decodeW(obj->GetStrProp(/* *::P_CITY */ 12)));
- if ( !::wcslen(city))
- this->delSetting(hContact, "City");
- else
- this->setTString(hContact, "City", city);
-}
-
-void CSkypeProto::UpdateProfileCountry(SEObject *obj, MCONTACT hContact)
-{
- char *country;
- ptrA isocode(::mir_strdup(obj->GetStrProp(/* *::P_COUNTRY */ 10)));
- if ( !::strlen(isocode))
- this->delSetting(hContact, "Country");
- else
- {
- country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode, 0);
- this->setTString(hContact, "Country", _A2T(country));
- }
-}
-
-void CSkypeProto::UpdateProfileEmails(SEObject *obj, MCONTACT hContact)
-{
- ptrW emails(::mir_utf8decodeW(obj->GetStrProp(/* *::P_EMAILS */ 16)));
- if (::wcscmp(emails, L"") == 0)
- {
- this->delSetting(hContact, "e-mail0");
- this->delSetting(hContact, "e-mail1");
- this->delSetting(hContact, "e-mail2");
- }
- else
- {
- StringList emls = emails;
- for (size_t i = 0; i < emls.size(); i++)
- {
- std::stringstream ss;
- ss << "e-mail" << i;
- std::string key = ss.str();
-
- this->setTString(hContact, key.c_str(), emls[i]);
- }
- }
-}
-
-void CSkypeProto::UpdateProfileFullName(SEObject *obj, MCONTACT hContact)
-{
- ptrW fullname(::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5)));
- if ( !::wcslen(fullname))
- {
- this->delSetting(hContact, "FirstName");
- this->delSetting(hContact, "LastName");
- }
- else
- {
- StringList names = fullname;
-
- this->setTString(hContact, "FirstName", names[0]);
- if (names.size() > 1)
- this->setTString(hContact, "LastName", names[1]);
- }
-}
-
-void CSkypeProto::UpdateProfileGender(SEObject *obj, MCONTACT hContact)
-{
- uint data = obj->GetUintProp(/* *::P_GENDER */ 8);
- if (data)
- this->setByte(hContact, "Gender", (BYTE)(data == 1 ? 'M' : 'F'));
- else
- this->delSetting(hContact, "Gender");
-}
-
-void CSkypeProto::UpdateProfileHomepage(SEObject *obj, MCONTACT hContact)
-{
- ptrW homepage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_HOMEPAGE */ 17)));
- if (::wcscmp(homepage, L"") == 0)
- this->delSetting(hContact, "Homepage");
- else
- this->setTString(hContact, "Homepage", homepage);
-}
-
-void CSkypeProto::UpdateProfileLanguages(SEObject *obj, MCONTACT hContact)
-{
- ptrW isocodes(::mir_utf8decodeW(obj->GetStrProp(/* *::P_LANGUAGES */ 9)));
-
- this->delSetting(hContact, "Language1");
- this->delSetting(hContact, "Language2");
- this->delSetting(hContact, "Language3");
-
- StringList langs = isocodes;
- for (size_t i = 0; i < langs.size(); i++)
- {
- if (CSkypeProto::languages.count(langs[i]))
- {
- std::stringstream ss;
- ss << "Language" << i + 1;
- std::string key = ss.str();
- std::wstring val = CSkypeProto::languages[langs[i]];
- this->setTString(hContact, key.c_str(), val.c_str());
- }
- }
-}
-
-void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, MCONTACT hContact)
-{
- ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 15)));
- if ( !::wcslen(phone))
- this->delSetting(hContact, "Cellular");
- else
- this->setTString(hContact, "Cellular", phone);
-}
-
-void CSkypeProto::UpdateProfileNick(SEObject *obj, MCONTACT hContact)
-{
- ptrW nick;
- if (hContact)
- {
- CContact *contact = (CContact *)obj;
- nick = ::mir_utf8decodeW(contact->GetNick());
- }
- else
- nick = ::mir_utf8decodeW(obj->GetStrProp(Account::P_FULLNAME));
-
- if ( !::wcslen(nick))
- this->delSetting(hContact, "Nick");
- else
- this->setTString(hContact, "Nick", nick);
-}
-
-void CSkypeProto::UpdateProfilePhone(SEObject *obj, MCONTACT hContact)
-{
- ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 13)));
- if ( !::wcslen(phone))
- this->delSetting(hContact, "Phone");
- else
- this->setTString(hContact, "Phone", phone);
-}
-
-void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, MCONTACT hContact)
-{
- ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_OFFICE */ 14)));
- if ( !::wcslen(phone))
- this->delSetting(hContact, "CompanyPhone");
- else
- this->setTString(hContact, "CompanyPhone", phone);
-}
-
-void CSkypeProto::UpdateProfileState(SEObject *obj, MCONTACT hContact)
-{
- ptrW state(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PROVINCE */ 11)));
- if ( !::wcslen(state))
- this->delSetting(hContact, "State");
- else
- this->setTString(hContact, "State", state);
-}
-
-void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, MCONTACT hContact)
-{
- ptrW statusMessage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_MOOD_TEXT */ 26)));
- if ( !::wcslen(statusMessage))
- this->delSetting(hContact, "XStatusMsg");
- else
- this->setTString(hContact, "XStatusMsg", statusMessage);
-}
-
-void CSkypeProto::UpdateProfileTimezone(SEObject *obj, MCONTACT hContact)
-{
- LONG data = obj->GetUintProp(/* *::P_TIMEZONE */ 27);
- if (data > 0)
- {
- LONG diffmin = (data - 24*3600) / 60;
- wchar_t sign[2];
- if (diffmin < 0)
- ::wcscpy(sign, L"-");
- else
- ::wcscpy(sign, L"+");
- uint hours = ::abs((int)(diffmin / 60));
- uint mins = ::abs((int)(diffmin % 60));
- wchar_t timeshift[7];
- ::mir_sntprintf(timeshift, SIZEOF(timeshift), _T("%s%d:%02d"), sign, hours, mins);
-
- wchar_t *szMin = wcschr(timeshift, ':');
- int nTz = ::_wtoi(timeshift) * -2;
- nTz += (nTz < 0 ? -1 : 1) * (szMin ? _ttoi( szMin + 1 ) / 30 : 0);
-
- this->setByte(hContact, "Timezone", (signed char)nTz);
- }
- else this->delSetting(hContact, "Timezone");
-}
-
-void CSkypeProto::UpdateProfile(SEObject *obj, MCONTACT hContact)
-{
- this->debugLogW(L"Updating profile for %p", hContact);
- this->UpdateProfileAvatar(obj, hContact);
-
- uint newTS = hContact ? obj->GetUintProp(Contact::P_PROFILE_TIMESTAMP) : obj->GetUintProp(Account::P_PROFILE_TIMESTAMP);
- this->UpdateProfileAboutText(obj, hContact);
- this->UpdateProfileBirthday(obj, hContact);
- this->UpdateProfileCity(obj, hContact);
- this->UpdateProfileCountry(obj, hContact);
- this->UpdateProfileEmails(obj, hContact);
- this->UpdateProfileFullName(obj, hContact);
- this->UpdateProfileGender(obj, hContact);
- this->UpdateProfileHomepage(obj, hContact);
- this->UpdateProfileLanguages(obj, hContact);
- this->UpdateProfileMobilePhone(obj, hContact);
- this->UpdateProfileNick(obj, hContact);
- this->UpdateProfilePhone(obj, hContact);
- this->UpdateProfileOfficePhone(obj, hContact);
- this->UpdateProfileState(obj, hContact);
- this->UpdateProfileStatusMessage(obj, hContact);
- this->UpdateProfileTimezone(obj, hContact);
-
- if (hContact)
- {
- ContactRef ref(obj->getOID());
- this->UpdateContactClient(hContact, ref);
- this->UpdateContactLastEventDate(hContact, ref);
- this->UpdateContactOnlineSinceTime(hContact, ref);
- }
-
- this->setDword(hContact, "ProfileTS", newTS);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp deleted file mode 100644 index 8931a48498..0000000000 --- a/protocols/Skype/src/skype_proto.cpp +++ /dev/null @@ -1,672 +0,0 @@ -#include "skype.h"
-#include "skype_chat.h"
-
-CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
- PROTO<CSkypeProto>(protoName, userName),
- Skype(1),
- skypeKitPort(8963),
- chatRooms(5)
-{
- this->rememberPassword = false;
-
- ::InitializeCriticalSection(&this->contact_search_lock);
-
- this->SetAllContactStatus(ID_STATUS_OFFLINE);
-
- DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
- dbEventType.module = this->m_szModuleName;
- dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_EMOTE;
- dbEventType.descr = "Skype emote";
- ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CONTACTS;
- dbEventType.descr = "Skype contacts";
- dbEventType.eventIcon = CSkypeProto::GetSkinIconHandle("sendContacts");
- ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL;
- dbEventType.descr = "Skype call";
- dbEventType.eventIcon = CSkypeProto::GetSkinIconHandle("call");
- ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- this->InitInstanceServiceList();
-}
-
-CSkypeProto::~CSkypeProto()
-{
- ::DeleteCriticalSection(&this->contact_search_lock);
-
- ::mir_free(this->login);
- if (this->password)
- {
- ::mir_free(this->password);
- this->password = NULL;
- }
-}
-
-MCONTACT __cdecl CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
-{
- CContact::Ref contact;
- this->GetContact((char *)mir_ptr<char>(::mir_utf8encodeW(psr->id)), contact);
- return this->AddContact(contact);
-}
-
-MCONTACT __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
-{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
-
- /*if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) != -1)
- {
- dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0 &&
- !strcmp(dbei.szModule, m_szModuleName) &&
- (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS))
- {
- char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2);
- char *firstName = nick + strlen(nick) + 1;
- char *lastName = firstName + strlen(firstName) + 1;
- char *skypeName = lastName + strlen(lastName) + 1;
- return AddContactBySkypeName(::mir_a2u(skypeName), ::mir_a2u(nick), 0);
- }
- }*/
- return 0;
-}
-
-int __cdecl CSkypeProto::Authorize(HANDLE hDbEvent)
-{
- if (this->IsOnline() && hDbEvent)
- {
- MCONTACT hContact = this->GetContactFromAuthEvent(hDbEvent);
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- return CSkypeProto::GrantAuth(hContact, NULL);
- }
-
- return 1;
-}
-
-int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason)
-{
- if (this->IsOnline())
- {
- MCONTACT hContact = this->GetContactFromAuthEvent(hDbEvent);
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- return CSkypeProto::RevokeAuth(hContact, NULL);
- }
-
- return 1;
-}
-
-int __cdecl CSkypeProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT* pre)
-{
- DWORD flags = 0;
-
- if (pre->flags & PREF_CREATEREAD)
- flags |= DBEF_READ;
-
- if (pre->flags & PREF_UTF)
- flags |= DBEF_UTF;
-
- this->AddDBEvent(
- hContact,
- EVENTTYPE_AUTHREQUEST,
- pre->timestamp,
- flags,
- pre->lParam,
- (PBYTE)pre->szMessage);
-
- return 0;
-}
-
-int __cdecl CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
-{
- if (this->IsOnline() && hContact)
- {
- CContact::Ref contact;
- SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
- if (this->GetContact(sid, contact))
- {
- contact->SetBuddyStatus(Contact::AUTHORIZED_BY_ME);
- contact->SendAuthRequest(::mir_utf8encodeW(szMessage));
- }
-
- return 0;
- }
-
- return 1;
-}
-
-HANDLE __cdecl CSkypeProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath )
-{
- uint oid = (uint)hTransfer;
-
- this->debugLogW(L"Incoming file transfer is accepted");
-
- bool success;
- wchar_t fullPath[MAX_PATH] = {0};
-
- SEString data;
- MessageRef msgRef(oid);
- TransferRefs transfers;
- msgRef->GetTransfers(transfers);
- for (uint i = 0; i < transfers.size(); i++)
- {
- auto transfer = transfers[i];
- transfer->GetPropFilename(data);
- ptrW name(::mir_utf8decodeW(data));
- ::mir_sntprintf(fullPath, MAX_PATH, L"%s%s", szPath, name);
-
- auto fOid = transfer->getOID();
- FileTransferParam ftp = this->transferts[oid];
-
- //PROTOFILETRANSFERSTATUS pfts = { sizeof(pfts) };
- //pfts.hContact = hContact;
- //pfts.flags = PFTS_UNICODE | PFTS_RECEIVING;
- //pfts.ptszFiles = ftp.pfts.ptszFiles;
- //pfts.totalFiles = ftp.pfts.totalFiles;
- //pfts.currentFileNumber = i;
- //pfts.totalBytes = ftp.files[fOid].size;
- //pfts.totalProgress = ftp.files[fOid].transfered;
- //pfts.tszWorkingDir = mir_wstrdup(szPath);
- //pfts.currentFileNumber = 0;
- //pfts.tszCurrentFile = mir_wstrdup(fullPath);
- ////pfts.tszCurrentFile = ::mir_utf8decodeW(data);
- //pfts.currentFileSize = ftp.files[fOid].size;
- //pfts.currentFileProgress = ftp.files[fOid].transfered;
-
- //if ( !ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)oid, (LPARAM)&pfts))
- if ( !transfer->Accept((char *)ptrA(::mir_utf8encodeW(fullPath)), success) || !success)
- {
- this->debugLogW(L"Cannot accept file transfer");
- this->transferList.remove_val(transfer);
- }
- }
-
- return hTransfer;
-}
-
-int __cdecl CSkypeProto::FileCancel(MCONTACT hContact, HANDLE hTransfer )
-{
- uint oid = (uint)hTransfer;
-
- MessageRef msgRef(oid);
- TransferRefs transfers;
- Transfer::STATUS transferStatus;
- msgRef->GetTransfers(transfers);
- for (uint i = 0; i < transfers.size(); i++)
- {
- auto transfer = transfers[i];
- transfer->GetPropStatus(transferStatus);
- if (transferStatus <= Transfer::CANCELLED && this->transferList.contains(transfer))
- {
- if ( !transfer->Cancel())
- this->debugLogW(L"Incoming file transfer is cancelled");
- this->transferList.remove_val(transfer);
- }
- }
- this->transferts.erase(this->transferts.find(oid));
-
- return 1;
-}
-
-int __cdecl CSkypeProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason )
-{
- uint oid = (uint)hTransfer;
-
- MessageRef msgRef(oid);
- TransferRefs transfers;
- Transfer::STATUS transferStatus;
- msgRef->GetTransfers(transfers);
- for (uint i = 0; i < transfers.size(); i++)
- {
- auto transfer = transfers[i];
- transfer->GetPropStatus(transferStatus);
- if (transferStatus <= Transfer::CANCELLED && this->transferList.contains(transfer))
- {
- if ( !transfer->Cancel())
- this->debugLogW(L"Incoming file transfer is denied");
- this->transferList.remove_val(transfer);
- }
- }
- this->transferts.erase(this->transferts.find(oid));
-
- return 1;
-}
-
-int __cdecl CSkypeProto::FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename )
-{
- if ( !this->IsOnline())
- return 1;
-
- uint oid = (uint)hTransfer;
-
- //auto fOid = transfers[i]->getOID();
- FileTransferParam ftp = this->transferts[oid];
-
- MessageRef msgRef(oid);
- TransferRefs transfers;
- msgRef->GetTransfers(transfers);
- for (uint i = 0; i < transfers.size(); i++){}
-
- switch (*action)
- {
- case FILERESUME_SKIP:
- /*if (ft->p2p_appID != 0)
- p2p_sendStatus(ft, 603);
- else
- msnftp_sendAcceptReject (ft, false);*/
- break;
-
- case FILERESUME_RESUME:
- //replaceStrT(ft->std.tszCurrentFile, *szFilename);
- break;
-
- case FILERESUME_RENAME:
- //replaceStrT(ft->std.tszCurrentFile, *szFilename);
- break;
-
- default:
- /*bool fcrt = ft->create() != -1;
- if (ft->p2p_appID != 0)
- {
- if (fcrt)
- p2p_sendFeedStart(ft);
-
- p2p_sendStatus(ft, fcrt ? 200 : 603);
- }
- else
- msnftp_sendAcceptReject (ft, fcrt);*/
-
- //ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0);
- break;
- }
-
- return 0;
-}
-
-DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, MCONTACT hContact)
-{
- switch(type)
- {
- case PFLAGNUM_1:
- return PF1_IM | PF1_FILE | PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME |
- PF1_AUTHREQ | PF1_CHAT | PF1_SERVERCLIST | PF1_CONTACT/* | PF1_ADDSEARCHRES*/;
- case PFLAGNUM_2:
- case PFLAGNUM_3:
- return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE | PF2_ONTHEPHONE;
- case PFLAGNUM_4:
- return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS |
- /*PF4_OFFLINEFILES | */PF4_IMSENDUTF | PF4_IMSENDOFFLINE | PF4_NOAUTHDENYREASON;
- case PFLAGNUM_5:
- return PF2_ONTHEPHONE;
- case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR)::Translate("Skype name");
- case PFLAG_MAXCONTACTSPERPACKET:
- return 1024;
- case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR)SKYPE_SETTINGS_SID;
- default:
- return 0;
- }
-}
-
-int __cdecl CSkypeProto::GetInfo(MCONTACT hContact, int infoType ) { return 0; }
-
-HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id)
-{
- if ( !this->IsOnline())
- return 0;
-
- this->ForkThread(&CSkypeProto::SearchBySidAsync, ::mir_tstrdup(id));
-
- return (HANDLE)SKYPE_SEARCH_BYSID;
-}
-
-HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email)
-{
- if ( !this->IsOnline())
- return 0;
-
- this->ForkThread(&CSkypeProto::SearchByEmailAsync, ::mir_tstrdup(email));
-
- return (HANDLE)SKYPE_SEARCH_BYEMAIL;
-}
-
-HANDLE __cdecl CSkypeProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
-{
- PROTOSEARCHRESULT *psr = new PROTOSEARCHRESULT();
- psr->cbSize = sizeof(psr);
- psr->flags = PSR_TCHAR;
- psr->nick = ::mir_wstrdup(nick);
- psr->firstName = ::mir_wstrdup(firstName);
- psr->lastName = ::mir_wstrdup(lastName);
-
- this->ForkThread(&CSkypeProto::SearchByNamesAsync, psr);
-
- return (HANDLE)SKYPE_SEARCH_BYNAMES;
-}
-
-HWND __cdecl CSkypeProto::SearchAdvanced( HWND owner ) { return 0; }
-
-HWND __cdecl CSkypeProto::CreateExtendedSearchUI( HWND owner ){ return 0; }
-
-int __cdecl CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre)
-{
- this->debugLogW(L"Incoming contacts");
- ::db_unset(hContact, "CList", "Hidden");
-
- return (INT_PTR)this->AddDBEvent(
- hContact,
- EVENTTYPE_CONTACTS,
- pre->timestamp,
- DBEF_UTF | ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0),
- pre->lParam,
- (PBYTE)pre->szMessage);
-}
-
-int __cdecl CSkypeProto::RecvFile(MCONTACT hContact, PROTORECVFILET* pre)
-{
- this->debugLogW(L"Incoming file transfer");
- ::db_unset(hContact, "CList", "Hidden");
- return ::Proto_RecvFile(hContact, pre);
-}
-
-int __cdecl CSkypeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
-{
- this->debugLogW(L"Incoming message");
- ::db_unset(hContact, "CList", "Hidden");
-
- ReadMessageParam *param = (ReadMessageParam*)pre->lParam;
-
- char *message = (char *)pre->szMessage;
- size_t msgLen = ::strlen(message) + 1;
-
- message = (char *)::mir_realloc(message, msgLen + param->guid.size());
- ::memcpy((char *)&message[msgLen], param->guid.data(), param->guid.size());
-
- return (INT_PTR)this->AddDBEvent(
- hContact,
- param->msgType == CMessage::POSTED_TEXT ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_EMOTE,
- pre->timestamp,
- DBEF_UTF | ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0),
- DWORD(msgLen + param->guid.size()),
- (PBYTE)message);
-}
-
-int __cdecl CSkypeProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT *) { return 0; }
-
-int __cdecl CSkypeProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList)
-{
- if (this->IsOnline() && hContact && hContactsList)
- {
- this->debugLogW(L"Outcoming contacts");
-
- ConversationRef conversation;
- if ( !this->isChatRoom(hContact))
- {
- SEStringList targets;
- targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- this->GetConversationByParticipants(targets, conversation);
- }
- else
- {
- this->GetConversationByIdentity((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)), conversation);
- }
- if ( !conversation)
- return 0;
-
- ContactRefs contacts;
- for (int i = 0; i < nContacts; i++)
- {
- CContact::Ref contact;
-
- ptrW csid(::db_get_wsa(hContactsList[i], this->m_szModuleName, SKYPE_SETTINGS_SID));
- this->GetContact((char *)ptrA(::mir_utf8encodeW(csid)), contact);
- contacts.append(contact);
- }
-
- time_t timestamp = time(NULL);
-
- if ( !conversation->PostContacts(contacts))
- return 0;
-
- // todo: bad hack
- CMessage::Refs msgs;
- this->GetMessageListByType(Message::POSTED_CONTACTS, true, msgs, timestamp);
-
- if (msgs.size() == 0)
- return 0;
-
- CMessage::Ref lastMsg = msgs[msgs.size() - 1];
-
- return lastMsg->getOID();
- }
-
- return 0;
-}
-
-HANDLE __cdecl CSkypeProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles)
-{
- if (this->IsOnline() && hContact && ppszFiles)
- {
- this->debugLogW(L"Outcoming file transfer");
-
- ConversationRef conversation;
- if ( !this->isChatRoom(hContact))
- {
- SEStringList targets;
- targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- this->GetConversationByParticipants(targets, conversation);
- }
- else
- {
- this->GetConversationByIdentity((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)), conversation);
- }
- if ( !conversation)
- return 0;
-
- FileTransferParam ftp;
- ftp.pfts.flags = PFTS_SENDING | PFTS_UNICODE;
- ftp.pfts.hContact = hContact;
- for (ftp.pfts.totalFiles = 0; ppszFiles[ftp.pfts.totalFiles]; ftp.pfts.totalFiles++);
- ftp.pfts.ptszFiles = new wchar_t*[ftp.pfts.totalFiles + 1];
-
- wchar_t *wd = new wchar_t[wcslen(ppszFiles[0]) + 1];
- wcscpy(wd, ppszFiles[0]);
- PathRemoveFileSpec(wd);
- ftp.pfts.tszWorkingDir = wd;
-
- SEFilenameList fileList;
- for (int i = 0; ppszFiles[i]; i++)
- {
- ftp.pfts.ptszFiles[i] = ::mir_wstrdup(ppszFiles[i]);
- fileList.append((char *)ptrA(::mir_utf8encodeW(ppszFiles[i])));
- }
-
- auto error = TRANSFER_OPEN_SUCCESS;
- SEFilename errFile;
- MessageRef msgRef;
- if ( !conversation->PostFiles(fileList, " ", error, errFile, msgRef) || error)
- return 0;
-
- SEString data;
- TransferRefs transfers;
- if (msgRef->GetTransfers(transfers))
- {
- for (uint i = 0; i < transfers.size(); i++)
- {
- transfers[i].fetch();
- this->transferList.append(transfers[i]);
-
- transfers[i]->GetPropFilesize(data);
- Sid::uint64 size = data.toUInt64();
-
- ftp.files.insert(std::make_pair(transfers[i]->getOID(), FileParam(size)));
- ftp.pfts.totalBytes += size;
- }
- }
-
- auto oid = msgRef->getOID();
- this->transferts.insert(std::make_pair(oid, ftp));
-
- return (HANDLE)oid;
- }
-
- return 0;
-}
-
-int __cdecl CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
-{
- this->debugLogW(L"Outcoming message");
- SEStringList targets;
- targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- CConversation::Ref conversation;
- this->GetConversationByParticipants(targets, conversation);
-
- if (conversation)
- {
- CMessage::Ref message;
- if (!conversation->PostText(msg, message))
- return 0;
-
- return message->getOID();
- }
-
- return 0;
-}
-
-int __cdecl CSkypeProto::SendUrl(MCONTACT hContact, int flags, const char *url) { return 0; }
-
-int __cdecl CSkypeProto::SetApparentMode(MCONTACT hContact, int mode) { return 0; }
-
-int CSkypeProto::SetStatus(int new_status)
-{
- switch (new_status)
- {
- case ID_STATUS_OCCUPIED:
- new_status = ID_STATUS_DND;
- break;
- case ID_STATUS_FREECHAT:
- new_status = ID_STATUS_ONLINE;
- break;
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- case ID_STATUS_NA:
- new_status = ID_STATUS_AWAY;
- break;
- }
-
- if (new_status == this->m_iDesiredStatus)
- return 0;
-
- int old_status = this->m_iStatus;
- this->m_iDesiredStatus = new_status;
-
- if (new_status == ID_STATUS_OFFLINE)
- {
- this->LogOut();
- this->m_iStatus = this->m_iDesiredStatus = ID_STATUS_OFFLINE;
-
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
-
- if ( !::Miranda_Terminated())
- {
- this->SetAllContactStatus(ID_STATUS_OFFLINE);
- this->CloseAllChatSessions();
- }
-
- return 0;
- }
- else
- {
- if (old_status == ID_STATUS_OFFLINE && !this->IsOnline())
- {
- this->m_iStatus = ID_STATUS_CONNECTING;
- if ( !this->LogIn())
- return 0;
- }
- else
- {
- if ( this->account->IsOnline())
- {
- SetServerStatus(new_status);
- return 0;
- }
-
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- return 0;
- }
- }
-
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- return 0;
-}
-
-HANDLE __cdecl CSkypeProto::GetAwayMsg(MCONTACT hContact) { return 0; }
-int __cdecl CSkypeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT *evt) { return 0; }
-int __cdecl CSkypeProto::SetAwayMsg(int m_iStatus, const TCHAR *msg) { return 0; }
-
-int __cdecl CSkypeProto::UserIsTyping(MCONTACT hContact, int type)
-{
- if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE)
- {
- ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (sid != NULL && ::wcsicmp(sid, this->login) != 0)
- {
- SEStringList targets;
- targets.append((char *)ptrA(::mir_utf8encodeW(sid)));
-
- CConversation::Ref conversation;
- this->GetConversationByParticipants(targets, conversation);
-
- if (conversation)
- {
- switch (type)
- {
- case PROTOTYPE_SELFTYPING_ON:
- conversation->SetMyTextStatusTo(Participant::WRITING);
- return 0;
-
- case PROTOTYPE_SELFTYPING_OFF:
- conversation->SetMyTextStatusTo(Participant::READING); //todo: mb TEXT_UNKNOWN?
- return 0;
- }
- }
- }
- }
-
- return 1;
-}
-
-int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
-{
- switch (eventType)
- {
- case EV_PROTO_ONLOAD:
- return this->OnProtoModulesLoaded(wParam, lParam);
-
- case EV_PROTO_ONEXIT:
- return this->OnPreShutdown(wParam, lParam);
-
- case EV_PROTO_ONOPTIONS:
- return this->OnOptionsInit(wParam,lParam);
-
- case EV_PROTO_ONCONTACTDELETED:
- return this->OnContactDeleted(wParam, lParam);
-
- case EV_PROTO_ONMENU:
- this->OnInitStatusMenu();
- break;
- }
-
- return 1;
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h deleted file mode 100644 index 5f6bb13e2d..0000000000 --- a/protocols/Skype/src/skype_proto.h +++ /dev/null @@ -1,560 +0,0 @@ -#pragma once
-
-struct _tag_iconList
-{
- wchar_t* Description;
- char* Name;
- int IconId;
- HANDLE Handle;
-};
-
-struct ReadMessageParam
-{
- SEBinary& guid;
- CMessage::TYPE msgType;
-};
-
-struct ContactParam
-{
- ContactRef contact;
- CSkypeProto *ppro;
-
- ContactParam(const ContactRef &contact, CSkypeProto *ppro) : contact(contact), ppro(ppro)
- {
- }
-};
-
-struct BlockParam
-{
- MCONTACT hContact;
- CSkypeProto *ppro;
- bool remove;
- bool abuse;
-
- BlockParam(MCONTACT hContact, CSkypeProto *ppro) : ppro(ppro)
- {
- this->hContact = hContact;
- }
-};
-
-struct ChatRoomParam
-{
- wchar_t *id;
- StringList invitedContacts;
- CSkypeProto *ppro;
-
- wchar_t topic[256];
- wchar_t guidline[256];
-
- bool enableJoining;
- int joinRank;
-
- bool passwordProtection;
- wchar_t password[32];
- wchar_t confirmation[32];
- wchar_t hint[32];
-
- ChatRoomParam(CSkypeProto *ppro)
- : ppro(ppro)
- {
- this->id = NULL;
- this->topic[0] = 0;
- this->guidline[0] = 0;
- this->password[0] = 0;
- this->confirmation[0] = 0;
- this->hint[0] = 0;
- this->enableJoining = true;
- this->joinRank = Participant::WRITER;
- this->passwordProtection = false;
- }
-
- ChatRoomParam(const wchar_t *id, const StringList &contacts, CSkypeProto *ppro)
- : id(::mir_wstrdup(id)), invitedContacts(contacts), ppro(ppro)
- {
- this->topic[0] = 0;
- this->guidline[0] = 0;
- this->password[0] = 0;
- this->confirmation[0] = 0;
- this->hint[0] = 0;
- this->enableJoining = true;
- this->joinRank = Participant::WRITER;
- this->passwordProtection = false;
- }
-
- ~ChatRoomParam()
- { ::mir_free(id); }
-};
-
-struct PasswordRequestBoxParam
-{
- wchar_t *login;
- char *password;
- bool rememberPassword;
- bool showRememberPasswordBox;
-
- PasswordRequestBoxParam(const wchar_t *login, bool showRememberPasswordBox = true, bool rememberPassword = false) :
- login(::mir_wstrdup(login)),
- password(NULL),
- rememberPassword(rememberPassword),
- showRememberPasswordBox(showRememberPasswordBox) { }
-
- ~PasswordRequestBoxParam()
- {
- ::mir_free(login);
- ::mir_free(password);
- }
-};
-
-struct PasswordChangeBoxParam
-{
- char *password;
- char *password2;
-
- PasswordChangeBoxParam() { }
-
- ~PasswordChangeBoxParam()
- {
- ::mir_free(password);
- ::mir_free(password2);
- }
-};
-
-struct FileParam
-{
- bool isCanceled;
- bool isCompleted;
-
- unsigned __int64 size;
- unsigned __int64 transfered;
-
- FileParam() { }
- FileParam(unsigned __int64 size)
- {
- this->size = size;
- this->transfered = 0;
- this->isCanceled = this->isCompleted = false;
- }
-};
-
-struct FileTransferParam
-{
- //CTransfer::Refs transfers;
- PROTOFILETRANSFERSTATUS pfts;
- std::map<int, FileParam> files;
-
- FileTransferParam()
- {
- this->pfts.cbSize = sizeof(this->pfts);
- this->pfts.flags = 0;
- this->pfts.currentFileNumber = 0;
- this->pfts.currentFileProgress = 0;
- this->pfts.currentFileSize = 0;
- this->pfts.currentFileTime = 0;
- this->pfts.totalBytes = 0;
- this->pfts.totalFiles = 0;
- this->pfts.totalProgress = 0;
- this->pfts.tszWorkingDir = NULL;
- this->pfts.wszCurrentFile = NULL;
-
- //Sid::fetch(this->transfers);
- }
-};
-
-class ChatMember;
-class ChatRoom;
-
-struct CSkypeProto : public PROTO<CSkypeProto>, private Skype
-{
- friend class ChatRoom;
- friend class CAccount;
- friend class CContact;
- friend class CConversation;
- friend class CContactGroup;
- friend class CContactSearch;
- friend class CTransfer;
-
-public:
- // PROTO_INTERFACE
- CSkypeProto(const char *protoName, const wchar_t *userName);
- ~CSkypeProto();
-
- // PROTO_INTERFACE
- virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
- virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent );
-
- virtual int __cdecl Authorize( HANDLE hDbEvent );
- virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason );
- virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* );
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage );
-
- virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath );
- virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
- virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason );
- virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename );
-
- virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL );
- virtual int __cdecl GetInfo(MCONTACT hContact, int infoType );
-
- virtual HANDLE __cdecl SearchBasic( const TCHAR* id );
- virtual HANDLE __cdecl SearchByEmail( const TCHAR* email );
- virtual HANDLE __cdecl SearchByName( const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName );
- virtual HWND __cdecl SearchAdvanced( HWND owner );
- virtual HWND __cdecl CreateExtendedSearchUI( HWND owner );
-
- virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT* );
- virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* );
- virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* );
- virtual int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT* );
-
- virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
- virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles );
- virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg );
- virtual int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url );
-
- virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode );
- virtual int __cdecl SetStatus( int iNewStatus );
-
- virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact );
- virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt );
- virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg );
-
- virtual int __cdecl UserIsTyping(MCONTACT hContact, int type );
-
- virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );
-
- // instances
- static CSkypeProto* InitSkypeProto(const char* protoName, const wchar_t* userName);
- static int UninitSkypeProto(CSkypeProto* ppro);
-
- static CSkypeProto* GetContactInstance(MCONTACT hContact);
- static void UninitInstances();
-
- // icons
- static void InitIcons();
- static void UninitIcons();
-
- // menus
- void OnInitStatusMenu();
- static void InitMenus();
- static void UninitMenus();
-
- // services
- static void InitServiceList();
-
- // hooks
- static void InitHookList();
-
- // languages
- static void InitLanguages();
-
- static INT_PTR __cdecl ParseSkypeUri(WPARAM wParam, LPARAM lParam);
-
-private:
- // Skype
- CAccount *newAccount(int oid);
- CContactGroup *newContactGroup(int oid);
- CConversation *newConversation(int oid);
- CContactSearch *newContactSearch(int oid);
- CParticipant *newParticipant(int oid);
- CContact *newContact(int oid);
- CMessage *newMessage(int oid);
- CTransfer *newTransfer(int oid);
-
- void OnMessage(
- const MessageRef & message,
- const bool & changesInboxTimestamp,
- const MessageRef & supersedesHistoryMessage,
- const ConversationRef & conversation);
-
- void OnConversationListChange(
- const ConversationRef& conversation,
- const Conversation::LIST_TYPE& type,
- const bool& added);
-
- int skypeKitPort;
- PROCESS_INFORMATION skypeKitProcessInfo;
-
-protected:
- CAccount::Ref account;
- CContact::Refs contactList;
- CTransfer::Refs transferList;
-
- CContactGroup::Ref commonList;
- CContactGroup::Ref authWaitList;
-
- CRITICAL_SECTION contact_search_lock;
-
- bool IsOnline();
-
- BYTE NeedUpdate;
-
- // account
- static wchar_t *LogoutReasons[];
- static wchar_t *PasswordChangeReasons[];
-
- wchar_t *login;
- char *password;
- bool rememberPassword;
-
- bool RequestPassword(PasswordRequestBoxParam ¶m);
- bool ChangePassword(PasswordChangeBoxParam ¶m);
-
- bool PrepareLogin();
- bool PreparePassword();
-
- void InitProxy();
- void SetAccountSettings();
-
- void SetServerStatus(int iStatus);
-
- bool LogIn();
- void LogOut();
-
- void OnLoggedIn();
- void OnCblUpdated();
- void OnLoggedOut(CAccount::LOGOUTREASON reason);
-
- void OnAccountChanged(int prop);
-
- INT_PTR __cdecl SetMyNickName(WPARAM, LPARAM);
-
- // avatars
- bool IsAvatarChanged(const SEBinary &avatar, MCONTACT hContact = NULL);
-
- wchar_t* GetContactAvatarFilePath(MCONTACT hContact);
-
- INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM);
- INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM);
- INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM);
- INT_PTR __cdecl SetMyAvatar(WPARAM, LPARAM);
-
- SEBinary GetAvatarBinary(wchar_t *path);
-
- // messages
- void OnMessageEvent(const ConversationRef &conversation, const MessageRef &message);
- void OnMessageSent(const ConversationRef &conversation, const MessageRef &message);
- void OnMessageReceived(const ConversationRef &conversation, const MessageRef &message);
-
- void SyncMessageHystory(const ConversationRef &conversation, const time_t timestamp);
- void SyncHistoryCommand(MCONTACT hContact, time_t timestamp);
- int __cdecl SyncLastDayHistoryCommand(WPARAM wParam, LPARAM lParam);
- int __cdecl SyncLastWeekHistoryCommand(WPARAM wParam, LPARAM lParam);
- int __cdecl SyncLastMonthHistoryCommand(WPARAM wParam, LPARAM lParam);
- int __cdecl SyncLast3MonthHistoryCommand(WPARAM wParam, LPARAM lParam);
- int __cdecl SyncLastYearHistoryCommand(WPARAM wParam, LPARAM lParam);
- int __cdecl SyncAllTimeHistoryCommand(WPARAM wParam, LPARAM lParam);
-
- // contacts
- void OnContactsEvent(const ConversationRef &conversation, const MessageRef &message);
- void OnContactsSent(const ConversationRef &conversation, const MessageRef &message);
- void OnContactsReceived(const ConversationRef &conversation, const MessageRef &message);
-
- // transfer
- static wchar_t *TransferFailureReasons[];
-
- std::map<int, FileTransferParam> transferts;
-
- void OnFileEvent(const ConversationRef &conversation, const MessageRef &message);
- void OnTransferChanged(const TransferRef &transfer, int prop);
-
- // chat
- void InitChatModule();
- INT_PTR __cdecl SkypeGCGetToolTipText(WPARAM wParam, LPARAM lParam);
-
- void UpdateChatUserStatus(const ContactRef &contact);
- void UpdateChatUserNick(const ContactRef &contact);
-
- void ChatValidateContact(MCONTACT hItem, HWND hwndList, const StringList &contacts);
- void ChatPrepare(MCONTACT hItem, HWND hwndList, const StringList &contacts);
-
- void GetInvitedContacts(MCONTACT hItem, HWND hwndList, StringList &invitedContacts);
-
- void ChatRoomParseUriComands(const wchar_t *commands);
-
- void ChatRoomInvite(MCONTACT hContact);
-
- void CloseAllChatSessions();
-
- ChatRoom *FindChatRoom(const wchar_t *cid);
-
- INT_PTR __cdecl CreateChatRoomCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM);
- INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM);
-
- int __cdecl OnGCEventHook(WPARAM, LPARAM lParam);
- int __cdecl OnGCMenuHook(WPARAM, LPARAM lParam);
-
- void OnChatEvent(const ConversationRef &conversation, const MessageRef &message);
-
- OBJLIST<ChatRoom> chatRooms;
-
- // contacts
- void UpdateContactAuthState(MCONTACT hContact, const ContactRef &contact);
- void UpdateContactStatus(MCONTACT hContact, const ContactRef &contact);
- void UpdateContactClient(MCONTACT hContact, const ContactRef &contact);
- void UpdateContactOnlineSinceTime(MCONTACT hContact, const ContactRef &contact);
- void UpdateContactLastEventDate(MCONTACT hContact, const ContactRef &contact);
-
- void OnSearchCompleted(HANDLE hSearch);
- void OnContactFinded(CContact::Ref contact, HANDLE hSearch);
-
- void OnContactChanged(const ContactRef &contact, int prop);
- void OnContactListChanged(const ContactRef &contact);
-
- bool IsProtoContact(MCONTACT hContact);
- MCONTACT GetContactBySid(const wchar_t* sid);
- MCONTACT GetContactFromAuthEvent(HANDLE hEvent);
- MCONTACT AddContact(CContact::Ref contact, bool isTemporary = false);
-
- bool IsContactOnline(MCONTACT hContact);
- void SetAllContactStatus(int status);
-
- void __cdecl LoadContactList(void*);
- void __cdecl LoadChatList(void*);
- void __cdecl LoadAuthWaitList(void*);
-
- void __cdecl SearchBySidAsync(void*);
- void __cdecl SearchByNamesAsync(void*);
- void __cdecl SearchByEmailAsync(void*);
-
- // profile
- void UpdateProfileAvatar(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileAboutText(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileBirthday(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileCity(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileCountry(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileEmails(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileFullName(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileGender(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileHomepage(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileLanguages(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileMobilePhone(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileNick(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfilePhone(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileOfficePhone(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileState(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileStatusMessage(SEObject *obj, MCONTACT hContact = NULL);
- void UpdateProfileTimezone(SEObject *obj, MCONTACT hContact = NULL);
-
- void UpdateProfile(SEObject *obj, MCONTACT hContact = NULL);
-
- void __cdecl LoadOwnInfo(void*);
-
- void SaveOwnInfoToServer(HWND hwndPage, int iPage);
-
- // utils
- static wchar_t* ValidationReasons[];
-
- static int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
-
- static char *RemoveHtml(const char *data);
-
- static int SkypeToMirandaStatus(CContact::AVAILABILITY availability);
- static CContact::AVAILABILITY MirandaToSkypeStatus(int status);
-
- static bool FileExists(wchar_t *path);
-
- static void ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
- static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
-
- static void CopyToClipboard(const wchar_t *text);
-
- static void ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith = L'_');
-
- // languages
- static std::map<std::wstring, std::wstring> languages;
-
- // instances
- static LIST<CSkypeProto> instanceList;
- static int CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2);
-
- //
- int SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam);
- int SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
-
- HANDLE CreateEvent(const char* szService);
-
- // netlib
- void InitNetLib();
- void UninitNetLib();
-
- // services
- void InitInstanceServiceList();
-
- // hooks
- void InitInstanceHookList();
-
- // icons
- static _tag_iconList IconList[];
- static HANDLE GetIconHandle(const char *name);
- static HANDLE GetSkinIconHandle(const char *name);
-
- // menus
- HGENMENU m_hMenuRoot;
- static HANDLE hChooserMenu;
- static HGENMENU contactMenuItems[CMI_MAX];
-
- virtual int __cdecl RequestAuth(WPARAM, LPARAM);
- virtual int __cdecl GrantAuth(WPARAM, LPARAM);
- virtual int __cdecl RevokeAuth(WPARAM, LPARAM);
-
- static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam);
-
- static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
- int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
-
- // blocked list
- int __cdecl BlockCommand(WPARAM, LPARAM);
- INT_PTR __cdecl OpenBlockedListCommand(WPARAM, LPARAM);
-
- static INT_PTR CALLBACK SkypeBlockProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK SkypeBlockedOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static LRESULT CALLBACK SkypeBlockedOptionsSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- // database
- bool IsMessageInDB(MCONTACT hContact, DWORD timestamp, SEBinary &guid, int flag = 0);
-
- HANDLE AddDBEvent(MCONTACT hContact, WORD type, DWORD time, DWORD flags = 0, DWORD cbBlob = 0, PBYTE pBlob = 0);
- void RaiseMessageSentEvent(
- MCONTACT hContact,
- DWORD timestamp,
- SEBinary &guid,
- const char *message,
- bool isUnread = true);
- void RaiseAuthRequestEvent(
- DWORD timestamp,
- CContact::Ref contact);
-
- // dialog procs
- static INT_PTR CALLBACK SkypeMainOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
- static INT_PTR CALLBACK SkypePasswordRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK SkypePrivacyOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- static INT_PTR CALLBACK SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK AccountSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
- // skype runtime
- char *LoadKeyPair();
- int StartSkypeRuntime(const wchar_t *profileName);
- BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode);
- void StopSkypeRuntime();
-
- // events
- static int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
-
- int __cdecl OnProtoModulesLoaded(WPARAM, LPARAM);
- int __cdecl OnPreShutdown(WPARAM, LPARAM);
- int __cdecl OnContactDeleted(WPARAM, LPARAM);
- int __cdecl OnOptionsInit(WPARAM, LPARAM);
- int __cdecl OnSrmmWindowOpen(WPARAM, LPARAM);
- int __cdecl OnUserInfoInit(WPARAM, LPARAM);
- INT_PTR __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
-
- int __cdecl OnMessagePreCreate(WPARAM, LPARAM);
- int __cdecl OnTabSRMMButtonPressed(WPARAM, LPARAM);
-};
diff --git a/protocols/Skype/src/skype_runtime.cpp b/protocols/Skype/src/skype_runtime.cpp deleted file mode 100644 index ed966b1f34..0000000000 --- a/protocols/Skype/src/skype_runtime.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include "skype.h"
-
-#include "aes\aes.h"
-
-#include "..\..\..\..\skypekit\key.h"
-
-char *CSkypeProto::LoadKeyPair()
-{
- HRSRC hResource = FindResource(g_hInstance, MAKEINTRESOURCE(IDR_KEY), L"BIN");
- if (hResource == NULL)
- return NULL;
-
- HGLOBAL hLoadedResource = LoadResource(g_hInstance, hResource);
- if (hLoadedResource == NULL)
- return NULL;
-
- LPVOID pLockedResource = LockResource(hLoadedResource);
- if (pLockedResource == NULL)
- return NULL;
-
- int length = ::SizeofResource(g_hInstance, hResource);
- if (length == 0)
- return NULL;
-
- char* pData = (char*)_alloca(length + 1);
- ::memcpy(pData, pLockedResource, length);
- pData[length] = 0;
-
- unsigned decodedLen;
- mir_ptr<BYTE> tmpD((BYTE*)::mir_base64_decode(pData, &decodedLen));
- BYTE *result = (BYTE*)::mir_alloc(decodedLen+17);
-
- aes_context ctx;
- char *key = (char*)::mir_base64_decode(MY_KEY, NULL);
- ::aes_set_key(&ctx, (BYTE*)key, 128);
- ::mir_free(key);
-
- for (unsigned i = 0; i < decodedLen; i += 16)
- aes_decrypt(&ctx, &tmpD[i], &result[i]);
-
- result[decodedLen] = 0;
- return (char *)result;
-}
-
-int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName)
-{
- STARTUPINFO cif = {0};
- cif.cb = sizeof(STARTUPINFO);
- cif.dwFlags = STARTF_USESHOWWINDOW;
- cif.wShowWindow = SW_HIDE;
-
- wchar_t fileName[MAX_PATH];
- ::GetModuleFileName(g_hInstance, fileName, MAX_PATH);
-
- wchar_t *skypeKitPath = ::wcsrchr(fileName, '\\');
- if (skypeKitPath != NULL)
- *skypeKitPath = 0;
- ::mir_snwprintf(fileName, SIZEOF(fileName), L"%s\\%s", fileName, L"SkypeKit.exe");
-
- PROCESSENTRY32 entry;
- entry.dwSize = sizeof(PROCESSENTRY32);
-
- // todo: rework
- HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
- if (::Process32First(snapshot, &entry) == TRUE)
- {
- while (::Process32Next(snapshot, &entry) == TRUE)
- {
- if (::wcsicmp(entry.szExeFile, L"SkypeKit.exe") == 0 || ::wcsicmp(entry.szExeFile, L"Skype.exe") == 0)
- {
- this->skypeKitPort += rand() % 1000 + 8963;
- break;
- }
- }
- }
- ::CloseHandle(snapshot);
-
- wchar_t param[128];
- VARST dbPath( _T("%miranda_userdata%\\SkypeKit"));
- ::mir_snwprintf(param, SIZEOF(param), L"-p -P %d -f \"%s\"", this->skypeKitPort, dbPath);
- int startingrt = ::CreateProcess(
- fileName, param,
- NULL, NULL, FALSE,
- CREATE_NEW_CONSOLE,
- NULL, NULL, &cif, &this->skypeKitProcessInfo);
-
- return startingrt;
-}
-
-BOOL CSkypeProto::SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
-{
- DWORD dwTID, dwCode, dwErr = 0;
- HANDLE hProcessDup = INVALID_HANDLE_VALUE;
- HANDLE hRT = NULL;
- HINSTANCE hKernel = ::GetModuleHandle(L"Kernel32");
- BOOL bSuccess = FALSE;
-
- BOOL bDup = ::DuplicateHandle(
- ::GetCurrentProcess(),
- hProcess,
- GetCurrentProcess(),
- &hProcessDup,
- PROCESS_ALL_ACCESS,
- FALSE,
- 0);
-
- // Detect the special case where the process is
- // already dead...
- if (::GetExitCodeProcess((bDup) ? hProcessDup : hProcess, &dwCode) && (dwCode == STILL_ACTIVE))
- {
- FARPROC pfnExitProc;
-
- pfnExitProc = GetProcAddress(hKernel, "ExitProcess");
-
- hRT = ::CreateRemoteThread(
- (bDup) ? hProcessDup : hProcess,
- NULL,
- 0,
- (LPTHREAD_START_ROUTINE)pfnExitProc,
- (PVOID)uExitCode, 0, &dwTID);
-
- if ( hRT == NULL )
- dwErr = GetLastError();
- }
- else
- dwErr = ERROR_PROCESS_ABORTED;
-
- if (hRT)
- {
- // Must wait process to terminate to
- // guarantee that it has exited...
- ::WaitForSingleObject((bDup) ? hProcessDup : hProcess, INFINITE);
-
- ::CloseHandle(hRT);
- bSuccess = TRUE;
- }
-
- if ( bDup )
- ::CloseHandle(hProcessDup);
-
- if ( !bSuccess )
- ::SetLastError(dwErr);
-
- return bSuccess;
-}
-
-void CSkypeProto::StopSkypeRuntime()
-{
- //DWORD dwExitCode = 0;
- //this->SafeTerminateProcess(this->skypeKitProcessInfo.hProcess, 0);
- //::PostThreadMessage(this->skypeKitProcessInfo.dwThreadId, WM_CLOSE, 0, 0);
- //::WaitForSingleObject(this->skypeKitProcessInfo.hProcess, 1500);
-
- DWORD dwExitCode = 0;
- ::GetExitCodeProcess(this->skypeKitProcessInfo.hProcess, &dwExitCode);
- if (dwExitCode == STILL_ACTIVE)
- //::TerminateProcess(this->skypeKitProcessInfo.hProcess, 0); // Zero is the exit code
- this->SafeTerminateProcess(this->skypeKitProcessInfo.hProcess, 0);
-
- ::CloseHandle(this->skypeKitProcessInfo.hThread);
- ::CloseHandle(this->skypeKitProcessInfo.hProcess);
-}
diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp deleted file mode 100644 index 9f2ac62434..0000000000 --- a/protocols/Skype/src/skype_services.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "skype.h"
-#include <m_chat.h>
-
-void CSkypeProto::InitServiceList()
-{
- ::CreateServiceFunction("Skype/MenuChoose", CSkypeProto::MenuChooseService);
-}
-
-void CSkypeProto::InitInstanceServiceList()
-{
- // Message API
- this->CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit);
- // Chat API
- this->CreateProtoService(PS_JOINCHAT, &CSkypeProto::OnJoinChat);
- this->CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChat);
- // Own info
- this->CreateProtoService(PS_SETMYNICKNAME, &CSkypeProto::SetMyNickName);
- // Avatar API
- this->CreateProtoService(PS_GETAVATARINFOT, &CSkypeProto::GetAvatarInfo);
- this->CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::GetAvatarCaps);
- this->CreateProtoService(PS_GETMYAVATART, &CSkypeProto::GetMyAvatar);
- this->CreateProtoService(PS_SETMYAVATART, &CSkypeProto::SetMyAvatar);
- // service to get from protocol chat buddy info
- this->CreateProtoService(MS_GC_PROTO_GETTOOLTIPTEXT, &CSkypeProto::SkypeGCGetToolTipText);
-}
diff --git a/protocols/Skype/src/skype_settings.cpp b/protocols/Skype/src/skype_settings.cpp deleted file mode 100644 index 4b4c7482c9..0000000000 --- a/protocols/Skype/src/skype_settings.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "skype_proto.h"
-
-BYTE CSkypeProto::GetSettingByte(HANDLE hContact, const char *setting, BYTE errorValue)
-{
- return ::db_get_b(hContact, this->m_szModuleName, setting, errorValue);
-}
-
-BYTE CSkypeProto::GetSettingByte(const char *setting, BYTE errorValue)
-{
- return this->GetSettingByte(NULL, setting, errorValue);
-}
-
-WORD CSkypeProto::GetSettingWord(HANDLE hContact, const char *setting, WORD errorValue)
-{
- return ::db_get_w(hContact, this->m_szModuleName, setting, errorValue);
-}
-
-WORD CSkypeProto::GetSettingWord(const char *setting, WORD errorValue)
-{
- return this->GetSettingWord(NULL, setting, errorValue);
-}
-
-DWORD CSkypeProto::GetSettingDword(HANDLE hContact, const char *setting, DWORD errorValue)
-{
- return ::db_get_dw(hContact, this->m_szModuleName, setting, errorValue);
-}
-
-DWORD CSkypeProto::GetSettingDword(const char *setting, DWORD errorValue)
-{
- return this->GetSettingDword(NULL, setting, errorValue);
-}
-
-wchar_t* CSkypeProto::GetSettingString(HANDLE hContact, const char *setting, wchar_t* errorValue)
-{
- DBVARIANT dbv = {0};
- wchar_t* result = NULL;
-
- if ( !::db_get_ws(hContact, this->m_szModuleName, setting, &dbv))
- {
- result = ::mir_wstrdup(dbv.pwszVal);
- ::db_free(&dbv);
- }
- else
- {
- result = ::mir_wstrdup(errorValue);
- }
-
- return result;
-}
-
-wchar_t* CSkypeProto::GetSettingString(const char *setting, wchar_t* errorValue)
-{
- return this->GetSettingString(NULL, setting, errorValue);
-}
-
-char* CSkypeProto::GetDecodeSettingString(HANDLE hContact, const char *setting, char* errorValue)
-{
- DBVARIANT dbv = {0};
- char* result = NULL;
-
- if ( !::db_get_s(hContact, this->m_szModuleName, setting, &dbv))
- {
- result = ::mir_strdup(dbv.pszVal);
- ::db_free(&dbv);
-
- ::CallService(
- MS_DB_CRYPT_DECODESTRING,
- ::strlen(result),
- reinterpret_cast<LPARAM>(result));
- }
- else result = ::mir_strdup(errorValue);
-
- return result;
-}
-
-//
-
-bool CSkypeProto::SetSettingByte(HANDLE hContact, const char *setting, BYTE value)
-{
- return !::db_set_b(hContact, this->m_szModuleName, setting, value);
-}
-
-bool CSkypeProto::SetSettingByte(const char *setting, BYTE errorValue)
-{
- return this->SetSettingByte(NULL, setting, errorValue);
-}
-
-bool CSkypeProto::SetSettingWord(HANDLE hContact, const char *setting, WORD value)
-{
- return !::db_set_w(hContact, this->m_szModuleName, setting, value);
-}
-
-bool CSkypeProto::SetSettingWord(const char *setting, WORD value)
-{
- return this->SetSettingWord(NULL, setting, value);
-}
-
-bool CSkypeProto::SetSettingDword(HANDLE hContact, const char *setting, DWORD value)
-{
- return !::db_set_dw(hContact, this->m_szModuleName, setting, value);
-}
-
-bool CSkypeProto::SetSettingDword(const char *setting, DWORD value)
-{
- return this->SetSettingDword(NULL, setting, value);
-}
-
-bool CSkypeProto::SetSettingString(HANDLE hContact, const char *szSetting, const wchar_t* value)
-{
- return !::db_set_ws(hContact, this->m_szModuleName, szSetting, value);
-}
-
-bool CSkypeProto::SetSettingString(const char *szSetting, const wchar_t* value)
-{
- return this->SetSettingString(NULL, szSetting, value);
-}
-
-bool CSkypeProto::SetDecodeSettingString(HANDLE hContact, const char *setting, const char* value)
-{
- if( ::strcmp(value, ""))
- {
- mir_ptr<char> result (::mir_strdup(value));
- ::CallService(MS_DB_CRYPT_ENCODESTRING, strlen(result), LPARAM((char*)result));
-
- return !db_set_s(hContact, m_szModuleName, setting, result);
- }
-
- return !this->SetSettingString(hContact, setting, L"");
-}
-
-//
-
-void CSkypeProto::DeleteSetting(const char *setting)
-{
- this->DeleteSetting(NULL, setting);
-}
-
-void CSkypeProto::DeleteSetting(HANDLE hContact, const char *setting)
-{
- ::db_unset(hContact, this->m_szModuleName, setting);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_skype.cpp b/protocols/Skype/src/skype_skype.cpp deleted file mode 100644 index 65df7f98f7..0000000000 --- a/protocols/Skype/src/skype_skype.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "skype.h"
-
-CAccount* CSkypeProto::newAccount(int oid)
-{
- return new CAccount(oid, this);
-}
-
-CContactGroup* CSkypeProto::newContactGroup(int oid)
-{
- return new CContactGroup(oid, this);
-}
-
-CContact* CSkypeProto::newContact(int oid)
-{
- return new CContact(oid, this);
-}
-
-CConversation* CSkypeProto::newConversation(int oid)
-{
- return new CConversation(oid, this);
-}
-
-CParticipant* CSkypeProto::newParticipant(int oid)
-{
- return new CParticipant(oid, this);
-}
-
-CMessage* CSkypeProto::newMessage(int oid)
-{
- return new CMessage(oid, this);
-}
-
-CTransfer* CSkypeProto::newTransfer(int oid)
-{
- return new CTransfer(oid, this);
-}
-
-CContactSearch* CSkypeProto::newContactSearch(int oid)
-{
- return new CContactSearch(oid, this);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp deleted file mode 100644 index a6f5fc5cab..0000000000 --- a/protocols/Skype/src/skype_transfers.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include "skype.h"
-
-wchar_t *CSkypeProto::TransferFailureReasons[] =
-{
- LPGENW("") /* --- */,
- LPGENW("SENDER_NOT_AUTHORIZED") /* SENDER_NOT_AUTHORISED */,
- LPGENW("REMOTELY_CANCELED") /* REMOTELY_CANCELLED */,
- LPGENW("FAILED_READ") /* FAILED_READ */,
- LPGENW("FAILED_REMOTE_READ") /* FAILED_REMOTE_READ */,
- LPGENW("FAILED_WRITE") /* FAILED_WRITE */,
- LPGENW("FAILED_REMOTE_WRITE") /* FAILED_REMOTE_WRITE */,
- LPGENW("REMOTE_DOES_NOT_SUPPORT_FT") /* REMOTE_DOES_NOT_SUPPORT_FT */,
- LPGENW("REMOTE_OFFLINE_FOR_TOO_LONG") /* REMOTE_OFFLINE_FOR_TOO_LONG */,
- LPGENW("TOO_MANY_PARALLEL") /* TOO_MANY_PARALLEL */,
- LPGENW("PLACEHOLDER_TIMEOUT") /* PLACEHOLDER_TIMEOUT */
-};
-
-void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop)
-{
- switch (prop)
- {
- case Transfer::P_STATUS:
- {
- Transfer::FAILUREREASON reason;
-
- SEBinary guid;
- transfer->GetPropChatmsgGuid(guid);
-
- MessageRef msgRef;
- this->GetMessageByGuid(guid, msgRef);
-
- uint oid = msgRef->getOID();
-
- uint fOid = transfer->getOID();
-
- Transfer::STATUS status;
- transfer->GetPropStatus(status);
- switch(status)
- {
- case Transfer::CONNECTING:
- this->SendBroadcast(this->transferts[oid].pfts.hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)oid, 0);
- break;
- case Transfer::TRANSFERRING:
- case Transfer::TRANSFERRING_OVER_RELAY:
- this->SendBroadcast(this->transferts[oid].pfts.hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)oid, 0);
- break;
- case Transfer::FAILED:
- transfer->GetPropFailurereason(reason);
- this->debugLogW(L"File transfer failed: %s", CSkypeProto::TransferFailureReasons[reason]);
- this->transferList.remove_val(transfer);
- this->transferts[oid].files[fOid].isCanceled = true;
- break;
- case Transfer::COMPLETED:
- this->transferList.remove_val(transfer);
- this->transferts[oid].files[fOid].isCompleted = true;
- this->transferts[oid].pfts.totalProgress += this->transferts[oid].files[fOid].size - this->transferts[oid].files[fOid].transfered;
- break;
- case Transfer::CANCELLED:
- case Transfer::CANCELLED_BY_REMOTE:
- transfer->GetPropFailurereason(reason);
- this->debugLogW(L"File transfer cancelled: %s", CSkypeProto::TransferFailureReasons[reason]);
- this->transferList.remove_val(transfer);
- this->transferts[oid].files[fOid].isCanceled = true;
- break;
- }
-
- int isNotAll = false;
- for (auto i = this->transferts[oid].files.begin(); i != this->transferts[oid].files.end(); i++)
- if ( !(i->second.isCanceled || i->second.isCompleted))
- {
- isNotAll = true;
- break;
- }
- if (isNotAll)
- {
- SEString data;
- uint fOid = transfer->getOID();
- transfer->GetPropBytestransferred(data);
- Sid::uint64 tb = data.toUInt64();
- this->transferts[oid].pfts.totalProgress += tb;
- this->transferts[oid].files[fOid].transfered = tb;
-
- this->SendBroadcast(this->transferts[oid].pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)oid, (LPARAM)&this->transferts[oid].pfts);
- }
- else
- {
- this->SendBroadcast(this->transferts[oid].pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)oid, 0);
- delete [] this->transferts[oid].pfts.ptszFiles;
- this->transferts.erase(this->transferts.find(oid));
- }
- }
- break;
-
- case Transfer::P_BYTESTRANSFERRED:
- {
- SEString data;
-
- SEBinary guid;
- transfer->GetPropChatmsgGuid(guid);
-
- MessageRef msgRef;
- this->GetMessageByGuid(guid, msgRef);
-
- uint oid = msgRef->getOID();
-
- uint fOid = transfer->getOID();
- transfer->GetPropBytestransferred(data);
- Sid::uint64 tb = data.toUInt64();
- this->transferts[oid].pfts.totalProgress += tb;
- this->transferts[oid].files[fOid].transfered = tb;
-
- this->SendBroadcast(this->transferts[oid].pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)oid, (LPARAM)&this->transferts[oid].pfts);
- }
- break;
- }
-}
-
-void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const MessageRef &message)
-{
- SEString data;
- Transfer::TYPE transferType;
- Transfer::STATUS transferStatus;
-
- ContactRef author;
- message->GetPropAuthor(data);
- this->GetContact(data, author);
-
- TransferRefs transfers;
- message->GetTransfers(transfers);
-
- FileTransferParam ftp;
- ftp.pfts.flags = PFTS_RECEIVING | PFTS_UNICODE;
- ftp.pfts.hContact = this->AddContact(author, true);
- ftp.pfts.totalFiles = (int)transfers.size();
- ftp.pfts.ptszFiles = new wchar_t*[transfers.size() + 1];
-
- int nifc = 0;
- for (size_t i = 0; i < transfers.size(); i++)
- {
- auto transfer = transfers[i];
-
- // For incomings, we need to check for transfer status, just to be sure.
- // In some cases, a transfer can appear with STATUS == PLACEHOLDER
- // As such transfers cannot be accepted, we will need to just store
- // the reference to Transfer Object and then check for further
- // status changes in Transfer::OnChange
- transfer->GetPropStatus(transferStatus);
- if (transferStatus == Transfer::NEW || transferStatus == Transfer::PLACEHOLDER)
- {
- transfer->GetPropType(transferType);
- if (transferType == Transfer::INCOMING)
- {
- transfer->GetPropFilename(data);
- ftp.pfts.ptszFiles[nifc++] = ::mir_utf8decodeW(data);
-
- transfer.fetch();
- this->transferList.append(transfer);
- //transfer.fetch();
-
- transfer->GetPropFilesize(data);
- Sid::uint64 size = data.toUInt64();
-
- ftp.files.insert(std::make_pair(transfer->getOID(), FileParam(size)));
- ftp.pfts.totalBytes += size;
- }
- }
- }
-
- if (nifc > 0)
- {
- uint timestamp;
- message->GetPropTimestamp(timestamp);
-
- auto oid = message->getOID();
-
- this->transferts.insert(std::make_pair(oid, ftp));
-
- PROTORECVFILET pre = {0};
- pre.flags = PREF_TCHAR;
- pre.fileCount = ftp.pfts.totalFiles;
- pre.timestamp = timestamp;
- pre.tszDescription = L"";
- pre.ptszFiles = ftp.pfts.ptszFiles;
- pre.lParam = (LPARAM)oid;
- ::ProtoChainRecvFile(ftp.pfts.hContact, &pre);
- }
- else
- {
- delete [] ftp.pfts.ptszFiles;
- }
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp deleted file mode 100644 index f8c410513d..0000000000 --- a/protocols/Skype/src/skype_utils.cpp +++ /dev/null @@ -1,542 +0,0 @@ -#include "skype.h"
-
-wchar_t *CSkypeProto::ValidationReasons[] =
-{
- LPGENW("NOT_VALIDATED") /* NOT_VALIDATED */,
- LPGENW("Validation succeeded") /* VALIDATED_OK */,
- LPGENW("Password is too short") /* TOO_SHORT */,
- LPGENW("The value exceeds max size limit for the given property") /* TOO_LONG */,
- LPGENW("Value contains illegal characters") /* CONTAINS_INVALID_CHAR */,
- LPGENW("Value contains whitespace") /* CONTAINS_SPACE */,
- LPGENW("Password cannot be the same as Skype name") /* SAME_AS_USERNAME */,
- LPGENW("Value has invalid format") /* INVALID_FORMAT */,
- LPGENW("Value contains invalid word") /* CONTAINS_INVALID_WORD */,
- LPGENW("Password is too simple") /* TOO_SIMPLE */,
- LPGENW("Value starts with an invalid character") /* STARTS_WITH_INVALID_CHAR */,
-};
-
-std::map<std::wstring, std::wstring> CSkypeProto::languages;
-
-void CSkypeProto::InitLanguages()
-{
- std::map<std::wstring, std::wstring> result;
- result[L"ab"] = L"Abkhazian";
- result[L"aa"] = L"Afar";
- result[L"af"] = L"Afrikaans";
- result[L"ak"] = L"Akan";
- result[L"sq"] = L"Albanian";
- result[L"am"] = L"Amharic";
- result[L"ar"] = L"Arabic";
- result[L"an"] = L"Aragonese";
- result[L"hy"] = L"Armenian";
- result[L"as"] = L"Assamese";
- result[L"av"] = L"Avaric";
- result[L"ae"] = L"Avestan";
- result[L"ay"] = L"Aymara";
- result[L"az"] = L"Azerbaijani";
- result[L"bm"] = L"Bambara";
- result[L"ba"] = L"Bashkir";
- result[L"eu"] = L"Basque";
- result[L"be"] = L"Belarusian";
- result[L"bn"] = L"Bengali";
- result[L"bh"] = L"Bihari languages";
- result[L"bi"] = L"Bislama";
- result[L"nb"] = L"Bokmal, Norwegian";
- result[L"bs"] = L"Bosnian";
- result[L"br"] = L"Breton";
- result[L"bg"] = L"Bulgarian";
- result[L"my"] = L"Burmese";
- result[L"es"] = L"Castilian";
- result[L"ca"] = L"Catalan";
- result[L"km"] = L"Central Khmer";
- result[L"ch"] = L"Chamorro";
- result[L"ce"] = L"Chechen";
- result[L"ny"] = L"Chewa";
- result[L"ny"] = L"Chichewa";
- result[L"zh"] = L"Chinese";
- result[L"za"] = L"Chuang";
- result[L"cu"] = L"Church Slavic";
- result[L"cu"] = L"Church Slavonic";
- result[L"cv"] = L"Chuvash";
- result[L"kw"] = L"Cornish";
- result[L"co"] = L"Corsican";
- result[L"cr"] = L"Cree";
- result[L"hr"] = L"Croatian";
- result[L"cs"] = L"Czech";
- result[L"da"] = L"Danish";
- result[L"dv"] = L"Dhivehi";
- result[L"dv"] = L"Divehi";
- result[L"nl"] = L"Dutch";
- result[L"dz"] = L"Dzongkha";
- result[L"en"] = L"English";
- result[L"eo"] = L"Esperanto";
- result[L"et"] = L"Estonian";
- result[L"ee"] = L"Ewe";
- result[L"fo"] = L"Faroese";
- result[L"fj"] = L"Fijian";
- result[L"fi"] = L"Finnish";
- result[L"nl"] = L"Flemish";
- result[L"fr"] = L"French";
- result[L"ff"] = L"Fulah";
- result[L"gd"] = L"Gaelic";
- result[L"gl"] = L"Galician";
- result[L"lg"] = L"Ganda";
- result[L"ka"] = L"Georgian";
- result[L"de"] = L"German";
- result[L"ki"] = L"Gikuyu";
- result[L"el"] = L"Greek, Modern (1453-)";
- result[L"kl"] = L"Greenlandic";
- result[L"gn"] = L"Guarani";
- result[L"gu"] = L"Gujarati";
- result[L"ht"] = L"Haitian";
- result[L"ht"] = L"Haitian Creole";
- result[L"ha"] = L"Hausa";
- result[L"he"] = L"Hebrew";
- result[L"hz"] = L"Herero";
- result[L"hi"] = L"Hindi";
- result[L"ho"] = L"Hiri Motu";
- result[L"hu"] = L"Hungarian";
- result[L"is"] = L"Icelandic";
- result[L"io"] = L"Ido";
- result[L"ig"] = L"Igbo";
- result[L"id"] = L"Indonesian";
- result[L"ia"] = L"Interlingua (International Auxiliary Language Association)";
- result[L"ie"] = L"Interlingue";
- result[L"iu"] = L"Inuktitut";
- result[L"ik"] = L"Inupiaq";
- result[L"ga"] = L"Irish";
- result[L"it"] = L"Italian";
- result[L"ja"] = L"Japanese";
- result[L"jv"] = L"Javanese";
- result[L"kl"] = L"Kalaallisut";
- result[L"kn"] = L"Kannada";
- result[L"kr"] = L"Kanuri";
- result[L"ks"] = L"Kashmiri";
- result[L"kk"] = L"Kazakh";
- result[L"ki"] = L"Kikuyu";
- result[L"rw"] = L"Kinyarwanda";
- result[L"ky"] = L"Kirghiz";
- result[L"kv"] = L"Komi";
- result[L"kg"] = L"Kongo";
- result[L"ko"] = L"Korean";
- result[L"kj"] = L"Kuanyama";
- result[L"ku"] = L"Kurdish";
- result[L"kj"] = L"Kwanyama";
- result[L"ky"] = L"Kyrgyz";
- result[L"lo"] = L"Lao";
- result[L"la"] = L"Latin";
- result[L"lv"] = L"Latvian";
- result[L"lb"] = L"Letzeburgesch";
- result[L"li"] = L"Limburgan";
- result[L"li"] = L"Limburger";
- result[L"li"] = L"Limburgish";
- result[L"ln"] = L"Lingala";
- result[L"lt"] = L"Lithuanian";
- result[L"lu"] = L"Luba-Katanga";
- result[L"lb"] = L"Luxembourgish";
- result[L"mk"] = L"Macedonian";
- result[L"mg"] = L"Malagasy";
- result[L"ms"] = L"Malay";
- result[L"ml"] = L"Malayalam";
- result[L"dv"] = L"Maldivian";
- result[L"mt"] = L"Maltese";
- result[L"gv"] = L"Manx";
- result[L"mi"] = L"Maori";
- result[L"mr"] = L"Marathi";
- result[L"mh"] = L"Marshallese";
- result[L"ro"] = L"Moldavian";
- result[L"ro"] = L"Moldovan";
- result[L"mn"] = L"Mongolian";
- result[L"na"] = L"Nauru";
- result[L"nv"] = L"Navaho";
- result[L"nv"] = L"Navajo";
- result[L"nd"] = L"Ndebele, North";
- result[L"nr"] = L"Ndebele, South";
- result[L"ng"] = L"Ndonga";
- result[L"ne"] = L"Nepali";
- result[L"nd"] = L"North Ndebele";
- result[L"se"] = L"Northern Sami";
- result[L"no"] = L"Norwegian";
- result[L"nb"] = L"Norwegian Bokmal";
- result[L"nn"] = L"Norwegian Nynorsk";
- result[L"ii"] = L"Nuosu";
- result[L"ny"] = L"Nyanja";
- result[L"nn"] = L"Nynorsk, Norwegian";
- result[L"ie"] = L"Occidental";
- result[L"oc"] = L"Occitan (post 1500)";
- result[L"oj"] = L"Ojibwa";
- result[L"cu"] = L"Old Bulgarian";
- result[L"cu"] = L"Old Church Slavonic";
- result[L"cu"] = L"Old Slavonic";
- result[L"or"] = L"Oriya";
- result[L"om"] = L"Oromo";
- result[L"os"] = L"Ossetian";
- result[L"os"] = L"Ossetic";
- result[L"pi"] = L"Pali";
- result[L"pa"] = L"Panjabi";
- result[L"ps"] = L"Pashto";
- result[L"fa"] = L"Persian";
- result[L"pl"] = L"Polish";
- result[L"pt"] = L"Portuguese";
- result[L"pa"] = L"Punjabi";
- result[L"ps"] = L"Pushto";
- result[L"qu"] = L"Quechua";
- result[L"ro"] = L"Romanian";
- result[L"rm"] = L"Romansh";
- result[L"rn"] = L"Rundi";
- result[L"ru"] = L"Russian";
- result[L"sm"] = L"Samoan";
- result[L"sg"] = L"Sango";
- result[L"sa"] = L"Sanskrit";
- result[L"sc"] = L"Sardinian";
- result[L"gd"] = L"Scottish Gaelic";
- result[L"sr"] = L"Serbian";
- result[L"sn"] = L"Shona";
- result[L"ii"] = L"Sichuan Yi";
- result[L"sd"] = L"Sindhi";
- result[L"si"] = L"Sinhala";
- result[L"si"] = L"Sinhalese";
- result[L"sk"] = L"Slovak";
- result[L"sl"] = L"Slovenian";
- result[L"so"] = L"Somali";
- result[L"st"] = L"Sotho, Southern";
- result[L"nr"] = L"South Ndebele";
- result[L"es"] = L"Spanish";
- result[L"su"] = L"Sundanese";
- result[L"sw"] = L"Swahili";
- result[L"ss"] = L"Swati";
- result[L"sv"] = L"Swedish";
- result[L"tl"] = L"Tagalog";
- result[L"ty"] = L"Tahitian";
- result[L"tg"] = L"Tajik";
- result[L"ta"] = L"Tamil";
- result[L"tt"] = L"Tatar";
- result[L"te"] = L"Telugu";
- result[L"th"] = L"Thai";
- result[L"bo"] = L"Tibetan";
- result[L"ti"] = L"Tigrinya";
- result[L"to"] = L"Tonga (Tonga Islands)";
- result[L"ts"] = L"Tsonga";
- result[L"tn"] = L"Tswana";
- result[L"tr"] = L"Turkish";
- result[L"tk"] = L"Turkmen";
- result[L"tw"] = L"Twi";
- result[L"ug"] = L"Uighur";
- result[L"uk"] = L"Ukrainian";
- result[L"ur"] = L"Urdu";
- result[L"ug"] = L"Uyghur";
- result[L"uz"] = L"Uzbek";
- result[L"ca"] = L"Valencian";
- result[L"ve"] = L"Venda";
- result[L"vi"] = L"Vietnamese";
- result[L"vo"] = L"Volapuk";
- result[L"wa"] = L"Walloon";
- result[L"cy"] = L"Welsh";
- result[L"fy"] = L"Western Frisian";
- result[L"wo"] = L"Wolof";
- result[L"xh"] = L"Xhosa";
- result[L"yi"] = L"Yiddish";
- result[L"yo"] = L"Yoruba";
- result[L"za"] = L"Zhuang";
- result[L"zu"] = L"Zulu";
-}
-
-// ---
-
-int CSkypeProto::SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
-{
- return ::ProtoBroadcastAck(this->m_szModuleName, hContact, type, result, hProcess, lParam);
-}
-
-int CSkypeProto::SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam)
-{
- return this->SendBroadcast(NULL, type, result, hProcess, lParam);
-}
-
-//
-
-int CSkypeProto::SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason)
-{
- int loginError = 0;
-
- // todo: rewrite!!
-
- switch (logoutReason)
- {
- case CAccount::SERVER_OVERLOADED:
- case CAccount::P2P_CONNECT_FAILED:
- case CAccount::SERVER_CONNECT_FAILED:
- loginError = LOGINERR_NOSERVER;
- break;
- case CAccount::HTTPS_PROXY_AUTH_FAILED:
- case CAccount::SOCKS_PROXY_AUTH_FAILED:
- loginError = LOGINERR_PROXYFAILURE;
- break;
- case CAccount::INCORRECT_PASSWORD:
- case CAccount::UNACCEPTABLE_PASSWORD:
- loginError = LOGINERR_WRONGPASSWORD;
- break;
-
- case CAccount::INVALID_APP_ID:
- loginError = 1001;
- break;
- }
-
- return loginError;
-}
-
-void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
-{
- if (::Miranda_Terminated()) return;
-
- if ( ::ServiceExists(MS_POPUP_ADDPOPUPT) && ::db_get_b(NULL, "Popup", "ModuleIsEnabled", 1))
- {
- POPUPDATAW ppd = {0};
- ppd.lchContact = hContact;
- ::wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
- ::wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE);
- ppd.lchIcon = ::Skin_GetIcon("Skype_main");
-
- if ( !::PUAddPopupW(&ppd))
- return;
-
- }
-
- ::MessageBoxW(NULL, message, caption, MB_OK | flags);
-}
-
-void CSkypeProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
-{
- CSkypeProto::ShowNotification(::TranslateT(MODULE), message, flags, hContact);
-}
-
-struct HtmlEntity
-{
- const char *entity;
- char symbol;
-};
-
-const HtmlEntity htmlEntities[]={
- {"nbsp", ' '},
- {"amp", '&'},
- {"quot", '"'},
- {"lt", '<'},
- {"gt", '>'},
- {"apos", '\''},
- {"copy", '©'},
- // TODO: add more
-};
-
-char *CSkypeProto::RemoveHtml(const char *text)
-{
- std::string new_string = "";
- std::string data = text;
-
- if (data.find("\x1b\xe3\xac\x8d\x1d") != -1)
- data = "CONVERSATION MEMBERS:" + data.substr(5, data.length() - 5);
-
- for (std::string::size_type i = 0; i < data.length(); i++)
- {
- if (data.at(i) == '<' && data.at(i+1) != ' ')
- {
- i = data.find(">", i);
- if (i == std::string::npos)
- break;
-
- continue;
- }
-
- if (data.at(i) == '&') {
- std::string::size_type begin = i;
- i = data.find(";", i);
- if (i == std::string::npos) {
- i = begin;
- } else {
- std::string entity = data.substr(begin+1, i-begin-1);
-
- bool found = false;
- for (int j=0; j<SIZEOF(htmlEntities); j++)
- {
- if (!stricmp(entity.c_str(), htmlEntities[j].entity)) {
- new_string += htmlEntities[j].symbol;
- found = true;
- break;
- }
- }
-
- if (found)
- continue;
- else
- i = begin;
- }
- }
-
- new_string += data.at(i);
- }
-
- return ::mir_strdup(new_string.c_str());
-}
-
-int CSkypeProto::SkypeToMirandaStatus(CContact::AVAILABILITY availability)
-{
- int status = ID_STATUS_OFFLINE;
-
- switch (availability)
- {
- case Contact::ONLINE:
- case Contact::SKYPE_ME:
- status = ID_STATUS_ONLINE;
- break;
-
- case Contact::ONLINE_FROM_MOBILE:
- case Contact::SKYPE_ME_FROM_MOBILE:
- status = ID_STATUS_ONTHEPHONE;
- break;
-
- case Contact::AWAY:
- case Contact::AWAY_FROM_MOBILE:
- status = ID_STATUS_AWAY;
- break;
-
- case Contact::DO_NOT_DISTURB:
- case Contact::DO_NOT_DISTURB_FROM_MOBILE:
- status = ID_STATUS_DND;
- break;
-
- case Contact::INVISIBLE:
- status = ID_STATUS_INVISIBLE;
- break;
-
- case Contact::SKYPEOUT:
- status = ID_STATUS_ONTHEPHONE;
- break;
-
- case Contact::CONNECTING:
- status = ID_STATUS_CONNECTING;
- break;
- }
-
- return status;
-}
-
-CContact::AVAILABILITY CSkypeProto::MirandaToSkypeStatus(int status)
-{
- CContact::AVAILABILITY availability = CContact::UNKNOWN;
-
- switch(status)
- {
- case ID_STATUS_ONLINE:
- availability = CContact::ONLINE;
- break;
-
- case ID_STATUS_AWAY:
- availability = CContact::AWAY;
- break;
-
- case ID_STATUS_DND:
- availability = CContact::DO_NOT_DISTURB;
- break;
-
- case ID_STATUS_INVISIBLE:
- availability = CContact::INVISIBLE;
- break;
- }
-
- return availability;
-}
-
-bool CSkypeProto::FileExists(wchar_t *path)
-{
- //return ::GetFileAttributes(fileName) != DWORD(-1)
- WIN32_FIND_DATA wfd;
- HANDLE hFind = ::FindFirstFile(path, &wfd);
- if (INVALID_HANDLE_VALUE != hFind)
- {
- ::FindClose(hFind);
- return true;
- }
- return false;
-}
-
-void CSkypeProto::CopyToClipboard(const wchar_t *text)
-{
- HWND hwnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
- ::OpenClipboard(hwnd);
- ::EmptyClipboard();
- HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(::lstrlen(text)+1));
- TCHAR *s = (TCHAR *)::GlobalLock(hMem);
- ::lstrcpy(s, text);
- ::GlobalUnlock(hMem);
- ::SetClipboardData(CF_UNICODETEXT, hMem);
- ::CloseClipboard();
-}
-
-void CSkypeProto::ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith)
-{
- if (text == NULL)
- return;
-
- wchar_t *special = L"\\/:*?\"<>|";
- for (size_t i = 0; i < ::wcslen(text); i++)
- if (::wcschr(special, text[i]) != NULL)
- text[i] = replaceWith;
-}
-
-INT_PTR CSkypeProto::ParseSkypeUri(WPARAM wParam, LPARAM lParam)
-{
- if (CSkypeProto::instanceList.getCount() == 0 || !CSkypeProto::instanceList[0]->IsOnline())
- return 1;
-
- CSkypeProto *ppro = CSkypeProto::instanceList[0];
-
- wchar_t *args = ::mir_wstrdup((wchar_t *)lParam);
- if (args == NULL)
- return 1;
- // set focus on clist
-
- wchar_t * q = ::wcschr(args, L'?');
- if (q == NULL)
- return 1;
-
- wchar_t *c = q + 1; *q = 0;
- StringList commands = StringList(c, L"&");
- StringList participants = StringList(args, L";");
- ptrW command, arg, commandAndParam;
-
- if ( !::lstrcmpiW(commands[0], L"chat"))
- ppro->ChatRoomParseUriComands(c);
- else
- {
- wchar_t message[1024];
- ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("Command \"%s\" is unsupported"), args);
- CSkypeProto::ShowNotification(message);
- return 1;
- }
-
- //for (size_t i = 1; i < commands.size(); i++)
- //{
- // command = ::mir_wstrdup(commands[i]);
- // wchar_t * p = ::wcschr(command, L'=');
- // if (p != NULL)
- // {
- // arg = p + 1;
- // *p = 0;
- // }
-
- // if ( !::lstrcmpiW(command, L"blob"))
- // {
- // ppro->JoinToChat(arg);
- // break;
- // }
- // else if ( !::lstrcmpiW(command, L"topic") && !participants.empty())
- // {
- // ChatRoomParam param(NULL, participants, ppro);
- // ::wcscpy(param.topic, arg);
- // ppro->CreateChatRoom(¶m);
- // break;
- //
- // }
- //}
-
- return 0;
-}
diff --git a/protocols/Skype/src/skypekit/account.cpp b/protocols/Skype/src/skypekit/account.cpp deleted file mode 100644 index 8ec02e08e8..0000000000 --- a/protocols/Skype/src/skypekit/account.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "..\skype.h"
-#include "account.h"
-
-CAccount::CAccount(unsigned int oid, CSkypeProto* _ppro) :
- Account(oid, _ppro),
- ppro(_ppro)
-{
-}
-
-bool CAccount::IsOnline()
-{
- CAccount::STATUS status;
- this->GetPropStatus(status);
- return status == CAccount::LOGGED_IN;
-}
-
-bool CAccount::SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result)
-{
- int fbl;
- if (!((Skype*)this->root)->ValidateAvatar(avatar, result, fbl) || result != Skype::VALIDATED_OK)
- return false;
-
- if (!this->SetBinProperty(Account::P_AVATAR_IMAGE, avatar))
- return false;
-
- return true;
-}
-
-void CAccount::OnChange(int prop)
-{
- ppro->OnAccountChanged(prop);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/account.h b/protocols/Skype/src/skypekit/account.h deleted file mode 100644 index a7128598ee..0000000000 --- a/protocols/Skype/src/skypekit/account.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class CAccount : public Account
-{
-public:
- typedef DRef<CAccount, Account> Ref;
- typedef DRefs<CAccount, Account> Refs;
-
- CAccount(unsigned int oid, CSkypeProto*);
-
- bool IsOnline();
- bool SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result);
-
-private:
- CSkypeProto* ppro;
-
- void OnChange(int prop);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/common.h b/protocols/Skype/src/skypekit/common.h deleted file mode 100644 index de00501ba3..0000000000 --- a/protocols/Skype/src/skypekit/common.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once
-
-#undef OCSP_REQUEST
-#undef OCSP_RESPONSE
-
-#include <skype-embedded_2.h>
-
-struct CSkypeProto;
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/contact.cpp b/protocols/Skype/src/skypekit/contact.cpp deleted file mode 100644 index c7a1a3247d..0000000000 --- a/protocols/Skype/src/skypekit/contact.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "..\skype.h"
-#include "contact.h"
-
-CContact::CContact(unsigned int oid, CSkypeProto* _ppro) :
- Contact(oid, _ppro),
- proto(_ppro)
-{
-}
-
-SEString CContact::GetSid()
-{
- SEString result;
- CContact::AVAILABILITY availability;
- this->GetPropAvailability(availability);
- if (availability == Contact::SKYPEOUT || availability == Contact::BLOCKED_SKYPEOUT)
- this->GetPropPstnnumber(result);
- else
- this->GetPropSkypename(result);
- return result;
-}
-
-SEString CContact::GetNick()
-{
- SEString result;
- CContact::AVAILABILITY availability;
- this->GetPropAvailability(availability);
- if (availability == CContact::SKYPEOUT)
- this->GetPropPstnnumber(result);
- else
- {
- SEString sid;
- this->GetIdentity(sid);
-
- this->GetPropDisplayname(result);
- if (this->proto && this->proto->login)
- {
- if (sid.equals(result))
- this->GetPropFullname(result);
- }
-
- if (result.size() == 0)
- result = sid;
- }
- return result;
-}
-
-bool CContact::GetFullname(SEString &firstName, SEString &lastName)
-{
- SEString fullname;
- this->GetPropFullname(fullname);
- int pos = fullname.find(" ");
- if (pos != -1)
- {
- firstName = fullname.substr(0, pos - 1);
- lastName = fullname.right((int)fullname.size() - pos - 1);
- } else
- firstName = fullname;
-
- return true;
-}
-
-void CContact::OnChange(int prop)
-{
- proto->OnContactChanged(this->ref(), prop);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/contact.h b/protocols/Skype/src/skypekit/contact.h deleted file mode 100644 index 4a79ba723d..0000000000 --- a/protocols/Skype/src/skypekit/contact.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class CContact : public Contact
-{
-public:
- typedef DRef<CContact, Contact> Ref;
- typedef DRefs<CContact, Contact> Refs;
-
- CContact(unsigned int oid, CSkypeProto*);
-
- SEString GetSid();
- SEString GetNick();
- bool GetFullname(SEString &firstName, SEString &lastName);
-
-private:
- CSkypeProto* proto;
-
- void OnChange(int prop);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/conversation.cpp b/protocols/Skype/src/skypekit/conversation.cpp deleted file mode 100644 index ff393c8efb..0000000000 --- a/protocols/Skype/src/skypekit/conversation.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "..\skype.h"
-#include "conversation.h"
-#include "..\skype_chat.h"
-
-CConversation::CConversation(unsigned int oid, SERootObject* root) :
- Conversation(oid, root)
-{
- this->room = NULL;
-}
-
-void CConversation::SetChatRoom(ChatRoom *room)
-{
- this->room = room;
-}
-
-void CConversation::OnChange(int prop)
-{
- if (this->room != NULL)
- this->room->OnChange(this->ref(), prop);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/conversation.h b/protocols/Skype/src/skypekit/conversation.h deleted file mode 100644 index 3441743328..0000000000 --- a/protocols/Skype/src/skypekit/conversation.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class ChatRoom;
-
-class CConversation : public Conversation
-{
-public:
- //typedef void (CSkypeProto::* OnConvoChanged)(const ConversationRef &conversation, int);
-
- typedef DRef<CConversation, Conversation> Ref;
- typedef DRefs<CConversation, Conversation> Refs;
-
- CConversation(unsigned int oid, SERootObject* root);
-
- void SetChatRoom(ChatRoom *room);
-
-private:
- ChatRoom *room;
-
- void OnChange(int prop);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/group.cpp b/protocols/Skype/src/skypekit/group.cpp deleted file mode 100644 index a75c43d371..0000000000 --- a/protocols/Skype/src/skypekit/group.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "..\skype.h"
-#include "group.h"
-
-CContactGroup::CContactGroup(unsigned int oid, CSkypeProto* _ppro) :
- ContactGroup(oid, _ppro),
- proto(_ppro)
-{
-}
-
-void CContactGroup::OnChange(const ContactRef &contact)
-{
- proto->OnContactListChanged(contact);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/group.h b/protocols/Skype/src/skypekit/group.h deleted file mode 100644 index 0443d203ea..0000000000 --- a/protocols/Skype/src/skypekit/group.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once
-
-#include "common.h"
-#include "contact.h"
-
-class CContactGroup : public ContactGroup
-{
-public:
- typedef void (CSkypeProto::* OnContactListChanged)(CContact::Ref contact);
-
- typedef DRef<CContactGroup, ContactGroup> Ref;
- typedef DRefs<CContactGroup, ContactGroup> Refs;
- CContactGroup(unsigned int oid, CSkypeProto*);
-
-private:
- CSkypeProto* proto;
-
- void OnChange(const ContactRef &contact);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/message.cpp b/protocols/Skype/src/skypekit/message.cpp deleted file mode 100644 index 48afa08662..0000000000 --- a/protocols/Skype/src/skypekit/message.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "..\skype.h"
-#include "message.h"
-
-CMessage::CMessage(unsigned int oid, SERootObject* root) :
- Message(oid, root)
-{
-}
diff --git a/protocols/Skype/src/skypekit/message.h b/protocols/Skype/src/skypekit/message.h deleted file mode 100644 index 6bf1eda497..0000000000 --- a/protocols/Skype/src/skypekit/message.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class CMessage : public Message
-{
-public:
- typedef DRef<CMessage, Message> Ref;
- typedef DRefs<CMessage, Message> Refs;
-
- CMessage(unsigned int oid, SERootObject* root);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/participant.cpp b/protocols/Skype/src/skypekit/participant.cpp deleted file mode 100644 index 41e183821b..0000000000 --- a/protocols/Skype/src/skypekit/participant.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "..\skype.h"
-#include "participant.h"
-#include "..\skype_chat.h"
-
-CParticipant::CParticipant(unsigned int oid, SERootObject* root) :
- Participant(oid, root)
-{
- this->room = NULL;
-}
-
-//void CParticipant::SetOnChangedCallback(OnChanged callback, ChatRoom *room)
-//{
-// this->room = room;
-// this->callback = callback;
-//}
-
-void CParticipant::SetChatRoom(ChatRoom *room)
-{
- this->room = room;
-}
-
-void CParticipant::OnChange(int prop)
-{
- if (this->room != NULL)
- this->room->OnParticipantChanged(this->ref(), prop);
- //(room->*callback)(this->ref(), prop);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/participant.h b/protocols/Skype/src/skypekit/participant.h deleted file mode 100644 index 170c14f1b7..0000000000 --- a/protocols/Skype/src/skypekit/participant.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class ChatRoom;
-
-class CParticipant : public Participant
-{
-public:
- //typedef void (ChatRoom::* OnChanged)(const ParticipantRef &participant, int);
-
- typedef DRef<CParticipant, Participant> Ref;
- typedef DRefs<CParticipant, Participant> Refs;
-
- CParticipant(unsigned int oid, SERootObject* root);
-
- //void SetOnChangedCallback(OnChanged callback, ChatRoom *room);
- void SetChatRoom(ChatRoom *room);
-
-private:
- ChatRoom *room;
- //OnChanged callback;
-
- void OnChange(int prop);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/search.cpp b/protocols/Skype/src/skypekit/search.cpp deleted file mode 100644 index f1b20563aa..0000000000 --- a/protocols/Skype/src/skypekit/search.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "..\skype.h"
-#include "search.h"
-
-CContactSearch::CContactSearch(unsigned int oid, CSkypeProto* _ppro) :
- ContactSearch(oid, _ppro),
- proto(_ppro)
-{
-}
-
-void CContactSearch::OnChange(int prop)
-{
- if (prop == P_CONTACT_SEARCH_STATUS)
- {
- CContactSearch::STATUS status;
- this->GetPropContactSearchStatus(status);
- if (status == FINISHED || status == FAILED)
- {
- this->isSeachFinished = true;
- if (this->proto)
- proto->OnSearchCompleted(this->hSearch);
- }
- }
-}
-
-void CContactSearch::OnNewResult(const ContactRef &contact, const uint &rankValue)
-{
- proto->OnContactFinded(contact, this->hSearch);
-}
-
-void CContactSearch::BlockWhileSearch()
-{
- this->isSeachFinished = false;
- this->isSeachFailed = false;
- while (!this->isSeachFinished && !this->isSeachFailed)
- Sleep(1);
-}
diff --git a/protocols/Skype/src/skypekit/search.h b/protocols/Skype/src/skypekit/search.h deleted file mode 100644 index dde9a043e3..0000000000 --- a/protocols/Skype/src/skypekit/search.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once
-
-#include "common.h"
-#include "contact.h"
-
-class CContactSearch : public ContactSearch
-{
-public:
- typedef DRef<CContactSearch, ContactSearch> Ref;
- typedef DRefs<CContactSearch, ContactSearch> Refs;
-
- bool isSeachFinished;
- bool isSeachFailed;
-
- CContactSearch(unsigned int oid, CSkypeProto* _ppro);
-
- void OnChange(int prop);
- void OnNewResult(const ContactRef &contact, const uint &rankValue);
-
- __forceinline void SetProtoInfo(HANDLE _hSearch) {
- hSearch = _hSearch;
- }
-
- void BlockWhileSearch();
-
-private:
- HANDLE hSearch;
- CSkypeProto* proto;
-};
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/transfer.cpp b/protocols/Skype/src/skypekit/transfer.cpp deleted file mode 100644 index 60a41bdcfe..0000000000 --- a/protocols/Skype/src/skypekit/transfer.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "..\skype.h"
-#include "transfer.h"
-
-CTransfer::CTransfer(unsigned int oid, CSkypeProto* _ppro) :
- Transfer(oid, _ppro),
- proto(_ppro)
-{
-}
-
-void CTransfer::OnChange(int prop)
-{
- proto->OnTransferChanged(this->ref(), prop);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skypekit/transfer.h b/protocols/Skype/src/skypekit/transfer.h deleted file mode 100644 index f01d48d328..0000000000 --- a/protocols/Skype/src/skypekit/transfer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once
-
-#include "common.h"
-
-class CTransfer : public Transfer
-{
-public:
- typedef DRef<CTransfer, Transfer> Ref;
- typedef DRefs<CTransfer, Transfer> Refs;
-
- CTransfer(unsigned int oid, CSkypeProto*);
-
-private:
- CSkypeProto* proto;
-
- void OnChange(int prop);
-};
\ No newline at end of file diff --git a/protocols/Skype/src/stdafx.cpp b/protocols/Skype/src/stdafx.cpp deleted file mode 100644 index 102b3be23c..0000000000 --- a/protocols/Skype/src/stdafx.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "skype.h"
diff --git a/protocols/Skype/src/string_list.h b/protocols/Skype/src/string_list.h deleted file mode 100644 index 7cf3b0aee7..0000000000 --- a/protocols/Skype/src/string_list.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once
-
-#include <algorithm>
-#include <vector>
-
-class StringList
-{
-private:
- std::vector<std::wstring> strings;
-
-public:
- StringList() {}
- StringList(const wchar_t* string, const wchar_t *delimeters = L" ")
- {
- wchar_t *data = ::mir_wstrdup(string);
- if (data)
- {
- wchar_t *p = ::wcstok(data, delimeters);
- if (p)
- {
- this->strings.push_back(p);
- while (p = wcstok(NULL, delimeters))
- {
- this->strings.push_back(p);
- }
- }
- ::mir_free(data);
- }
- }
- virtual ~StringList() { }
-
- __inline const wchar_t *operator[](size_t idx) const
- {
- return (idx >= 0 && idx < this->size()) ? this->strings[idx].c_str() : NULL;
- }
-
- __inline void insert(const wchar_t* p)
- {
- this->strings.push_back(::mir_wstrdup(p));
- }
-
- __inline bool contains(const wchar_t* p) const
- {
- return std::find(this->strings.begin(), this->strings.end(), p) != this->strings.end();
- }
-
- __inline size_t size() const
- {
- return this->strings.size();
- }
-
- __inline bool empty() const
- {
- return this->strings.empty();
- }
-
- __inline void clear()
- {
- this->strings.clear();
- }
-};
\ No newline at end of file diff --git a/protocols/Skype/src/version.h b/protocols/Skype/src/version.h deleted file mode 100644 index 11d4ede64f..0000000000 --- a/protocols/Skype/src/version.h +++ /dev/null @@ -1,15 +0,0 @@ -#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 11
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Skype protocol"
-#define __INTERNAL_NAME "Skype"
-#define __FILENAME "Skype.dll"
-#define __DESCRIPTION "Skype protocol support for Miranda NG."
-#define __AUTHOR "unsane, mataes, ghazan"
-#define __AUTHOREMAIL "mataes2007@gmail.com"
-#define __AUTHORWEB "http://miranda-ng.org/p/Skype/"
-#define __COPYRIGHT "© 2012-14 Miranda NG team"
|