def add_new_message(id, user, user_profile, text):
 try:
  if (not verification_user(id, user)):
   return get_new_message_for_user(user)
  if checking_conference(id):
   conferences = get_memcached(get_key('conferences'))
   for key in conferences[id]['users'].keys():
    conferences[id]['users'][key]['messages'].append(dict(user=user, text=text, time=strftime('%H:%M:%S'), date=strftime('%Y-%m-%d'), profile=user_profile))
   set_memcached(get_key('conferences'), conferences)
 except:
  data = json.dumps({'cmd': 'Error', 'data': {'msg': str(sys.exc_info())}})
  return HttpResponse(data, content_type='application/json', status=200)
 return get_new_message_for_user(user)

def add_new_message ( id , user , user_profile , text ) : try : if ( not verification_user ( id , user ) ) : return get_new_message_for_user ( user ) if checking_conference ( id ) : conferences = get_memcached ( get_key ( 'conferences' ) ) for key in conferences [ id ] [ 'users' ] . keys ( ) : conferences [ id ] [ 'users' ] [ key ] [ 'messages' ] . append ( dict ( user = user , text = text , time = strftime ( '%H:%M:%S' ) , date = strftime ( '%Y-%m-%d' ) , profile = user_profile ) ) set_memcached ( get_key ( 'conferences' ) , conferences ) except : data = json . dumps ( { 'cmd' : 'Error' , 'data' : { 'msg' : str ( sys . exc_info ( ) ) } } ) return HttpResponse ( data , content_type = 'application/json' , status = 200 ) return get_new_message_for_user ( user )
add new message .