comparison src/protocols/sametime/sametime.c @ 13106:a0a4b44239e8

[gaim-migrate @ 15468] I was reading the gettext man page and it pointed out that it should be typed as const char *, but it's char * to avoid warnings in code predating ANSI C. So, for the heck of it, I changed added a cast in internal.h. As it turns out, there was a lot of code that relied on this. In the interest of type safety, I've fixed all the warnings. I feel this improved a number of function signatures (in terms of typing clarity). Flame me if you object. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 02 Feb 2006 21:34:43 +0000
parents eb64b2b26e56
children 3a97c65196d1
comparison
equal deleted inserted replaced
13105:e347b2217b1b 13106:a0a4b44239e8
1392 static void mw_session_stateChange(struct mwSession *session, 1392 static void mw_session_stateChange(struct mwSession *session,
1393 enum mwSessionState state, 1393 enum mwSessionState state,
1394 gpointer info) { 1394 gpointer info) {
1395 struct mwGaimPluginData *pd; 1395 struct mwGaimPluginData *pd;
1396 GaimConnection *gc; 1396 GaimConnection *gc;
1397 char *msg = NULL; 1397 const char *msg = NULL;
1398 1398
1399 pd = mwSession_getClientData(session); 1399 pd = mwSession_getClientData(session);
1400 gc = pd->gc; 1400 gc = pd->gc;
1401 1401
1402 switch(state) { 1402 switch(state) {
1446 gaim_connection_set_state(gc, GAIM_CONNECTED); 1446 gaim_connection_set_state(gc, GAIM_CONNECTED);
1447 break; 1447 break;
1448 1448
1449 case mwSession_STOPPING: 1449 case mwSession_STOPPING:
1450 if(GPOINTER_TO_UINT(info) & ERR_FAILURE) { 1450 if(GPOINTER_TO_UINT(info) & ERR_FAILURE) {
1451 msg = mwError(GPOINTER_TO_UINT(info)); 1451 char *err = mwError(GPOINTER_TO_UINT(info));
1452 gaim_connection_error(gc, msg); 1452 gaim_connection_error(gc, err);
1453 g_free(msg); 1453 g_free(err);
1454 } 1454 }
1455 break; 1455 break;
1456 1456
1457 case mwSession_STOPPED: 1457 case mwSession_STOPPED:
1458 break; 1458 break;
1526 static void mw_session_admin(struct mwSession *session, 1526 static void mw_session_admin(struct mwSession *session,
1527 const char *text) { 1527 const char *text) {
1528 GaimConnection *gc; 1528 GaimConnection *gc;
1529 GaimAccount *acct; 1529 GaimAccount *acct;
1530 const char *host; 1530 const char *host;
1531 const char *msg;
1531 char *prim; 1532 char *prim;
1532 1533
1533 gc = session_to_gc(session); 1534 gc = session_to_gc(session);
1534 g_return_if_fail(gc != NULL); 1535 g_return_if_fail(gc != NULL);
1535 1536
1536 acct = gaim_connection_get_account(gc); 1537 acct = gaim_connection_get_account(gc);
1537 g_return_if_fail(acct != NULL); 1538 g_return_if_fail(acct != NULL);
1538 1539
1539 host = gaim_account_get_string(acct, MW_KEY_HOST, NULL); 1540 host = gaim_account_get_string(acct, MW_KEY_HOST, NULL);
1540 1541
1541 prim = _("A Sametime administrator has issued the following announcement" 1542 msg = _("A Sametime administrator has issued the following announcement"
1542 " on server %s"); 1543 " on server %s");
1543 prim = g_strdup_printf(prim, NSTR(host)); 1544 prim = g_strdup_printf(msg, NSTR(host));
1544 1545
1545 gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, 1546 gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO,
1546 _("Sametime Administrator Announcement"), 1547 _("Sametime Administrator Announcement"),
1547 prim, text, NULL, NULL); 1548 prim, text, NULL, NULL);
1548 1549
3148 return (attr != NULL) && mwAwareAttribute_asBoolean(attr); 3149 return (attr != NULL) && mwAwareAttribute_asBoolean(attr);
3149 } 3150 }
3150 3151
3151 3152
3152 static char *user_supports_text(struct mwServiceAware *srvc, const char *who) { 3153 static char *user_supports_text(struct mwServiceAware *srvc, const char *who) {
3153 char *feat[] = {NULL, NULL, NULL, NULL, NULL}; 3154 const char *feat[] = {NULL, NULL, NULL, NULL, NULL};
3154 char **f = feat; 3155 const char **f = feat;
3155 3156
3156 if(user_supports(srvc, who, mwAttribute_AV_PREFS_SET)) { 3157 if(user_supports(srvc, who, mwAttribute_AV_PREFS_SET)) {
3157 gboolean mic, speak, video; 3158 gboolean mic, speak, video;
3158 3159
3159 mic = user_supports(srvc, who, mwAttribute_MICROPHONE); 3160 mic = user_supports(srvc, who, mwAttribute_MICROPHONE);
3166 } 3167 }
3167 3168
3168 if(user_supports(srvc, who, mwAttribute_FILE_TRANSFER)) 3169 if(user_supports(srvc, who, mwAttribute_FILE_TRANSFER))
3169 *f++ = _("File Transfer"); 3170 *f++ = _("File Transfer");
3170 3171
3171 return (*feat)? g_strjoinv(", ", feat): NULL; 3172 return (*feat)? g_strjoinv(", ", (char **)feat): NULL;
3172 /* jenni loves siege */ 3173 /* jenni loves siege */
3173 } 3174 }
3174 3175
3175 3176
3176 static void mw_prpl_tooltip_text(GaimBuddy *b, GString *str, gboolean full) { 3177 static void mw_prpl_tooltip_text(GaimBuddy *b, GString *str, gboolean full) {
3286 GaimRequestField *f; 3287 GaimRequestField *f;
3287 3288
3288 GaimAccount *acct; 3289 GaimAccount *acct;
3289 GaimConnection *gc; 3290 GaimConnection *gc;
3290 3291
3291 char *msgA, *msgB; 3292 const char *msgA;
3293 const char *msgB;
3294 char *msg1;
3292 3295
3293 g_return_if_fail(buddy != NULL); 3296 g_return_if_fail(buddy != NULL);
3294 3297
3295 acct = buddy->account; 3298 acct = buddy->account;
3296 g_return_if_fail(acct != NULL); 3299 g_return_if_fail(acct != NULL);
3310 gaim_request_field_group_add_field(g, f); 3313 gaim_request_field_group_add_field(g, f);
3311 3314
3312 msgA = _("Create conference with user"); 3315 msgA = _("Create conference with user");
3313 msgB = _("Please enter a topic for the new conference, and an invitation" 3316 msgB = _("Please enter a topic for the new conference, and an invitation"
3314 " message to be sent to %s"); 3317 " message to be sent to %s");
3315 msgB = g_strdup_printf(msgB, buddy->name); 3318 msg1 = g_strdup_printf(msgB, buddy->name);
3316 3319
3317 gaim_request_fields(gc, _("New Conference"), 3320 gaim_request_fields(gc, _("New Conference"),
3318 msgA, msgB, fields, 3321 msgA, msg1, fields,
3319 _("Create"), G_CALLBACK(conf_create_prompt_join), 3322 _("Create"), G_CALLBACK(conf_create_prompt_join),
3320 _("Cancel"), G_CALLBACK(conf_create_prompt_cancel), 3323 _("Cancel"), G_CALLBACK(conf_create_prompt_cancel),
3321 buddy); 3324 buddy);
3322 g_free(msgB); 3325 g_free(msg1);
3323 } 3326 }
3324 3327
3325 3328
3326 static void conf_select_prompt_cancel(GaimBuddy *buddy, 3329 static void conf_select_prompt_cancel(GaimBuddy *buddy,
3327 GaimRequestFields *fields) { 3330 GaimRequestFields *fields) {
3363 GaimRequestField *f; 3366 GaimRequestField *f;
3364 3367
3365 GaimAccount *acct; 3368 GaimAccount *acct;
3366 GaimConnection *gc; 3369 GaimConnection *gc;
3367 3370
3368 char *msgA, *msgB; 3371 const char *msgA;
3372 const char *msgB;
3373 char *msg;
3369 3374
3370 acct = buddy->account; 3375 acct = buddy->account;
3371 g_return_if_fail(acct != NULL); 3376 g_return_if_fail(acct != NULL);
3372 3377
3373 gc = gaim_account_get_connection(acct); 3378 gc = gaim_account_get_connection(acct);
3393 3398
3394 msgA = _("Invite user to a conference"); 3399 msgA = _("Invite user to a conference");
3395 msgB = _("Select a conference from the list below to send an invite to" 3400 msgB = _("Select a conference from the list below to send an invite to"
3396 " user %s. Select \"Create New Conference\" if you'd like to" 3401 " user %s. Select \"Create New Conference\" if you'd like to"
3397 " create a new conference to invite this user to."); 3402 " create a new conference to invite this user to.");
3398 msgB = g_strdup_printf(msgB, buddy->name); 3403 msg = g_strdup_printf(msgB, buddy->name);
3399 3404
3400 gaim_request_fields(gc, _("Invite to Conference"), 3405 gaim_request_fields(gc, _("Invite to Conference"),
3401 msgA, msgB, fields, 3406 msgA, msg, fields,
3402 _("Invite"), G_CALLBACK(conf_select_prompt_invite), 3407 _("Invite"), G_CALLBACK(conf_select_prompt_invite),
3403 _("Cancel"), G_CALLBACK(conf_select_prompt_cancel), 3408 _("Cancel"), G_CALLBACK(conf_select_prompt_cancel),
3404 buddy); 3409 buddy);
3405 g_free(msgB); 3410 g_free(msg);
3406 } 3411 }
3407 3412
3408 3413
3409 static void blist_menu_conf(GaimBlistNode *node, gpointer data) { 3414 static void blist_menu_conf(GaimBlistNode *node, gpointer data) {
3410 GaimBuddy *buddy = (GaimBuddy *) node; 3415 GaimBuddy *buddy = (GaimBuddy *) node;
3513 } 3518 }
3514 3519
3515 3520
3516 static void prompt_host(GaimConnection *gc) { 3521 static void prompt_host(GaimConnection *gc) {
3517 GaimAccount *acct; 3522 GaimAccount *acct;
3523 const char *msgA;
3518 char *msg; 3524 char *msg;
3519 3525
3520 acct = gaim_connection_get_account(gc); 3526 acct = gaim_connection_get_account(gc);
3521 msg = _("No host or IP address has been configured for the" 3527 msgA = _("No host or IP address has been configured for the"
3522 " Meanwhile account %s. Please enter one below to" 3528 " Meanwhile account %s. Please enter one below to"
3523 " continue logging in."); 3529 " continue logging in.");
3524 msg = g_strdup_printf(msg, NSTR(gaim_account_get_username(acct))); 3530 msg = g_strdup_printf(msgA, NSTR(gaim_account_get_username(acct)));
3525 3531
3526 gaim_request_input(gc, _("Meanwhile Connection Setup"), 3532 gaim_request_input(gc, _("Meanwhile Connection Setup"),
3527 _("No Sametime Community Server Specified"), msg, 3533 _("No Sametime Community Server Specified"), msg,
3528 MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL, 3534 MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL,
3529 _("Connect"), G_CALLBACK(prompt_host_ok_cb), 3535 _("Connect"), G_CALLBACK(prompt_host_ok_cb),
4149 4155
4150 4156
4151 static void multi_resolved_query(struct mwResolveResult *result, 4157 static void multi_resolved_query(struct mwResolveResult *result,
4152 GaimConnection *gc) { 4158 GaimConnection *gc) {
4153 GList *l; 4159 GList *l;
4154 char *msgA, *msgB; 4160 const char *msgA;
4161 const char *msgB;
4162 char *msg;
4155 4163
4156 GaimNotifySearchResults *sres; 4164 GaimNotifySearchResults *sres;
4157 GaimNotifySearchColumn *scol; 4165 GaimNotifySearchColumn *scol;
4158 4166
4159 sres = gaim_notify_searchresults_new(); 4167 sres = gaim_notify_searchresults_new();
4187 4195
4188 msgA = _("An ambiguous user ID was entered"); 4196 msgA = _("An ambiguous user ID was entered");
4189 msgB = _("The identifier '%s' may possibly refer to any of the following" 4197 msgB = _("The identifier '%s' may possibly refer to any of the following"
4190 " users. Please select the correct user from the list below to" 4198 " users. Please select the correct user from the list below to"
4191 " add them to your buddy list."); 4199 " add them to your buddy list.");
4192 msgB = g_strdup_printf(msgB, result->name); 4200 msg = g_strdup_printf(msgB, result->name);
4193 4201
4194 gaim_notify_searchresults(gc, _("Select User"), 4202 gaim_notify_searchresults(gc, _("Select User"),
4195 msgA, msgB, sres, notify_close, NULL); 4203 msgA, msg, sres, notify_close, NULL);
4196 4204
4197 g_free(msgB); 4205 g_free(msg);
4198 } 4206 }
4199 4207
4200 4208
4201 static void add_buddy_resolved(struct mwServiceResolve *srvc, 4209 static void add_buddy_resolved(struct mwServiceResolve *srvc,
4202 guint32 id, guint32 code, GList *results, 4210 guint32 id, guint32 code, GList *results,
4255 gaim_blist_remove_buddy(buddy); 4263 gaim_blist_remove_buddy(buddy);
4256 blist_schedule(pd); 4264 blist_schedule(pd);
4257 4265
4258 if(res && res->name) { 4266 if(res && res->name) {
4259 /* compose and display an error message */ 4267 /* compose and display an error message */
4260 char *msgA, *msgB; 4268 const char *msgA;
4269 const char *msgB;
4270 char *msg;
4261 4271
4262 msgA = _("Unable to add user: user not found"); 4272 msgA = _("Unable to add user: user not found");
4263 4273
4264 msgB = _("The identifier '%s' did not match any users in your" 4274 msgB = _("The identifier '%s' did not match any users in your"
4265 " Sametime community. This entry has been removed from" 4275 " Sametime community. This entry has been removed from"
4266 " your buddy list."); 4276 " your buddy list.");
4267 msgB = g_strdup_printf(msgB, NSTR(res->name)); 4277 msg = g_strdup_printf(msgB, NSTR(res->name));
4268 4278
4269 gaim_notify_error(gc, _("Unable to add user"), msgA, msgB); 4279 gaim_notify_error(gc, _("Unable to add user"), msgA, msg);
4270 4280
4271 g_free(msgB); 4281 g_free(msg);
4272 } 4282 }
4273 } 4283 }
4274 4284
4275 4285
4276 static void mw_prpl_add_buddy(GaimConnection *gc, 4286 static void mw_prpl_add_buddy(GaimConnection *gc,
5114 acct = gaim_connection_get_account(gc); 5124 acct = gaim_connection_get_account(gc);
5115 5125
5116 /* collision checking */ 5126 /* collision checking */
5117 group = gaim_find_group(name); 5127 group = gaim_find_group(name);
5118 if(group) { 5128 if(group) {
5119 char *msgA, *msgB; 5129 const char *msgA;
5130 const char *msgB;
5131 char *msg;
5120 5132
5121 msgA = _("Unable to add group: group exists"); 5133 msgA = _("Unable to add group: group exists");
5122 msgB = _("A group named '%s' already exists in your buddy list."); 5134 msgB = _("A group named '%s' already exists in your buddy list.");
5123 msgB = g_strdup_printf(msgB, name); 5135 msg = g_strdup_printf(msgB, name);
5124 5136
5125 gaim_notify_error(gc, _("Unable to add group"), msgA, msgB); 5137 gaim_notify_error(gc, _("Unable to add group"), msgA, msg);
5126 5138
5127 g_free(msgB); 5139 g_free(msg);
5128 return; 5140 return;
5129 } 5141 }
5130 5142
5131 group = gaim_group_new(name); 5143 group = gaim_group_new(name);
5132 gn = (GaimBlistNode *) group; 5144 gn = (GaimBlistNode *) group;
5168 5180
5169 GaimRequestFields *fields; 5181 GaimRequestFields *fields;
5170 GaimRequestFieldGroup *g; 5182 GaimRequestFieldGroup *g;
5171 GaimRequestField *f; 5183 GaimRequestField *f;
5172 GList *l; 5184 GList *l;
5173 char *msgA, *msgB; 5185 const char *msgA;
5186 const char *msgB;
5187 char *msg;
5174 5188
5175 GaimConnection *gc = pd->gc; 5189 GaimConnection *gc = pd->gc;
5176 5190
5177 fields = gaim_request_fields_new(); 5191 fields = gaim_request_fields_new();
5178 5192
5197 5211
5198 msgA = _("Notes Address Book group results"); 5212 msgA = _("Notes Address Book group results");
5199 msgB = _("The identifier '%s' may possibly refer to any of the following" 5213 msgB = _("The identifier '%s' may possibly refer to any of the following"
5200 " Notes Address Book groups. Please select the correct group from" 5214 " Notes Address Book groups. Please select the correct group from"
5201 " the list below to add it to your buddy list."); 5215 " the list below to add it to your buddy list.");
5202 msgB = g_strdup_printf(msgB, result->name); 5216 msg = g_strdup_printf(msgB, result->name);
5203 5217
5204 gaim_request_fields(gc, _("Select Notes Address Book"), 5218 gaim_request_fields(gc, _("Select Notes Address Book"),
5205 msgA, msgB, fields, 5219 msgA, msg, fields,
5206 _("Add Group"), G_CALLBACK(remote_group_multi_cb), 5220 _("Add Group"), G_CALLBACK(remote_group_multi_cb),
5207 _("Cancel"), G_CALLBACK(remote_group_multi_cleanup), 5221 _("Cancel"), G_CALLBACK(remote_group_multi_cleanup),
5208 pd); 5222 pd);
5209 5223
5210 g_free(msgB); 5224 g_free(msg);
5211 } 5225 }
5212 5226
5213 5227
5214 static void remote_group_resolved(struct mwServiceResolve *srvc, 5228 static void remote_group_resolved(struct mwServiceResolve *srvc,
5215 guint32 id, guint32 code, GList *results, 5229 guint32 id, guint32 code, GList *results,
5237 return; 5251 return;
5238 } 5252 }
5239 } 5253 }
5240 5254
5241 if(res && res->name) { 5255 if(res && res->name) {
5242 char *msgA, *msgB; 5256 const char *msgA;
5257 const char *msgB;
5258 char *msg;
5243 5259
5244 msgA = _("Unable to add group: group not found"); 5260 msgA = _("Unable to add group: group not found");
5245 5261
5246 msgB = _("The identifier '%s' did not match any Notes Address Book" 5262 msgB = _("The identifier '%s' did not match any Notes Address Book"
5247 " groups in your Sametime community."); 5263 " groups in your Sametime community.");
5248 msgB = g_strdup_printf(msgB, res->name); 5264 msg = g_strdup_printf(msgB, res->name);
5249 5265
5250 gaim_notify_error(gc, _("Unable to add group"), msgA, msgB); 5266 gaim_notify_error(gc, _("Unable to add group"), msgA, msg);
5251 5267
5252 g_free(msgB); 5268 g_free(msg);
5253 } 5269 }
5254 } 5270 }
5255 5271
5256 5272
5257 static void remote_group_action_cb(GaimConnection *gc, const char *name) { 5273 static void remote_group_action_cb(GaimConnection *gc, const char *name) {
5277 } 5293 }
5278 5294
5279 5295
5280 static void remote_group_action(GaimPluginAction *act) { 5296 static void remote_group_action(GaimPluginAction *act) {
5281 GaimConnection *gc; 5297 GaimConnection *gc;
5282 const char *msgA, *msgB; 5298 const char *msgA;
5299 const char *msgB;
5283 5300
5284 gc = act->context; 5301 gc = act->context;
5285 5302
5286 msgA = _("Notes Address Book Group"); 5303 msgA = _("Notes Address Book Group");
5287 msgB = _("Enter the name of a Notes Address Book group in the field below" 5304 msgB = _("Enter the name of a Notes Address Book group in the field below"
5296 5313
5297 5314
5298 static void search_notify(struct mwResolveResult *result, 5315 static void search_notify(struct mwResolveResult *result,
5299 GaimConnection *gc) { 5316 GaimConnection *gc) {
5300 GList *l; 5317 GList *l;
5301 char *msgA, *msgB; 5318 const char *msgA;
5319 const char *msgB;
5320 char *msg1;
5321 char *msg2;
5302 5322
5303 GaimNotifySearchResults *sres; 5323 GaimNotifySearchResults *sres;
5304 GaimNotifySearchColumn *scol; 5324 GaimNotifySearchColumn *scol;
5305 5325
5306 sres = gaim_notify_searchresults_new(); 5326 sres = gaim_notify_searchresults_new();
5332 msgA = _("Search results for '%s'"); 5352 msgA = _("Search results for '%s'");
5333 msgB = _("The identifier '%s' may possibly refer to any of the following" 5353 msgB = _("The identifier '%s' may possibly refer to any of the following"
5334 " users. You may add these users to your buddy list or send them" 5354 " users. You may add these users to your buddy list or send them"
5335 " messages with the action buttons below."); 5355 " messages with the action buttons below.");
5336 5356
5337 msgA = g_strdup_printf(msgA, result->name); 5357 msg1 = g_strdup_printf(msgA, result->name);
5338 msgB = g_strdup_printf(msgB, result->name); 5358 msg2 = g_strdup_printf(msgB, result->name);
5339 5359
5340 gaim_notify_searchresults(gc, _("Search Results"), 5360 gaim_notify_searchresults(gc, _("Search Results"),
5341 msgA, msgB, sres, notify_close, NULL); 5361 msg1, msg2, sres, notify_close, NULL);
5342 5362
5343 g_free(msgA); 5363 g_free(msg1);
5344 g_free(msgB); 5364 g_free(msg2);
5345 } 5365 }
5346 5366
5347 5367
5348 static void search_resolved(struct mwServiceResolve *srvc, 5368 static void search_resolved(struct mwServiceResolve *srvc,
5349 guint32 id, guint32 code, GList *results, 5369 guint32 id, guint32 code, GList *results,
5356 5376
5357 if(!code && res && res->matches) { 5377 if(!code && res && res->matches) {
5358 search_notify(res, gc); 5378 search_notify(res, gc);
5359 5379
5360 } else { 5380 } else {
5361 char *msgA, *msgB; 5381 const char *msgA;
5382 const char *msgB;
5383 char *msg;
5384
5362 msgA = _("No matches"); 5385 msgA = _("No matches");
5363 msgB = _("The identifier '%s' did not match and users in your" 5386 msgB = _("The identifier '%s' did not match and users in your"
5364 " Sametime community."); 5387 " Sametime community.");
5365 msgB = g_strdup_printf(msgB, NSTR(res->name)); 5388 msg = g_strdup_printf(msgB, NSTR(res->name));
5366 5389
5367 gaim_notify_error(gc, _("No Matches"), msgA, msgB); 5390 gaim_notify_error(gc, _("No Matches"), msgA, msg);
5368 5391
5369 g_free(msgB); 5392 g_free(msg);
5370 } 5393 }
5371 } 5394 }
5372 5395
5373 5396
5374 static void search_action_cb(GaimConnection *gc, const char *name) { 5397 static void search_action_cb(GaimConnection *gc, const char *name) {
5394 } 5417 }
5395 5418
5396 5419
5397 static void search_action(GaimPluginAction *act) { 5420 static void search_action(GaimPluginAction *act) {
5398 GaimConnection *gc; 5421 GaimConnection *gc;
5399 const char *msgA, *msgB; 5422 const char *msgA;
5423 const char *msgB;
5400 5424
5401 gc = act->context; 5425 gc = act->context;
5402 5426
5403 msgA = _("Search for a user"); 5427 msgA = _("Search for a user");
5404 msgB = _("Enter a name or partial ID in the field below to search" 5428 msgB = _("Enter a name or partial ID in the field below to search"