Mercurial > pidgin.yaz
comparison src/protocols/novell/novell.c @ 10762:019229bf8b7e
[gaim-migrate @ 12366]
A start on converting Novell to use the new status API. I don't know
when I'll get a chance to work on this again, so I'm committing this
now. If anyone wants to take a stab at it, feel free. Might want
to IM me if you start working on it (markdoliner on AIM and MSN,
lbdash on Yahoo!)
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 31 Mar 2005 03:42:38 +0000 |
parents | bf5e48215158 |
children | 50224ac8184d |
comparison
equal
deleted
inserted
replaced
10761:7c6b69eb82f2 | 10762:019229bf8b7e |
---|---|
28 #include "util.h" | 28 #include "util.h" |
29 #include "sslconn.h" | 29 #include "sslconn.h" |
30 #include "request.h" | 30 #include "request.h" |
31 #include "network.h" | 31 #include "network.h" |
32 #include "privacy.h" | 32 #include "privacy.h" |
33 #include "status.h" | |
33 #include "version.h" | 34 #include "version.h" |
34 | 35 |
35 #define DEFAULT_PORT 8300 | 36 #define DEFAULT_PORT 8300 |
36 #define NOVELL_CONNECT_STEPS 4 | 37 #define NOVELL_CONNECT_STEPS 4 |
37 #define NM_ROOT_FOLDER_NAME "GroupWise Messenger" | 38 #define NM_ROOT_FOLDER_NAME "GroupWise Messenger" |
2915 } | 2916 } |
2916 } | 2917 } |
2917 | 2918 |
2918 return NULL; | 2919 return NULL; |
2919 } | 2920 } |
2921 | |
2922 /* | |
2923 * TODO: Someone that uses this protocol needs to verify | |
2924 * that these are correct and work. | |
2925 * | |
2926 * Before the status rewrite, Novell had the following | |
2927 * user-setable statuses: Available, Away, Busy, Appear | |
2928 * Offline and GAIM_AWAY_CUSTOM. Are all of those taken | |
2929 * care of with the statuses below? | |
2930 */ | |
2931 static GList * | |
2932 novell_status_types(GaimAccount *account) | |
2933 { | |
2934 GList *status_types = NULL; | |
2935 GaimStatusType *type; | |
2936 | |
2937 g_return_val_if_fail(account != NULL, NULL); | |
2938 | |
2939 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, "offline", _("Offline"), FALSE, TRUE, FALSE); | |
2940 status_types = g_list_append(status_types, type); | |
2941 | |
2942 /* TODO: Do we need both an "online" and an "available" state? */ | |
2943 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, "online", _("Online"), FALSE, TRUE, FALSE); | |
2944 status_types = g_list_append(status_types, type); | |
2945 | |
2946 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, "available", _("Available"), TRUE, TRUE, TRUE); | |
2947 status_types = g_list_append(status_types, type); | |
2948 | |
2949 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, "away", _("Away"), TRUE, TRUE, TRUE); | |
2950 status_types = g_list_append(status_types, type); | |
2951 | |
2952 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, "busy", _("Busy"), TRUE, TRUE, TRUE); | |
2953 status_types = g_list_append(status_types, type); | |
2954 | |
2955 type = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, "appearoffline", _("Appear Offline"), TRUE, TRUE, TRUE); | |
2956 status_types = g_list_append(status_types, type); | |
2957 | |
2958 return status_types; | |
2959 } | |
2960 | |
2961 static void | |
2962 novell_set_status(GaimAccount *account, GaimStatus *status) | |
2963 { | |
2964 gboolean connected; | |
2965 GaimStatusType *type; | |
2966 int primitive; | |
2967 | |
2968 connected = gaim_account_is_connected(account); | |
2969 type = gaim_status_get_type(status); | |
2970 primitive = gaim_status_type_get_primitive(type); | |
2971 | |
2972 /* | |
2973 * We don't have any independent statuses, so we don't need to | |
2974 * do anything when a status is deactivated (because another | |
2975 * status is about to be activated). | |
2976 */ | |
2977 if (!gaim_status_is_active(status)) | |
2978 return; | |
2979 | |
2980 if (primitive != GAIM_STATUS_OFFLINE && !connected) { | |
2981 gaim_account_connect(account); | |
2982 } else if (primitive == GAIM_STATUS_OFFLINE && connected) { | |
2983 gaim_account_disconnect(account); | |
2984 } else { | |
2985 if (!connected) | |
2986 return; | |
2987 | |
2988 /* TODO: Need to do the same stuff that novell_set_away does here */ | |
2989 } | |
2990 } | |
2991 | |
2920 #if 0 | 2992 #if 0 |
2921 static GList * | |
2922 novell_away_states(GaimConnection * gc) | |
2923 { | |
2924 GList *m = NULL; | |
2925 | |
2926 m = g_list_append(m, _("Available")); | |
2927 m = g_list_append(m, _("Away")); | |
2928 m = g_list_append(m, _("Busy")); | |
2929 m = g_list_append(m, _("Appear Offline")); | |
2930 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
2931 | |
2932 return m; | |
2933 } | |
2934 | |
2935 static void | 2993 static void |
2936 novell_set_away(GaimConnection * gc, const char *state, const char *msg) | 2994 novell_set_away(GaimConnection * gc, const char *state, const char *msg) |
2937 { | 2995 { |
2938 NMUser *user; | 2996 NMUser *user; |
2939 NMSTATUS_T status = NM_STATUS_AVAILABLE; | 2997 NMSTATUS_T status = NM_STATUS_AVAILABLE; |
3001 | 3059 |
3002 if (text) | 3060 if (text) |
3003 g_free(text); | 3061 g_free(text); |
3004 } | 3062 } |
3005 #endif | 3063 #endif |
3064 | |
3006 static void | 3065 static void |
3007 novell_add_permit(GaimConnection *gc, const char *who) | 3066 novell_add_permit(GaimConnection *gc, const char *who) |
3008 { | 3067 { |
3009 NMUser *user; | 3068 NMUser *user; |
3010 NMERR_T rc = NM_OK; | 3069 NMERR_T rc = NM_OK; |
3408 NO_BUDDY_ICONS, /* icon_spec */ | 3467 NO_BUDDY_ICONS, /* icon_spec */ |
3409 novell_list_icon, /* list_icon */ | 3468 novell_list_icon, /* list_icon */ |
3410 novell_list_emblems, /* list_emblems */ | 3469 novell_list_emblems, /* list_emblems */ |
3411 novell_status_text, /* status_text */ | 3470 novell_status_text, /* status_text */ |
3412 novell_tooltip_text, /* tooltip_text */ | 3471 novell_tooltip_text, /* tooltip_text */ |
3413 /*novell_away_states*/NULL, /* away_states */ | 3472 novell_status_types, /* status_types */ |
3414 novell_blist_node_menu, /* blist_node_menu */ | 3473 novell_blist_node_menu, /* blist_node_menu */ |
3415 NULL, /* chat_info */ | 3474 NULL, /* chat_info */ |
3416 NULL, /* chat_info_defaults */ | 3475 NULL, /* chat_info_defaults */ |
3417 novell_login, /* login */ | 3476 novell_login, /* login */ |
3418 novell_close, /* close */ | 3477 novell_close, /* close */ |
3419 novell_send_im, /* send_im */ | 3478 novell_send_im, /* send_im */ |
3420 NULL, /* set_info */ | 3479 NULL, /* set_info */ |
3421 novell_send_typing, /* send_typing */ | 3480 novell_send_typing, /* send_typing */ |
3422 novell_get_info, /* get_info */ | 3481 novell_get_info, /* get_info */ |
3423 /*novell_set_away*/ NULL, /* set_away */ | 3482 novell_set_status, /* set_status */ |
3424 novell_set_idle, /* set_idle */ | 3483 novell_set_idle, /* set_idle */ |
3425 NULL, /* change_passwd */ | 3484 NULL, /* change_passwd */ |
3426 novell_add_buddy, /* add_buddy */ | 3485 novell_add_buddy, /* add_buddy */ |
3427 NULL, /* add_buddies */ | 3486 NULL, /* add_buddies */ |
3428 novell_remove_buddy, /* remove_buddy */ | 3487 novell_remove_buddy, /* remove_buddy */ |