1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
#include "skype_proto.h"
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->SignInAsync(this);
}
if (loginStatus == CAccount::LOGGED_OUT)
{
CAccount::LOGOUTREASON whyLogout;
this->account->GetPropLogoutreason(whyLogout);
if (whyLogout != CAccount::LOGOUT_CALLED)
{
this->m_iStatus = ID_STATUS_OFFLINE;
this->SendBroadcast(
ACKTYPE_LOGIN,
ACKRESULT_FAILED,
NULL,
this->SkypeToMirandaLoginError(whyLogout));
this->ShowNotification(CSkypeProto::LogoutReasons[whyLogout - 1]);
if (this->rememberPassword && whyLogout == CAccount::INCORRECT_PASSWORD)
{
this->rememberPassword = false;
if (this->password)
{
::mir_free(this->password);
this->password = NULL;
}
}
}
}
break;
case CAccount::P_PWDCHANGESTATUS:
{
CAccount::PWDCHANGESTATUS status;
this->account->GetPropPwdchangestatus(status);
if (status != CAccount::PWD_CHANGING)
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 CAccount::P_AVAILABILITY:
{
CContact::AVAILABILITY status;
this->account->GetPropAvailability(status);
if (status != CContact::CONNECTING && status >= CContact::ONLINE)
this->SetStatus(this->SkypeToMirandaStatus(status));
}
break;*/
}
}
bool CSkypeProto::IsOnline()
{
return this->m_iStatus > ID_STATUS_OFFLINE;
}
void __cdecl CSkypeProto::SignInAsync(void*)
{
if ( !this->rememberPassword)
{
::mir_free(this->password);
this->password = NULL;
}
else
{
::CallService(MS_DB_CRYPT_ENCODESTRING, ::strlen(this->password), LPARAM(this->password));
}
this->LoadOwnInfo(this);
this->LoadContactList(this);
this->SetStatus(this->m_iDesiredStatus);
}
bool CSkypeProto::SignIn(int status)
{
this->login = ::DBGetString(NULL, this->m_szModuleName, SKYPE_SETTINGS_LOGIN);
if ( !this->login || !::strlen(this->login))
{
this->m_iStatus = ID_STATUS_OFFLINE;
this->SendBroadcast(ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
this->ShowNotification(
TranslateT("You have not entered a Skype name.\n\
Configure this in Options->Network->Skype and try again."));
}
else if (this->skype->GetAccount(this->login, this->account))
{
if ( !this->rememberPassword)
{
if (this->password)
{
::mir_free(this->password);
this->password = NULL;
}
this->password = ::DBGetString(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;
}
}
else ::CallService(MS_DB_CRYPT_DECODESTRING, ::strlen(this->password), LPARAM(this->password));
}
this->account.fetch();
this->account->SetOnAccountChangedCallback(
(CAccount::OnAccountChanged)&CSkypeProto::OnAccountChanged,
this);
int port = this->GetSettingWord("Port", rand() % 10000 + 10000);
this->skype->SetInt(SETUPKEY_PORT, port);
this->skype->SetInt(SETUPKEY_DISABLE_PORT80, (int)!this->GetSettingByte("UseAlternativePorts", 1));
this->InitProxy();
this->account->LoginWithPassword(this->password, false, false);
return true;
}
return false;
}
|