changeset 23490:fd276936164f

Make errors when sending OIM's more visible. Also, msn_session_report_user doesn't modify msg, so it can be const. References #5379.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 20 Jun 2008 05:36:18 +0000
parents 20da64b2e104
children f3922a72eb02
files libpurple/protocols/msn/oim.c libpurple/protocols/msn/session.c libpurple/protocols/msn/session.h
diffstat 3 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/oim.c	Fri Jun 20 05:15:49 2008 +0000
+++ b/libpurple/protocols/msn/oim.c	Fri Jun 20 05:36:18 2008 +0000
@@ -333,6 +333,32 @@
 						g_queue_push_head(oim->send_queue, msg);
 						msn_oim_send_msg(oim);
 					}
+				} else {
+					/* Report the error */
+					const char *str_reason;
+
+					if (g_str_equal(faultcode_str, "q0:SystemUnavailable")) {
+						str_reason = _("Message was not sent because the system is "
+						               "unavailable. This normally happens when the "
+						               "user is blocked or does not exist.");
+
+					} else if (g_str_equal(faultcode_str, "q0:SenderThrottleLimitExceeded")) {
+						str_reason = _("Message was not sent because messages "
+						               "are being sent too quickly.");
+
+					} else if (g_str_equal(faultcode_str, "q0:InvalidContent")) {
+						str_reason = _("Message was not sent because an unknown "
+						               "encoding error occured.");
+
+					} else {
+						str_reason = _("Message was not sent because an unknown "
+						               "error occured.");
+					}
+					
+					msn_session_report_user(oim->session, msg->to_member, 
+						str_reason, PURPLE_MESSAGE_ERROR);
+					msn_session_report_user(oim->session, msg->to_member,
+						msg->oim_msg, PURPLE_MESSAGE_RAW);
 				}
 
 				g_free(faultcode_str);
--- a/libpurple/protocols/msn/session.c	Fri Jun 20 05:15:49 2008 +0000
+++ b/libpurple/protocols/msn/session.c	Fri Jun 20 05:36:18 2008 +0000
@@ -192,7 +192,7 @@
  * 	passport - the one want to talk to you
  */
 void
-msn_session_report_user(MsnSession *session,const char *passport,char *msg,PurpleMessageFlags flags)
+msn_session_report_user(MsnSession *session,const char *passport,const char *msg,PurpleMessageFlags flags)
 {
 	PurpleConversation * conv;
 
--- a/libpurple/protocols/msn/session.h	Fri Jun 20 05:15:49 2008 +0000
+++ b/libpurple/protocols/msn/session.h	Fri Jun 20 05:36:18 2008 +0000
@@ -232,6 +232,6 @@
 
 /*post message to User*/
 void msn_session_report_user(MsnSession *session,const char *passport,
-							char *msg,PurpleMessageFlags flags);
+							const char *msg,PurpleMessageFlags flags);
 
 #endif /* _MSN_SESSION_H_ */