void switch_context_im_all(const char *im) { char *quot_im_name; uim_agent_context_list *ptr; /* change default IM */ update_default_engine(im); /* check focus state when change IM of current application */ quot_im_name = uim_malloc(strlen(im) + 2); quot_im_name[0] = '\''; quot_im_name[1] = '\0'; strcat(quot_im_name, im); if (agent_context_list_head) /* update default IM name in libuim? should be called only one time? */ uim_prop_update_custom(agent_context_list_head->agent_context->context, "custom-preserved-default-im-name", quot_im_name); for (ptr = agent_context_list_head; ptr != NULL; ptr = ptr->next) { switch_context_im(ptr->agent_context, im); } free(quot_im_name); }
static int cmd_change(int context_id, const char *im) { uim_agent_context *ua; if (im && strlen(im) > 0 && (ua = get_uim_agent_context(context_id))) { if (check_im_name(im)) { switch_context_im(ua, im); check_prop_list_update(ua); check_default_engine(); return 1; } else { return -1; } } else { return -1; } }