View | Details | Raw Unified | Return to bug 66609
Collapse All | Expand All

(-)src/protocols/msn/msn.c (-8 / +29 lines)
Lines 338-344 initiate_chat_cb(GaimBlistNode *node, gp Link Here
338
       /* TODO: This might move somewhere else, after USR might be */
338
       /* TODO: This might move somewhere else, after USR might be */
339
       swboard->chat_id = session->conv_seq++;
339
       swboard->chat_id = session->conv_seq++;
340
       swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
340
       swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
341
       swboard->flag = MSN_SB_FLAG_IM;
342
       gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
341
       gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
343
                                                       gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE,
342
                                                       gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE,
343
TRUE);
Lines 697-703 msn_send_im(GaimConnection *gc, const ch Link Here
697
               MsnSwitchBoard *swboard;
696
               MsnSwitchBoard *swboard;
698
               session = gc->proto_data;
697
               session = gc->proto_data;
699
               swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM);
698
               swboard = msn_session_get_swboard(session, who);
700
               msn_switchboard_send_msg(swboard, msg, TRUE);
699
               msn_switchboard_send_msg(swboard, msg, TRUE);
701
       }
700
       }
Lines 753-759 msn_send_typing(GaimConnection *gc, cons Link Here
753
               return MSN_TYPING_SEND_TIMEOUT;
752
               return MSN_TYPING_SEND_TIMEOUT;
754
       }
753
       }
755
       swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM);
754
       swboard = msn_session_find_swboard(session, who);
756
       if (swboard == NULL || !msn_switchboard_can_send(swboard))
755
       if (swboard == NULL || !msn_switchboard_can_send(swboard))
757
               return 0;
756
               return 0;
Lines 1056-1062 msn_chat_invite(GaimConnection *gc, int Link Here
1056
       session = gc->proto_data;
1055
       session = gc->proto_data;
1057
       swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
1056
       swboard = msn_session_find_swboard_with_id(session, id);
1058
       if (swboard == NULL)
1057
       if (swboard == NULL)
1059
       {
1058
       {
Lines 1065-1071 msn_chat_invite(GaimConnection *gc, int Link Here
1065
               msn_switchboard_request(swboard);
1064
               msn_switchboard_request(swboard);
1066
               swboard->chat_id = id;
1065
               swboard->chat_id = id;
1067
               swboard->conv = gaim_find_chat(gc, id);
1066
               swboard->conv = gaim_find_chat(gc, id);
1068
               swboard->flag = MSN_SB_FLAG_IM;
1069
       }
1067
       }
1070
       msn_switchboard_request_add_user(swboard, who);
1068
       msn_switchboard_request_add_user(swboard, who);
Lines 1076-1091 msn_chat_leave(GaimConnection *gc, int i Link Here
1076
{
1074
{
1077
       MsnSession *session;
1075
       MsnSession *session;
1078
       MsnSwitchBoard *swboard;
1076
       MsnSwitchBoard *swboard;
1077
       GaimConversation *conv;
1079
       session = gc->proto_data;
1078
       session = gc->proto_data;
1080
       swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
1079
       swboard = msn_session_find_swboard_with_id(session, id);
1081
       /* if swboard is NULL we were the only person left anyway */
1080
       /* if swboard is NULL we were the only person left anyway */
1082
       if (swboard == NULL)
1081
       if (swboard == NULL)
1083
               return;
1082
               return;
1083
       conv = swboard->conv;
1084
1084
       msn_switchboard_close(swboard);
1085
       msn_switchboard_close(swboard);
1086
1087
       /* If other switchboards managed to associate themselves with this
1088
        * conv, make sure they know it's gone! */
1089
       if (conv != NULL)
1090
       {
1091
               while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL)
1092
                       swboard->conv = NULL;
1093
       }
1085
}
1094
}
1086
static int
1095
static int
Lines 1100-1106 msn_chat_send(GaimConnection *gc, int id Link Here
1100
       account = gaim_connection_get_account(gc);
1109
       account = gaim_connection_get_account(gc);
1101
       session = gc->proto_data;
1110
       session = gc->proto_data;
1102
       swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
1111
       swboard = msn_session_find_swboard_with_id(session, id);
1103
       if (swboard == NULL)
1112
       if (swboard == NULL)
1104
               return -EINVAL;
1113
               return -EINVAL;
Lines 1193-1202 msn_convo_closed(GaimConnection *gc, con Link Here
1193
{
1202
{
1194
       MsnSession *session;
1203
       MsnSession *session;
1195
       MsnSwitchBoard *swboard;
1204
       MsnSwitchBoard *swboard;
1205
       GaimConversation *conv;
1196
       session = gc->proto_data;
1206
       session = gc->proto_data;
1197
       swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM);
1207
       swboard = msn_session_find_swboard(session, who);
1198
       /*
1208
       /*
1199
        * Don't perform an assertion here. If swboard is NULL, then the
1209
        * Don't perform an assertion here. If swboard is NULL, then the
Lines 1206-1215 msn_convo_closed(GaimConnection *gc, con Link Here
1206
       if (swboard == NULL)
1216
       if (swboard == NULL)
1207
               return;
1217
               return;
1218
       conv = swboard->conv;
1219
1208
       if (!(swboard->flag & MSN_SB_FLAG_FT))
1220
       if (!(swboard->flag & MSN_SB_FLAG_FT))
1209
               msn_switchboard_close(swboard);
1221
               msn_switchboard_close(swboard);
1210
       else
1222
       else
1211
               swboard->conv = NULL;
1223
               swboard->conv = NULL;
1224
1225
       /* If other switchboards managed to associate themselves with this
1226
        * conv, make sure they know it's gone! */
1227
       if (conv != NULL)
1228
       {
1229
               while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL)
1230
                       swboard->conv = NULL;
1231
       }
1212
}
1232
}
1213
static void
1233
static void
(-)src/protocols/msn/session.c (-11 / +28 lines)
Lines 45-50 msn_session_new(GaimAccount *account) Link Here
45
                                                                gaim_account_get_username(account), NULL);
45
                                                                gaim_account_get_username(account), NULL);
46
       session->protocol_ver = 9;
46
       session->protocol_ver = 9;
47
       session->conv_seq = 1;
47
       return session;
48
       return session;
48
}
49
}
Lines 144-151 msn_session_disconnect(MsnSession *sessi Link Here
144
/* TODO: This must go away when conversation is redesigned */
145
/* TODO: This must go away when conversation is redesigned */
145
MsnSwitchBoard *
146
MsnSwitchBoard *
146
msn_session_find_swboard(MsnSession *session, const char *username,
147
msn_session_find_swboard(MsnSession *session, const char *username)
147
                                                MsnSBFlag flag)
148
{
148
{
149
       GList *l;
149
       GList *l;
Lines 158-165 msn_session_find_swboard(MsnSession *ses Link Here
158
               swboard = l->data;
158
               swboard = l->data;
159
               if ((swboard->im_user != NULL) &&
159
               if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user))
160
                       !strcmp(username, swboard->im_user) && (swboard->flag & flag))
161
                       return swboard;
160
                       return swboard;
162
       }
161
       }
Lines 167-174 msn_session_find_swboard(MsnSession *ses Link Here
167
}
166
}
168
MsnSwitchBoard *
167
MsnSwitchBoard *
169
msn_session_find_swboard_with_id(const MsnSession *session, int chat_id,
168
msn_session_find_swboard_with_conv(MsnSession *session, GaimConversation *conv)
170
                                                                MsnSBFlag flag)
169
{
170
       GList *l;
171
172
       g_return_val_if_fail(session  != NULL, NULL);
173
       g_return_val_if_fail(conv != NULL, NULL);
174
175
       for (l = session->switches; l != NULL; l = l->next)
176
       {
177
               MsnSwitchBoard *swboard;
178
179
               swboard = l->data;
180
181
               if (swboard->conv == conv)
182
                       return swboard;
183
       }
184
185
       return NULL;
186
}
187
188
MsnSwitchBoard *
189
msn_session_find_swboard_with_id(const MsnSession *session, int chat_id)
171
{
190
{
172
       GList *l;
191
       GList *l;
Lines 181-187 msn_session_find_swboard_with_id(const M Link Here
181
               swboard = l->data;
200
               swboard = l->data;
182
               if ((swboard->chat_id == chat_id) && (swboard->flag & flag))
201
               if (swboard->chat_id == chat_id)
183
                       return swboard;
202
                       return swboard;
184
       }
203
       }
Lines 189-206 msn_session_find_swboard_with_id(const M Link Here
189
}
208
}
190
MsnSwitchBoard *
209
MsnSwitchBoard *
191
msn_session_get_swboard(MsnSession *session, const char *username,
210
msn_session_get_swboard(MsnSession *session, const char *username)
192
                                               MsnSBFlag flag)
193
{
211
{
194
       MsnSwitchBoard *swboard;
212
       MsnSwitchBoard *swboard;
195
       swboard = msn_session_find_swboard(session, username, flag);
213
       swboard = msn_session_find_swboard(session, username);
196
       if (swboard == NULL)
214
       if (swboard == NULL)
197
       {
215
       {
198
               swboard = msn_switchboard_new(session);
216
               swboard = msn_switchboard_new(session);
199
               swboard->im_user = g_strdup(username);
217
               swboard->im_user = g_strdup(username);
200
               swboard->flag = flag;
201
               msn_switchboard_request(swboard);
218
               msn_switchboard_request(swboard);
202
               msn_switchboard_request_add_user(swboard, username);
219
               msn_switchboard_request_add_user(swboard, username);
203
       }
220
       }
(-)src/protocols/msn/session.h (-6 / +13 lines)
Lines 160-195 void msn_session_disconnect(MsnSession * Link Here
160
 *
160
 *
161
 * @param session The MSN session.
161
 * @param session The MSN session.
162
 * @param username The username to search for.
162
 * @param username The username to search for.
163
 * @param flag The flag of the switchboard.
164
 *
163
 *
165
 * @return The switchboard, if found.
164
 * @return The switchboard, if found.
166
 */
165
 */
167
MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
166
MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
168
                                                                                const char *username, MsnSBFlag flag);
167
                                                                                const char *username);
168
 /**
169
 * Finds a switchboard with the given conversation.
170
 *
171
 * @param session The MSN session.
172
 * @param conv    The conversation to search for.
173
 *
174
 * @return The switchboard, if found.
175
 */
176
MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session,
177
                                                                                                  GaimConversation *conv);
169
/**
178
/**
170
 * Finds a switchboard with the given chat ID.
179
 * Finds a switchboard with the given chat ID.
171
 *
180
 *
172
 * @param session The MSN session.
181
 * @param session The MSN session.
173
 * @param chat_id The chat ID to search for.
182
 * @param chat_id The chat ID to search for.
174
 * @param flag The flag of the switchboard.
175
 *
183
 *
176
 * @return The switchboard, if found.
184
 * @return The switchboard, if found.
177
 */
185
 */
178
MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session,
186
MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session,
179
                                                                                                int chat_id, MsnSBFlag flag);
187
                                                                                                int chat_id);
180
/**
188
/**
181
 * Returns a switchboard to communicate with certain username.
189
 * Returns a switchboard to communicate with certain username.
182
 *
190
 *
183
 * @param session The MSN session.
191
 * @param session The MSN session.
184
 * @param username The username to search for.
192
 * @param username The username to search for.
185
 * @param flag The flag of the switchboard.
186
 *
193
 *
187
 * @return The switchboard.
194
 * @return The switchboard.
188
 */
195
 */
189
MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
196
MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
190
                                                                               const char *username, MsnSBFlag flag);
197
                                                                               const char *username);
191
/**
198
/**
192
 * Sets an error for the MSN session.
199
 * Sets an error for the MSN session.
(-)src/protocols/msn/slplink.c (-7 / +4 lines)
Lines 162-172 msn_slplink_find_slp_session(MsnSlpLink Link Here
162
void
162
void
163
msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
163
msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
164
{
164
{
165
       if (slplink->slp_calls == NULL)
165
       if (slplink->swboard != NULL)
166
       {
166
               slplink->swboard->flag |= MSN_SB_FLAG_FT;
167
               if (slplink->swboard != NULL)
168
                       slplink->swboard->flag |= MSN_SB_FLAG_FT;
169
       }
170
       slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall);
167
       slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall);
171
}
168
}
Lines 233-240 msn_slplink_send_msg(MsnSlpLink *slplink Link Here
233
               if (slplink->swboard == NULL)
230
               if (slplink->swboard == NULL)
234
               {
231
               {
235
                       slplink->swboard = msn_session_get_swboard(slplink->session,
232
                       slplink->swboard = msn_session_get_swboard(slplink->session,
236
                                                                                                          slplink->remote_user,
233
237
                                                                                                          MSN_SB_FLAG_FT);
234
slplink->remote_user);
238
                       if (slplink->swboard == NULL)
235
                       if (slplink->swboard == NULL)
239
                               return;
236
                               return;
(-)src/protocols/msn/switchboard.h (-2 / +1 lines)
Lines 54-61 typedef enum Link Here
54
 */
54
 */
55
typedef enum
55
typedef enum
56
{
56
{
57
       MSN_SB_FLAG_IM = 0x01, /**< This switchboard is used for instant messaging. */
57
       MSN_SB_FLAG_FT = 0x01, /**< This switchboard is being used for file transfer. */
58
       MSN_SB_FLAG_FT = 0x02, /**< This switchboard is used for file transfer. */
59
} MsnSBFlag;
58
} MsnSBFlag;
(-)src/util.c (-1 / +5 lines)
Lines 1121-1127 gaim_markup_html_to_xhtml(const char *ht Link Here
1121
                                                       }
1121
                                                       }
1122
                                                       g_string_append_printf(xhtml, "<span style='background: %s;'>",
1122
                                                       g_string_append_printf(xhtml, "<span style='background: %s;'>",
1123
color->str);
1123
                                                       g_string_free(color, TRUE);
1124
                                                       g_string_free(color, TRUE);
1124
                                                       c = strchr(c, '>') + 1;
1125
                                                       if ((c = strchr(c, '>')) != NULL)
1126
                                                               c++;
1127
                                                       else
1128
                                                               c = p;
1125
                                                       pt->src_tag = "body";
1129
                                                       pt->src_tag = "body";
1126
                                                       pt->dest_tag = "span";
1130
                                                       pt->dest_tag = "span";
1127
                                                       tags = g_list_prepend(tags, pt);
1131
                                                       tags = g_list_prepend(tags, pt);

Return to bug 66609