Exemple #1
0
static void ft_state(struct mwFileTransfer *ft,
		     enum mwFileTransferState state) {

  g_return_if_fail(ft != NULL);

  if(ft->state == state) return;

  g_info("setting ft (%s, %s) state: %s",
	 NSTR(ft->who.user), NSTR(ft->who.community),
	 ft_state_str(state));

  ft->state = state;
}
static gboolean collect_dead(gpointer key, gpointer val, gpointer data) {
  struct aware_entry *aware = val;
  GList **dead = data;

  if(aware->membership == NULL) {
    g_info(" removing %s, %s",
	   NSTR(aware->aware.id.user), NSTR(aware->aware.id.community));
    *dead = g_list_append(*dead, aware);
    return TRUE;

  } else {
    return FALSE;
  }
}
Exemple #3
0
static void convo_set_state(struct mwConversation *conv,
			    enum mwConversationState state) {

  g_return_if_fail(conv != NULL);

  if(conv->state != state) {
    // Miranda NG adaptation
    //g_info("setting conversation (%s, %s) state: %s",
	//   NSTR(conv->target.user), NSTR(conv->target.community),
	//   conv_state_str(state));
    g_message("setting conversation (%s, %s) state: %s", NSTR(conv->target.user), NSTR(conv->target.community), conv_state_str(state));
    conv->state = state;
  }
}
Exemple #4
0
GList *mwPlace_getMembers(struct mwPlace *place) {
  GList *l, *ll;

  g_return_val_if_fail(place != NULL, NULL);
  g_return_val_if_fail(place->members != NULL, NULL);

  ll = map_collect_values(place->members);
  for(l = ll; l; l = l->next) {
    struct place_member *pm = l->data;
    l->data = &pm->idb;
    g_info("collected member %u: %s, %s", pm->place_id,
	   NSTR(pm->idb.user), NSTR(pm->idb.community));
  }

  return ll;
}
void mwChannel_addSupportedCipherInstance(struct mwChannel *chan,
					  struct mwCipherInstance *ci) {
  g_return_if_fail(chan != NULL);
  g_message("channel 0x%08x added cipher %s", chan->id,
	    NSTR(mwCipher_getName(mwCipherInstance_getCipher(ci))));
  put_supported(chan, ci);
}
Exemple #6
0
static void state(struct mwSession *s, enum mwSessionState state,
		  gpointer info) {

  struct mwSessionHandler *sh;

  g_return_if_fail(s != NULL);
  g_return_if_fail(s->handler != NULL);

  if(mwSession_isState(s, state)) return;

  s->state = state;
  s->state_info = info;

  switch(state) {
  case mwSession_STOPPING:
  case mwSession_STOPPED:
    g_message("session state: %s (0x%08x)", state_str(state),
	      GPOINTER_TO_UINT(info));
    break;

  case mwSession_LOGIN_REDIR:
	/// Miranda NG adaptation - start - https://developer.pidgin.im/ticket/7563#comment:4
    //g_message("session state: %s (%s)", state_str(state), (char *)info);
    g_message("session state: %s (%s)", state_str(state), NSTR((char *)info));
	/// Miranda NG adaptation - end
    break;

  default:
    g_message("session state: %s", state_str(state));
  }

  sh = s->handler;
  if(sh && sh->on_stateChange)
    sh->on_stateChange(s, state, info);
}
Exemple #7
0
static void recv(struct mwService *service, struct mwChannel *chan,
		 guint16 type, struct mwOpaque *data) {

  // `service` unused
  (void)service;

  struct mwPlace *place;
  struct mwGetBuffer *b;
  int res = 0;

  place = mwChannel_getServiceData(chan);
  g_return_if_fail(place != NULL);

  b = mwGetBuffer_wrap(data);
  switch(type) {
  case msg_in_JOIN_RESPONSE:
    res = recv_JOIN_RESPONSE(place, b);
    break;

  case msg_in_INFO:
    res = recv_INFO(place, b);
    break;

  case msg_in_MESSAGE:
    res = recv_MESSAGE(place, b);
    break;

  case msg_in_SECTION:
    res = recv_SECTION(place, b);
    break;

  case msg_in_UNKNOWNa:
    res = recv_UNKNOWNa(place, b);
    break;

  default:
    mw_mailme_opaque(data, "Received unknown message type 0x%x on place %s",
		     type, NSTR(place->name));
  }

  if(res) {
    mw_mailme_opaque(data, "Troubling parsing message type 0x0%x on place %s",
		     type, NSTR(place->name));
  }

  mwGetBuffer_free(b);
}
Exemple #8
0
static void place_state(struct mwPlace *place, enum mwPlaceState s) {
  g_return_if_fail(place != NULL);
  
  if(place->state == s) return;

  place->state = s;
  g_message("place %s state: %s", NSTR(place->name), place_state_str(s));
}
Exemple #9
0
void mwService_stopped(struct mwService *srvc) {
  g_return_if_fail(srvc != NULL);

  if(srvc->state != mwServiceState_STOPPED) {
    srvc->state = mwServiceState_STOPPED;
    g_message("stopped service %s", NSTR(mwService_getName(srvc)));
  }
}
Exemple #10
0
static void conf_state(struct mwConference *conf,
		       enum mwConferenceState state) {
  g_return_if_fail(conf != NULL);

  if(conf->state == state) return;

  conf->state = state;
  g_message("conference %s state: %s",
	    NSTR(conf->name), conf_state_str(state));
}
void system_dump(void){
	char *buffer = NULL;

	//get wan gw
	buffer =  NSTR(primary_wan_ip_set[0].gw_ip);
	D(SYSTEM, "get apcli0 gw [%s]\n", buffer);

	//get wan ip
	buffer =  NSTR(primary_wan_ip_set[0].ip);
	D(SYSTEM, "get apcli0 ip [%s]\n", buffer);

	//get wan mac
	buffer = ESTR(SYS_wan_mac);
	D(SYSTEM, "get apcli0 mac [%s]\n", buffer);

	update_mat_table();

	system_show_assoclist();

}
Exemple #12
0
void mwService_stop(struct mwService *srvc) {
  g_return_if_fail(srvc != NULL);

  if(MW_SERVICE_IS_DEAD(srvc))
    return;

  srvc->state = mwServiceState_STOPPING;
  g_message("stopping service %s", NSTR(mwService_getName(srvc)));

  if(srvc->stop) {
    srvc->stop(srvc);
  } else {
    mwService_stopped(srvc);
  }
}
Exemple #13
0
void mwService_start(struct mwService *srvc) {
  g_return_if_fail(srvc != NULL);

  if(! MW_SERVICE_IS_STOPPED(srvc))
    return;

  srvc->state = mwServiceState_STARTING;
  g_message("starting service %s", NSTR(mwService_getName(srvc)));

  if(srvc->start) {
    srvc->start(srvc);
  } else {
    mwService_started(srvc);
  }
}
Exemple #14
0
void mwChannel_selectCipherInstance(struct mwChannel *chan,
				    struct mwCipherInstance *ci) {
  struct mwCipher *c;

  g_return_if_fail(chan != NULL);
  g_return_if_fail(chan->supported != NULL);

  chan->cipher = ci;
  if(ci) {
    guint cid;

    c = mwCipherInstance_getCipher(ci);
    cid = mwCipher_getType(c);

    g_hash_table_steal(chan->supported, GUINT_TO_POINTER(cid));

    switch(mwCipher_getType(c)) {
    case mwCipher_RC2_40:
      chan->policy = mwEncrypt_RC2_40;
      break;

    case mwCipher_RC2_128:
      chan->policy = mwEncrypt_RC2_128;
      break;

    default:
      /* unsure if this is bad */
      chan->policy = mwEncrypt_WHATEVER;
    }

    g_message("channel 0x%08x selected cipher %s",
	      chan->id, NSTR(mwCipher_getName(c)));

  } else {

    chan->policy = mwEncrypt_NONE;
    g_message("channel 0x%08x selected no cipher", chan->id);
  }

  g_hash_table_destroy(chan->supported);
  chan->supported = NULL;
}
Exemple #15
0
void
samplecat_list_store_add (SamplecatListStore* self, Sample* sample)
{

	if(!samplecat.store) return;
	g_return_if_fail(sample);

#if 1
	/* these has actualy been checked _before_ here
	 * but backend may 'inject' mime types. ?!
	 */
	if(!sample->mimetype){
		dbg(0,"no mimetype given -- this should NOT happen: fix backend");
		return;
	}
	if(mimestring_is_unsupported(sample->mimetype)){
		dbg(0, "unsupported MIME type: %s", sample->mimetype);
		return;
	}
#endif

	if(!sample->sample_rate){
		// needed w/ tracker backend.
		sample_get_file_info(sample);
	}

	char samplerate_s[32]; samplerate_format(samplerate_s, sample->sample_rate);
	char length_s[64]; format_smpte(length_s, sample->length);

#ifdef USE_AYYI
	GdkPixbuf* ayyi_icon = NULL;

	//is the file loaded in the current Ayyi song?
	if(ayyi.got_shm){
		gchar* fullpath = g_build_filename(sample->sample_dir, sample->name, NULL);
		if(ayyi_song__have_file(fullpath)){
			dbg(1, "sample is used in current project TODO set icon");
		} else dbg(2, "sample not used in current project");
		g_free(fullpath);
	}
#endif

#define NSTR(X) (X?X:"")

	//icon (only shown if the sound file is currently available)
	GdkPixbuf* iconbuf = sample->online ? get_iconbuf_from_mimetype(sample->mimetype) : NULL;

	GtkTreeIter iter;
	gtk_list_store_append(samplecat.store, &iter);
	gtk_list_store_set(samplecat.store, &iter,
			COL_ICON,       iconbuf,
			COL_NAME,       sample->name,
			COL_FNAME,      sample->sample_dir,
			COL_IDX,        sample->id,
			COL_MIMETYPE,   sample->mimetype,
			COL_KEYWORDS,   NSTR(sample->keywords),
			COL_PEAKLEVEL,  sample->peaklevel,
			COL_OVERVIEW,   sample->overview,
			COL_LENGTH,     length_s,
			COL_SAMPLERATE, samplerate_s,
			COL_CHANNELS,   sample->channels,
			COL_COLOUR,     sample->colour_index,
#ifdef USE_AYYI
			COL_AYYI_ICON,  ayyi_icon,
#endif
			COL_SAMPLEPTR,  sample,
			COL_LEN,        sample->length,
			-1);

	GtkTreePath* treepath;
	if((treepath = gtk_tree_model_get_path(GTK_TREE_MODEL(samplecat.store), &iter))){
		sample->row_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(samplecat.store), treepath);
		gtk_tree_path_free(treepath);
	}

	g_return_if_fail (self);
	if(sample->row_ref && sample->online){
		request_analysis(sample);
	}

	sample_ref (sample);
}
Exemple #16
0
void mwService_started(struct mwService *srvc) {
  g_return_if_fail(srvc != NULL);

  srvc->state = mwServiceState_STARTED;
  g_message("started service %s", NSTR(mwService_getName(srvc)));
}