Frameworks/libpurple.framework/Versions/0.6.2/Headers/oim.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 1739 Frameworks/libpurple.framework/Versions/0.6.0/Headers/oim.h@8b0daad9656c
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file oim.h			Header file for oim.c
     3  *	Author
     4  *		MaYuan<mayuan2006@gmail.com>
     5  * purple
     6  *
     7  * Purple is the legal property of its developers, whose names are too numerous
     8  * to list here.  Please refer to the COPYRIGHT file distributed with this
     9  * source distribution.
    10  *
    11  * This program is free software; you can redistribute it and/or modify
    12  * it under the terms of the GNU General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
    14  * (at your option) any later version.
    15  *
    16  * This program is distributed in the hope that it will be useful,
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with this program; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24  */
    25 #ifndef _MSN_OIM_H_
    26 #define _MSN_OIM_H_
    27 
    28 /* OIM Retrieval Info */
    29 #define MSN_OIM_RETRIEVE_HOST	"rsi.hotmail.com"
    30 #define MSN_OIM_RETRIEVE_URL	"/rsi/rsi.asmx"
    31 
    32 /* OIM GetMetadata SOAP Template */
    33 #define MSN_OIM_GET_METADATA_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata"
    34 
    35 #define MSN_OIM_GET_METADATA_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
    36 "<soap:Envelope"\
    37 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
    38 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
    39 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
    40 	"<soap:Header>"\
    41 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
    42 			"<t>EMPTY</t>"\
    43 			"<p>EMPTY</p>"\
    44 		"</PassportCookie>"\
    45 	"</soap:Header>"\
    46 	"<soap:Body>"\
    47 		"<GetMetadata xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\" />"\
    48 	"</soap:Body>"\
    49 "</soap:Envelope>"
    50 
    51 /*OIM GetMessage SOAP Template*/
    52 #define MSN_OIM_GET_SOAP_ACTION	"http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage"
    53 
    54 #define MSN_OIM_GET_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
    55 "<soap:Envelope"\
    56 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
    57 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
    58 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
    59 	"<soap:Header>"\
    60 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
    61 			"<t>EMPTY</t>"\
    62 			"<p>EMPTY</p>"\
    63 		"</PassportCookie>"\
    64 	"</soap:Header>"\
    65 	"<soap:Body>"\
    66 		"<GetMessage xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
    67 			"<messageId>%s</messageId>"\
    68 			"<alsoMarkAsRead>false</alsoMarkAsRead>"\
    69 		"</GetMessage>"\
    70 	"</soap:Body>"\
    71 "</soap:Envelope>"
    72 
    73 /*OIM DeleteMessages SOAP Template*/
    74 #define MSN_OIM_DEL_SOAP_ACTION	"http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages"
    75 
    76 #define MSN_OIM_DEL_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
    77 "<soap:Envelope"\
    78 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
    79 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
    80 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
    81 	"<soap:Header>"\
    82 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
    83 			"<t>EMPTY</t>"\
    84 			"<p>EMPTY</p>"\
    85 		"</PassportCookie>"\
    86 	"</soap:Header>"\
    87 	"<soap:Body>"\
    88 		"<DeleteMessages xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
    89 			"<messageIds>"\
    90 				"<messageId>%s</messageId>"\
    91 			"</messageIds>"\
    92 		"</DeleteMessages>"\
    93 	"</soap:Body>"\
    94 "</soap:Envelope>"
    95 
    96 /*OIM Send SOAP Template*/
    97 #define MSN_OIM_MSG_TEMPLATE "MIME-Version: 1.0\n"\
    98 	"Content-Type: text/plain; charset=UTF-8\n"\
    99 	"Content-Transfer-Encoding: base64\n"\
   100 	"X-OIM-Message-Type: OfflineMessage\n"\
   101 	"X-OIM-Run-Id: {%s}\n"\
   102 	"X-OIM-Sequence-Num: %d\n\n"
   103 
   104 #define MSN_OIM_SEND_HOST	"ows.messenger.msn.com"
   105 #define MSN_OIM_SEND_URL	"/OimWS/oim.asmx"
   106 #define MSN_OIM_SEND_SOAP_ACTION	"http://messenger.live.com/ws/2006/09/oim/Store2"
   107 #define MSN_OIM_SEND_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
   108 "<soap:Envelope"\
   109 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
   110 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
   111 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
   112 	"<soap:Header>"\
   113 		"<From"\
   114 			" memberName=\"%s\""\
   115 			" friendlyName=\"%s\""\
   116 			" xml:lang=\"en-US\""\
   117 			" proxy=\"MSNMSGR\""\
   118 			" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\""\
   119 			" msnpVer=\"MSNP15\""\
   120 			" buildVer=\"8.5.1288\"/>"\
   121 		"<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
   122 		"<Ticket passport=\"EMPTY\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
   123 		"<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">"\
   124 			"<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>"\
   125 			"<MessageNumber>%d</MessageNumber>"\
   126 		"</Sequence>"\
   127 	"</soap:Header>"\
   128 	"<soap:Body>"\
   129 		"<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>"\
   130 		"<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">%s</Content>"\
   131 	"</soap:Body>"\
   132 "</soap:Envelope>"
   133 
   134 typedef struct _MsnOim MsnOim;
   135 
   136 struct _MsnOim
   137 {
   138 	MsnSession *session;
   139 
   140 	GList * oim_list;
   141 
   142 	char *challenge;
   143 	char *run_id;
   144 	gint send_seq;
   145 	GQueue *send_queue;
   146 };
   147 
   148 /****************************************************
   149  * function prototype
   150  * **************************************************/
   151 MsnOim * msn_oim_new(MsnSession *session);
   152 void msn_oim_destroy(MsnOim *oim);
   153 
   154 void msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg);
   155 
   156 /*Send OIM Message*/
   157 void msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername,
   158 								const char *friendname, const char *tomember,
   159 								const char * msg);
   160 
   161 void msn_oim_send_msg(MsnOim *oim);
   162 
   163 #endif/* _MSN_OIM_H_*/