예제 #1
0
int users_probe_all(){
DIR *dir;
Stream *s;
struct dirent *de;
struct stat st;
int r;

	s=jabber_stream();
	if (!s) return -1;
	dir=opendir(".");
	if (!dir){
		g_warning(L_("Couldn't open '%s' directory: %s"),spool_dir,g_strerror(errno));
		return -1;
	}
	while((de=readdir(dir))){
		r=stat(de->d_name,&st);
		if (r){
			g_warning(L_("Couldn't stat '%s': %s"),de->d_name,g_strerror(errno));
			continue;
		}
		if (S_ISREG(st.st_mode) && strchr(de->d_name,'@')) 
			presence_send_probe(s,NULL,de->d_name);
	}
	closedir(dir);
	return 0;
}
예제 #2
0
파일: sessions.c 프로젝트: Doap/transports
gboolean sessions_reconnect(gpointer data){
char *jid;

	jid=(char *)data;
	presence_send_probe(jabber_stream(),NULL,jid);
	g_free(jid);
	return FALSE;
}
예제 #3
0
파일: sessions.c 프로젝트: Doap/transports
Session *session_get_by_jid(const char *jid,Stream *stream,int delay_login){
Session *s;
User *u;
char *njid;
GList *it;

	g_assert(sessions_jid!=NULL);
	debug(L_("Looking up session for '%s'"),jid);
	njid=jid_normalized(jid,0);
	if (njid==NULL){
		g_message(L_("Bad JID: '%s'"),jid);
		return NULL;
	}

	debug(L_("Using '%s' as key"),njid);
	s=(Session *)g_hash_table_lookup(sessions_jid,(gpointer)njid);
	g_free(njid);
	if (s) return s;
	debug(L_("Session not found"));
	if (!stream) return NULL;
	u=user_get_by_jid(jid);
	if (!u) return NULL;

	debug(L_("User loaded, processing his subscriptions."));
	for(it=g_list_first(u->contacts);it;it=g_list_next(it)){
		Contact *c;
		char *c_jid;
		c=(Contact *)it->data;
		if (c->subscribe == SUB_UNDEFINED) {
			c_jid=jid_build(c->uin);
			presence_send_subscribe(stream,c_jid,u->jid);
			g_free(c_jid);
		}
		else if (c->subscribe == SUB_FROM || c->subscribe == SUB_BOTH){
			c_jid=jid_build(c->uin);
			presence_send_probe(stream,c_jid,u->jid);
			g_free(c_jid);
		}
	}
	debug(L_("Creating new session"));
	return session_create(u,jid,NULL,NULL,stream,delay_login);
}