Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/msn.c @ 19465:d9d9283680a4
In MSN prpl, use attention API. Can be disabled by undefining
MSN_USE_ATTENTION_API. Also update Yahoo prpl to use a common
idiom in the attention_types function that MSN also uses.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Mon, 27 Aug 2007 06:58:54 +0000 |
parents | 926ccb104da0 |
children | ebe2d2e71223 44b4e8bd759b 1754155051a4 315151da0dc6 7f8cf35fc99b |
comparison
equal
deleted
inserted
replaced
19464:ca45543c11a3 | 19465:d9d9283680a4 |
---|---|
98 g_free(tmp); | 98 g_free(tmp); |
99 | 99 |
100 return buf; | 100 return buf; |
101 } | 101 } |
102 | 102 |
103 static gboolean | |
104 msn_send_attention(PurpleConnection *gc, const char *username, guint type) | |
105 { | |
106 MsnMessage *msg; | |
107 MsnSession *session; | |
108 MsnSwitchBoard *swboard; | |
109 | |
110 msg = msn_message_new_nudge(); | |
111 session = gc->proto_data; | |
112 swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); | |
113 | |
114 if (swboard == NULL) | |
115 return FALSE; | |
116 | |
117 msn_switchboard_send_msg(swboard, msg, TRUE); | |
118 | |
119 return TRUE; | |
120 } | |
121 | |
122 #ifdef MSN_USE_ATTENTION_API | |
123 static GList * | |
124 msn_attention_types(PurpleAccount *account) | |
125 { | |
126 PurpleAttentionType *attn; | |
127 static GList *list = NULL; | |
128 | |
129 if (!list) { | |
130 attn = g_new0(PurpleAttentionType, 1); | |
131 attn->name = _("nudge"); | |
132 attn->incoming_description = _("nudged"); | |
133 attn->outgoing_description = _("Nudging"); | |
134 list = g_list_append(list, attn); | |
135 } | |
136 | |
137 return list; | |
138 } | |
139 #endif | |
140 | |
141 | |
103 static PurpleCmdRet | 142 static PurpleCmdRet |
104 msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) | 143 msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) |
105 { | 144 { |
106 PurpleAccount *account = purple_conversation_get_account(conv); | 145 PurpleAccount *account = purple_conversation_get_account(conv); |
107 PurpleConnection *gc = purple_account_get_connection(account); | 146 PurpleConnection *gc = purple_account_get_connection(account); |
108 MsnMessage *msg; | 147 const gchar *username; |
109 MsnSession *session; | 148 |
110 MsnSwitchBoard *swboard; | 149 username = purple_conversation_get_name(conv); |
111 | 150 |
112 msg = msn_message_new_nudge(); | 151 #ifdef MSN_USE_ATTENTION_API |
113 session = gc->proto_data; | 152 serv_send_attention(gc, username, MSN_NUDGE); |
114 swboard = msn_session_get_swboard(session, purple_conversation_get_name(conv), MSN_SB_FLAG_IM); | 153 #else |
115 | 154 if (!msn_send_attention(gc, username, MSN_NUDGE)) |
116 if (swboard == NULL) | |
117 return PURPLE_CMD_RET_FAILED; | 155 return PURPLE_CMD_RET_FAILED; |
118 | 156 |
119 msn_switchboard_send_msg(swboard, msg, TRUE); | |
120 | |
121 purple_conversation_write(conv, NULL, _("You have just sent a Nudge!"), PURPLE_MESSAGE_SYSTEM, time(NULL)); | 157 purple_conversation_write(conv, NULL, _("You have just sent a Nudge!"), PURPLE_MESSAGE_SYSTEM, time(NULL)); |
158 #endif | |
122 | 159 |
123 return PURPLE_CMD_RET_OK; | 160 return PURPLE_CMD_RET_OK; |
124 } | 161 } |
125 | 162 |
126 static void | 163 static void |
2100 msn_offline_message, /* offline_message */ | 2137 msn_offline_message, /* offline_message */ |
2101 NULL, /* whiteboard_prpl_ops */ | 2138 NULL, /* whiteboard_prpl_ops */ |
2102 NULL, /* send_raw */ | 2139 NULL, /* send_raw */ |
2103 NULL, /* roomlist_room_serialize */ | 2140 NULL, /* roomlist_room_serialize */ |
2104 | 2141 |
2142 #ifdef MSN_USE_ATTENTION_API | |
2143 msn_send_attention, /* send_attention */ | |
2144 msn_attention_types, /* attention_types */ | |
2145 #else | |
2105 /* padding */ | 2146 /* padding */ |
2106 NULL, | 2147 NULL, |
2107 NULL, | 2148 NULL, |
2149 #endif | |
2108 NULL, | 2150 NULL, |
2109 NULL | 2151 NULL |
2110 }; | 2152 }; |
2111 | 2153 |
2112 static PurplePluginInfo info = | 2154 static PurplePluginInfo info = |