Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/oim.h
branchadium-1.5.11-merge
changeset 6013 f8d0dc659e3f
parent 5941 307f53385811
parent 6012 200a01709ba4
child 6014 fcb71cb71a3d
child 6015 2b01cc935b7c
equal deleted inserted replaced
5941:307f53385811 6013:f8d0dc659e3f
     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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,  USA
       
    24  */
       
    25 #ifndef MSN_OIM_H
       
    26 #define MSN_OIM_H
       
    27 
       
    28 typedef struct _MsnOim MsnOim;
       
    29 
       
    30 /* OIM Retrieval Info */
       
    31 #define MSN_OIM_RETRIEVE_HOST	"rsi.hotmail.com"
       
    32 #define MSN_OIM_RETRIEVE_URL	"/rsi/rsi.asmx"
       
    33 
       
    34 /* OIM GetMetadata SOAP Template */
       
    35 #define MSN_OIM_GET_METADATA_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata"
       
    36 
       
    37 #define MSN_OIM_GET_METADATA_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
       
    38 "<soap:Envelope"\
       
    39 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
       
    40 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
       
    41 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
       
    42 	"<soap:Header>"\
       
    43 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
       
    44 			"<t>EMPTY</t>"\
       
    45 			"<p>EMPTY</p>"\
       
    46 		"</PassportCookie>"\
       
    47 	"</soap:Header>"\
       
    48 	"<soap:Body>"\
       
    49 		"<GetMetadata xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\" />"\
       
    50 	"</soap:Body>"\
       
    51 "</soap:Envelope>"
       
    52 
       
    53 /*OIM GetMessage SOAP Template*/
       
    54 #define MSN_OIM_GET_SOAP_ACTION	"http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage"
       
    55 
       
    56 #define MSN_OIM_GET_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
       
    57 "<soap:Envelope"\
       
    58 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
       
    59 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
       
    60 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
       
    61 	"<soap:Header>"\
       
    62 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
       
    63 			"<t>EMPTY</t>"\
       
    64 			"<p>EMPTY</p>"\
       
    65 		"</PassportCookie>"\
       
    66 	"</soap:Header>"\
       
    67 	"<soap:Body>"\
       
    68 		"<GetMessage xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
       
    69 			"<messageId>%s</messageId>"\
       
    70 			"<alsoMarkAsRead>false</alsoMarkAsRead>"\
       
    71 		"</GetMessage>"\
       
    72 	"</soap:Body>"\
       
    73 "</soap:Envelope>"
       
    74 
       
    75 /*OIM DeleteMessages SOAP Template*/
       
    76 #define MSN_OIM_DEL_SOAP_ACTION	"http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages"
       
    77 
       
    78 #define MSN_OIM_DEL_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
       
    79 "<soap:Envelope"\
       
    80 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
       
    81 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
       
    82 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
       
    83 	"<soap:Header>"\
       
    84 		"<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
       
    85 			"<t>EMPTY</t>"\
       
    86 			"<p>EMPTY</p>"\
       
    87 		"</PassportCookie>"\
       
    88 	"</soap:Header>"\
       
    89 	"<soap:Body>"\
       
    90 		"<DeleteMessages xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
       
    91 			"<messageIds>"\
       
    92 				"<messageId>%s</messageId>"\
       
    93 			"</messageIds>"\
       
    94 		"</DeleteMessages>"\
       
    95 	"</soap:Body>"\
       
    96 "</soap:Envelope>"
       
    97 
       
    98 /*OIM Send SOAP Template*/
       
    99 #define MSN_OIM_MSG_TEMPLATE "MIME-Version: 1.0\n"\
       
   100 	"Content-Type: text/plain; charset=UTF-8\n"\
       
   101 	"Content-Transfer-Encoding: base64\n"\
       
   102 	"X-OIM-Message-Type: OfflineMessage\n"\
       
   103 	"X-OIM-Run-Id: {%s}\n"\
       
   104 	"X-OIM-Sequence-Num: %d\n\n"
       
   105 
       
   106 #define MSN_OIM_SEND_HOST	"ows.messenger.msn.com"
       
   107 #define MSN_OIM_SEND_URL	"/OimWS/oim.asmx"
       
   108 #define MSN_OIM_SEND_SOAP_ACTION	"http://messenger.live.com/ws/2006/09/oim/Store2"
       
   109 #define MSN_OIM_SEND_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
       
   110 "<soap:Envelope"\
       
   111 	" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\
       
   112 	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\
       
   113 	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\
       
   114 	"<soap:Header>"\
       
   115 		"<From"\
       
   116 			" memberName=\"%s\""\
       
   117 			" friendlyName=\"%s\""\
       
   118 			" xml:lang=\"en-US\""\
       
   119 			" proxy=\"MSNMSGR\""\
       
   120 			" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\""\
       
   121 			" msnpVer=\"MSNP15\""\
       
   122 			" buildVer=\"8.5.1288\"/>"\
       
   123 		"<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
       
   124 		"<Ticket passport=\"EMPTY\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
       
   125 		"<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">"\
       
   126 			"<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>"\
       
   127 			"<MessageNumber>%d</MessageNumber>"\
       
   128 		"</Sequence>"\
       
   129 	"</soap:Header>"\
       
   130 	"<soap:Body>"\
       
   131 		"<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>"\
       
   132 		"<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">%s</Content>"\
       
   133 	"</soap:Body>"\
       
   134 "</soap:Envelope>"
       
   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*/