comparison src/protocols/msn/msn.c @ 5363:ebebc833cf77

[gaim-migrate @ 5739] You can now set your home, work, and mobile phone numbers. Trust me, I'm going somewhere with all this. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 13 May 2003 08:03:27 +0000
parents 953aa05279f4
children 379beab3d157
comparison
equal deleted inserted replaced
5362:a206742d470d 5363:ebebc833cf77
65 signoff(gc); 65 signoff(gc);
66 } 66 }
67 } 67 }
68 68
69 static void 69 static void
70 msn_set_phone_number(gpointer data, const char *type, const char *entry)
71 {
72 struct gaim_connection *gc = data;
73 MsnSession *session = gc->proto_data;
74 char outparams[MSN_BUF_LEN];
75
76 if (entry == NULL || *entry == '\0')
77 g_snprintf(outparams, sizeof(outparams), "%s ", type);
78 else
79 g_snprintf(outparams, sizeof(outparams), "%s %s", type, entry);
80
81 if (!msn_servconn_send_command(session->notification_conn,
82 "PRP", outparams)) {
83
84 hide_login_progress(gc, _("Write error"));
85 signoff(gc);
86 }
87 }
88
89 static void
90 msn_set_home_phone_cb(gpointer data, char *entry)
91 {
92 msn_set_phone_number(data, "PHH", entry);
93 }
94
95 static void
96 msn_set_work_phone_cb(gpointer data, char *entry)
97 {
98 msn_set_phone_number(data, "PHW", entry);
99 }
100
101 static void
102 msn_set_mobile_phone_cb(gpointer data, char *entry)
103 {
104 msn_set_phone_number(data, "PHM", entry);
105 }
106
107 static void
70 msn_show_set_friendly_name(struct gaim_connection *gc) 108 msn_show_set_friendly_name(struct gaim_connection *gc)
71 { 109 {
72 do_prompt_dialog(_("Set Friendly Name:"), gc->displayname, 110 do_prompt_dialog(_("Set Friendly Name:"), gc->displayname,
73 gc, msn_act_id, NULL); 111 gc, msn_act_id, NULL);
74 } 112 }
75 113
114 static void
115 msn_show_set_home_phone(struct gaim_connection *gc)
116 {
117 MsnSession *session = gc->proto_data;
118
119 do_prompt_dialog(_("Set Home Phone Number:"),
120 msn_user_get_home_phone(session->user),
121 gc, msn_set_home_phone_cb, NULL);
122 }
123
124 static void
125 msn_show_set_work_phone(struct gaim_connection *gc)
126 {
127 MsnSession *session = gc->proto_data;
128
129 do_prompt_dialog(_("Set Work Phone Number:"),
130 msn_user_get_work_phone(session->user),
131 gc, msn_set_work_phone_cb, NULL);
132 }
133
134 static void
135 msn_show_set_mobile_phone(struct gaim_connection *gc)
136 {
137 MsnSession *session = gc->proto_data;
138
139 do_prompt_dialog(_("Set Mobile Phone Number:"),
140 msn_user_get_mobile_phone(session->user),
141 gc, msn_set_mobile_phone_cb, NULL);
142 }
76 143
77 /************************************************************************** 144 /**************************************************************************
78 * Protocol Plugin ops 145 * Protocol Plugin ops
79 **************************************************************************/ 146 **************************************************************************/
80 147
118 } 185 }
119 186
120 static char * 187 static char *
121 msn_tooltip_text(struct buddy *b) 188 msn_tooltip_text(struct buddy *b)
122 { 189 {
190 char *text = NULL;
191 /* MsnUser *user = b->proto_data; */
192
123 if (GAIM_BUDDY_IS_ONLINE(b)) { 193 if (GAIM_BUDDY_IS_ONLINE(b)) {
124 return g_strdup_printf(_("<b>Status:</b> %s"), 194 text = g_strdup_printf(_("<b>Status:</b> %s"),
125 msn_away_get_text(MSN_AWAY_TYPE(b->uc))); 195 msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
126 } 196 }
127 197
128 return NULL; 198 return text;
129 } 199 }
130 200
131 static GList * 201 static GList *
132 msn_away_states(struct gaim_connection *gc) 202 msn_away_states(struct gaim_connection *gc)
133 { 203 {
151 struct proto_actions_menu *pam; 221 struct proto_actions_menu *pam;
152 222
153 pam = g_new0(struct proto_actions_menu, 1); 223 pam = g_new0(struct proto_actions_menu, 1);
154 pam->label = _("Set Friendly Name"); 224 pam->label = _("Set Friendly Name");
155 pam->callback = msn_show_set_friendly_name; 225 pam->callback = msn_show_set_friendly_name;
226 pam->gc = gc;
227 m = g_list_append(m, pam);
228
229 pam = g_new0(struct proto_actions_menu, 1);
230 pam->label = _("Set Home Phone Number");
231 pam->callback = msn_show_set_home_phone;
232 pam->gc = gc;
233 m = g_list_append(m, pam);
234
235 pam = g_new0(struct proto_actions_menu, 1);
236 pam->label = _("Set Work Phone Number");
237 pam->callback = msn_show_set_work_phone;
238 pam->gc = gc;
239 m = g_list_append(m, pam);
240
241 pam = g_new0(struct proto_actions_menu, 1);
242 pam->label = _("Set Mobile Phone Number");
243 pam->callback = msn_show_set_mobile_phone;
156 pam->gc = gc; 244 pam->gc = gc;
157 m = g_list_append(m, pam); 245 m = g_list_append(m, pam);
158 246
159 return m; 247 return m;
160 } 248 }
842 } 930 }
843 931
844 static void 932 static void
845 msn_buddy_free(struct buddy *b) 933 msn_buddy_free(struct buddy *b)
846 { 934 {
847 if (b->proto_data != NULL) 935 if (b->proto_data != NULL) {
848 g_free(b->proto_data); 936 msn_user_destroy(b->proto_data);
937 b->proto_data = NULL;
938 }
849 } 939 }
850 940
851 static void 941 static void
852 msn_convo_closed(struct gaim_connection *gc, char *who) 942 msn_convo_closed(struct gaim_connection *gc, char *who)
853 { 943 {