Solved a problem with MSN_STATUS_IDLE
This commit is contained in:
parent
c92a7038d0
commit
ccb2ba04e9
|
@ -57,6 +57,7 @@ int32 StartPollThread(void* punt)
|
||||||
MSN::NotificationServerConnection* mainConnection = mainClass->GetConnection();
|
MSN::NotificationServerConnection* mainConnection = mainClass->GetConnection();
|
||||||
mainConnection->connect("messenger.hotmail.com", 1863);
|
mainConnection->connect("messenger.hotmail.com", 1863);
|
||||||
while (1) {
|
while (1) {
|
||||||
|
fflush(stdout);
|
||||||
if (kPollSockets == NULL)
|
if (kPollSockets == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -272,14 +273,14 @@ MSNP::Process(BMessage* msg)
|
||||||
fMainConnection->disconnect();
|
fMainConnection->disconnect();
|
||||||
delete fMainConnection;
|
delete fMainConnection;
|
||||||
int end = fBuddyList.CountItems();
|
int end = fBuddyList.CountItems();
|
||||||
int x;
|
|
||||||
for (x=0; x != end; x++) {
|
for (int x=0; x != end; x++) {
|
||||||
MSN::Buddy contact = fBuddyList.ItemAt(x);
|
MSN::Buddy* contact = fBuddyList.ItemAt(x);
|
||||||
if (contact.lists & MSN::LST_AL ) {
|
if (contact->lists & MSN::LST_AL ) {
|
||||||
BMessage msg(IM_MESSAGE);
|
BMessage msg(IM_MESSAGE);
|
||||||
msg.AddInt32("im_what", IM_STATUS_SET);
|
msg.AddInt32("im_what", IM_STATUS_SET);
|
||||||
msg.AddString("protocol", kProtocolSignature);
|
msg.AddString("protocol", kProtocolSignature);
|
||||||
msg.AddString("id", contact.userName.c_str());
|
msg.AddString("id", contact->userName.c_str());
|
||||||
msg.AddInt32("status", CAYA_OFFLINE);
|
msg.AddInt32("status", CAYA_OFFLINE);
|
||||||
fServerMsgr->SendMessage(&msg);
|
fServerMsgr->SendMessage(&msg);
|
||||||
}
|
}
|
||||||
|
@ -314,7 +315,6 @@ MSNP::Process(BMessage* msg)
|
||||||
y = x;
|
y = x;
|
||||||
} else {
|
} else {
|
||||||
delete fSwitchboardList.ItemAt(x)->second;
|
delete fSwitchboardList.ItemAt(x)->second;
|
||||||
//delete fSwitchboardList.ItemAt(x)->first;
|
|
||||||
fSwitchboardList.RemoveItemAt(x);
|
fSwitchboardList.RemoveItemAt(x);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -513,7 +513,7 @@ void MSNP::registerSocket(void *s, int reading, int writing, bool isSSL)
|
||||||
// printf("MSNP::registerSocket %d %d %d\n", reading, writing, isSSL);
|
// printf("MSNP::registerSocket %d %d %d\n", reading, writing, isSSL);
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if (kSocketsCount == kSocketsAvailable) {
|
if (kSocketsCount == kSocketsAvailable) {
|
||||||
|
printf("allocating memory\n");
|
||||||
kPollSockets = (struct pollfd*) realloc(kPollSockets, (kSocketsAvailable + 10) * sizeof(struct pollfd));
|
kPollSockets = (struct pollfd*) realloc(kPollSockets, (kSocketsAvailable + 10) * sizeof(struct pollfd));
|
||||||
if (kPollSockets == NULL) {
|
if (kPollSockets == NULL) {
|
||||||
Error("Memory Error!!\n", NULL);
|
Error("Memory Error!!\n", NULL);
|
||||||
|
@ -646,26 +646,31 @@ void MSNP::gotBuddyListInfo(MSN::NotificationServerConnection* conn, MSN::ListSy
|
||||||
std::map<std::string, int> allContacts;
|
std::map<std::string, int> allContacts;
|
||||||
//Progress("MSN Protocol Login", "MSN Protocol: Logged in!", 0.90);
|
//Progress("MSN Protocol Login", "MSN Protocol: Logged in!", 0.90);
|
||||||
for (; i != info->contactList.end(); i++) {
|
for (; i != info->contactList.end(); i++) {
|
||||||
MSN::Buddy *contact = (*i).second;
|
MSN::Buddy contact = *(*i).second;
|
||||||
if (contact->lists & MSN::LST_AB ) {
|
if (contact.lists & MSN::LST_AB ) {
|
||||||
allContacts[contact->userName.c_str()]=0;
|
allContacts[contact.userName.c_str()]=0;
|
||||||
allContacts[contact->userName.c_str()] |= MSN::LST_AB;
|
allContacts[contact.userName.c_str()] |= MSN::LST_AB;
|
||||||
}
|
}
|
||||||
if (contact->lists & MSN::LST_AL) {
|
if (contact.lists & MSN::LST_AL) {
|
||||||
allContacts[contact->userName.c_str()] |= MSN::LST_AL;
|
allContacts[contact.userName.c_str()] |= MSN::LST_AL;
|
||||||
printf("-AL %s \n", contact->userName.c_str());
|
//printf("-AL %s \n", contact.userName.c_str());
|
||||||
fBuddyList.AddItem(*contact);
|
fBuddyList.AddItem(&contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contact->lists & MSN::LST_BL) {
|
if (contact.lists & MSN::LST_BL) {
|
||||||
allContacts[contact->userName.c_str()] |= MSN::LST_BL;
|
allContacts[contact.userName.c_str()] |= MSN::LST_BL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contact->lists & MSN::LST_RL) {
|
if (contact.lists & MSN::LST_RL) {
|
||||||
printf("-RL %s \n", contact->userName.c_str());
|
//printf("-RL %s \n", contact.userName.c_str());
|
||||||
}
|
}
|
||||||
if (contact->lists & MSN::LST_PL) {
|
if (contact.lists & MSN::LST_PL) {
|
||||||
printf("-PL %s \n", contact->userName.c_str());
|
//printf("-PL %s \n", contact.userName.c_str());
|
||||||
|
}
|
||||||
|
if (contact.lists & MSN::LST_AL) {
|
||||||
|
allContacts[contact.userName.c_str()] |= MSN::LST_AL;
|
||||||
|
//printf("-AL %s \n", contact.userName.c_str());
|
||||||
|
fBuddyList.AddItem(&contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conn->completeConnection(allContacts,info);
|
conn->completeConnection(allContacts,info);
|
||||||
|
@ -718,17 +723,17 @@ void MSNP::connectionReady(MSN::Connection * conn)
|
||||||
int end = fBuddyList.CountItems();
|
int end = fBuddyList.CountItems();
|
||||||
int x;
|
int x;
|
||||||
for (x=0; x != end; x++) {
|
for (x=0; x != end; x++) {
|
||||||
MSN::Buddy contact = fBuddyList.ItemAt(x);
|
MSN::Buddy* contact = fBuddyList.ItemAt(x);
|
||||||
if (contact.lists & MSN::LST_AL ) {
|
if (contact->lists & MSN::LST_AL) {
|
||||||
serverBased.AddString("id", contact.userName.c_str());
|
serverBased.AddString("id", contact->userName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fServerMsgr->SendMessage(&serverBased);
|
fServerMsgr->SendMessage(&serverBased);
|
||||||
|
|
||||||
for (x=0; x != end; x++) {
|
for (x=0; x != end; x++) {
|
||||||
MSN::Buddy contact = fBuddyList.ItemAt(x);
|
MSN::Buddy* contact = fBuddyList.ItemAt(x);
|
||||||
if (contact.lists & MSN::LST_AL ) {
|
if (contact->lists & MSN::LST_AL) {
|
||||||
SendContactInfo(&contact);
|
SendContactInfo(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +803,7 @@ void MSNP::buddyChangedStatus(MSN::NotificationServerConnection * conn, MSN::Pas
|
||||||
msg.AddInt32("status", CAYA_AWAY);
|
msg.AddInt32("status", CAYA_AWAY);
|
||||||
break;
|
break;
|
||||||
case MSN::STATUS_IDLE :
|
case MSN::STATUS_IDLE :
|
||||||
msg.AddInt32("status", CAYA_DO_NOT_DISTURB);
|
msg.AddInt32("status", CAYA_AWAY);
|
||||||
break;
|
break;
|
||||||
case MSN::STATUS_BUSY :
|
case MSN::STATUS_BUSY :
|
||||||
msg.AddInt32("status", CAYA_DO_NOT_DISTURB);
|
msg.AddInt32("status", CAYA_DO_NOT_DISTURB);
|
||||||
|
@ -877,16 +882,16 @@ void MSNP::buddyJoinedConversation(MSN::SwitchboardServerConnection * conn, MSN:
|
||||||
void MSNP::buddyLeftConversation(MSN::SwitchboardServerConnection * conn, MSN::Passport username)
|
void MSNP::buddyLeftConversation(MSN::SwitchboardServerConnection * conn, MSN::Passport username)
|
||||||
{
|
{
|
||||||
// printf("MSNP::buddyLeftConversation\n");
|
// printf("MSNP::buddyLeftConversation\n");
|
||||||
int x;
|
/* int x;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
count = fSwitchboardList.CountItems();
|
count = fSwitchboardList.CountItems();
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
for (x=0; x < count; x++) {
|
for (x=0; x < count; x++) {
|
||||||
if (fSwitchboardList.ItemAt(x)->second == conn) {;
|
if (fSwitchboardList.ItemAt(x)->second == conn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ private:
|
||||||
bool fSettings;
|
bool fSettings;
|
||||||
|
|
||||||
CayaProtocolMessengerInterface* fServerMsgr;
|
CayaProtocolMessengerInterface* fServerMsgr;
|
||||||
List<MSN::Buddy> fBuddyList;
|
List<MSN::Buddy*> fBuddyList;
|
||||||
List<pair<string, MSN::SwitchboardServerConnection*>*> fSwitchboardList;
|
List<pair<string, MSN::SwitchboardServerConnection*>*> fSwitchboardList;
|
||||||
MSN::NotificationServerConnection* fMainConnection;
|
MSN::NotificationServerConnection* fMainConnection;
|
||||||
// LibMSN Callbacks :
|
// LibMSN Callbacks :
|
||||||
|
|
Ŝarĝante…
Reference in New Issue