Commit 4832d9f6 authored by smorlat's avatar smorlat

fix make distcheck

work in progress with buddy lookups.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@268 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent cdd943a8
......@@ -24,29 +24,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern SipSetup fonis_sip_setup;
#endif
static SipSetup *all_sip_setups[]={
#ifdef HAVE_FONIS
&fonis_sip_setup,
#endif
NULL
};
void sip_setup_register_all(void){
}
SipSetup *sip_setup_lookup(const char *type_name){
#ifdef HAVE_FONIS
if (strcmp(type_name,"fonis")==0){
if (!fonis_sip_setup.initialized){
if (fonis_sip_setup.init()){
fonis_sip_setup.initialized=TRUE;
SipSetup **p=all_sip_setups;
while(*p!=NULL){
if ( strcmp((*p)->name,type_name)==0){
if (!(*p)->initialized){
(*p)->init();
(*p)->initialized=TRUE;
if ((*p)->capabilities==0){
ms_error("%s SipSetup isn't capable of anything ?");
}
}
return *p;
}
return &fonis_sip_setup;
}
#endif
ms_warning("no %s setup manager declared.",type_name);
return NULL;
}
void sip_setup_unregister_all(void){
#ifdef HAVE_FONIS
if (fonis_sip_setup.initialized)
fonis_sip_setup.exit();
#endif
SipSetup **p=all_sip_setups;
while(*p!=NULL){
if ((*p)->initialized){
(*p)->exit();
(*p)->initialized=FALSE;
}
}
}
......@@ -54,6 +67,9 @@ SipSetupContext *sip_setup_context_new(SipSetup *s){
SipSetupContext *obj=(SipSetupContext*)ms_new0(SipSetupContext,1);
obj->funcs=s;
obj->data=NULL;
if (obj->funcs->init_instance){
obj->funcs->init_instance(obj);
}
return obj;
}
......@@ -93,9 +109,21 @@ int sip_setup_context_get_relay(SipSetupContext *ctx,char *relay, size_t size){
return -1;
}
int sip_setup_context_lookup_buddy(SipSetupContext *ctx, const char *key, BuddyInfo *binfo){
int sip_setup_context_lookup_buddy(SipSetupContext *ctx, const char *key){
if (ctx->funcs->lookup_buddy)
return ctx->funcs->lookup_buddy(ctx,key,binfo);
return ctx->funcs->lookup_buddy(ctx,key);
return -1;
}
BuddyLookupStatus sip_setup_context_get_buddy_lookup_status(SipSetupContext *ctx){
if (ctx->funcs->get_buddy_lookup_status)
return ctx->funcs->get_buddy_lookup_status(ctx);
return BuddyLookupFailure;
}
int sip_setup_context_get_buddy_lookup_results(SipSetupContext *ctx, MSList **results /*of BuddyInfo */){
if (ctx->funcs->get_buddy_lookup_results)
return ctx->funcs->get_buddy_lookup_results(ctx,results);
return -1;
}
......
......@@ -26,6 +26,7 @@ struct _SipSetup;
struct _BuddyInfo;
struct _SipSetupContext{
struct _SipSetup *funcs;
char domain[128];
......@@ -35,15 +36,26 @@ struct _SipSetupContext{
typedef struct _SipSetupContext SipSetupContext;
#define SIP_SETUP_CAP_PROXY_PROVIDER (1)
#define SIP_SETUP_CAP_STUN_PROVIDER (1<<1)
#define SIP_SETUP_CAP_RELAY_PROVIDER (1<<2)
#define SIP_SETUP_CAP_BUDDY_LOOKUP (1<<3)
#define SIP_SETUP_CAP_ACCOUNT_MANAGER (1<<4)
struct _SipSetup{
char *name;
unsigned int capabilities;
bool_t (*init)(void);
int (*init_instance)(SipSetupContext *ctx);
int (*create_account)( const char *uri, const char *passwd);
int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size);
int (*lookup_buddy)(SipSetupContext *ctx, const char *key, struct _BuddyInfo *info);
int (*lookup_buddy)(SipSetupContext *ctx, const char *key);
int (*get_buddy_lookup_status)(SipSetupContext *ctx);
int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results);
void (*exit)(void);
bool_t initialized;
};
......@@ -65,17 +77,29 @@ typedef struct _BuddyInfo{
BuddyAddress address;
}BuddyInfo;
typedef enum _BuddyLookupStatus{
BuddyLookupNone,
BuddyLookupConnecting,
BuddyLookupConnected,
BuddyLookupReceivingResponse,
BuddyLookupDone,
BuddyLookupFailure
}BuddyLookupStatus;
void sip_setup_register_all(void);
SipSetup *sip_setup_lookup(const char *type_name);
void sip_setup_unregister_all(void);
int sip_setup_new_account(SipSetup *s, const char *uri, const char *passwd);
SipSetupContext * sip_setup_context_new(SipSetup *s);
int sip_setup_context_get_capabilities(SipSetupContext *ctx);
int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd);
int sip_setup_context_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
int sip_setup_context_get_stun_servers(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
int sip_setup_context_get_relay(SipSetupContext *ctx,char *relay, size_t size);
int sip_setup_context_lookup_buddy(SipSetupContext *ctx, const char *key, BuddyInfo *binfo);
int sip_setup_context_get_relay(SipSetupContext *ctx, char *relay, size_t size);
int sip_setup_context_lookup_buddy(SipSetupContext *ctx, const char *key);
BuddyLookupStatus sip_setup_context_get_buddy_lookup_status(SipSetupContext *ctx);
int sip_setup_context_get_buddy_lookup_results(SipSetupContext *ctx, MSList **results /*of BuddyInfo */);
void sip_setup_context_free(SipSetupContext *ctx);
#endif
GLADE_FILES= about.glade \
gtk-linphone.glade \
main.glade \
password.glade \
contact.glade \
......@@ -8,7 +7,8 @@ GLADE_FILES= about.glade \
sip_account.glade \
chatroom.glade \
call_logs.glade \
log.glade
log.glade \
buddylookup.glade
PIXMAPS= linphone2.png \
linphone.png \
......@@ -31,6 +31,7 @@ linphone_3_SOURCES= main.c\
calllogs.c \
logging.c \
update.c \
buddylookup.c \
linphone.h
linphone_3_LDADD=$(top_builddir)/oRTP/src/libortp.la \
......
/*
linphone, gtk-glade interface.
Copyright (C) 2008 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include "sipsetup.h"
enum {
LOOKUP_RESULT_NAME,
LOOKUP_RESULT_SIP_URI,
LOOKUP_RESULT_ADDRESS,
LOOKUP_RESULT_NCOL
};
void linphone_gtk_buddy_lookup_window_destroyed(GtkWidget *w){
guint tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"typing_timeout"));
if (tid!=0){
g_source_remove(tid);
}
tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"buddylookup_processing"));
if (tid!=0){
g_source_remove(tid);
}
}
void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
GtkListStore *store;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *select;
GtkWidget *w=linphone_gtk_create_window("buddylookup");
GtkWidget *results=linphone_gtk_get_widget(w,"search_results");
store = gtk_list_store_new(LOOKUP_RESULT_NCOL, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(results),GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Firstname, Lastname"),
renderer,
"text", LOOKUP_RESULT_NAME,
NULL);
g_object_set (G_OBJECT(column), "resizable", TRUE, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (results), column);
column = gtk_tree_view_column_new_with_attributes (_("SIP address"),
renderer,
"text", LOOKUP_RESULT_SIP_URI,
NULL);
g_object_set (G_OBJECT(column), "resizable", TRUE, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (results), column);
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (results));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(results),LOOKUP_RESULT_ADDRESS);
g_object_set_data(G_OBJECT(w),"SipSetupContext",ctx);
g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_buddy_lookup_window_destroyed,w);
gtk_widget_show(w);
}
static gboolean linphone_gtk_process_buddy_lookup(GtkWidget *w){
BuddyLookupStatus bls;
SipSetupContext *ctx;
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext");
bls=sip_setup_context_get_buddy_lookup_status(ctx);
switch(bls){
case BuddyLookupNone:
case BuddyLookupFailure:
gtk_progress_bar_set_fraction(pb,0);
gtk_progress_bar_set_text(pb,NULL);
break;
case BuddyLookupConnecting:
gtk_progress_bar_set_fraction(pb,20);
gtk_progress_bar_set_text(pb,_("Connecting..."));
break;
case BuddyLookupConnected:
gtk_progress_bar_set_fraction(pb,40);
gtk_progress_bar_set_text(pb,_("Connected"));
break;
case BuddyLookupReceivingResponse:
gtk_progress_bar_set_fraction(pb,80);
gtk_progress_bar_set_text(pb,_("Receiving data..."));
break;
case BuddyLookupDone:
gtk_progress_bar_set_fraction(pb,100);
gtk_progress_bar_set_text(pb,_("Done !"));
break;
}
return TRUE;
}
static gboolean keyword_typing_finished(GtkWidget *w){
guint tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"typing_timeout"));
const char *keyword;
SipSetupContext *ctx;
if (tid!=0){
g_source_remove(tid);
}
keyword=gtk_entry_get_text(GTK_ENTRY(w));
if (strlen(keyword)>=4){
guint tid2;
ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext");
sip_setup_context_lookup_buddy(ctx,keyword);
tid2=g_timeout_add(250,(GSourceFunc)linphone_gtk_process_buddy_lookup,w);
g_object_set_data(G_OBJECT(w),"buddylookup_processing",GINT_TO_POINTER(tid2));
}
return FALSE;
}
void linphone_gtk_keyword_changed(GtkEditable *e){
GtkWidget *w=gtk_widget_get_toplevel(GTK_WIDGET(e));
guint tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"typing_timeout"));
if (tid!=0){
g_source_remove(tid);
}
tid=g_timeout_add(2000,(GSourceFunc)keyword_typing_finished,w);
g_object_set_data(G_OBJECT(w),"typing_timeout",GINT_TO_POINTER(tid));
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Thu Feb 19 22:19:01 2009 -->
<glade-interface>
<widget class="GtkWindow" id="buddylookup">
<property name="title" translatable="yes">Search people...</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="border_width">5</property>
<property name="label_xalign">0</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<child>
<widget class="GtkEntry" id="keyword">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<signal name="changed" handler="linphone_gtk_keyword_changed"/>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkTreeView" id="search_results">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="add_buddy">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="linphone_gtk_add_buddy_from_database"/>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Add to my list</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkProgressBar" id="progressbar">
<property name="visible">True</property>
<property name="activity_mode">True</property>
<property name="show_text">True</property>
<property name="text" translatable="yes"></property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Search somebody&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -60,7 +60,8 @@ MSSndCard * ms_snd_card_manager_get_default_card(MSSndCardManager *m){
MSList *elem;
for (elem=m->cards;elem!=NULL;elem=elem->next){
MSSndCard *card=(MSSndCard*)elem->data;
if (card->capabilities==(MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK))
if ((card->capabilities & MS_SND_CARD_CAP_CAPTURE )
&& (card->capabilities & MS_SND_CARD_CAP_PLAYBACK))
return card;
}
return NULL;
......@@ -70,8 +71,7 @@ MSSndCard * ms_snd_card_manager_get_default_capture_card(MSSndCardManager *m){
MSList *elem;
for (elem=m->cards;elem!=NULL;elem=elem->next){
MSSndCard *card=(MSSndCard*)elem->data;
if (card->capabilities==(MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK)
||card->capabilities==MS_SND_CARD_CAP_CAPTURE)
if (card->capabilities & MS_SND_CARD_CAP_CAPTURE)
return card;
}
return NULL;
......@@ -81,8 +81,7 @@ MSSndCard * ms_snd_card_manager_get_default_playback_card(MSSndCardManager *m){
MSList *elem;
for (elem=m->cards;elem!=NULL;elem=elem->next){
MSSndCard *card=(MSSndCard*)elem->data;
if (card->capabilities==(MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK)
||card->capabilities==MS_SND_CARD_CAP_PLAYBACK)
if (card->capabilities & MS_SND_CARD_CAP_PLAYBACK)
return card;
}
return NULL;
......
......@@ -7,6 +7,7 @@ gtk-glade/main.c
gtk-glade/friendlist.c
gtk-glade/propertybox.c
gtk-glade/update.c
gtk-glade/buddylookup.c
gtk-glade/main.glade
gtk-glade/about.glade
gtk-glade/contact.glade
......@@ -18,11 +19,13 @@ gtk-glade/sip_account.glade
gtk-glade/chatroom.glade
gtk-glade/incoming_call.glade
gtk-glade/parameters.glade
gtk-glade/buddylookup.glade
coreapi/linphonecore.c
coreapi/misc.c
coreapi/exevents.c
coreapi/presence.c
coreapi/friend.c
coreapi/proxy.c
mediastreamer2/src/alaw.c
mediastreamer2/src/alsa.c
mediastreamer2/src/aqsnd.c
......@@ -44,7 +47,6 @@ mediastreamer2/src/msv4m.c
mediastreamer2/src/nowebcam.c
mediastreamer2/src/oss.c
mediastreamer2/src/pixconv.c
mediastreamer2/src/sdlout.c
mediastreamer2/src/sizeconv.c
mediastreamer2/src/speexec.c
mediastreamer2/src/tee.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment