Changeset ffa5b70 for protocols/msn/msn.c
- Timestamp:
- 2015-03-15T14:41:47Z (10 years ago)
- Children:
- 6e74911
- Parents:
- 3752019
- git-author:
- dequis <dx@…> (09-03-15 08:35:50)
- git-committer:
- dequis <dx@…> (15-03-15 14:41:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r3752019 rffa5b70 30 30 int msn_chat_id; 31 31 GSList *msn_connections; 32 GSList *msn_switchboards;33 32 34 33 static char *set_eval_display_name(set_t *set, char *value); … … 48 47 49 48 set_add(&acc->set, "mail_notifications", "false", set_eval_bool, acc); 50 set_add(&acc->set, "switchboard_keepalives", "false", set_eval_bool, acc);51 49 52 50 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE | … … 80 78 md->away_state = msn_away_state_list; 81 79 md->domaintree = g_tree_new(msn_domaintree_cmp); 82 md-> ns->fd = -1;80 md->fd = -1; 83 81 84 82 msn_connections = g_slist_prepend(msn_connections, ic); 85 83 86 84 imcb_log(ic, "Connecting"); 87 msn_ns_connect(ic, md->ns,server,85 msn_ns_connect(ic, server, 88 86 set_getint(&ic->acc->set, "port")); 89 87 } … … 96 94 97 95 if (md) { 98 msn_ns_close(md->ns); 99 100 while (md->switchboards) { 101 msn_sb_destroy(md->switchboards->data); 102 } 96 msn_ns_close(md); 103 97 104 98 msn_msgq_purge(ic, &md->msgq); … … 154 148 { 155 149 struct bee_user *bu = bee_user_by_handle(ic->bee, ic, who); 156 struct msn_buddy_data *bd = bu ? bu->data : NULL;157 struct msn_switchboard *sb;158 150 159 151 #ifdef DEBUG 160 152 if (strcmp(who, "raw") == 0) { 161 153 msn_ns_write(ic, -1, "%s\r\n", message); 162 } else 154 return 0; 155 } 163 156 #endif 164 if (bd && bd->flags & MSN_BUDDY_FED) { 165 msn_ns_sendmessage(ic, bu, message); 166 } else if ((sb = msn_sb_by_handle(ic, who))) { 167 return(msn_sb_sendmessage(sb, message)); 168 } else { 169 struct msn_message *m; 170 171 /* Create a message. We have to arrange a usable switchboard, and send the message later. */ 172 m = g_new0(struct msn_message, 1); 173 m->who = g_strdup(who); 174 m->text = g_strdup(message); 175 176 return msn_sb_write_msg(ic, m); 177 } 178 157 158 msn_ns_sendmessage(ic, bu, message); 179 159 return(0); 180 160 } … … 198 178 static void msn_set_away(struct im_connection *ic, char *state, char *message) 199 179 { 200 char *uux;180 //char *uux; 201 181 struct msn_data *md = ic->proto_data; 202 182 … … 258 238 static void msn_chat_msg(struct groupchat *c, char *message, int flags) 259 239 { 260 struct msn_switchboard *sb = msn_sb_by_chat(c); 261 262 if (sb) { 263 msn_sb_sendmessage(sb, message); 264 } 265 /* FIXME: Error handling (although this can't happen unless something's 266 already severely broken) disappeared here! */ 240 /* TODO: groupchats*/ 267 241 } 268 242 269 243 static void msn_chat_invite(struct groupchat *c, char *who, char *message) 270 244 { 271 struct msn_switchboard *sb = msn_sb_by_chat(c); 272 273 if (sb) { 274 msn_sb_write(sb, "CAL %d %s\r\n", ++sb->trId, who); 275 } 245 /* TODO: groupchats*/ 276 246 } 277 247 278 248 static void msn_chat_leave(struct groupchat *c) 279 249 { 280 struct msn_switchboard *sb = msn_sb_by_chat(c); 281 282 if (sb) { 283 msn_sb_write(sb, "OUT\r\n"); 284 } 250 /* TODO: groupchats*/ 285 251 } 286 252 287 253 static struct groupchat *msn_chat_with(struct im_connection *ic, char *who) 288 254 { 289 struct msn_switchboard *sb;255 /* TODO: groupchats*/ 290 256 struct groupchat *c = imcb_chat_new(ic, who); 291 292 if ((sb = msn_sb_by_handle(ic, who))) { 293 debug("Converting existing switchboard to %s to a groupchat", who); 294 return msn_sb_to_chat(sb); 295 } else { 296 struct msn_message *m; 297 298 /* Create a magic message. This is quite hackish, but who cares? :-P */ 299 m = g_new0(struct msn_message, 1); 300 m->who = g_strdup(who); 301 m->text = g_strdup(GROUPCHAT_SWITCHBOARD_MESSAGE); 302 303 msn_sb_write_msg(ic, m); 304 305 return c; 306 } 257 return c; 307 258 } 308 259 … … 324 275 static void msn_add_deny(struct im_connection *ic, char *who) 325 276 { 326 struct msn_switchboard *sb;327 328 277 msn_buddy_list_add(ic, MSN_BUDDY_BL, who, who, NULL); 329 330 /* If there's still a conversation with this person, close it. */331 if ((sb = msn_sb_by_handle(ic, who))) {332 msn_sb_destroy(sb);333 }334 278 } 335 279
Note: See TracChangeset
for help on using the changeset viewer.