Mercurial > pidgin
comparison src/protocols/novell/novell.c @ 9268:54fb1f466953
[gaim-migrate @ 10069]
" - Added keepalive support
- Improved handling of character sets in RTF (improves
intl interoperability between Gaim and the
Windows/XPLAT Messenger clients)." --Mike Stoddard of Novell
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 12 Jun 2004 15:13:29 +0000 |
parents | 7ab20f829190 |
children | 7a8aa87164ae |
comparison
equal
deleted
inserted
replaced
9267:3e8619644a8a | 9268:54fb1f466953 |
---|---|
35 #define DEFAULT_PORT 8300 | 35 #define DEFAULT_PORT 8300 |
36 #define NOVELL_CONNECT_STEPS 4 | 36 #define NOVELL_CONNECT_STEPS 4 |
37 | 37 |
38 static GaimPlugin *my_protocol = NULL; | 38 static GaimPlugin *my_protocol = NULL; |
39 | 39 |
40 static gboolean set_permit = FALSE; | |
41 | |
42 static gboolean | 40 static gboolean |
43 _is_disconnect_error(NMERR_T err); | 41 _is_disconnect_error(NMERR_T err); |
44 | 42 |
45 static gboolean | 43 static gboolean |
46 _check_for_disconnect(NMUser * user, NMERR_T err); | 44 _check_for_disconnect(NMUser * user, NMERR_T err); |
102 if (alias) | 100 if (alias) |
103 gaim_account_set_alias(user->client_data, alias); | 101 gaim_account_set_alias(user->client_data, alias); |
104 } | 102 } |
105 | 103 |
106 _sync_contact_list(user); | 104 _sync_contact_list(user); |
107 _sync_privacy_lists(user); | |
108 | 105 |
109 /* Tell Gaim that we are connected */ | 106 /* Tell Gaim that we are connected */ |
110 gaim_connection_set_state(gc, GAIM_CONNECTED); | 107 gaim_connection_set_state(gc, GAIM_CONNECTED); |
111 serv_finish_login(gc); | 108 serv_finish_login(gc); |
112 | 109 |
1683 NMUserRecord *user_record = NULL; | 1680 NMUserRecord *user_record = NULL; |
1684 NMContact *contact = NULL; | 1681 NMContact *contact = NULL; |
1685 GaimConversation *gconv; | 1682 GaimConversation *gconv; |
1686 NMConference *conference; | 1683 NMConference *conference; |
1687 GaimConvImFlags imflags; | 1684 GaimConvImFlags imflags; |
1685 char *text = NULL; | |
1686 | |
1687 text = g_markup_escape_text(nm_event_get_text(event), -1); | |
1688 | 1688 |
1689 conference = nm_event_get_conference(event); | 1689 conference = nm_event_get_conference(event); |
1690 if (conference) { | 1690 if (conference) { |
1691 | 1691 |
1692 GaimConversation *chat = nm_conference_get_data(conference); | 1692 GaimConversation *chat = nm_conference_get_data(conference); |
1701 if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) | 1701 if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) |
1702 imflags |= GAIM_CONV_IM_AUTO_RESP; | 1702 imflags |= GAIM_CONV_IM_AUTO_RESP; |
1703 | 1703 |
1704 serv_got_im(gaim_account_get_connection(user->client_data), | 1704 serv_got_im(gaim_account_get_connection(user->client_data), |
1705 nm_user_record_get_display_id(user_record), | 1705 nm_user_record_get_display_id(user_record), |
1706 nm_event_get_text(event), imflags, | 1706 text, imflags, |
1707 nm_event_get_gmt(event)); | 1707 nm_event_get_gmt(event)); |
1708 | 1708 |
1709 gconv = gaim_find_conversation_with_account( | 1709 gconv = gaim_find_conversation_with_account( |
1710 nm_user_record_get_display_id(user_record), | 1710 nm_user_record_get_display_id(user_record), |
1711 (GaimAccount *) user->client_data); | 1711 (GaimAccount *) user->client_data); |
1713 | 1713 |
1714 contact = nm_find_contact(user, nm_event_get_source(event)); | 1714 contact = nm_find_contact(user, nm_event_get_source(event)); |
1715 if (contact) { | 1715 if (contact) { |
1716 | 1716 |
1717 gaim_conversation_set_title( | 1717 gaim_conversation_set_title( |
1718 gconv, | 1718 gconv, nm_contact_get_display_name(contact)); |
1719 nm_contact_get_display_name(contact)); | |
1720 | 1719 |
1721 | 1720 |
1722 } else { | 1721 } else { |
1723 | 1722 |
1724 const char *name = | 1723 const char *name = |
1757 name = nm_user_record_get_display_id(user_record); | 1756 name = nm_user_record_get_display_id(user_record); |
1758 } | 1757 } |
1759 | 1758 |
1760 serv_got_chat_in(gaim_account_get_connection(user->client_data), | 1759 serv_got_chat_in(gaim_account_get_connection(user->client_data), |
1761 gaim_conv_chat_get_id(GAIM_CONV_CHAT(chat)), | 1760 gaim_conv_chat_get_id(GAIM_CONV_CHAT(chat)), |
1762 name, | 1761 name, 0, text, nm_event_get_gmt(event)); |
1763 0, nm_event_get_text(event), | 1762 } |
1764 nm_event_get_gmt(event)); | 1763 } |
1765 } | 1764 } |
1766 } | 1765 |
1767 } | 1766 g_free(text); |
1768 } | 1767 } |
1769 | 1768 |
1770 static void | 1769 static void |
1771 _evt_conference_left(NMUser * user, NMEvent * event) | 1770 _evt_conference_left(NMUser * user, NMEvent * event) |
1772 { | 1771 { |
2159 user = gc->proto_data; | 2158 user = gc->proto_data; |
2160 if (user == NULL) | 2159 if (user == NULL) |
2161 return 0; | 2160 return 0; |
2162 | 2161 |
2163 /* Create a new message */ | 2162 /* Create a new message */ |
2164 message = nm_create_message(gaim_markup_strip_html(message_body)); | 2163 message = nm_create_message(message_body); |
2165 | 2164 |
2166 /* Need to get the DN for the buddy so we can look up the convo */ | 2165 /* Need to get the DN for the buddy so we can look up the convo */ |
2167 dn = nm_lookup_dn(user, name); | 2166 dn = nm_lookup_dn(user, name); |
2168 | 2167 |
2169 /* Do we already know about the sender? */ | 2168 /* Do we already know about the sender? */ |
2369 | 2368 |
2370 user = gc->proto_data; | 2369 user = gc->proto_data; |
2371 if (user == NULL) | 2370 if (user == NULL) |
2372 return -1; | 2371 return -1; |
2373 | 2372 |
2374 message = nm_create_message(gaim_markup_strip_html(text)); | 2373 message = nm_create_message(text); |
2375 | 2374 |
2376 for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { | 2375 for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { |
2377 conference = cnode->data; | 2376 conference = cnode->data; |
2378 if (conference && (chat = nm_conference_get_data(conference))) { | 2377 if (conference && (chat = nm_conference_get_data(conference))) { |
2379 if (gaim_conv_chat_get_id(GAIM_CONV_CHAT(chat)) == id) { | 2378 if (gaim_conv_chat_get_id(GAIM_CONV_CHAT(chat)) == id) { |
3081 | 3080 |
3082 user = gc->proto_data; | 3081 user = gc->proto_data; |
3083 if (user == NULL) | 3082 if (user == NULL) |
3084 return; | 3083 return; |
3085 | 3084 |
3086 if (set_permit == FALSE) { | 3085 if (user->privacy_synched == FALSE) { |
3087 set_permit = TRUE; | 3086 _sync_privacy_lists(user); |
3087 user->privacy_synched = TRUE; | |
3088 return; | 3088 return; |
3089 } | 3089 } |
3090 | 3090 |
3091 if (nm_user_is_privacy_locked(user)) { | 3091 if (nm_user_is_privacy_locked(user)) { |
3092 _show_privacy_locked_error(gc, user); | 3092 _show_privacy_locked_error(gc, user); |
3283 | 3283 |
3284 static GList * | 3284 static GList * |
3285 novell_blist_node_menu(GaimBlistNode *node) | 3285 novell_blist_node_menu(GaimBlistNode *node) |
3286 { | 3286 { |
3287 GList *list = NULL; | 3287 GList *list = NULL; |
3288 GaimBlistNodeAction *act; | 3288 GaimBlistNodeAction *act; |
3289 | 3289 |
3290 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | 3290 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
3291 act = gaim_blist_node_action_new(_("Initiate _Chat"), | 3291 act = gaim_blist_node_action_new(_("Initiate _Chat"), |
3292 _initiate_conference_cb, NULL); | 3292 _initiate_conference_cb, NULL); |
3293 list = g_list_append(list, act); | 3293 list = g_list_append(list, act); |
3294 } | 3294 } |
3295 | 3295 |
3296 return list; | 3296 return list; |
3297 } | |
3298 | |
3299 static void | |
3300 novell_keepalive(GaimConnection *gc) | |
3301 { | |
3302 NMUser *user; | |
3303 NMERR_T rc = NM_OK; | |
3304 | |
3305 if (gc == NULL) | |
3306 return; | |
3307 | |
3308 user = gc->proto_data; | |
3309 if (user == NULL) | |
3310 return; | |
3311 | |
3312 rc = nm_send_keepalive(user, NULL, NULL); | |
3313 _check_for_disconnect(user, rc); | |
3297 } | 3314 } |
3298 | 3315 |
3299 static GaimPluginProtocolInfo prpl_info = { | 3316 static GaimPluginProtocolInfo prpl_info = { |
3300 GAIM_PRPL_API_VERSION, | 3317 GAIM_PRPL_API_VERSION, |
3301 0, | 3318 0, |
3326 novell_rem_permit, | 3343 novell_rem_permit, |
3327 novell_rem_deny, | 3344 novell_rem_deny, |
3328 novell_set_permit_deny, | 3345 novell_set_permit_deny, |
3329 NULL, /* warn */ | 3346 NULL, /* warn */ |
3330 NULL, /* join_chat */ | 3347 NULL, /* join_chat */ |
3331 NULL, /* reject_chat ?? */ | 3348 NULL, /* reject_chat */ |
3332 novell_chat_invite, /* chat_invite */ | 3349 novell_chat_invite, /* chat_invite */ |
3333 novell_chat_leave, | 3350 novell_chat_leave, |
3334 NULL, /* chat_whisper */ | 3351 NULL, /* chat_whisper */ |
3335 novell_chat_send, | 3352 novell_chat_send, |
3336 NULL, /* keepalive */ | 3353 novell_keepalive, |
3337 NULL, /* register_user */ | 3354 NULL, /* register_user */ |
3338 NULL, /* get_cb_info */ | 3355 NULL, /* get_cb_info */ |
3339 NULL, /* get_cb_away_msg */ | 3356 NULL, /* get_cb_away_msg */ |
3340 novell_alias_buddy, | 3357 novell_alias_buddy, |
3341 novell_group_buddy, | 3358 novell_group_buddy, |