momoving msn plugin to caya gpl plugins subproject
This commit is contained in:
parent
dc31fbfd67
commit
297fd986f8
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _LIST_H
|
||||
#define _LIST_H
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
template<class T>
|
||||
class List {
|
||||
public:
|
||||
uint32 CountItems() const;
|
||||
|
||||
void AddItem(T type);
|
||||
|
||||
void RemoveItemAt(uint32 position);
|
||||
|
||||
T ItemAt(uint32 position);
|
||||
|
||||
private:
|
||||
std::list<T> fList;
|
||||
typedef typename std::list<T>::iterator fIter;
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
uint32 List<T>::CountItems() const
|
||||
{
|
||||
return fList.size();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void List<T>::AddItem(T type)
|
||||
{
|
||||
fList.push_back(type);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void List<T>::RemoveItemAt(uint32 position)
|
||||
{
|
||||
fIter i = fList.begin();
|
||||
std::advance(i, position);
|
||||
fList.erase(i);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T List<T>::ItemAt(uint32 position)
|
||||
{
|
||||
fIter i = fList.begin();
|
||||
std::advance(i, position);
|
||||
return *i;
|
||||
}
|
||||
|
||||
#endif // _LIST_H
|
|
@ -0,0 +1,20 @@
|
|||
SubDir TOP protocols msn ;
|
||||
|
||||
SubDirSysHdrs [ FDirName $(TOP) ] ;
|
||||
SubDirSysHdrs [ FDirName $(TOP) libs ] ;
|
||||
SubDirSysHdrs [ FDirName $(TOP) libs libmsn ] ;
|
||||
SubDirSysHdrs [ FDirName $(OPENSSL_INCLUDE_DIR) ] ;
|
||||
SubDirSysHdrs [ FDirName $(CAYA_INCLUDE_DIR) ] ;
|
||||
|
||||
AddOn msn :
|
||||
main.cpp
|
||||
MSN.cpp
|
||||
: be root $(TARGET_LIBSTDC++) ssl crypto network bnetapi libmsn.a
|
||||
: msn.rdef SettingsTemplate.rdef
|
||||
;
|
||||
|
||||
Depends msn : libmsn.a ;
|
||||
|
||||
LINKFLAGS on msn += -L$(OPENSSL_LIBRARY_DIR) ;
|
||||
|
||||
InstallBin $(CAYA_DIRECTORY)/protocols : msn ;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,258 @@
|
|||
/*
|
||||
* Copyright 2010, Dario Casalinuovo. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef IMKIT_MSNP_H
|
||||
#define IMKIT_MSNP_H
|
||||
|
||||
//#include <list>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <OS.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <libsupport/List.h>
|
||||
#include <CayaProtocol.h>
|
||||
#include <CayaConstants.h>
|
||||
#include <CayaProtocolMessages.h>
|
||||
|
||||
#include <msn.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MSNP : public MSN::Callbacks, public CayaProtocol {
|
||||
public:
|
||||
|
||||
MSNP();
|
||||
virtual ~MSNP();
|
||||
|
||||
virtual status_t Init(CayaProtocolMessengerInterface*);
|
||||
|
||||
virtual status_t Shutdown();
|
||||
|
||||
virtual status_t Process(BMessage *);
|
||||
|
||||
virtual const char * Signature() const;
|
||||
virtual const char * FriendlySignature() const;
|
||||
|
||||
virtual status_t UpdateSettings(BMessage *);
|
||||
|
||||
virtual uint32 GetEncoding();
|
||||
|
||||
virtual CayaProtocolMessengerInterface* MessengerInterface() const { return fServerMsgr; }
|
||||
virtual MSN::NotificationServerConnection* GetConnection() const { return fMainConnection; }
|
||||
virtual uint32 Version() const;
|
||||
|
||||
void Error(const char* message, const char* who);
|
||||
void Progress(const char* id, const char* message, float progress);
|
||||
void SendContactInfo(MSN::Buddy*);
|
||||
void MessageFromBuddy(const char* mess, const char* id);
|
||||
|
||||
;
|
||||
private:
|
||||
|
||||
thread_id fPollThread;
|
||||
bool fLogged;
|
||||
BString fServer;
|
||||
string fUsername;
|
||||
BString fPassword;
|
||||
uint fClientID;
|
||||
string fNickname;
|
||||
|
||||
bool fSettings;
|
||||
|
||||
CayaProtocolMessengerInterface* fServerMsgr;
|
||||
List<MSN::Buddy> fBuddyList;
|
||||
List<pair<string, MSN::SwitchboardServerConnection*>*> fSwitchboardList;
|
||||
MSN::NotificationServerConnection* fMainConnection;
|
||||
// LibMSN Callbacks :
|
||||
virtual void registerSocket(void* s, int read, int write, bool isSSL);
|
||||
|
||||
virtual void unregisterSocket(void* s);
|
||||
|
||||
virtual void closeSocket(void* s);
|
||||
|
||||
virtual void showError(MSN::Connection* conn, std::string msg);
|
||||
|
||||
virtual void buddyChangedStatus(MSN::NotificationServerConnection* conn,
|
||||
MSN::Passport buddy, std::string friendlyname, MSN::BuddyStatus state,
|
||||
unsigned int clientID, std::string msnobject);
|
||||
|
||||
virtual void buddyOffline(MSN::NotificationServerConnection* conn,
|
||||
MSN::Passport buddy);
|
||||
|
||||
virtual void log(int writing, const char* buf);
|
||||
|
||||
virtual void buddyChangedPersonalInfo(MSN::NotificationServerConnection* conn,
|
||||
MSN::Passport fromPassport, MSN::personalInfo);
|
||||
|
||||
virtual void gotFriendlyName(MSN::NotificationServerConnection* conn,
|
||||
std::string friendlyname);
|
||||
|
||||
virtual void gotBuddyListInfo(MSN::NotificationServerConnection* conn,
|
||||
MSN::ListSyncInfo* data);
|
||||
|
||||
virtual void gotLatestListSerial(MSN::NotificationServerConnection* conn,
|
||||
std::string lastChange);
|
||||
|
||||
virtual void gotGTC(MSN::NotificationServerConnection* conn, char c);
|
||||
|
||||
virtual void gotBLP(MSN::NotificationServerConnection* conn, char c);
|
||||
|
||||
virtual void addedListEntry(MSN::NotificationServerConnection* conn,
|
||||
MSN::ContactList list, MSN::Passport buddy, std::string friendlyname);
|
||||
|
||||
virtual void removedListEntry(MSN::NotificationServerConnection* conn,
|
||||
MSN::ContactList list, MSN::Passport buddy);
|
||||
|
||||
virtual void addedGroup(MSN::NotificationServerConnection* conn,
|
||||
bool added, std::string groupName, std::string groupID);
|
||||
|
||||
virtual void removedGroup(MSN::NotificationServerConnection* conn,
|
||||
bool removed, std::string groupID);
|
||||
|
||||
virtual void renamedGroup(MSN::NotificationServerConnection* conn,
|
||||
bool renamed, std::string newGroupName, std::string groupID);
|
||||
|
||||
virtual void addedContactToGroup(MSN::NotificationServerConnection* conn,
|
||||
bool added, std::string groupId, std::string contactId);
|
||||
|
||||
virtual void removedContactFromGroup(MSN::NotificationServerConnection* conn,
|
||||
bool removed, std::string groupId, std::string contactId);
|
||||
|
||||
virtual void addedContactToAddressBook(MSN::NotificationServerConnection* conn,
|
||||
bool added, std::string passport, std::string displayName, std::string guid);
|
||||
|
||||
virtual void removedContactFromAddressBook(MSN::NotificationServerConnection* conn,
|
||||
bool removed, std::string contactId, std::string passport);
|
||||
|
||||
virtual void enabledContactOnAddressBook(MSN::NotificationServerConnection* conn,
|
||||
bool enabled, std::string contactId, std::string passport);
|
||||
virtual void disabledContactOnAddressBook(MSN::NotificationServerConnection* conn,
|
||||
bool disabled, std::string contactId);
|
||||
|
||||
virtual void gotSwitchboard(MSN::SwitchboardServerConnection* conn, const void* tag);
|
||||
|
||||
virtual void buddyJoinedConversation(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport buddy, std::string friendlyname, int is_initial);
|
||||
|
||||
virtual void buddyLeftConversation(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport buddy);
|
||||
|
||||
virtual void gotInstantMessage(MSN::SwitchboardServerConnection * conn,
|
||||
MSN::Passport buddy, std::string friendlyname, MSN::Message* msg);
|
||||
|
||||
virtual void gotMessageSentACK(MSN::SwitchboardServerConnection * conn, int trID);
|
||||
|
||||
virtual void gotEmoticonNotification(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport buddy, std::string alias, std::string msnobject);
|
||||
|
||||
virtual void failedSendingMessage(MSN::Connection * conn);
|
||||
|
||||
virtual void buddyTyping(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport buddy, std::string friendlyname);
|
||||
|
||||
virtual void gotNudge(MSN::SwitchboardServerConnection* conn, MSN::Passport from);
|
||||
|
||||
virtual void gotVoiceClipNotification(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport from, std::string msnobject);
|
||||
|
||||
virtual void gotWinkNotification(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport from, std::string msnobject);
|
||||
|
||||
virtual void gotInk(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport from, std::string image);
|
||||
|
||||
virtual void gotVoiceClipFile(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, std::string file);
|
||||
|
||||
virtual void gotEmoticonFile(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, std::string alias, std::string file);
|
||||
|
||||
virtual void gotWinkFile(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, std::string file);
|
||||
|
||||
virtual void gotActionMessage(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport username, std::string message);
|
||||
|
||||
virtual void gotInitialEmailNotification(MSN::NotificationServerConnection* conn,
|
||||
int msgs_inbox, int unread_inbox, int msgs_folders, int unread_folders);
|
||||
|
||||
virtual void gotNewEmailNotification(MSN::NotificationServerConnection* conn,
|
||||
std::string from, std::string subject);
|
||||
|
||||
virtual void fileTransferProgress(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, long long unsigned transferred, long long unsigned total);
|
||||
|
||||
virtual void fileTransferFailed(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, MSN::fileTransferError error);
|
||||
|
||||
virtual void fileTransferSucceeded(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID);
|
||||
|
||||
virtual void fileTransferInviteResponse(MSN::SwitchboardServerConnection* conn,
|
||||
unsigned int sessionID, bool response);
|
||||
|
||||
virtual void gotNewConnection(MSN::Connection* conn);
|
||||
|
||||
virtual void gotOIMList(MSN::NotificationServerConnection* conn,
|
||||
std::vector<MSN::eachOIM> OIMs);
|
||||
|
||||
virtual void gotOIM(MSN::NotificationServerConnection* conn,
|
||||
bool success, std::string id, std::string message);
|
||||
|
||||
virtual void gotOIMSendConfirmation(MSN::NotificationServerConnection* conn,
|
||||
bool success, int id);
|
||||
|
||||
virtual void gotOIMDeleteConfirmation(MSN::NotificationServerConnection* conn,
|
||||
bool success, std::string id);
|
||||
|
||||
virtual void gotContactDisplayPicture(MSN::SwitchboardServerConnection* conn,
|
||||
MSN::Passport passport, std::string filename);
|
||||
|
||||
virtual void closingConnection(MSN::Connection* conn);
|
||||
|
||||
virtual void changedStatus(MSN::NotificationServerConnection* conn,
|
||||
MSN::BuddyStatus state);
|
||||
|
||||
virtual void* connectToServer(std::string server, int port,
|
||||
bool* connected, bool isSSL);
|
||||
|
||||
virtual void connectionReady(MSN::Connection* conn);
|
||||
|
||||
virtual void askFileTransfer(MSN::SwitchboardServerConnection*conn,
|
||||
MSN::fileTransferInvite ft);
|
||||
|
||||
virtual int listenOnPort(int port);
|
||||
|
||||
virtual std::string getOurIP();
|
||||
|
||||
virtual int getSocketFileDescriptor (void* sock);
|
||||
|
||||
virtual size_t getDataFromSocket (void* sock, char* data, size_t size);
|
||||
|
||||
virtual size_t writeDataToSocket (void* sock, char* data, size_t size);
|
||||
|
||||
virtual std::string getSecureHTTPProxy();
|
||||
virtual void gotInboxUrl (MSN::NotificationServerConnection *conn,
|
||||
MSN::hotmailInfo info);
|
||||
};
|
||||
|
||||
extern const char* kProtocolName;
|
||||
extern const char* kProtocolSignature;
|
||||
|
||||
#endif // IMKIT_MSNP_H
|
|
@ -0,0 +1,19 @@
|
|||
resource(1000) message('IMst') {
|
||||
"setting" = message {
|
||||
"name" = "username",
|
||||
"description" = "Username",
|
||||
int32 "type" = 'CSTR'
|
||||
},
|
||||
"setting" = message {
|
||||
"name" = "password",
|
||||
"description" = "Password",
|
||||
int32 "type" = 'CSTR',
|
||||
"is_secret" = true
|
||||
},
|
||||
"setting" = message {
|
||||
"name" = "resource",
|
||||
"description" = "Resource",
|
||||
int32 "type" = 'CSTR',
|
||||
"default" = "Caya"
|
||||
}
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
#include "MSN.h"
|
||||
|
||||
extern "C" __declspec(dllexport) CayaProtocol* protocol();
|
||||
extern "C" __declspec(dllexport) const char* signature();
|
||||
extern "C" __declspec(dllexport) const char* friendly_signature();
|
||||
|
||||
CayaProtocol*
|
||||
protocol()
|
||||
{
|
||||
return (CayaProtocol*)new MSNP();
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
signature()
|
||||
{
|
||||
return kProtocolSignature;
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
friendly_signature()
|
||||
{
|
||||
return kProtocolName;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
resource app_version {
|
||||
major = 0,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_ALPHA,
|
||||
internal = 0,
|
||||
|
||||
short_info = "MSN Messenger Protocol for Caya",
|
||||
long_info = "©2009-2010 Dario Casalinuovo"
|
||||
};
|
||||
|
||||
resource vector_icon {
|
||||
$"6E636966070200060238C0BEBA7E0B3A7E0B38C0BE48D8C64A1C0A0194CBEED9"
|
||||
$"007FC50200060239209E39209EB9209E39209E487FFF4AEBEC00007FC58800A9"
|
||||
$"4F02000603B97CC8BA70F23A70F2B97CC84AA9AE4AE5EA0000A94F7B61BD65FF"
|
||||
$"A1D07E02000602B44F83BABC1B3ABC1BB44F834BC9BA4AC8C100F4A6567EFCCA"
|
||||
$"25020006023B48000000000000003B64004AE0004B00004AF4A656FFE95A2F02"
|
||||
$"0006023C00000000000000003C00004AE0004A400004F4A65689E95A2F020106"
|
||||
$"02360EABB34A1839C88F3C5DC44A10924A42F8FF3E5BA6006D7CBC070206BE5F"
|
||||
$"BEBDBBAFBF6FBE4EBE66BE35BDBABE40BE0FBBFABBA5B635B92BB8BDB9EAB57A"
|
||||
$"B8F4B418B958B493B8D1B3B631B443BB93B3D3BA96B5C3BEFEBB42C4BEB888C2"
|
||||
$"9FBAA9C1E90207C048C43FC05AC460BF74C2D1BE5FBEBDBEBEC0B9BBAFBF6FBB"
|
||||
$"42C4BEBAA9C1E9BB42C4BFBB42C4BEBB42C4BEBB9DC505BC53C574BC04C54BBD"
|
||||
$"C5C635BF8DC597BEBAC60FBFE2C568C082C4A0C04C4DC06FC4800209BF8DC597"
|
||||
$"BFE2C568BEBAC60FBC53C574BDC5C635BC04C54BBB42C4BEBB9DC505BB42C4BE"
|
||||
$"BB42C4BEBB42C4BFBC5CC791C03DCAC8BE07C995C0A2CAFDC163CADDC101CB0D"
|
||||
$"C1A6CABDC1DECA48C1CBCA73C237C974C277C71DC262C875C1B8C659C082C4A0"
|
||||
$"C110C583C04C4D0208CA79C0F3CB37C44DCA3FC192C99BC2C1CA0BC206C8F2C3"
|
||||
$"DAC66CC4A8C7C5C482C531C4CBC22EC409C386C490C263C507C277C71DC27CC6"
|
||||
$"0FC36BC80CC5CCC981C48AC8E0C604C99DC688C9B0C64AC9B0C6E8C9B0C792C9"
|
||||
$"4BC742C98BC9D0C7820206BFD5BE3CC2D7BD02C0D4BFF0C20BC373C1A6C1E6C2"
|
||||
$"18C3A4C22EC409C223C3D7C386C490C66CC4A8C531C4CBC7C5C482C99BC2C1C8"
|
||||
$"F2C3DACA0BC206CA79C0F3CA3FC192C854BCF90206CAC1B705CC42BA33CA8AB6"
|
||||
$"90C9C127CA2CB60BC8F1B54CC6EAB5D1C7ECB556C3B7B759BF54BD6CC05BBA16"
|
||||
$"BF80BDAFBFD5BE3CBFABBDF5C2D7BD02CA79C0F3C854BCF9CB85BE0F0206BE31"
|
||||
$"BD99BE7ABFE3BE27BD3FBE79BCD6BE3CBCEDBEB1BCC0BF28BD2BBEF9BCE4C074"
|
||||
$"BF0FC20BC373C190C191C258C49EC277C71DC27DC5D9C19DC63EC048C43FC0E1"
|
||||
$"C547BF4947070A000100000A010101000A020102000A030103000A040104000A"
|
||||
$"050105000A06010600"
|
||||
};
|
Ŝarĝante…
Reference in New Issue