Esempio n. 1
0
void rem_away_mess(GtkWidget *w, struct away_message *a)
{
	gchar *text;

	text = g_strdup_printf(_("Are you sure you want to remove the away message \"%s\"?"), a->name);

	gaim_request_action(NULL, NULL, _("Remove Away Message"), text, -1, g_strdup(a->name), 2,
						_("Remove"), G_CALLBACK(do_rem_away_mess),
						_("Cancel"), G_CALLBACK(g_free));

	g_free(text);
}
Esempio n. 2
0
/* receive an application to join the group */
void qq_process_recv_group_im_apply_join
    (guint8 *data, guint8 **cursor, gint len, guint32 internal_group_id, GaimConnection *gc)
{
	guint32 external_group_id, user_uid;
	guint8 group_type;
	gchar *reason_utf8, *msg, *reason;
	group_member_opt *g;

	g_return_if_fail(internal_group_id > 0 && data != NULL && len > 0);

	if (*cursor >= (data + len - 1)) {
		gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Received group msg apply_join is empty\n");
		return;
	}

	read_packet_dw(data, cursor, len, &external_group_id);
	read_packet_b(data, cursor, len, &group_type);
	read_packet_dw(data, cursor, len, &user_uid);

	g_return_if_fail(external_group_id > 0 && user_uid > 0);

	convert_as_pascal_string(*cursor, &reason_utf8, QQ_CHARSET_DEFAULT);

	msg = g_strdup_printf(_("User %d applied to join group %d"), user_uid, external_group_id);
	reason = g_strdup_printf(_("Reason: %s"), reason_utf8);

	g = g_new0(group_member_opt, 1);
	g->gc = gc;
	g->internal_group_id = internal_group_id;
	g->member = user_uid;

	gaim_request_action(gc, _("QQ Qun Operation"),
			    msg, reason,
			    2, g, 3,
			    _("Approve"),
			    G_CALLBACK
			    (qq_group_approve_application_with_struct),
			    _("Reject"),
			    G_CALLBACK
			    (qq_group_reject_application_with_struct),
			    _("Search"), G_CALLBACK(qq_group_search_application_with_struct));

	g_free(reason);
	g_free(msg);
	g_free(reason_utf8);
}
Esempio n. 3
0
File: dialog.c Progetto: VoxOx/VoxOx
void
msn_show_sync_issue(MsnSession *session, const char *passport,
					const char *group_name)
{
	GaimConnection *gc;
	GaimAccount *account;
	MsnAddRemData *data;
	char *msg, *reason;

	account = session->account;
	gc = gaim_account_get_connection(account);

	data        = g_new0(MsnAddRemData, 1);
	data->who   = g_strdup(passport);
	data->group = g_strdup(group_name);
	data->gc    = gc;

	msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
						  gaim_account_get_username(account),
						  gaim_account_get_protocol_name(account));

	if (group_name != NULL)
	{
		reason = g_strdup_printf(_("%s on the local list is "
								   "inside the group \"%s\" but not on "
								   "the server list. "
								   "Do you want this buddy to be added?"),
								 passport, group_name);
	}
	else
	{
		reason = g_strdup_printf(_("%s is on the local list but "
								   "not on the server list. "
								   "Do you want this buddy to be added?"),
								 passport);
	}

	gaim_request_action(gc, NULL, msg, reason, GAIM_DEFAULT_ACTION_NONE, 
						data, 2,
						_("Yes"), G_CALLBACK(msn_add_cb),
						_("No"), G_CALLBACK(msn_rem_cb));

	g_free(reason);
	g_free(msg);
}
Esempio n. 4
0
static void authorize_add_cb(struct _jabber_add_permit *jap)
{
	if(g_list_find(gaim_connections_get_all(), jap->gc)) {
		GaimBuddy *buddy = NULL;
		jabber_presence_subscription_set(jap->gc->proto_data, jap->who,
				"subscribed");

		buddy = gaim_find_buddy(jap->gc->account, jap->who);

		if (buddy) {
			JabberBuddy *jb = NULL;

			jb = jabber_buddy_find(jap->js, jap->who, TRUE);

			if ((jb->subscription & JABBER_SUB_TO) == 0) {
				char *buffer = NULL;
				struct _jabber_add_permit *jap2 = g_new0(struct _jabber_add_permit, 1);
				jap2->gc = jap->gc;
				jap2->who = g_strdup(jap->who);

				/* XXX: Tidy this up when not in string freeze */
				buffer = g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s%s"),
				                         jap->who, "", "", "",
				                         (gaim_connection_get_display_name(jap->gc) != NULL
				                            ? gaim_connection_get_display_name(jap->gc)
				                            : gaim_account_get_username(jap->gc->account)),
				                         ".", "",
				                         _("\n\nDo you wish to add him or her to your buddy list?"));

				gaim_request_action(NULL, NULL, _("Add buddy to your list?"),
				                    buffer, GAIM_DEFAULT_ACTION_NONE, jap2, 2,
				                    _("Add"),    G_CALLBACK(add_user_cb),
				                    _("Cancel"), G_CALLBACK(free_jabber_add_permit));

				g_free(buffer);

			} else
Esempio n. 5
0
static void
sippy_recv_cb(gpointer data, gint source, GaimInputCondition condition)
{
  GaimConnection *gc = data;
  int len;
  int command;
  static char buf[4096];
  static char bufFrom[4096];
  static char bufTo[4096];
  
  len = read( FD_GAG_TO_GAIM, &command, sizeof(command ) );
  if ( len == -1 )
  {
     int err = errno;
     gaim_debug(GAIM_DEBUG_INFO,"sippy","err=%d\n",err);  
     /* something really bad happened */
     resip_assert(0);
  }
  if ( len == 0 )
  {
     /* not ready */
     return;
  }
  resip_assert( len == sizeof(command) );
  
  switch ( command )
  {
     case SIMPLE_IM:
     {	
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got an IM messages from gag\n");  

        sippy_get_string( bufTo, sizeof(bufTo) );
        sippy_get_string( bufFrom, sizeof(bufFrom) );
        sippy_get_string( buf, sizeof(buf) );

        gaim_debug(GAIM_DEBUG_INFO,"sippy","got an IM from=%s to=%s data=%s\n",bufFrom,bufTo,buf);  

        serv_got_im(gc,bufFrom,buf,0,time(NULL)); 
     }
     break;
     
     case SIMPLE_LOGIN_STATUS:
     {
        unsigned char success;
        int sipCode;
        
        /* bool success, int sipCode, data message */
        sippy_get_bool( &success );
        sippy_get_int( &sipCode );
        sippy_get_string( buf, sizeof(buf) );  
 
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got a LOGIN_STATUS status=%d msg=%s\n",sipCode,buf);
	if (gaim_connection_get_state(gc) != GAIM_CONNECTED)
	{
          if (success)
          {
            gaim_connection_update_progress(gc,_("Connecting"),1,2);
            gaim_connection_set_state(gc, GAIM_CONNECTED);
          }
          else
          {
            gaim_connection_error(gc, _(buf));
          }
	}
     }
     break;
     
     case SIMPLE_PRESENCE: /* uri aor, bool  available, Data status */
     { 
        unsigned char open;
	int lastReportedUCStatus;
        
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got a PRES messages from gag\n");

        sippy_get_string( bufFrom, sizeof(bufFrom) );
        sippy_get_bool( &open );
        sippy_get_string( buf, sizeof(buf) );
        
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got a PRES messages from gag from=%s open=%d, msg=%s\n",bufFrom,open,buf);

        {
	  struct simple_connection_cache *sc_cache = gc->proto_data;
	  struct simple_friend_cache *sf;
	  
	  sf = g_hash_table_lookup(sc_cache->friends,bufFrom);
	  if (!sf) {
	    sf = simple_friend_cache_new();
	    g_hash_table_insert(sc_cache->friends,g_strdup(bufFrom),sf);
	  }
          if (sf->status_string)
	  {
	    g_free(sf->status_string);
	  } 
	  sf->status_string = g_strdup(buf);

	  lastReportedUCStatus = (sf->status_int ^= 2);
	} 

	/* AFAICT, there is a half-done change to the use of
	 * the last argument to serv_got_update that is messing
	 * up Yahoo as well as us. The code above the prpl abstraction
	 * claims the integer is ours to do with as we please, but they
	 * use the lowest order bit to mean available or not.
	 *
	 * Other code looks for changes to this integer - if it has
	 * not changed it shortcuts all the GUI updates. So...
	 * We're going to game gaim for now by toggling the second
	 * lowest order bit each time we call this function.
         *
         * TODO: This was true in the gaim 0.71 code - need to review to
         * see if this is still appropriate.
	 */

        serv_got_update(gc, bufFrom, (int)open, 0, 0, 0, lastReportedUCStatus);

     }
     break;
     
     case SIMPLE_HELLO: /* bool ok */
     {
        unsigned char ok;
        sippy_get_bool( &ok ); 
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got a HELLO ok=%d\n",ok);
     }
     
     case SIMPLE_ERROR:
     { 
        gaim_debug(GAIM_DEBUG_INFO,"sippy","got an ERROR messages from gag\n");
        sippy_get_string( buf, sizeof(buf) );
        gaim_debug(GAIM_DEBUG_INFO,"sippy","gag ERROR %s\n",buf);
        gaim_request_action(gc, _("SIP Error"), _("SIP Error"), buf, 
                             0, NULL, 1, _("Okay"), 0);
     }
     break;
     
     default:
        resip_assert(0);
  }
}