PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) { PurpleWhiteboard *wb; SilcPurpleWb wbs; wb = purple_whiteboard_get_session(sg->account, channel->channel_name); if (!wb) wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); if (!wb) return NULL; if (!wb->proto_data) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; wbs->type = 1; wbs->u.channel = channel; wbs->width = SILCPURPLE_WB_WIDTH; wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; wb->proto_data = wbs; /* Start the whiteboard */ purple_whiteboard_start(wb); purple_whiteboard_clear(wb); } return wb; }
PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) { SilcClientConnection conn; PurpleWhiteboard *wb; SilcPurpleWb wbs; conn = sg->conn; wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); if (!wb) wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); if (!wb) return NULL; if (!wb->proto_data) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; wbs->type = 0; wbs->u.client = client_entry; wbs->width = SILCPURPLE_WB_WIDTH; wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; wb->proto_data = wbs; /* Start the whiteboard */ purple_whiteboard_start(wb); purple_whiteboard_clear(wb); } return wb; }
void yahoo_doodle_initiate(PurpleConnection *gc, const char *name) { PurpleAccount *account; char *to = (char*)name; PurpleWhiteboard *wb; g_return_if_fail(gc); g_return_if_fail(name); account = purple_connection_get_account(gc); wb = purple_whiteboard_get_session(account, to); if(wb == NULL) { /* Insert this 'session' in the list. At this point, it's only a * requested session. */ wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); } /* NOTE Perhaps some careful handling of remote assumed established * sessions */ yahoo_doodle_command_send_ready(gc, to, DOODLE_IMV_KEY); yahoo_doodle_command_send_request(gc, to, DOODLE_IMV_KEY); }
static int yahoo_doodle_accept_request(PurpleRequestAcceptData *data) { PurpleWhiteboard *wb; PurpleAccount *account; account = purple_connection_get_account(data->gc); wb = purple_whiteboard_get_session(account, data->from); /* If a session with the remote user doesn't exist */ if(wb == NULL) { doodle_session *ds; wb = purple_whiteboard_create(account, data->from, DOODLE_STATE_REQUESTED); ds = wb->proto_data; ds->imv_key = g_strdup(data->imv_key); yahoo_doodle_command_send_ready(data->gc, data->from, data->imv_key); } /* TODO Might be required to clear the canvas of an existing doodle * session at this point */ return 0; }
static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data) { PurpleConversation *conv = data; PurpleAccount *account = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(account); char *to = (char*)(purple_conversation_get_name(conv)); /* Only handle this if local client requested Doodle session (else local * client would have sent one) */ PurpleWhiteboard *wb = purple_whiteboard_get(account, to); /* Write a local message to this conversation showing that a request for a * Doodle session has been made */ /* XXXX because otherwise gettext will see this string, even though it's * in an #if 0 block. Remove the XXXX if you want to use this code. * But, it really shouldn't be a Yahoo-specific string. ;) */ purple_conv_im_write(PURPLE_CONV_IM(conv), "", XXXX_("Sent Doodle request."), PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL)); yahoo_doodle_command_send_request(gc, to); yahoo_doodle_command_send_ready(gc, to); /* Insert this 'session' in the list. At this point, it's only a requested * session. */ wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); }