Lamarque Vieira Souza wrote:
Hi there,
Is anyone working on implementing hotmail mail notification in WLM plugin? If
no I would like to implement it. But I need some information about how libmsn
work and if it implements all the mail notification protocol. I see in
msntest.cpp some functions related to mail notification but no command to test
it in the handle_command function. By the way, there is a bug report about
this missing feature here https://bugs.kde.org/show_bug.cgi?id=163225
Hello,
there are two callbacks for email notification for now:
------------
virtual void
gotInitialEmailNotification(MSN::NotificationServerConnection * conn,
int msgs_inbox, int unread_inbox, int msgs_folders, int unread_folders) = 0;
virtual void gotNewEmailNotification(MSN::NotificationServerConnection *
conn, std::string from, std::string subject) = 0;
-------------
the first one (gotInitialEmailNotification()) is called only once, and
inform the application how many emails unread you have in your inbox
(and some other info that I dont remember now :)
the second one (gotNewEmailNotification()) is called as soon as you
receive a new email, and provides only the sender and the subject.
You need to emit a signal in wlmlibmsn.cpp when these callbacks are
called, and connect these signals to slots in wlmaccount.cpp, that will
manage the email information.
Another thing that should be implemented is to request the hotmail inbox
url from the server.
I've started the patch for libmsn but never finished. Feel free to
finish it if you want.
The "half-patch" is attached.
You can contact me if you need more information.
Tiago Salem Herrmann
Index: msn/notificationserver.cpp
===================================================================
--- msn/notificationserver.cpp (revision 78)
+++ msn/notificationserver.cpp (working copy)
@@ -354,6 +354,15 @@
msg = this->readBuffer.substr(0, msglen);
this->readBuffer = this->readBuffer.substr(msglen);
}
+
+ void NotificationServerConnection::callback_URL(std::vector<std::string> &
args, int trid, void *data)
+ {
+ this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+
+ std::string msg;
+ std::string url = args[2];
+ std::cout << url << std::endl;
+ }
void NotificationServerConnection::handle_MSG(std::vector<std::string> &
args)
{
@@ -1677,4 +1686,14 @@
{
this->m_clientId = m_clientId;
}
+
+ void NotificationServerConnection::getInboxUrl()
+ {
+ this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+ std::ostringstream buf_;
+ buf_ << "URL " << this->trID++ << " INBOX\r\n";
+ write(buf_);
+
+ this->addCallback(&NotificationServerConnection::callback_URL,
this->trID++, NULL);
+ }
}
Index: msn/notificationserver.h
===================================================================
--- msn/notificationserver.h (revision 78)
+++ msn/notificationserver.h (working copy)
@@ -334,6 +334,8 @@
/** Send an Offline Instant Message
*/
void send_oim(Soap::OIM oim);
+
+ void getInboxUrl();
/* when we have to send more than 1 ADL command, we need to keep this
here to track */
std::list<std::string> adl_packets;
@@ -513,6 +515,7 @@
void handle_ADL(std::vector<std::string> & args);
void handle_UBN(std::vector<std::string> & args);
void handle_FQY(std::vector<std::string> & args);
+ void handle_URL(std::vector<std::string> & args);
void callback_NegotiateCVR(std::vector<std::string> & args, int trid,
void *data);
void callback_TransferToSwitchboard(std::vector<std::string> & args,
int trid, void *data);
@@ -520,6 +523,7 @@
void callback_PassportAuthentication(std::vector<std::string> & args,
int trid, void * data);
void callback_AuthenticationComplete(std::vector<std::string> & args,
int trid, void * data);
void callback_initialBPL(std::vector<std::string> & args, int trid,
void *data);
+ void callback_URL(std::vector<std::string> & args, int trid, void
*data);
void message_initial_email_notification(std::vector<std::string> &
args, std::string mime, std::string body);
Index: msntest/msntest.cpp
===================================================================
--- msntest/msntest.cpp (revision 78)
+++ msntest/msntest.cpp (working copy)
@@ -541,6 +541,8 @@
mainConnection.connect("messenger.hotmail.com", 1863);
} else if (!strcmp(command, "disconnect")) {
mainConnection.disconnectNS();
+ } else if (!strcmp(command, "inboxurl")) {
+ mainConnection.getInboxUrl();
} else {
fprintf(stderr, "\nBad command \"%s\"", command);
}
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel